8000 fix: Implement fallback properly by ChayimFriedman2 · Pull Request #20721 · rust-lang/rust-analyzer · GitHub
[go: up one dir, main page]

Skip to content

Conversation

ChayimFriedman2
Copy link
Contributor
@ChayimFriedman2 ChayimFriedman2 commented Sep 22, 2025

fallback.rs was ported straight from rustc (minus the lint parts).

This fixes the ! regressions.

rustc uses graphs from rustc-data-structures. I opted to depend on an external dependency (petgraph), since implementing graph handling ourselves doesn't seem like a good idea.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 22, 2025

ctx.infer_mut_body();

ctx.infer_closures();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closure analysis should be done after fallback.

self.table.fallback_if_possible();
/// Clones `self` and calls `resolve_all()` on it.
// FIXME: Remove this.
pub(crate) fn fixme_resolve_all_clone(&self) -> InferenceResult {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this clone and resolve all pattern already exists in our consteval modules.

Is this function being introduced to group necessary calls together that should be called in order to handle fallbacks correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not introduce new usages of the pattern. I created the function since I was changing the ordering of things we do on finish, and this pattern requires running only some passes. I also took the chance to give it a scary name 😅

Copy link
Member
@ShoyuVanilla ShoyuVanilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me overall, though this has small conflict with master (Maybe #20717? 😅 )

fallback.rs was ported straight from rustc (minus the lint parts).

This fixes the `!` regressions.
@ChayimFriedman2
Copy link
Contributor Author

What broke CI?

@ChayimFriedman2
Copy link
Contributor Author

It's passing now 🤷

Anyway, merging based on approval above.

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Sep 24, 2025
Merged via the queue into rust-lang:master with commit bbb6459 Sep 24, 2025
28 of 30 checks passed
@ChayimFriedman2 ChayimFriedman2 deleted the fix-never branch September 24, 2025 18:27
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0