-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #83767 - camelid:mangle-v0-fix, r=nikomatsakis
Fix v0 symbol mangling bug Fixes #83611. r? ``@jackh726``
- Loading branch information
Showing
4 changed files
with
144 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Ensure that trait objects don't include more than one binder. See #83611 | ||
|
||
// build-fail | ||
// revisions: v0 | ||
//[v0]compile-flags: -Z symbol-mangling-version=v0 | ||
//[v0]normalize-stderr-test: "Cs.*?_" -> "CRATE_HASH" | ||
//[v0]normalize-stderr-test: "core\[.*?\]" -> "core[HASH]" | ||
|
||
#![feature(rustc_attrs)] | ||
|
||
trait Bar { | ||
fn method(&self) {} | ||
} | ||
|
||
impl Bar for &dyn FnMut(&u8) { | ||
#[rustc_symbol_name] | ||
//[v0]~^ ERROR symbol-name | ||
//[v0]~| ERROR demangling | ||
//[v0]~| ERROR demangling-alt | ||
fn method(&self) {} | ||
} | ||
|
||
trait Foo { | ||
fn method(&self) {} | ||
} | ||
|
||
impl Foo for &(dyn FnMut(&u8) + for<'b> Send) { | ||
#[rustc_symbol_name] | ||
//[v0]~^ ERROR symbol-name | ||
//[v0]~| ERROR demangling | ||
//[v0]~| ERROR demangling-alt | ||
fn method(&self) {} | ||
} | ||
|
||
trait Baz { | ||
fn method(&self) {} | ||
} | ||
|
||
impl Baz for &(dyn for<'b> Send + FnMut(&u8)) { | ||
#[rustc_symbol_name] | ||
//[v0]~^ ERROR symbol-name | ||
//[v0]~| ERROR demangling | ||
//[v0]~| ERROR demangling-alt | ||
fn method(&self) {} | ||
} | ||
|
||
fn main() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
error: symbol-name(_RNvXCRATE_HASH13trait_objectsRDG_INtNtNtCRATE_HASH4core3ops8function5FnMutTRL0_hEEp6OutputuEL_NtB2_3Bar6method) | ||
--> $DIR/trait-objects.rs:16:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> as trait_objects[17891616a171812d]::Bar>::method) | ||
--> $DIR/trait-objects.rs:16:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output = ()> as trait_objects::Bar>::method) | ||
--> $DIR/trait-objects.rs:16:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: symbol-name(_RNvXs_CRATE_HASH13trait_objectsRDG_INtNtNtCRATE_HASH4core3ops8function5FnMutTRL0_hEEp6OutputuNtNtBI_6marker4SendEL_NtB4_3Foo6method) | ||
--> $DIR/trait-objects.rs:28:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[17891616a171812d]::Foo>::method) | ||
--> $DIR/trait-objects.rs:28:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output = ()> + core::marker::Send as trait_objects::Foo>::method) | ||
--> $DIR/trait-objects.rs:28:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: symbol-name(_RNvXs0_CRATE_HASH13trait_objectsRDG_INtNtNtCRATE_HASH4core3ops8function5FnMutTRL0_hEEp6OutputuNtNtBJ_6marker4SendEL_NtB5_3Baz6method) | ||
--> $DIR/trait-objects.rs:40:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling(<&dyn for<'a> core[HASH]::ops::function::FnMut<(&'a u8,), Output = ()> + core[HASH]::marker::Send as trait_objects[17891616a171812d]::Baz>::method) | ||
--> $DIR/trait-objects.rs:40:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: demangling-alt(<&dyn for<'a> core::ops::function::FnMut<(&'a u8,), Output = ()> + core::marker::Send as trait_objects::Baz>::method) | ||
--> $DIR/trait-objects.rs:40:5 | ||
| | ||
LL | #[rustc_symbol_name] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 9 previous errors | ||
|