Skip to content

Commit

Permalink
Update trait_duplication_in_bounds.rs ui test to add regression for #
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 16, 2024
1 parent 169e2ab commit 7217c22
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
31 changes: 30 additions & 1 deletion tests/ui/trait_duplication_in_bounds.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,33 @@ fn bad_trait_object(arg0: &(dyn Any + Send)) {
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>;
}
31 changes: 30 additions & 1 deletion tests/ui/trait_duplication_in_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,33 @@ fn bad_trait_object(arg0: &(dyn Any + Send + Send)) {
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>;
}

0 comments on commit 7217c22

Please sign in to comment.