about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-01-06 06:01:14 +0000
committerMichael Goulet <michael@errs.io>2025-01-06 06:11:06 +0000
commitab07e78092bf8f370b9a61266d40c3a444b59608 (patch)
treeaa0b2b00cbb1f4cd363053c1bf4e81e26a473362
parent3323bbec7ed62974b3f0b1b7fd05f93ed7945259 (diff)
downloadrust-ab07e78092bf8f370b9a61266d40c3a444b59608.tar.gz
rust-ab07e78092bf8f370b9a61266d40c3a444b59608.zip
Failing test
-rw-r--r--tests/ui/symbol-names/normalize-in-param-env.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/ui/symbol-names/normalize-in-param-env.rs b/tests/ui/symbol-names/normalize-in-param-env.rs
new file mode 100644
index 00000000000..a1453eb13ef
--- /dev/null
+++ b/tests/ui/symbol-names/normalize-in-param-env.rs
@@ -0,0 +1,38 @@
+//@ revisions: legacy v0
+//@[v0] compile-flags: -C symbol-mangling-version=v0
+//@[legacy] compile-flags: -C symbol-mangling-version=legacy -Zunstable-options
+//@ build-pass
+
+pub struct Vec2;
+
+pub trait Point {
+    type S;
+}
+impl Point for Vec2 {
+    type S = f32;
+}
+
+pub trait Point2: Point<S = Self::S2> {
+    type S2;
+}
+impl Point2 for Vec2 {
+    type S2 = Self::S;
+}
+
+trait MyFrom<T> {
+    fn my_from();
+}
+impl<P: Point2> MyFrom<P::S> for P {
+    fn my_from() {
+        // This is just a really dumb way to force the legacy symbol mangling to
+        // mangle the closure's parent impl def path *with* args. Otherwise,
+        // legacy symbol mangling will strip the args from the instance, meaning
+        // that we don't trigger the bug.
+        let c = || {};
+        let x = Box::new(c) as Box<dyn Fn()>;
+    }
+}
+
+fn main() {
+    <Vec2 as MyFrom<_>>::my_from();
+}