-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Provide suggestions through rustc_confusables
annotations
#120730
Conversation
r? @cjgillot (rustbot has picked a reviewer for you, use r? to override) |
a1063b6
to
d7868c4
Compare
This comment has been minimized.
This comment has been minimized.
d7868c4
to
149b73e
Compare
This comment has been minimized.
This comment has been minimized.
149b73e
to
5660300
Compare
This comment has been minimized.
This comment has been minimized.
5660300
to
e4820c5
Compare
r? @oli-obk |
Fixes #87212 |
can you also add a annotation for #108437 |
@chenyukang added :) |
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.
whoops started reviewing this and got distracted. Will do another round tomorrow
This comment has been minimized.
This comment has been minimized.
@bors r+ |
``` error[E0308]: mismatched types --> $DIR/rustc_confusables_std_cases.rs:20:14 | LL | x.append(42); | ------ ^^ expected `&mut Vec<{integer}>`, found integer | | | arguments to this method are incorrect | = note: expected mutable reference `&mut Vec<{integer}>` found type `{integer}` note: method defined here --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL help: you might have meant to use `push` | LL | x.push(42); | ~~~~ ```
Do not provide a structured suggestion when the arguments don't match. ``` error[E0599]: no method named `test_mut` found for struct `Vec<{integer}>` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:7:7 | LL | a.test_mut(); | ^^^^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope note: `MyIter` defines an item `test_mut`, perhaps you need to implement it --> $DIR/auto-ref-slice-plus-ref.rs:14:1 | LL | trait MyIter { | ^^^^^^^^^^^^ help: there is a method `get_mut` with a similar name, but with different arguments --> $SRC_DIR/core/src/slice/mod.rs:LL:COL ``` Consider methods beyond inherent ones when suggesting typos. ``` error[E0599]: no method named `owned` found for reference `&dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:11:7 | LL | fn owned(self: Box<Self>); | --------- the method might not be found because of this arbitrary self type ... LL | x.owned(); | ^^^^^ help: there is a method with a similar name: `to_owned` ``` Fix rust-lang#101013.
9a950a5
to
91d0b37
Compare
@bors r=oli-obk |
☀️ Test successful - checks-actions |
Finished benchmarking commit (a28d221): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 649.393s -> 651.286s (0.29%) |
For posterity: this caused a large performance regression in certain cases where errors were being emitted. I had an example involving a refactoring of rustc itself where I had hundreds of errors and each error was taking ~5 seconds to emit! Happily, #125100 fixes the problem. |
Help with common API confusion, like asking for
push
when the data structure really hasappend
.Fix #59450 (we can open subsequent tickets for specific cases).
Fix #108437:
On type error of method call arguments, look at confusables for suggestion. Fix #87212: