diff --git a/src/test/codegen/drop.rs b/src/test/codegen/drop.rs
index 7e6f8eaaa30..307c4e2c1e2 100644
--- a/src/test/codegen/drop.rs
+++ b/src/test/codegen/drop.rs
@@ -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;
diff --git a/src/test/codegen/external-no-mangle-fns.rs b/src/test/codegen/external-no-mangle-fns.rs
index 79d5dc2400c..90288214499 100644
--- a/src/test/codegen/external-no-mangle-fns.rs
+++ b/src/test/codegen/external-no-mangle-fns.rs
@@ -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()
diff --git a/src/test/codegen/external-no-mangle-statics.rs b/src/test/codegen/external-no-mangle-statics.rs
index 2998000180e..e44373926b7 100644
--- a/src/test/codegen/external-no-mangle-statics.rs
+++ b/src/test/codegen/external-no-mangle-statics.rs
@@ -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
diff --git a/src/test/codegen/internalize-closures.rs b/src/test/codegen/internalize-closures.rs
index 3434820aa8a..8d9192c6fa0 100644
--- a/src/test/codegen/internalize-closures.rs
+++ b/src/test/codegen/internalize-closures.rs
@@ -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);
 }
diff --git a/src/test/codegen/link-dead-code.rs b/src/test/codegen/link-dead-code.rs
index cb3dd07a2a7..de5a237c5f8 100644
--- a/src/test/codegen/link-dead-code.rs
+++ b/src/test/codegen/link-dead-code.rs
@@ -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 }
diff --git a/src/test/codegen/local-generics-in-exe-internalized.rs b/src/test/codegen/local-generics-in-exe-internalized.rs
index 6bdbf929193..e5430fbf17a 100644
--- a/src/test/codegen/local-generics-in-exe-internalized.rs
+++ b/src/test/codegen/local-generics-in-exe-internalized.rs
@@ -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)
 }
diff --git a/src/test/codegen/target-cpu-on-functions.rs b/src/test/codegen/target-cpu-on-functions.rs
index 3fdf6ab6d00..523216deb84 100644
--- a/src/test/codegen/target-cpu-on-functions.rs
+++ b/src/test/codegen/target-cpu-on-functions.rs
@@ -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"="{{.*}}"
diff --git a/src/test/run-make-fulldeps/stable-symbol-names/Makefile b/src/test/run-make-fulldeps/stable-symbol-names/Makefile
index 3cbc5593ac0..451af809b22 100644
--- a/src/test/run-make-fulldeps/stable-symbol-names/Makefile
+++ b/src/test/run-make-fulldeps/stable-symbol-names/Makefile
@@ -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"
 
diff --git a/src/test/run-make-fulldeps/symbol-visibility/Makefile b/src/test/run-make-fulldeps/symbol-visibility/Makefile
index d99470e30d7..7901866015b 100644
--- a/src/test/run-make-fulldeps/symbol-visibility/Makefile
+++ b/src/test/run-make-fulldeps/symbol-visibility/Makefile
@@ -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" ]
diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs
index 5f6198aff50..c73ba293ee2 100644
--- a/src/test/run-pass/backtrace.rs
+++ b/src/test/run-pass/backtrace.rs
@@ -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
diff --git a/src/test/ui/symbol-names/basic.stderr b/src/test/ui/symbol-names/basic.legacy.stderr
similarity index 86%
rename from src/test/ui/symbol-names/basic.stderr
rename to src/test/ui/symbol-names/basic.legacy.stderr
index ebb8b4390d2..e26168dcfc4 100644
--- a/src/test/ui/symbol-names/basic.stderr
+++ b/src/test/ui/symbol-names/basic.legacy.stderr
@@ -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]
    | ^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/symbol-names/basic.rs b/src/test/ui/symbol-names/basic.rs
index 1459ac014ea..aa88184eddf 100644
--- a/src/test/ui/symbol-names/basic.rs
+++ b/src/test/ui/symbol-names/basic.rs
@@ -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() {
 }
diff --git a/src/test/ui/symbol-names/basic.v0.stderr b/src/test/ui/symbol-names/basic.v0.stderr
new file mode 100644
index 00000000000..40a39daaedc
--- /dev/null
+++ b/src/test/ui/symbol-names/basic.v0.stderr
@@ -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
+
diff --git a/src/test/ui/symbol-names/impl1.stderr b/src/test/ui/symbol-names/impl1.legacy.stderr
similarity index 86%
rename from src/test/ui/symbol-names/impl1.stderr
rename to src/test/ui/symbol-names/impl1.legacy.stderr
index 3a7d540c488..298841aa7c9 100644
--- a/src/test/ui/symbol-names/impl1.stderr
+++ b/src/test/ui/symbol-names/impl1.legacy.stderr
@@ -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]
    |         ^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/symbol-names/impl1.rs b/src/test/ui/symbol-names/impl1.rs
index 803fa856b60..2b30362e419 100644
--- a/src/test/ui/symbol-names/impl1.rs
+++ b/src/test/ui/symbol-names/impl1.rs
@@ -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() { }
     }
 }
diff --git a/src/test/ui/symbol-names/impl1.v0.stderr b/src/test/ui/symbol-names/impl1.v0.stderr
new file mode 100644
index 00000000000..9f6314a6c29
--- /dev/null
+++ b/src/test/ui/symbol-names/impl1.v0.stderr
@@ -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
+
diff --git a/src/test/ui/symbol-names/issue-60925.legacy.stderr b/src/test/ui/symbol-names/issue-60925.legacy.stderr
new file mode 100644
index 00000000000..0bbe424aa02
--- /dev/null
+++ b/src/test/ui/symbol-names/issue-60925.legacy.stderr
@@ -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
+
diff --git a/src/test/ui/symbol-names/issue-60925.rs b/src/test/ui/symbol-names/issue-60925.rs
index 22efa978bd2..09d68eebb95 100644
--- a/src/test/ui/symbol-names/issue-60925.rs
+++ b/src/test/ui/symbol-names/issue-60925.rs
@@ -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()] {
diff --git a/src/test/ui/symbol-names/issue-60925.v0.stderr b/src/test/ui/symbol-names/issue-60925.v0.stderr
new file mode 100644
index 00000000000..5ead40211d2
--- /dev/null
+++ b/src/test/ui/symbol-names/issue-60925.v0.stderr
@@ -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
+