Skip to content

Commit

Permalink
Add regression tests for 123303
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Apr 1, 2024
1 parent 88296bd commit 56dbeeb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/ui/traits/stack-error-order-dependence-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//@ check-pass
// Regression test for <https://github.com/rust-lang/rust/issues/123303>.
// This time EXCEPT without `dyn` builtin bounds :^)

pub trait Trait: Supertrait {}

trait Impossible {}
impl<F: ?Sized + Impossible> Trait for F {}

pub trait Supertrait {}

impl<T: ?Sized + Trait + Impossible> Supertrait for T {}

fn needs_supertrait<T: ?Sized + Supertrait>() {}
fn needs_trait<T: ?Sized + Trait>() {}

struct A;
impl Trait for A where A: Supertrait {}
impl Supertrait for A {}

fn main() {
needs_supertrait::<A>();
needs_trait::<A>();
}
19 changes: 19 additions & 0 deletions tests/ui/traits/stack-error-order-dependence.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ check-pass
// Regression test for <https://github.com/rust-lang/rust/issues/123303>.

pub trait Trait: Supertrait {}

trait Impossible {}
impl<F: ?Sized + Impossible> Trait for F {}

pub trait Supertrait {}

impl<T: ?Sized + Trait + Impossible> Supertrait for T {}

fn needs_supertrait<T: ?Sized + Supertrait>() {}
fn needs_trait<T: ?Sized + Trait>() {}

fn main() {
needs_supertrait::<dyn Trait>();
needs_trait::<dyn Trait>();
}

0 comments on commit 56dbeeb

Please sign in to comment.