1 // build-pass (FIXME(62277): could be check-pass?)
3 // FIXME(eddyb) shorten the name so windows doesn't choke on it.
4 #![crate_name = "trait_test"]
6 // Regression test related to #56288. Check that a supertrait projection (of
7 // `Output`) that references `Self` is ok if there is another occurrence of
8 // the same supertrait that specifies the projection explicitly, even if
9 // the projection's associated type is not explicitly specified in the object type.
11 // Note that in order for this to compile, we need the `Self`-referencing projection
12 // to normalize fairly directly to a concrete type, otherwise the trait resolver
15 // There is a test in `trait-object-with-self-in-projection-output-bad.rs` that
16 // having a normalizing, but `Self`-containing projection does not *by itself*
17 // allow you to avoid writing the projected type (`Output`, in this example)
24 impl<T: ?Sized> ConstI32 for T {
32 trait NormalizingHelper: Base<Output=<Self as ConstI32>::Out> + Base<Output=i32> {
41 impl NormalizingHelper for u32
47 // Make sure this works both with and without the associated type
49 let _x: Box<dyn NormalizingHelper<Target=i32>> = Box::new(2u32);
50 let _y: Box<dyn NormalizingHelper<Target=i32, Output=i32>> = Box::new(2u32);