Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make inductive cycles always ambiguous #122791

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add regression tests for 123303
  • Loading branch information
compiler-errors committed Apr 1, 2024
commit 56dbeeb5ac05d8e34983db20453d72bdeb222cbe
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>();
}
Loading