-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: don't suggest similar method when unstable #109212
Conversation
Big problems with the |
This comment has been minimized.
This comment has been minimized.
// note that `DUMMY_SP` is ok here because it is only used for | ||
// suggestions and macro stuff which isn't applicable here. | ||
!matches!( | ||
self.tcx.eval_stability(candidate.item.def_id, None, DUMMY_SP, None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this call might be introducing a cycle, which manifests as an .unwrap()
ICE. Can you check if calling tcx.lookup_stability(def_id)
also hits it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what I was vaguely thinking. (EDIT: I'm talking about tcx.lookup_stability
isn't what we want either, it calls eval_stability
internally and emits an error if the DefId
is unstable (definitely not what we want).check_stability
, lookup_stabilty
is the low-level one 🤦) I'm not sure how to fix the cycle.
@estebank The offending code is in let is_staged_api = self.lookup_stability(def_id.krate.as_def_id()).is_some();
if !is_staged_api {
return EvalResult::Allow;
} The I have no idea on how to fix this. |
Let's land the typeck part of this for now and keep investigating the resolve version. It's likely we'll have to add some tracking to |
0544dc1
to
96603bd
Compare
@estebank Sure, I'm happy to land just the typeck part, I'll be looking into the resolve part a bit (not sure the fix is easy). |
This comment has been minimized.
This comment has been minimized.
96603bd
to
0dc36fc
Compare
@bors r+ rollup |
🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened. |
Rollup of 10 pull requests Successful merges: - rust-lang#104100 (Allow using `Range` as an `Iterator` in const contexts. ) - rust-lang#105793 (Add note for mismatched types because of circular dependencies) - rust-lang#108798 (move default backtrace setting to sys) - rust-lang#108829 (Use Edition 2021 :pat in matches macro) - rust-lang#108973 (Beautify pin! docs) - rust-lang#109003 (Add `useless_anonymous_reexport` lint) - rust-lang#109022 (read_buf_exact: on error, all read bytes are appended to the buffer) - rust-lang#109212 (fix: don't suggest similar method when unstable) - rust-lang#109243 (The name of NativeLib will be presented) - rust-lang#109324 (Implement FixedSizeEncoding for UnusedGenericParams.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #109177
Don't display typo suggestions for unstable things, unless the feature flag is enabled.
AFAIK, there are two places this occurs:
rustc_resolve
: before type checking, effectively justFnCtxt::Free
.rustc_hir_typck
: during type checking, forFnCtxt::Assoc(..)
s.The linked issue is about the latter, obviously the issue is applicable to both.
r? @estebank