test: support both (legacy
and v0
) choices of mangling.
This commit is contained in:
parent
408bf9de34
commit
5fd3e89d70
19 changed files with 245 additions and 58 deletions
|
@ -19,15 +19,18 @@ pub fn droppy() {
|
|||
// that's one new drop call per call to possibly_unwinding(), and finally 3 drop calls for the
|
||||
// regular function exit. We used to have problems with quadratic growths of drop calls in such
|
||||
// functions.
|
||||
// CHECK-NOT: invoke{{.*}}drop{{.*}}SomeUniqueName
|
||||
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
|
||||
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
|
||||
// CHECK-NOT: call{{.*}}drop{{.*}}SomeUniqueName
|
||||
// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
|
||||
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
|
||||
// CHECK: invoke{{.*}}drop{{.*}}SomeUniqueName
|
||||
// CHECK: call{{.*}}drop{{.*}}SomeUniqueName
|
||||
// CHECK-NOT: {{(call|invoke).*}}drop{{.*}}SomeUniqueName
|
||||
// FIXME(eddyb) the `void @` forces a match on the instruction, instead of the
|
||||
// comment, that's `; call core::ptr::real_drop_in_place::<drop::SomeUniqueName>`
|
||||
// for the `v0` mangling, should switch to matching on that once `legacy` is gone.
|
||||
// CHECK-NOT: invoke void @{{.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// CHECK: call void @{{.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// CHECK: call void @{{.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// CHECK-NOT: call void @{{.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// CHECK: invoke void @{{.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// CHECK: call void @{{.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// CHECK: invoke void @{{.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// CHECK: call void @{{.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// CHECK-NOT: {{(call|invoke) void @.*}}drop_in_place{{.*}}SomeUniqueName
|
||||
// The next line checks for the } that ends the function definition
|
||||
// CHECK-LABEL: {{^[}]}}
|
||||
let _s = SomeUniqueName;
|
||||
|
|
|
@ -33,7 +33,9 @@ const HIDDEN: () = {
|
|||
};
|
||||
|
||||
// The surrounding item should not accidentally become external
|
||||
// CHECK: define internal{{.*}} void @_ZN22external_no_mangle_fns1x
|
||||
// CHECK-LABEL: ; external_no_mangle_fns::x
|
||||
// CHECK-NEXT: ; Function Attrs:
|
||||
// CHECK-NEXT: define internal
|
||||
#[inline(never)]
|
||||
fn x() {
|
||||
// CHECK: define void @g()
|
||||
|
|
|
@ -75,4 +75,6 @@ fn x() {
|
|||
#[no_mangle]
|
||||
pub static mut P: u8 = 0;
|
||||
}
|
||||
// CHECK: define internal void @_ZN26external_no_mangle_statics1x{{.*$}}
|
||||
// CHECK-LABEL: ; external_no_mangle_statics::x
|
||||
// CHECK-NEXT: ; Function Attrs:
|
||||
// CHECK-NEXT: define internal
|
||||
|
|
|
@ -4,7 +4,11 @@ pub fn main() {
|
|||
|
||||
// We want to make sure that closures get 'internal' linkage instead of
|
||||
// 'weak_odr' when they are not shared between codegen units
|
||||
// CHECK: define internal {{.*}}_ZN20internalize_closures4main{{.*}}$u7b$$u7b$closure$u7d$$u7d$
|
||||
// FIXME(eddyb) `legacy` mangling uses `{{closure}}`, while `v0`
|
||||
// uses `{closure#0}`, switch to the latter once `legacy` is gone.
|
||||
// CHECK-LABEL: ; internalize_closures::main::{{.*}}closure
|
||||
// CHECK-NEXT: ; Function Attrs:
|
||||
// CHECK-NEXT: define internal
|
||||
let c = |x:i32| { x + 1 };
|
||||
let _ = c(1);
|
||||
}
|
||||
|
|
|
@ -5,12 +5,18 @@
|
|||
// This test makes sure that, when -Clink-dead-code is specified, we generate
|
||||
// code for functions that would otherwise be skipped.
|
||||
|
||||
// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code8const_fn
|
||||
// CHECK-LABEL: ; link_dead_code::const_fn
|
||||
// CHECK-NEXT: ; Function Attrs:
|
||||
// CHECK-NEXT: define hidden
|
||||
const fn const_fn() -> i32 { 1 }
|
||||
|
||||
// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code9inline_fn
|
||||
// CHECK-LABEL: ; link_dead_code::inline_fn
|
||||
// CHECK-NEXT: ; Function Attrs:
|
||||
// CHECK-NEXT: define hidden
|
||||
#[inline]
|
||||
fn inline_fn() -> i32 { 2 }
|
||||
|
||||
// CHECK-LABEL: define hidden i32 @_ZN14link_dead_code10private_fn
|
||||
// CHECK-LABEL: ; link_dead_code::private_fn
|
||||
// CHECK-NEXT: ; Function Attrs:
|
||||
// CHECK-NEXT: define hidden
|
||||
fn private_fn() -> i32 { 3 }
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
// Check that local generics are internalized if they are in the same CGU
|
||||
|
||||
// CHECK: define internal {{.*}} @_ZN34local_generics_in_exe_internalized3foo{{.*}}
|
||||
// CHECK-LABEL: ; local_generics_in_exe_internalized::foo
|
||||
// CHECK-NEXT: ; Function Attrs:
|
||||
// CHECK-NEXT: define internal
|
||||
pub fn foo<T>(x: T, y: T) -> (T, T) {
|
||||
(x, y)
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ pub extern fn exported() {
|
|||
not_exported();
|
||||
}
|
||||
|
||||
// CHECK-LABEL: define {{.*}} @_ZN23target_cpu_on_functions12not_exported{{.*}}() {{.*}} #0
|
||||
// CHECK-LABEL: ; target_cpu_on_functions::not_exported
|
||||
// CHECK-NEXT: ; Function Attrs:
|
||||
// CHECK-NEXT: define {{.*}}() {{.*}} #0
|
||||
fn not_exported() {}
|
||||
|
||||
// CHECK: attributes #0 = {{.*}} "target-cpu"="{{.*}}"
|
||||
|
|
|
@ -3,14 +3,15 @@
|
|||
# The following command will:
|
||||
# 1. dump the symbols of a library using `nm`
|
||||
# 2. extract only those lines that we are interested in via `grep`
|
||||
# 3. from those lines, extract just the symbol name via `sed`
|
||||
# (symbol names always start with "_ZN" and end with "E")
|
||||
# 3. from those lines, extract just the symbol name via `sed`, which:
|
||||
# * always starts with "_ZN" and ends with "E" (`legacy` mangling)
|
||||
# * always starts with "_R" (`v0` mangling)
|
||||
# 4. sort those symbol names for deterministic comparison
|
||||
# 5. write the result into a file
|
||||
|
||||
dump-symbols = nm "$(TMPDIR)/lib$(1).rlib" \
|
||||
| grep -E "$(2)" \
|
||||
| sed "s/.*\(_ZN.*E\).*/\1/" \
|
||||
| sed -E "s/.*(_ZN.*E|_R[a-zA-Z0-9_]*).*/\1/" \
|
||||
| sort \
|
||||
> "$(TMPDIR)/$(1)$(3).nm"
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@ EXE_NAME=an_executable
|
|||
COMBINED_CDYLIB_NAME=libcombined_rlib_dylib.dylib
|
||||
endif
|
||||
|
||||
# `grep` regex for symbols produced by either `legacy` or `v0` mangling
|
||||
RE_ANY_RUST_SYMBOL="_ZN.*h.*E\|_R[a-zA-Z0-9_]+"
|
||||
|
||||
all:
|
||||
$(RUSTC) -Zshare-generics=no an_rlib.rs
|
||||
$(RUSTC) -Zshare-generics=no a_cdylib.rs
|
||||
|
@ -31,20 +34,20 @@ all:
|
|||
# Check that a cdylib exports the public #[no_mangle] functions of dependencies
|
||||
[ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -c public_c_function_from_rlib)" -eq "1" ]
|
||||
# Check that a cdylib DOES NOT export any public Rust functions
|
||||
[ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -c _ZN.*h.*E)" -eq "0" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ]
|
||||
|
||||
# Check that a Rust dylib exports its monomorphic functions
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_c_function_from_rust_dylib)" -eq "1" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c _ZN.*public_rust_function_from_rust_dylib.*E)" -eq "1" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_rust_function_from_rust_dylib)" -eq "1" ]
|
||||
# Check that a Rust dylib does not export generics if -Zshare-generics=no
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c _ZN.*public_generic_function_from_rust_dylib.*E)" -eq "0" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_generic_function_from_rust_dylib)" -eq "0" ]
|
||||
|
||||
|
||||
# Check that a Rust dylib exports the monomorphic functions from its dependencies
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_c_function_from_rlib)" -eq "1" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_rust_function_from_rlib)" -eq "1" ]
|
||||
# Check that a Rust dylib does not export generics if -Zshare-generics=no
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c _ZN.*public_generic_function_from_rlib.*E)" -eq "0" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_generic_function_from_rlib)" -eq "0" ]
|
||||
|
||||
# Check that an executable does not export any dynamic symbols
|
||||
[ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c public_c_function_from_rlib)" -eq "0" ]
|
||||
|
@ -58,7 +61,7 @@ all:
|
|||
# Check that a cdylib exports the public #[no_mangle] functions of dependencies
|
||||
[ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -c public_c_function_from_rlib)" -eq "1" ]
|
||||
# Check that a cdylib DOES NOT export any public Rust functions
|
||||
[ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -c _ZN.*h.*E)" -eq "0" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(COMBINED_CDYLIB_NAME) | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ]
|
||||
|
||||
|
||||
$(RUSTC) -Zshare-generics=yes an_rlib.rs
|
||||
|
@ -71,17 +74,17 @@ all:
|
|||
# Check that a cdylib exports the public #[no_mangle] functions of dependencies
|
||||
[ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -c public_c_function_from_rlib)" -eq "1" ]
|
||||
# Check that a cdylib DOES NOT export any public Rust functions
|
||||
[ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -c _ZN.*h.*E)" -eq "0" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(CDYLIB_NAME) | grep -c $(RE_ANY_RUST_SYMBOL))" -eq "0" ]
|
||||
|
||||
# Check that a Rust dylib exports its monomorphic functions, including generics this time
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_c_function_from_rust_dylib)" -eq "1" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c _ZN.*public_rust_function_from_rust_dylib.*E)" -eq "1" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c _ZN.*public_generic_function_from_rust_dylib.*E)" -eq "1" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_rust_function_from_rust_dylib)" -eq "1" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_generic_function_from_rust_dylib)" -eq "1" ]
|
||||
|
||||
# Check that a Rust dylib exports the monomorphic functions from its dependencies
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_c_function_from_rlib)" -eq "1" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_rust_function_from_rlib)" -eq "1" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c _ZN.*public_generic_function_from_rlib.*E)" -eq "1" ]
|
||||
[ "$$($(NM) $(TMPDIR)/$(RDYLIB_NAME) | grep -c public_generic_function_from_rlib)" -eq "1" ]
|
||||
|
||||
# Check that an executable does not export any dynamic symbols
|
||||
[ "$$($(NM) $(TMPDIR)/$(EXE_NAME) | grep -c public_c_function_from_rlib)" -eq "0" ]
|
||||
|
|
|
@ -42,6 +42,21 @@ fn expected(fn_name: &str) -> String {
|
|||
format!(" backtrace::{}", fn_name)
|
||||
}
|
||||
|
||||
fn contains_verbose_expected(s: &str, fn_name: &str) -> bool {
|
||||
// HACK(eddyb) work around the fact that verbosely demangled stack traces
|
||||
// (from `RUST_BACKTRACE=full`, or, as is the case here, panic-in-panic)
|
||||
// may contain symbols with hashes in them, i.e. `backtrace[...]::`.
|
||||
let prefix = " backtrace";
|
||||
let suffix = &format!("::{}", fn_name);
|
||||
s.match_indices(prefix).any(|(i, _)| {
|
||||
s[i + prefix.len()..]
|
||||
.trim_start_matches('[')
|
||||
.trim_start_matches(char::is_alphanumeric)
|
||||
.trim_start_matches(']')
|
||||
.starts_with(suffix)
|
||||
})
|
||||
}
|
||||
|
||||
fn runtest(me: &str) {
|
||||
// Make sure that the stack trace is printed
|
||||
let p = template(me).arg("fail").env("RUST_BACKTRACE", "1").spawn().unwrap();
|
||||
|
@ -79,7 +94,7 @@ fn runtest(me: &str) {
|
|||
let s = str::from_utf8(&out.stderr).unwrap();
|
||||
// loosened the following from double::h to double:: due to
|
||||
// spurious failures on mac, 32bit, optimized
|
||||
assert!(s.contains("stack backtrace") && s.contains(&expected("double")),
|
||||
assert!(s.contains("stack backtrace") && contains_verbose_expected(s, "double"),
|
||||
"bad output3: {}", s);
|
||||
|
||||
// Make sure a stack trace isn't printed too many times
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
error: symbol-name(_ZN5basic4main17hd72940ef9669d526E)
|
||||
--> $DIR/basic.rs:3:1
|
||||
--> $DIR/basic.rs:7:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling(basic::main::hd72940ef9669d526)
|
||||
--> $DIR/basic.rs:3:1
|
||||
--> $DIR/basic.rs:7:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling-alt(basic::main)
|
||||
--> $DIR/basic.rs:3:1
|
||||
--> $DIR/basic.rs:7:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: def-path(main)
|
||||
--> $DIR/basic.rs:7:1
|
||||
--> $DIR/basic.rs:14:1
|
||||
|
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
|
@ -1,9 +1,18 @@
|
|||
// revisions: legacy v0
|
||||
//[legacy]compile-flags: -Z symbol-mangling-version=legacy
|
||||
//[v0]compile-flags: -Z symbol-mangling-version=v0
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[rustc_symbol_name]
|
||||
//~^ ERROR symbol-name(_ZN5basic4main
|
||||
//~| ERROR demangling(basic::main
|
||||
//~| ERROR demangling-alt(basic::main)
|
||||
#[rustc_def_path] //~ ERROR def-path(main)
|
||||
//[legacy]~^ ERROR symbol-name(_ZN5basic4main
|
||||
//[legacy]~| ERROR demangling(basic::main
|
||||
//[legacy]~| ERROR demangling-alt(basic::main)
|
||||
//[v0]~^^^^ ERROR symbol-name(_RNvCs4fqI2P2rA04_5basic4main)
|
||||
//[v0]~| ERROR demangling(basic[317d481089b8c8fe]::main)
|
||||
//[v0]~| ERROR demangling-alt(basic::main)
|
||||
#[rustc_def_path]
|
||||
//[legacy]~^ ERROR def-path(main)
|
||||
//[v0]~^^ ERROR def-path(main)
|
||||
fn main() {
|
||||
}
|
||||
|
|
26
src/test/ui/symbol-names/basic.v0.stderr
Normal file
26
src/test/ui/symbol-names/basic.v0.stderr
Normal file
|
@ -0,0 +1,26 @@
|
|||
error: symbol-name(_RNvCs4fqI2P2rA04_5basic4main)
|
||||
--> $DIR/basic.rs:7:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling(basic[317d481089b8c8fe]::main)
|
||||
--> $DIR/basic.rs:7:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling-alt(basic::main)
|
||||
--> $DIR/basic.rs:7:1
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: def-path(main)
|
||||
--> $DIR/basic.rs:14:1
|
||||
|
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
|
@ -1,47 +1,47 @@
|
|||
error: symbol-name(_ZN5impl13foo3Foo3bar17he53b9bee7600ed8dE)
|
||||
--> $DIR/impl1.rs:8:9
|
||||
--> $DIR/impl1.rs:12:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling(impl1::foo::Foo::bar::he53b9bee7600ed8d)
|
||||
--> $DIR/impl1.rs:8:9
|
||||
--> $DIR/impl1.rs:12:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling-alt(impl1::foo::Foo::bar)
|
||||
--> $DIR/impl1.rs:8:9
|
||||
--> $DIR/impl1.rs:12:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: def-path(foo::Foo::bar)
|
||||
--> $DIR/impl1.rs:12:9
|
||||
--> $DIR/impl1.rs:19:9
|
||||
|
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h86c41f0462d901d4E)
|
||||
--> $DIR/impl1.rs:21:9
|
||||
--> $DIR/impl1.rs:30:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling(impl1::bar::<impl impl1::foo::Foo>::baz::h86c41f0462d901d4)
|
||||
--> $DIR/impl1.rs:21:9
|
||||
--> $DIR/impl1.rs:30:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling-alt(impl1::bar::<impl impl1::foo::Foo>::baz)
|
||||
--> $DIR/impl1.rs:21:9
|
||||
--> $DIR/impl1.rs:30:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: def-path(bar::<impl foo::Foo>::baz)
|
||||
--> $DIR/impl1.rs:25:9
|
||||
--> $DIR/impl1.rs:37:9
|
||||
|
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
|
@ -1,3 +1,7 @@
|
|||
// revisions: legacy v0
|
||||
//[legacy]compile-flags: -Z symbol-mangling-version=legacy
|
||||
//[v0]compile-flags: -Z symbol-mangling-version=v0
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
@ -6,10 +10,15 @@ mod foo {
|
|||
|
||||
impl Foo {
|
||||
#[rustc_symbol_name]
|
||||
//~^ ERROR symbol-name(_ZN5impl13foo3Foo3bar
|
||||
//~| ERROR demangling(impl1::foo::Foo::bar
|
||||
//~| ERROR demangling-alt(impl1::foo::Foo::bar)
|
||||
#[rustc_def_path] //~ ERROR def-path(foo::Foo::bar)
|
||||
//[legacy]~^ ERROR symbol-name(_ZN5impl13foo3Foo3bar
|
||||
//[legacy]~| ERROR demangling(impl1::foo::Foo::bar
|
||||
//[legacy]~| ERROR demangling-alt(impl1::foo::Foo::bar)
|
||||
//[v0]~^^^^ ERROR symbol-name(_RNvMNtCs4fqI2P2rA04_5impl13fooNtB2_3Foo3bar)
|
||||
//[v0]~| ERROR demangling(<impl1[317d481089b8c8fe]::foo::Foo>::bar)
|
||||
//[v0]~| ERROR demangling-alt(<impl1::foo::Foo>::bar)
|
||||
#[rustc_def_path]
|
||||
//[legacy]~^ ERROR def-path(foo::Foo::bar)
|
||||
//[v0]~^^ ERROR def-path(foo::Foo::bar)
|
||||
fn bar() { }
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +28,15 @@ mod bar {
|
|||
|
||||
impl Foo {
|
||||
#[rustc_symbol_name]
|
||||
//~^ ERROR symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz
|
||||
//~| ERROR demangling(impl1::bar::<impl impl1::foo::Foo>::baz
|
||||
//~| ERROR demangling-alt(impl1::bar::<impl impl1::foo::Foo>::baz)
|
||||
#[rustc_def_path] //~ ERROR def-path(bar::<impl foo::Foo>::baz)
|
||||
//[legacy]~^ ERROR symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz
|
||||
//[legacy]~| ERROR demangling(impl1::bar::<impl impl1::foo::Foo>::baz
|
||||
//[legacy]~| ERROR demangling-alt(impl1::bar::<impl impl1::foo::Foo>::baz)
|
||||
//[v0]~^^^^ ERROR symbol-name(_RNvMNtCs4fqI2P2rA04_5impl13barNtNtB4_3foo3Foo3baz)
|
||||
//[v0]~| ERROR demangling(<impl1[317d481089b8c8fe]::foo::Foo>::baz)
|
||||
//[v0]~| ERROR demangling-alt(<impl1::foo::Foo>::baz)
|
||||
#[rustc_def_path]
|
||||
//[legacy]~^ ERROR def-path(bar::<impl foo::Foo>::baz)
|
||||
//[v0]~^^ ERROR def-path(bar::<impl foo::Foo>::baz)
|
||||
fn baz() { }
|
||||
}
|
||||
}
|
||||
|
|
50
src/test/ui/symbol-names/impl1.v0.stderr
Normal file
50
src/test/ui/symbol-names/impl1.v0.stderr
Normal file
|
@ -0,0 +1,50 @@
|
|||
error: symbol-name(_RNvMNtCs4fqI2P2rA04_5impl13fooNtB2_3Foo3bar)
|
||||
--> $DIR/impl1.rs:12:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling(<impl1[317d481089b8c8fe]::foo::Foo>::bar)
|
||||
--> $DIR/impl1.rs:12:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling-alt(<impl1::foo::Foo>::bar)
|
||||
--> $DIR/impl1.rs:12:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: def-path(foo::Foo::bar)
|
||||
--> $DIR/impl1.rs:19:9
|
||||
|
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: symbol-name(_RNvMNtCs4fqI2P2rA04_5impl13barNtNtB4_3foo3Foo3baz)
|
||||
--> $DIR/impl1.rs:30:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling(<impl1[317d481089b8c8fe]::foo::Foo>::baz)
|
||||
--> $DIR/impl1.rs:30:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling-alt(<impl1::foo::Foo>::baz)
|
||||
--> $DIR/impl1.rs:30:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: def-path(bar::<impl foo::Foo>::baz)
|
||||
--> $DIR/impl1.rs:37:9
|
||||
|
|
||||
LL | #[rustc_def_path]
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
20
src/test/ui/symbol-names/issue-60925.legacy.stderr
Normal file
20
src/test/ui/symbol-names/issue-60925.legacy.stderr
Normal file
|
@ -0,0 +1,20 @@
|
|||
error: symbol-name(_ZN11issue_609253foo36Foo$LT$issue_60925..llv$6d$..Foo$GT$3foo17h059a991a004536adE)
|
||||
--> $DIR/issue-60925.rs:21:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling(issue_60925::foo::Foo<issue_60925::llv$6d$..Foo$GT$::foo::h059a991a004536ad)
|
||||
--> $DIR/issue-60925.rs:21:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling-alt(issue_60925::foo::Foo<issue_60925::llv$6d$..Foo$GT$::foo)
|
||||
--> $DIR/issue-60925.rs:21:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
|
@ -1,8 +1,13 @@
|
|||
// ignore-tidy-linelength
|
||||
// revisions: legacy v0
|
||||
//[legacy]compile-flags: -Z symbol-mangling-version=legacy
|
||||
//[v0]compile-flags: -Z symbol-mangling-version=v0
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
// This test is the same code as in ui/issue-53912.rs but this test checks that the symbol mangling
|
||||
// fix produces the correct result, whereas that test just checks that the reproduction compiles
|
||||
// successfully and doesn't segfault
|
||||
// successfully and doesn't crash LLVM
|
||||
|
||||
fn dummy() {}
|
||||
|
||||
|
@ -14,9 +19,12 @@ mod foo {
|
|||
|
||||
impl Foo<::llvm::Foo> {
|
||||
#[rustc_symbol_name]
|
||||
//~^ ERROR symbol-name(_ZN11issue_609253foo36Foo$LT$issue_60925..llv$6d$..Foo$GT$3foo
|
||||
//~| ERROR demangling(issue_60925::foo::Foo<issue_60925::llv$6d$..Foo$GT$::foo
|
||||
//~| ERROR demangling-alt(issue_60925::foo::Foo<issue_60925::llv$6d$..Foo$GT$::foo)
|
||||
//[legacy]~^ ERROR symbol-name(_ZN11issue_609253foo36Foo$LT$issue_60925..llv$6d$..Foo$GT$3foo
|
||||
//[legacy]~| ERROR demangling(issue_60925::foo::Foo<issue_60925::llv$6d$..Foo$GT$::foo
|
||||
//[legacy]~| ERROR demangling-alt(issue_60925::foo::Foo<issue_60925::llv$6d$..Foo$GT$::foo)
|
||||
//[v0]~^^^^ ERROR symbol-name(_RNvMNtCs4fqI2P2rA04_11issue_609253fooINtB2_3FooNtNtB4_4llvm3FooE3foo)
|
||||
//[v0]~| ERROR demangling(<issue_60925[317d481089b8c8fe]::foo::Foo<issue_60925[317d481089b8c8fe]::llvm::Foo>>::foo)
|
||||
//[v0]~| ERROR demangling-alt(<issue_60925::foo::Foo<issue_60925::llvm::Foo>>::foo)
|
||||
pub(crate) fn foo() {
|
||||
for _ in 0..0 {
|
||||
for _ in &[::dummy()] {
|
||||
|
|
20
src/test/ui/symbol-names/issue-60925.v0.stderr
Normal file
20
src/test/ui/symbol-names/issue-60925.v0.stderr
Normal file
|
@ -0,0 +1,20 @@
|
|||
error: symbol-name(_RNvMNtCs4fqI2P2rA04_11issue_609253fooINtB2_3FooNtNtB4_4llvm3FooE3foo)
|
||||
--> $DIR/issue-60925.rs:21:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling(<issue_60925[317d481089b8c8fe]::foo::Foo<issue_60925[317d481089b8c8fe]::llvm::Foo>>::foo)
|
||||
--> $DIR/issue-60925.rs:21:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: demangling-alt(<issue_60925::foo::Foo<issue_60925::llvm::Foo>>::foo)
|
||||
--> $DIR/issue-60925.rs:21:9
|
||||
|
|
||||
LL | #[rustc_symbol_name]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
Loading…
Add table
Reference in a new issue