Skip to content
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

Rollup of 8 pull requests #132661

Merged
merged 17 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
10edeea
rustc_codegen_llvm: Add a new 'pc' option to branch-protection
mrkajetanp Oct 16, 2024
4e0d71f
chore(style): sync submodule exclusion list between tidy and rustfmt
ismailarilik Nov 2, 2024
67a8592
Suggest fixing typos and let bindings at the same time
uellenberg Nov 2, 2024
06fc531
Add test for assoc fn suggestion on enum variant
estebank Nov 3, 2024
e26ad8b
Properly suggest `E::assoc` when we encounter `E::Variant::assoc`
estebank Nov 3, 2024
613f53e
add const_eval_select macro to reduce redundancy
RalfJung Nov 3, 2024
2eac3c0
Do not filter empty passes & Make CTFE Clippy into lintless pass
blyxyas Nov 5, 2024
3300960
Add documentation on `ast::Attribute`
GuillaumeGomez Nov 5, 2024
02b3415
CI: switch 7 linux jobs to free runners
MarcoIeni Nov 5, 2024
c8247c0
Rollup merge of #132259 - mrkajetanp:branch-protection-pauth-lr, r=da…
matthiaskrgr Nov 5, 2024
0078e64
Rollup merge of #132409 - MarcoIeni:ci-remove-linux-4c-large, r=Kobzol
matthiaskrgr Nov 5, 2024
b236558
Rollup merge of #132498 - uellenberg:typo-and-let-suggestions, r=este…
matthiaskrgr Nov 5, 2024
b524be5
Rollup merge of #132524 - ismailarilik:chore/style/sync-submodule-exc…
matthiaskrgr Nov 5, 2024
bb50ebf
Rollup merge of #132567 - estebank:bad-suggestion, r=Nadrieril
matthiaskrgr Nov 5, 2024
aa4fe48
Rollup merge of #132571 - RalfJung:const_eval_select_macro, r=oli-obk
matthiaskrgr Nov 5, 2024
560248f
Rollup merge of #132637 - blyxyas:lint-less-passes, r=flip1995
matthiaskrgr Nov 5, 2024
4346249
Rollup merge of #132642 - GuillaumeGomez:attr-docs, r=compiler-errors
matthiaskrgr Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,10 +894,13 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {

// If the trait has a single item (which wasn't matched by the algorithm), suggest it
let suggestion = self.get_single_associated_item(path, &source, is_expected);
if !self.r.add_typo_suggestion(err, suggestion, ident_span) {
fallback = !self.let_binding_suggestion(err, ident_span);
}
self.r.add_typo_suggestion(err, suggestion, ident_span);
}

if self.let_binding_suggestion(err, ident_span) {
fallback = false;
}

fallback
}

Expand Down
11 changes: 10 additions & 1 deletion tests/ui/error-festival.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@ error[E0425]: cannot find value `y` in this scope
--> $DIR/error-festival.rs:14:5
|
LL | y = 2;
| ^ help: a local variable with a similar name exists: `x`
| ^
|
help: a local variable with a similar name exists
|
LL | x = 2;
| ~
help: you might have meant to introduce a new binding
|
LL | let y = 2;
| +++

error[E0603]: constant `FOO` is private
--> $DIR/error-festival.rs:22:10
Expand Down
7 changes: 7 additions & 0 deletions tests/ui/suggestions/suggest-let-and-typo-issue-132483.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() {
let x1 = 0;
x2 = 1;
//~^ ERROR E0425
other_val = 2;
//~^ ERROR E0425
}
29 changes: 29 additions & 0 deletions tests/ui/suggestions/suggest-let-and-typo-issue-132483.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
error[E0425]: cannot find value `x2` in this scope
--> $DIR/suggest-let-and-typo-issue-132483.rs:3:5
|
LL | x2 = 1;
| ^^
|
help: a local variable with a similar name exists
|
LL | x1 = 1;
| ~~
help: you might have meant to introduce a new binding
|
LL | let x2 = 1;
| +++

error[E0425]: cannot find value `other_val` in this scope
--> $DIR/suggest-let-and-typo-issue-132483.rs:5:5
|
LL | other_val = 2;
| ^^^^^^^^^
|
help: you might have meant to introduce a new binding
|
LL | let other_val = 2;
| +++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0425`.