diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 8871de194a634..e29e95a145b43 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -231,7 +231,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { freshener: infcx.freshener(), intercrate_ambiguity_causes: None, query_mode: TraitQueryMode::Standard, - treat_inductive_cycle: TreatInductiveCycleAs::Recur, + treat_inductive_cycle: TreatInductiveCycleAs::Ambig, } } diff --git a/tests/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr b/tests/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr index c23e54594ee30..f86152253cf84 100644 --- a/tests/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr +++ b/tests/ui/associated-type-bounds/bad-bounds-on-assoc-in-trait.stderr @@ -1,3 +1,15 @@ +error[E0277]: `::C` is not an iterator + --> $DIR/bad-bounds-on-assoc-in-trait.rs:26:21 + | +LL | type C: Clone + Iterator Lam<&'a u8, App: Debug>> + Sync>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `::C` is not an iterator + | + = help: the trait `Iterator` is not implemented for `::C` +help: consider further restricting the associated type + | +LL | trait Case1 where ::C: Iterator { + | ++++++++++++++++++++++++++++++++++ + error[E0277]: `<::C as Iterator>::Item` cannot be sent between threads safely --> $DIR/bad-bounds-on-assoc-in-trait.rs:26:36 | @@ -34,6 +46,6 @@ help: consider further restricting the associated type LL | trait Case1 where <::C as Iterator>::Item: Sync { | ++++++++++++++++++++++++++++++++++++++++++++++++++ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr index dc621d6b8a848..42232126f4e3e 100644 --- a/tests/ui/impl-trait/in-trait/specialization-broken.stderr +++ b/tests/ui/impl-trait/in-trait/specialization-broken.stderr @@ -1,31 +1,18 @@ -error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/specialization-broken.rs:16:22 +error[E0391]: cycle detected when computing whether impls specialize one another + --> $DIR/specialization-broken.rs:12:1 | LL | default impl Foo for U - | - this type parameter -... -LL | fn bar(&self) -> U { - | ^ - | | - | expected associated type, found type parameter `U` - | help: change the output type to match the trait: `impl Sized` + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: type in trait - --> $DIR/specialization-broken.rs:9:22 + = note: ...which requires evaluating trait selection obligation `i32: Foo`... + = note: ...which again requires computing whether impls specialize one another, completing the cycle +note: cycle used when building specialization graph of trait `Foo` + --> $DIR/specialization-broken.rs:8:1 | -LL | fn bar(&self) -> impl Sized; - | ^^^^^^^^^^ - = note: expected signature `fn(&U) -> impl Sized` - found signature `fn(&U) -> U` +LL | trait Foo { + | ^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: method with return-position `impl Trait` in trait cannot be specialized - --> $DIR/specialization-broken.rs:16:5 - | -LL | fn bar(&self) -> U { - | ^^^^^^^^^^^^^^^^^^ - | - = note: specialization behaves in inconsistent and surprising ways with `#![feature(return_position_impl_trait_in_trait)]`, and for now is disallowed - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0053`. +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/specialization/defaultimpl/specialization-no-default.stderr b/tests/ui/specialization/defaultimpl/specialization-no-default.stderr index f9e62a99baee8..b60b337ce8dc5 100644 --- a/tests/ui/specialization/defaultimpl/specialization-no-default.stderr +++ b/tests/ui/specialization/defaultimpl/specialization-no-default.stderr @@ -8,61 +8,20 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete = note: `#[warn(incomplete_features)]` on by default -error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:20:5 +error[E0391]: cycle detected when computing whether impls specialize one another + --> $DIR/specialization-no-default.rs:46:1 | -LL | impl Foo for T { - | ----------------- parent `impl` is here -... -LL | fn foo(&self) {} - | ^^^^^^^^^^^^^ cannot specialize default item `foo` +LL | default impl Baz for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: to specialize, `foo` in the parent `impl` must be marked `default` - -error[E0520]: `bar` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:23:5 - | -LL | impl Foo for T { - | ----------------- parent `impl` is here -... -LL | fn bar(&self) {} - | ^^^^^^^^^^^^^ cannot specialize default item `bar` - | - = note: to specialize, `bar` in the parent `impl` must be marked `default` - -error[E0520]: `T` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:37:5 - | -LL | impl Bar for T { - | ----------------- parent `impl` is here -... -LL | type T = (); - | ^^^^^^ cannot specialize default item `T` - | - = note: to specialize, `T` in the parent `impl` must be marked `default` - -error[E0520]: `baz` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:55:5 - | -LL | impl Baz for T { - | ------------------------ parent `impl` is here -... -LL | fn baz(&self) {} - | ^^^^^^^^^^^^^ cannot specialize default item `baz` - | - = note: to specialize, `baz` in the parent `impl` must be marked `default` - -error[E0520]: `redundant` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:74:5 - | -LL | impl Redundant for T { - | ------------------------------ parent `impl` is here -... -LL | fn redundant(&self) {} - | ^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` + = note: ...which immediately requires computing whether impls specialize one another again +note: cycle used when building specialization graph of trait `Baz` + --> $DIR/specialization-no-default.rs:42:1 | - = note: to specialize, `redundant` in the parent `impl` must be marked `default` +LL | trait Baz { + | ^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to previous error; 1 warning emitted -For more information about this error, try `rustc --explain E0520`. +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr b/tests/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr index f19975060a46b..4b738d5d604f9 100644 --- a/tests/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr +++ b/tests/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr @@ -8,15 +8,21 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete = note: `#[warn(incomplete_features)]` on by default -error[E0046]: not all trait items implemented, missing: `foo_two` - --> $DIR/specialization-trait-item-not-implemented.rs:18:1 +error[E0391]: cycle detected when computing whether impls specialize one another + --> $DIR/specialization-trait-item-not-implemented.rs:12:1 | -LL | fn foo_two(&self) -> &'static str; - | ---------------------------------- `foo_two` from trait -... -LL | impl Foo for MyStruct {} - | ^^^^^^^^^^^^^^^^^^^^^ missing `foo_two` in implementation +LL | default impl Foo for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: ...which requires evaluating trait selection obligation `MyStruct: Foo`... + = note: ...which again requires computing whether impls specialize one another, completing the cycle +note: cycle used when building specialization graph of trait `Foo` + --> $DIR/specialization-trait-item-not-implemented.rs:5:1 + | +LL | trait Foo { + | ^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to previous error; 1 warning emitted -For more information about this error, try `rustc --explain E0046`. +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr b/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr index 37788612f4371..5bd8912e50cd0 100644 --- a/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr +++ b/tests/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr @@ -8,37 +8,12 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete = note: `#[warn(incomplete_features)]` on by default -error[E0599]: the method `foo_one` exists for struct `MyStruct`, but its trait bounds were not satisfied +error[E0275]: overflow evaluating the requirement `MyStruct: Foo` --> $DIR/specialization-trait-not-implemented.rs:22:29 | -LL | struct MyStruct; - | --------------- - | | - | method `foo_one` not found for this struct - | doesn't satisfy `MyStruct: Foo` -... LL | println!("{}", MyStruct.foo_one()); - | ^^^^^^^ method cannot be called on `MyStruct` due to unsatisfied trait bounds - | -note: trait bound `MyStruct: Foo` was not satisfied - --> $DIR/specialization-trait-not-implemented.rs:14:1 - | -LL | default impl Foo for T { - | ^^^^^^^^^^^^^^^^---^^^^^- - | | - | unsatisfied trait bound introduced here -note: the trait `Foo` must be implemented - --> $DIR/specialization-trait-not-implemented.rs:7:1 - | -LL | trait Foo { - | ^^^^^^^^^ - = help: items from traits can only be used if the trait is implemented and in scope -note: `Foo` defines an item `foo_one`, perhaps you need to implement it - --> $DIR/specialization-trait-not-implemented.rs:7:1 - | -LL | trait Foo { - | ^^^^^^^^^ + | ^^^^^^^ error: aborting due to previous error; 1 warning emitted -For more information about this error, try `rustc --explain E0599`. +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/specialization/issue-39448.stderr b/tests/ui/specialization/issue-39448.stderr index 9ce51d1136d0e..47ad98c9eba1e 100644 --- a/tests/ui/specialization/issue-39448.stderr +++ b/tests/ui/specialization/issue-39448.stderr @@ -8,28 +8,21 @@ LL | #![feature(specialization)] = help: consider using `min_specialization` instead, which is more stable and complete = note: `#[warn(incomplete_features)]` on by default -error[E0275]: overflow evaluating the requirement `T: FromA` - --> $DIR/issue-39448.rs:45:13 - | -LL | x.foo(y.to()).to() - | ^^ - | -note: required for `T` to implement `FromA` - --> $DIR/issue-39448.rs:24:29 +error[E0391]: cycle detected when computing whether impls specialize one another + --> $DIR/issue-39448.rs:24:1 | LL | impl> FromA for U { - | -------- ^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `U` to implement `ToA` - --> $DIR/issue-39448.rs:34:12 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: ...which requires evaluating trait selection obligation `u16: FromA`... + = note: ...which again requires computing whether impls specialize one another, completing the cycle +note: cycle used when building specialization graph of trait `FromA` + --> $DIR/issue-39448.rs:20:1 | -LL | impl ToA for T - | ^^^^^^ ^ -LL | where -LL | U: FromA, - | -------- unsatisfied trait bound introduced here +LL | trait FromA { + | ^^^^^^^^^^^^^^ + = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information error: aborting due to previous error; 1 warning emitted -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0391`.