Update trait_duplication_in_bounds.rs ui test to add regression for ##9961

This commit is contained in:
Guillaume Gomez 2024-01-16 12:13:15 +01:00
parent 169e2ab55b
commit 7217c22f69
2 changed files with 60 additions and 2 deletions

View File

@ -118,4 +118,33 @@ fn bad_trait_object(arg0: &(dyn Any + Send)) {
unimplemented!(); unimplemented!();
} }
fn main() {} trait Proj {
type S;
}
impl Proj for () {
type S = ();
}
impl Proj for i32 {
type S = i32;
}
trait Base<T> {
fn is_base(&self);
}
trait Derived<B: Proj>: Base<B::S> + Base<()> {
fn is_derived(&self);
}
fn f<P: Proj>(obj: &dyn Derived<P>) {
obj.is_derived();
Base::<P::S>::is_base(obj);
Base::<()>::is_base(obj);
}
fn main() {
let _x: fn(_) = f::<()>;
let _x: fn(_) = f::<i32>;
}

View File

@ -118,4 +118,33 @@ fn bad_trait_object(arg0: &(dyn Any + Send + Send)) {
unimplemented!(); unimplemented!();
} }
fn main() {} trait Proj {
type S;
}
impl Proj for () {
type S = ();
}
impl Proj for i32 {
type S = i32;
}
trait Base<T> {
fn is_base(&self);
}
trait Derived<B: Proj>: Base<B::S> + Base<()> {
fn is_derived(&self);
}
fn f<P: Proj>(obj: &dyn Derived<P>) {
obj.is_derived();
Base::<P::S>::is_base(obj);
Base::<()>::is_base(obj);
}
fn main() {
let _x: fn(_) = f::<()>;
let _x: fn(_) = f::<i32>;
}