mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
fix tests and code cleanup
This commit is contained in:
parent
952df48948
commit
5689f9c679
@ -1816,11 +1816,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
|
||||
if let Some(Expr { kind: ExprKind::Assign(lhs, rhs, _), .. }) =
|
||||
self.diagnostic_metadata.in_assignment
|
||||
{
|
||||
let is_rhs_assign = match rhs.kind {
|
||||
ExprKind::Assign(..) => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
let is_rhs_assign = matches!(rhs.kind, ExprKind::Assign(..));
|
||||
if let ast::ExprKind::Path(None, _) = lhs.kind && !is_rhs_assign {
|
||||
let sm = self.r.session.source_map();
|
||||
let line_span = sm.span_extend_to_line(ident_span);
|
||||
|
@ -1,10 +1,30 @@
|
||||
// error-pattern: not found in this scope
|
||||
|
||||
fn main() {
|
||||
x = x = x;
|
||||
//~^ ERROR cannot find value `x` in this scope
|
||||
//~| ERROR cannot find value `x` in this scope
|
||||
//~| ERROR cannot find value `x` in this scope
|
||||
|
||||
x = y = y = y;
|
||||
//~^ ERROR cannot find value `y` in this scope
|
||||
//~| ERROR cannot find value `y` in this scope
|
||||
//~| ERROR cannot find value `y` in this scope
|
||||
//~| ERROR cannot find value `x` in this scope
|
||||
|
||||
x = y = y;
|
||||
//~^ ERROR cannot find value `x` in this scope
|
||||
//~| ERROR cannot find value `y` in this scope
|
||||
//~| ERROR cannot find value `y` in this scope
|
||||
|
||||
x = x = y;
|
||||
//~^ ERROR cannot find value `x` in this scope
|
||||
//~| ERROR cannot find value `x` in this scope
|
||||
//~| ERROR cannot find value `y` in this scope
|
||||
|
||||
x = x; // will suggest add `let`
|
||||
//~^ ERROR cannot find value `x` in this scope
|
||||
//~| ERROR cannot find value `x` in this scope
|
||||
|
||||
x = y // will suggest add `let`
|
||||
//~^ ERROR cannot find value `x` in this scope
|
||||
//~| ERROR cannot find value `y` in this scope
|
||||
}
|
||||
|
@ -1,81 +1,115 @@
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:4:5
|
||||
--> $DIR/issue-104086-suggest-let.rs:2:5
|
||||
|
|
||||
LL | x = x = x;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:4:9
|
||||
--> $DIR/issue-104086-suggest-let.rs:2:9
|
||||
|
|
||||
LL | x = x = x;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:4:13
|
||||
--> $DIR/issue-104086-suggest-let.rs:2:13
|
||||
|
|
||||
LL | x = x = x;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:5:5
|
||||
|
|
||||
LL | x = y = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:5:9
|
||||
|
|
||||
LL | x = y = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:5:13
|
||||
|
|
||||
LL | x = y = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:5:17
|
||||
|
|
||||
LL | x = y = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:6:5
|
||||
|
|
||||
LL | x = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:6:9
|
||||
|
|
||||
LL | x = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:6:13
|
||||
|
|
||||
LL | x = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:7:5
|
||||
|
|
||||
LL | x = x = y;
|
||||
LL | x = y = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:7:9
|
||||
|
|
||||
LL | x = x = y;
|
||||
LL | x = y = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:7:13
|
||||
|
|
||||
LL | x = y = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:7:17
|
||||
|
|
||||
LL | x = y = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:13:5
|
||||
|
|
||||
LL | x = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:13:9
|
||||
|
|
||||
LL | x = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:13:13
|
||||
|
|
||||
LL | x = y = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:18:5
|
||||
|
|
||||
LL | x = x = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:18:9
|
||||
|
|
||||
LL | x = x = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:18:13
|
||||
|
|
||||
LL | x = x = y;
|
||||
| ^ not found in this scope
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:23:5
|
||||
|
|
||||
LL | x = x; // will suggest add `let`
|
||||
| ^
|
||||
|
|
||||
help: you might have meant to introduce a new binding
|
||||
|
|
||||
LL | let x = x; // will suggest add `let`
|
||||
| +++
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:23:9
|
||||
|
|
||||
LL | x = x; // will suggest add `let`
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0425]: cannot find value `x` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:27:5
|
||||
|
|
||||
LL | x = y // will suggest add `let`
|
||||
| ^
|
||||
|
|
||||
help: you might have meant to introduce a new binding
|
||||
|
|
||||
LL | let x = y // will suggest add `let`
|
||||
| +++
|
||||
|
||||
error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/issue-104086-suggest-let.rs:27:9
|
||||
|
|
||||
LL | x = y // will suggest add `let`
|
||||
| ^ not found in this scope
|
||||
|
||||
error: aborting due to 17 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
||||
|
Loading…
Reference in New Issue
Block a user