Skip to content

Commit

Permalink
Failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jan 6, 2025
1 parent 3323bbe commit ab07e78
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/ui/symbol-names/normalize-in-param-env.rs
Original file line number Diff line number Diff line change
@@ -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();
}

0 comments on commit ab07e78

Please sign in to comment.