diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2022-02-16 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2022-02-16 02:05:17 +0100 |
| commit | 3158372dea6e1b28b70c4312cd87b76b3d6bfb44 (patch) | |
| tree | 08438daa321e5c0e3dfef1529a378dace3f38323 /src/test | |
| parent | bfb2856f271fcb647b3cad1b88b29ec97bbab2a3 (diff) | |
| download | rust-3158372dea6e1b28b70c4312cd87b76b3d6bfb44.tar.gz rust-3158372dea6e1b28b70c4312cd87b76b3d6bfb44.zip | |
Fix inconsistent symbol mangling with -Zverbose
Always skip arguments that are the defaults of their respective parameters, to avoid generating inconsistent symbols for builds with `-Zverbose` flag and without it.
Diffstat (limited to 'src/test')
5 files changed, 23 insertions, 8 deletions
diff --git a/src/test/ui/associated-types/substs-ppaux.rs b/src/test/ui/associated-types/substs-ppaux.rs index 974a1d961a0..66cd94d7a1b 100644 --- a/src/test/ui/associated-types/substs-ppaux.rs +++ b/src/test/ui/associated-types/substs-ppaux.rs @@ -25,7 +25,7 @@ fn foo<'z>() where &'z (): Sized { let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>; //[verbose]~^ ERROR mismatched types //[verbose]~| expected unit type `()` - //[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>}` + //[verbose]~| found fn item `fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}` //[normal]~^^^^ ERROR mismatched types //[normal]~| expected unit type `()` //[normal]~| found fn item `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}` diff --git a/src/test/ui/associated-types/substs-ppaux.verbose.stderr b/src/test/ui/associated-types/substs-ppaux.verbose.stderr index cf480223da2..b831f3b7a76 100644 --- a/src/test/ui/associated-types/substs-ppaux.verbose.stderr +++ b/src/test/ui/associated-types/substs-ppaux.verbose.stderr @@ -20,7 +20,7 @@ error[E0308]: mismatched types --> $DIR/substs-ppaux.rs:25:17 | LL | fn bar<'a, T>() where T: 'a {} - | --------------------------- fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>} defined here + | --------------------------- fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>} defined here ... LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>; | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found fn item @@ -28,7 +28,7 @@ LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>; | expected due to this | = note: expected unit type `()` - found fn item `fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>}` + found fn item `fn() {<i8 as Foo<ReStatic, ReStatic>>::bar::<ReStatic, char>}` help: use parentheses to call this function | LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>(); diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 459198eec5a..983d6a06afa 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -6,7 +6,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: no_region::<'_#1r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box<T, std::alloc::Global>,)) -> std::boxed::Box<(dyn Anything + '_#2r), std::alloc::Global>, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, (), ] = note: number of external vids: 3 @@ -42,7 +42,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: correct_region::<'_#1r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box<T, std::alloc::Global>,)) -> std::boxed::Box<(dyn Anything + '_#2r), std::alloc::Global>, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#2r)>, (), ] = note: number of external vids: 3 @@ -69,7 +69,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: wrong_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box<T, std::alloc::Global>,)) -> std::boxed::Box<(dyn Anything + '_#3r), std::alloc::Global>, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, (), ] = note: number of external vids: 4 @@ -105,7 +105,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | = note: defining type: outlives_region::<'_#1r, '_#2r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box<T, std::alloc::Global>,)) -> std::boxed::Box<(dyn Anything + '_#3r), std::alloc::Global>, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn Anything + '_#3r)>, (), ] = note: number of external vids: 4 diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 6e8b3021d33..88d73e7a729 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -6,7 +6,7 @@ LL | with_signature(x, |y| y) | = note: defining type: no_region::<'_#1r, T>::{closure#0} with closure substs [ i32, - extern "rust-call" fn((std::boxed::Box<T, std::alloc::Global>,)) -> std::boxed::Box<(dyn std::fmt::Debug + '_#2r), std::alloc::Global>, + extern "rust-call" fn((std::boxed::Box<T>,)) -> std::boxed::Box<(dyn std::fmt::Debug + '_#2r)>, (), ] = note: number of external vids: 3 diff --git a/src/test/ui/symbol-names/verbose.rs b/src/test/ui/symbol-names/verbose.rs new file mode 100644 index 00000000000..e00c592b6d2 --- /dev/null +++ b/src/test/ui/symbol-names/verbose.rs @@ -0,0 +1,15 @@ +// Regression test for issue #57596, where -Zverbose flag unintentionally +// affected produced symbols making it impossible to link between crates +// with a different value of the flag (for symbols involving generic +// arguments equal to defaults of their respective parameters). +// +// build-pass +// compile-flags: -Zverbose + +pub fn error(msg: String) -> Box<dyn std::error::Error> { + msg.into() +} + +fn main() { + error(String::new()); +} |
