-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add filter with following segment while lookup typo for path #113331
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
Add filter with following segment while lookup typo for path #113331
Conversation
9c2118d
to
6a373c1
Compare
6a373c1
to
45c1218
Compare
45c1218
to
2099022
Compare
2099022
to
6f53e61
Compare
This comment has been minimized.
This comment has been minimized.
d922b82
to
0aa79d3
Compare
0aa79d3
to
9763472
Compare
| | ||
LL | bar: std::cell::Cell<bool> | ||
| ~~~ | ||
help: consider importing one of these items | ||
| | ||
LL + use core::cell; | ||
| | ||
LL + use std::cell; | ||
| | ||
help: if you import `cell`, refer to it directly | ||
| | ||
LL - bar: st::cell::Cell<bool> | ||
LL + bar: cell::Cell<bool> | ||
| |
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'm noticing that these suggestions are now redundant. Could we check if the first suggestion has been emitted, and if so not try the import one?
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.
It's a little bit redundant, but sometimes the import one is the right advice to fix an error, I changed the code to skip the import suggestions if typo is found, and found this case changed:
error[E0433]: failed to resolve: use of undeclared type `FromIterator`
--> $DIR/suggest-tryinto-edition-change.rs:23:22
|
LL | let _v: Vec<_> = FromIterator::from_iter(&[1]);
| ^^^^^^^^^^^^ use of undeclared type `FromIterator`
|
= note: 'std::iter::FromIterator' is included in the prelude starting in Edition 2021
= note: 'core::iter::FromIterator' is included in the prelude starting in Edition 2021
help: a trait with a similar name exists
|
LL | let _v: Vec<_> = IntoIterator::from_iter(&[1]);
| ~~~~~~~~~~~~
help: consider importing one of these items
|
LL + use core::iter::FromIterator;
|
LL + use std::iter::FromIterator;
|
it's better than the new result after code changed:
error[E0433]: failed to resolve: use of undeclared type `FromIterator`
--> $DIR/suggest-tryinto-edition-change.rs:23:22
|
LL | let _v: Vec<_> = FromIterator::from_iter(&[1]);
| ^^^^^^^^^^^^
| |
| use of undeclared type `FromIterator`
| help: a trait with a similar name exists: `IntoIterator`
we are unsure which is better in all scenarios, so let's keep it right now.
r=me, with #113331 (comment) addressed or not |
@bors r=estebank |
…iaskrgr Rollup of 2 pull requests Successful merges: - rust-lang#113331 (Add filter with following segment while lookup typo for path) - rust-lang#113524 (Remove the library/term exception in tidy's pal checker code) r? `@ghost` `@rustbot` modify labels: rollup
From the discussion: #112917 (comment)
Seems we can not get the assoc items for
Struct
,Enum
in the resolving phase.A obvious filter is avoid suggesting the same name with the following segment path.
Use
following_seg
can extend the functionsmart_resolve_partial_mod_path_errors
for more scenarios, such asstd::sync_error::atomic::AtomicBool
in test case.r? @estebank