Skip to content

Commit 826cb06

Browse files
committed
Auto merge of #72982 - tblah:riscv-ui-tests, r=estebank
resolve: Sort E0408 errors by Symbol str This is a request for comments implementing my suggested solution to #72913 Previously errors were sorted by Symbol index instead of the string. The indexes are not the same between architectures because Symbols for architecture extensions (e.g. x86 AVX or RISC-V d) are interned before the source file is parsed. RISC-V's naming of extensions after single letters led to it having errors sorted differently for test cases using single letter variable names. Instead sort the errors by the Symbol string so that it is stable across architectures. While I was at it, there's also 8edb05c skipping some ui tests which I think are irrelevant for risc-v.
2 parents e412475 + 41bfd18 commit 826cb06

29 files changed

+85
-66
lines changed

src/librustc_resolve/late.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,8 @@ impl<'a, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
13311331

13321332
// 3) Report all missing variables we found.
13331333
let mut missing_vars = missing_vars.iter_mut().collect::<Vec<_>>();
1334-
missing_vars.sort();
1334+
missing_vars.sort_by_key(|(sym, _err)| sym.as_str());
1335+
13351336
for (name, mut v) in missing_vars {
13361337
if inconsistent_vars.contains_key(name) {
13371338
v.could_be_path = false;

src/test/ui/borrowck/borrowck-asm.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// ignore-powerpc
44
// ignore-powerpc64
55
// ignore-powerpc64le
6+
// ignore-riscv64
67
// ignore-sparc
78
// ignore-sparc64
89

src/test/ui/borrowck/borrowck-asm.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0382]: use of moved value: `x`
2-
--> $DIR/borrowck-asm.rs:24:17
2+
--> $DIR/borrowck-asm.rs:25:17
33
|
44
LL | let x = &mut 0isize;
55
| - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
@@ -11,7 +11,7 @@ LL | let z = x;
1111
| ^ value used here after move
1212

1313
error[E0503]: cannot use `x` because it was mutably borrowed
14-
--> $DIR/borrowck-asm.rs:31:37
14+
--> $DIR/borrowck-asm.rs:32:37
1515
|
1616
LL | let y = &mut x;
1717
| ------ borrow of `x` occurs here
@@ -23,7 +23,7 @@ LL | let z = y;
2323
| - borrow later used here
2424

2525
error[E0384]: cannot assign twice to immutable variable `x`
26-
--> $DIR/borrowck-asm.rs:39:36
26+
--> $DIR/borrowck-asm.rs:40:36
2727
|
2828
LL | let x = 3;
2929
| -
@@ -35,7 +35,7 @@ LL | llvm_asm!("nop" : "=r"(x));
3535
| ^ cannot assign twice to immutable variable
3636

3737
error[E0384]: cannot assign twice to immutable variable `x`
38-
--> $DIR/borrowck-asm.rs:53:36
38+
--> $DIR/borrowck-asm.rs:54:36
3939
|
4040
LL | let x = 3;
4141
| -
@@ -47,13 +47,13 @@ LL | llvm_asm!("nop" : "+r"(x));
4747
| ^ cannot assign twice to immutable variable
4848

4949
error[E0381]: use of possibly-uninitialized variable: `x`
50-
--> $DIR/borrowck-asm.rs:60:37
50+
--> $DIR/borrowck-asm.rs:61:37
5151
|
5252
LL | llvm_asm!("nop" : "=*r"(x));
5353
| ^ use of possibly-uninitialized `x`
5454

5555
error[E0506]: cannot assign to `x` because it is borrowed
56-
--> $DIR/borrowck-asm.rs:68:36
56+
--> $DIR/borrowck-asm.rs:69:36
5757
|
5858
LL | let y = &*x;
5959
| --- borrow of `x` occurs here
@@ -65,7 +65,7 @@ LL | let z = y;
6565
| - borrow later used here
6666

6767
error[E0382]: use of moved value: `x`
68-
--> $DIR/borrowck-asm.rs:76:45
68+
--> $DIR/borrowck-asm.rs:77:45
6969
|
7070
LL | let x = &mut 2;
7171
| - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait

src/test/ui/c-variadic/variadic-ffi-1.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// ignore-arm stdcall isn't supported
22
// ignore-aarch64 stdcall isn't supported
3+
// ignore-riscv64 stdcall isn't supported
34

45
extern "stdcall" {
56
fn printf(_: *const u8, ...); //~ ERROR: variadic function must have C or cdecl calling

src/test/ui/c-variadic/variadic-ffi-1.stderr

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0045]: C-variadic function must have C or cdecl calling convention
2-
--> $DIR/variadic-ffi-1.rs:5:5
2+
--> $DIR/variadic-ffi-1.rs:6:5
33
|
44
LL | fn printf(_: *const u8, ...);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention
66

77
error[E0060]: this function takes at least 2 arguments but 0 arguments were supplied
8-
--> $DIR/variadic-ffi-1.rs:16:9
8+
--> $DIR/variadic-ffi-1.rs:17:9
99
|
1010
LL | fn foo(f: isize, x: u8, ...);
1111
| ----------------------------- defined here
@@ -16,7 +16,7 @@ LL | foo();
1616
| expected at least 2 arguments
1717

1818
error[E0060]: this function takes at least 2 arguments but 1 argument was supplied
19-
--> $DIR/variadic-ffi-1.rs:17:9
19+
--> $DIR/variadic-ffi-1.rs:18:9
2020
|
2121
LL | fn foo(f: isize, x: u8, ...);
2222
| ----------------------------- defined here
@@ -27,7 +27,7 @@ LL | foo(1);
2727
| expected at least 2 arguments
2828

2929
error[E0308]: mismatched types
30-
--> $DIR/variadic-ffi-1.rs:19:56
30+
--> $DIR/variadic-ffi-1.rs:20:56
3131
|
3232
LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
3333
| ------------------------------------- ^^^ expected non-variadic fn, found variadic function
@@ -38,7 +38,7 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo;
3838
found fn item `unsafe extern "C" fn(_, _, ...) {foo}`
3939

4040
error[E0308]: mismatched types
41-
--> $DIR/variadic-ffi-1.rs:20:54
41+
--> $DIR/variadic-ffi-1.rs:21:54
4242
|
4343
LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
4444
| ----------------------------------- ^^^ expected variadic fn, found non-variadic function
@@ -49,37 +49,37 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar;
4949
found fn item `extern "C" fn(_, _) {bar}`
5050

5151
error[E0617]: can't pass `f32` to variadic function
52-
--> $DIR/variadic-ffi-1.rs:22:19
52+
--> $DIR/variadic-ffi-1.rs:23:19
5353
|
5454
LL | foo(1, 2, 3f32);
5555
| ^^^^ help: cast the value to `c_double`: `3f32 as c_double`
5656

5757
error[E0617]: can't pass `bool` to variadic function
58-
--> $DIR/variadic-ffi-1.rs:23:19
58+
--> $DIR/variadic-ffi-1.rs:24:19
5959
|
6060
LL | foo(1, 2, true);
6161
| ^^^^ help: cast the value to `c_int`: `true as c_int`
6262

6363
error[E0617]: can't pass `i8` to variadic function
64-
--> $DIR/variadic-ffi-1.rs:24:19
64+
--> $DIR/variadic-ffi-1.rs:25:19
6565
|
6666
LL | foo(1, 2, 1i8);
6767
| ^^^ help: cast the value to `c_int`: `1i8 as c_int`
6868

6969
error[E0617]: can't pass `u8` to variadic function
70-
--> $DIR/variadic-ffi-1.rs:25:19
70+
--> $DIR/variadic-ffi-1.rs:26:19
7171
|
7272
LL | foo(1, 2, 1u8);
7373
| ^^^ help: cast the value to `c_uint`: `1u8 as c_uint`
7474

7575
error[E0617]: can't pass `i16` to variadic function
76-
--> $DIR/variadic-ffi-1.rs:26:19
76+
--> $DIR/variadic-ffi-1.rs:27:19
7777
|
7878
LL | foo(1, 2, 1i16);
7979
| ^^^^ help: cast the value to `c_int`: `1i16 as c_int`
8080

8181
error[E0617]: can't pass `u16` to variadic function
82-
--> $DIR/variadic-ffi-1.rs:27:19
82+
--> $DIR/variadic-ffi-1.rs:28:19
8383
|
8484
LL | foo(1, 2, 1u16);
8585
| ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint`

src/test/ui/cfg/conditional-compile-arch.rs

+3
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ pub fn main() { }
3636

3737
#[cfg(target_arch = "sparc64")]
3838
pub fn main() { }
39+
40+
#[cfg(target_arch = "riscv64")]
41+
pub fn main() { }

src/test/ui/extern/extern-methods.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22
// ignore-arm
33
// ignore-aarch64
4+
// ignore-riscv64 fastcall isn't supported
45

56
trait A {
67
extern "fastcall" fn test1(i: i32);

src/test/ui/extern/extern-thiscall.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22
// ignore-arm
33
// ignore-aarch64
4+
// ignore-riscv64 thiscall isn't supported
45

56
#![feature(abi_thiscall)]
67

src/test/ui/extern/extern-vectorcall.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22
// ignore-arm
33
// ignore-aarch64
4+
// ignore-riscv64 vectorcall isn't supported
45

56
#![feature(abi_vectorcall)]
67

src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Test that the MSP430 interrupt ABI cannot be used when msp430_interrupt
22
// feature gate is not used.
33

4+
// ignore-riscv64 msp430 is not supported
5+
46
extern "msp430-interrupt" fn foo() {}
57
//~^ ERROR msp430-interrupt ABI is experimental and subject to change
68

src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: msp430-interrupt ABI is experimental and subject to change
2-
--> $DIR/feature-gate-abi-msp430-interrupt.rs:4:8
2+
--> $DIR/feature-gate-abi-msp430-interrupt.rs:6:8
33
|
44
LL | extern "msp430-interrupt" fn foo() {}
55
| ^^^^^^^^^^^^^^^^^^

src/test/ui/llvm-asm/llvm-asm-bad-clobber.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// ignore-powerpc
77
// ignore-powerpc64
88
// ignore-powerpc64le
9+
// ignore-riscv64
910
// ignore-sparc
1011
// ignore-sparc64
1112
// ignore-mips

src/test/ui/llvm-asm/llvm-asm-bad-clobber.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0664]: clobber should not be surrounded by braces
2-
--> $DIR/llvm-asm-bad-clobber.rs:22:42
2+
--> $DIR/llvm-asm-bad-clobber.rs:23:42
33
|
44
LL | llvm_asm!("xor %eax, %eax" : : : "{eax}");
55
| ^^^^^^^

src/test/ui/llvm-asm/llvm-asm-in-bad-modifier.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// ignore-powerpc
44
// ignore-powerpc64
55
// ignore-powerpc64le
6+
// ignore-riscv64
67
// ignore-sparc
78
// ignore-sparc64
89
// ignore-mips

src/test/ui/llvm-asm/llvm-asm-in-bad-modifier.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0662]: input operand constraint contains '='
2-
--> $DIR/llvm-asm-in-bad-modifier.rs:23:44
2+
--> $DIR/llvm-asm-in-bad-modifier.rs:24:44
33
|
44
LL | llvm_asm!("mov $1, $0" : "=r"(x) : "=r"(5));
55
| ^^^^
66

77
error[E0663]: input operand constraint contains '+'
8-
--> $DIR/llvm-asm-in-bad-modifier.rs:24:44
8+
--> $DIR/llvm-asm-in-bad-modifier.rs:25:44
99
|
1010
LL | llvm_asm!("mov $1, $0" : "=r"(y) : "+r"(5));
1111
| ^^^^

src/test/ui/llvm-asm/llvm-asm-misplaced-option.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// ignore-powerpc
88
// ignore-powerpc64
99
// ignore-powerpc64le
10+
// ignore-riscv64
1011
// ignore-sparc
1112
// ignore-sparc64
1213
// ignore-mips

src/test/ui/llvm-asm/llvm-asm-misplaced-option.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
warning: unrecognized option
2-
--> $DIR/llvm-asm-misplaced-option.rs:24:69
2+
--> $DIR/llvm-asm-misplaced-option.rs:25:69
33
|
44
LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc");
55
| ^^^^
66

77
warning: expected a clobber, found an option
8-
--> $DIR/llvm-asm-misplaced-option.rs:31:85
8+
--> $DIR/llvm-asm-misplaced-option.rs:32:85
99
|
1010
LL | llvm_asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile");
1111
| ^^^^^^^^^^

src/test/ui/llvm-asm/llvm-asm-out-assign-imm.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// ignore-powerpc
44
// ignore-powerpc64
55
// ignore-powerpc64le
6+
// ignore-riscv64
67
// ignore-sparc
78
// ignore-sparc64
89
// ignore-mips

src/test/ui/llvm-asm/llvm-asm-out-assign-imm.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0384]: cannot assign twice to immutable variable `x`
2-
--> $DIR/llvm-asm-out-assign-imm.rs:24:39
2+
--> $DIR/llvm-asm-out-assign-imm.rs:25:39
33
|
44
LL | let x: isize;
55
| - help: make this binding mutable: `mut x`

src/test/ui/llvm-asm/llvm-asm-out-no-modifier.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// ignore-powerpc
44
// ignore-powerpc64
55
// ignore-powerpc64le
6+
// ignore-riscv64
67
// ignore-sparc
78
// ignore-sparc64
89
// ignore-mips

src/test/ui/llvm-asm/llvm-asm-out-no-modifier.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0661]: output operand constraint lacks '=' or '+'
2-
--> $DIR/llvm-asm-out-no-modifier.rs:22:34
2+
--> $DIR/llvm-asm-out-no-modifier.rs:23:34
33
|
44
LL | llvm_asm!("mov $1, $0" : "r"(x) : "r"(5));
55
| ^^^

src/test/ui/llvm-asm/llvm-asm-out-read-uninit.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// ignore-powerpc
44
// ignore-powerpc64
55
// ignore-powerpc64le
6+
// ignore-riscv64
67
// ignore-sparc
78
// ignore-sparc64
89
// ignore-mips

src/test/ui/llvm-asm/llvm-asm-out-read-uninit.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0381]: use of possibly-uninitialized variable: `x`
2-
--> $DIR/llvm-asm-out-read-uninit.rs:22:48
2+
--> $DIR/llvm-asm-out-read-uninit.rs:23:48
33
|
44
LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(x));
55
| ^ use of possibly-uninitialized `x`
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
error[E0408]: variable `x` is not bound in all patterns
2-
--> $DIR/mismatched-bindings-async-fn.rs:6:17
3-
|
4-
LL | async fn a((x | s): String) {}
5-
| - ^ pattern doesn't bind `x`
6-
| |
7-
| variable not in all patterns
8-
91
error[E0408]: variable `s` is not bound in all patterns
102
--> $DIR/mismatched-bindings-async-fn.rs:6:13
113
|
@@ -15,12 +7,12 @@ LL | async fn a((x | s): String) {}
157
| pattern doesn't bind `s`
168

179
error[E0408]: variable `x` is not bound in all patterns
18-
--> $DIR/mismatched-bindings-async-fn.rs:11:13
10+
--> $DIR/mismatched-bindings-async-fn.rs:6:17
1911
|
20-
LL | let x | s = String::new();
21-
| - ^ pattern doesn't bind `x`
22-
| |
23-
| variable not in all patterns
12+
LL | async fn a((x | s): String) {}
13+
| - ^ pattern doesn't bind `x`
14+
| |
15+
| variable not in all patterns
2416

2517
error[E0408]: variable `s` is not bound in all patterns
2618
--> $DIR/mismatched-bindings-async-fn.rs:11:9
@@ -30,6 +22,14 @@ LL | let x | s = String::new();
3022
| |
3123
| pattern doesn't bind `s`
3224

25+
error[E0408]: variable `x` is not bound in all patterns
26+
--> $DIR/mismatched-bindings-async-fn.rs:11:13
27+
|
28+
LL | let x | s = String::new();
29+
| - ^ pattern doesn't bind `x`
30+
| |
31+
| variable not in all patterns
32+
3333
error: aborting due to 4 previous errors
3434

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

src/test/ui/span/issue-39698.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}
88
| | pattern doesn't bind `a`
99
| variable not in all patterns
1010

11-
error[E0408]: variable `d` is not bound in all patterns
12-
--> $DIR/issue-39698.rs:10:37
13-
|
14-
LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
15-
| - - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `d`
16-
| | | |
17-
| | | pattern doesn't bind `d`
18-
| | variable not in all patterns
19-
| variable not in all patterns
20-
2111
error[E0408]: variable `b` is not bound in all patterns
2212
--> $DIR/issue-39698.rs:10:9
2313
|
@@ -38,6 +28,16 @@ LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}
3828
| | pattern doesn't bind `c`
3929
| pattern doesn't bind `c`
4030

31+
error[E0408]: variable `d` is not bound in all patterns
32+
--> $DIR/issue-39698.rs:10:37
33+
|
34+
LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); }
35+
| - - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `d`
36+
| | | |
37+
| | | pattern doesn't bind `d`
38+
| | variable not in all patterns
39+
| variable not in all patterns
40+
4141
error: aborting due to 4 previous errors
4242

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

0 commit comments

Comments
 (0)