diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2021-01-07 16:44:08 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2021-01-07 16:52:44 -0800 |
| commit | 9a5dcaab673b5b5a2842b689daeb0b2968fec476 (patch) | |
| tree | 12017f0f4ef9df5dfc0a9195f2ceb659bf678395 /src/test/ui/error-codes | |
| parent | c8915eebeaaef9f7cc1cff6ffd97f578b03c2ac9 (diff) | |
| download | rust-9a5dcaab673b5b5a2842b689daeb0b2968fec476.tar.gz rust-9a5dcaab673b5b5a2842b689daeb0b2968fec476.zip | |
Use correct span for structured suggestion
On structured suggestion for `let` -> `const` and `const` -> `let`, use a proper `Span` and update tests to check the correct application. Follow up to #80012.
Diffstat (limited to 'src/test/ui/error-codes')
| -rw-r--r-- | src/test/ui/error-codes/E0435.fixed | 6 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0435.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0435.stderr | 6 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/test/ui/error-codes/E0435.fixed b/src/test/ui/error-codes/E0435.fixed new file mode 100644 index 00000000000..fdf896d2dbb --- /dev/null +++ b/src/test/ui/error-codes/E0435.fixed @@ -0,0 +1,6 @@ +// run-rustfix +fn main () { + #[allow(non_upper_case_globals)] + const foo: usize = 42; + let _: [u8; foo]; //~ ERROR E0435 +} diff --git a/src/test/ui/error-codes/E0435.rs b/src/test/ui/error-codes/E0435.rs index 620dd30a23b..d9354efb8fd 100644 --- a/src/test/ui/error-codes/E0435.rs +++ b/src/test/ui/error-codes/E0435.rs @@ -1,4 +1,6 @@ +// run-rustfix fn main () { - let foo = 42u32; + #[allow(non_upper_case_globals)] + let foo: usize = 42; let _: [u8; foo]; //~ ERROR E0435 } diff --git a/src/test/ui/error-codes/E0435.stderr b/src/test/ui/error-codes/E0435.stderr index 21827d1fd87..fc08fade91c 100644 --- a/src/test/ui/error-codes/E0435.stderr +++ b/src/test/ui/error-codes/E0435.stderr @@ -1,8 +1,8 @@ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/E0435.rs:3:17 + --> $DIR/E0435.rs:5:17 | -LL | let foo = 42u32; - | --- help: consider using `const` instead of `let` +LL | let foo: usize = 42; + | ------- help: consider using `const` instead of `let`: `const foo` LL | let _: [u8; foo]; | ^^^ non-constant value |
