From e02c5b5930c2c9ba3e5423fe12e2ef0155017297 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 20:31:36 +0200 Subject: Merging upstream version 1.74.1+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/traits/bad-method-typaram-kind.stderr | 4 +- .../bound/on-structs-and-enums-in-fns.stderr | 10 + .../bound/on-structs-and-enums-in-impls.stderr | 5 + .../bound/on-structs-and-enums-locals.stderr | 10 + .../bound/on-structs-and-enums-static.stderr | 5 + tests/ui/traits/bound/on-structs-and-enums.stderr | 20 ++ .../traits/deny-builtin-object-impl.current.stderr | 5 + .../ui/traits/deny-builtin-object-impl.next.stderr | 5 + .../dont-autoderef-ty-with-escaping-var.stderr | 11 +- tests/ui/traits/impl-bounds-checking.stderr | 5 + .../inheritance/repeated-supertrait-ambig.stderr | 6 +- tests/ui/traits/issue-105231.rs | 2 +- tests/ui/traits/issue-105231.stderr | 8 +- tests/ui/traits/issue-66768.rs | 205 +++++++++++++++++++++ tests/ui/traits/issue-77982.stderr | 20 +- .../traits/issue-91949-hangs-on-recursion.stderr | 2 +- tests/ui/traits/issue-99875.stderr | 4 +- .../alias_eq_substs_eq_not_intercrate.stderr | 2 + tests/ui/traits/new-solver/async.fail.stderr | 2 +- .../new-solver/auto-with-drop_tracking_mir.rs | 2 +- .../new-solver/builtin-fn-must-return-sized.stderr | 6 +- .../traits/new-solver/canonicalize-effect-var.rs | 22 +++ .../trait_ref_is_knowable-norm-overflow.stderr | 6 + .../coinduction/fixpoint-exponential-growth.stderr | 4 +- .../double-cycle-inductive-coinductive.stderr | 8 +- .../cycles/fixpoint-rerun-all-cycle-heads.rs | 53 ++++++ .../cycles/fixpoint-rerun-all-cycle-heads.stderr | 10 + .../new-solver/cycles/inductive-not-on-stack.rs | 2 +- .../cycles/inductive-not-on-stack.stderr | 19 +- .../new-solver/dont-ice-on-assoc-projection.rs | 19 ++ .../new-solver/dont-ice-on-assoc-projection.stderr | 21 +++ ...-type_of-tait-in-defining-scope.not_send.stderr | 4 +- tests/ui/traits/new-solver/generator.fail.stderr | 8 +- .../overflow/exponential-trait-goals.stderr | 4 +- .../traits/new-solver/overflow/global-cache.stderr | 4 +- .../overflow/recursion-limit-zero-issue-115351.rs | 12 ++ .../recursion-limit-zero-issue-115351.stderr | 27 +++ .../overflow/recursive-self-normalization-2.stderr | 4 +- .../overflow/recursive-self-normalization.stderr | 4 +- .../traits/new-solver/projection-discr-kind.stderr | 5 + ...rojection-param-candidates-are-ambiguous.stderr | 4 +- .../capture-late-ct-in-anon.rs | 2 +- .../capture-late-ct-in-anon.stderr | 2 +- tests/ui/traits/non_lifetime_binders/fail.stderr | 5 + .../non_lifetime_binders/late-bound-in-anon-ct.rs | 2 +- .../late-bound-in-anon-ct.stderr | 2 +- tests/ui/traits/object-does-not-impl-trait.stderr | 5 + .../traits/object/enforce-supertrait-projection.rs | 2 +- .../object/enforce-supertrait-projection.stderr | 2 +- .../ui/traits/reservation-impl/no-use.next.stderr | 6 +- tests/ui/traits/reservation-impl/no-use.old.stderr | 6 +- .../cycle-via-builtin-auto-trait-impl.rs | 2 +- .../cycle-via-builtin-auto-trait-impl.stderr | 8 +- .../ui/traits/suggest-deferences/issue-39029.fixed | 18 -- tests/ui/traits/suggest-deferences/issue-39029.rs | 18 -- .../traits/suggest-deferences/issue-39029.stderr | 19 -- .../ui/traits/suggest-deferences/issue-62530.fixed | 15 -- tests/ui/traits/suggest-deferences/issue-62530.rs | 15 -- .../traits/suggest-deferences/issue-62530.stderr | 21 --- .../ui/traits/suggest-deferences/multiple-0.fixed | 36 ---- tests/ui/traits/suggest-deferences/multiple-0.rs | 36 ---- .../ui/traits/suggest-deferences/multiple-0.stderr | 21 --- tests/ui/traits/suggest-deferences/multiple-1.rs | 54 ------ .../ui/traits/suggest-deferences/multiple-1.stderr | 18 -- .../suggest-deferences/root-obligation.fixed | 13 -- .../traits/suggest-deferences/root-obligation.rs | 13 -- .../suggest-deferences/root-obligation.stderr | 21 --- .../suggest-dereferencing-receiver-argument.fixed | 14 -- .../suggest-dereferencing-receiver-argument.rs | 14 -- .../suggest-dereferencing-receiver-argument.stderr | 15 -- .../dont-suggest-unsize-deref.rs | 15 ++ .../dont-suggest-unsize-deref.stderr | 22 +++ .../traits/suggest-dereferences/issue-39029.fixed | 18 ++ .../ui/traits/suggest-dereferences/issue-39029.rs | 18 ++ .../traits/suggest-dereferences/issue-39029.stderr | 19 ++ .../traits/suggest-dereferences/issue-62530.fixed | 15 ++ .../ui/traits/suggest-dereferences/issue-62530.rs | 15 ++ .../traits/suggest-dereferences/issue-62530.stderr | 21 +++ .../traits/suggest-dereferences/multiple-0.fixed | 36 ++++ tests/ui/traits/suggest-dereferences/multiple-0.rs | 36 ++++ .../traits/suggest-dereferences/multiple-0.stderr | 21 +++ tests/ui/traits/suggest-dereferences/multiple-1.rs | 54 ++++++ .../traits/suggest-dereferences/multiple-1.stderr | 18 ++ .../suggest-dereferences/root-obligation.fixed | 13 ++ .../traits/suggest-dereferences/root-obligation.rs | 13 ++ .../suggest-dereferences/root-obligation.stderr | 21 +++ .../suggest-dereferencing-receiver-argument.fixed | 14 ++ .../suggest-dereferencing-receiver-argument.rs | 14 ++ .../suggest-dereferencing-receiver-argument.stderr | 15 ++ tests/ui/traits/suggest-fully-qualified-closure.rs | 2 +- .../traits/suggest-fully-qualified-closure.stderr | 4 +- tests/ui/traits/suggest-where-clause.stderr | 12 +- tests/ui/traits/unsend-future.rs | 1 + tests/ui/traits/unsend-future.stderr | 4 +- tests/ui/traits/vtable-res-trait-param.stderr | 5 + 95 files changed, 950 insertions(+), 460 deletions(-) create mode 100644 tests/ui/traits/issue-66768.rs create mode 100644 tests/ui/traits/new-solver/canonicalize-effect-var.rs create mode 100644 tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs create mode 100644 tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr create mode 100644 tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs create mode 100644 tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr create mode 100644 tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs create mode 100644 tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr delete mode 100644 tests/ui/traits/suggest-deferences/issue-39029.fixed delete mode 100644 tests/ui/traits/suggest-deferences/issue-39029.rs delete mode 100644 tests/ui/traits/suggest-deferences/issue-39029.stderr delete mode 100644 tests/ui/traits/suggest-deferences/issue-62530.fixed delete mode 100644 tests/ui/traits/suggest-deferences/issue-62530.rs delete mode 100644 tests/ui/traits/suggest-deferences/issue-62530.stderr delete mode 100644 tests/ui/traits/suggest-deferences/multiple-0.fixed delete mode 100644 tests/ui/traits/suggest-deferences/multiple-0.rs delete mode 100644 tests/ui/traits/suggest-deferences/multiple-0.stderr delete mode 100644 tests/ui/traits/suggest-deferences/multiple-1.rs delete mode 100644 tests/ui/traits/suggest-deferences/multiple-1.stderr delete mode 100644 tests/ui/traits/suggest-deferences/root-obligation.fixed delete mode 100644 tests/ui/traits/suggest-deferences/root-obligation.rs delete mode 100644 tests/ui/traits/suggest-deferences/root-obligation.stderr delete mode 100644 tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed delete mode 100644 tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs delete mode 100644 tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr create mode 100644 tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs create mode 100644 tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr create mode 100644 tests/ui/traits/suggest-dereferences/issue-39029.fixed create mode 100644 tests/ui/traits/suggest-dereferences/issue-39029.rs create mode 100644 tests/ui/traits/suggest-dereferences/issue-39029.stderr create mode 100644 tests/ui/traits/suggest-dereferences/issue-62530.fixed create mode 100644 tests/ui/traits/suggest-dereferences/issue-62530.rs create mode 100644 tests/ui/traits/suggest-dereferences/issue-62530.stderr create mode 100644 tests/ui/traits/suggest-dereferences/multiple-0.fixed create mode 100644 tests/ui/traits/suggest-dereferences/multiple-0.rs create mode 100644 tests/ui/traits/suggest-dereferences/multiple-0.stderr create mode 100644 tests/ui/traits/suggest-dereferences/multiple-1.rs create mode 100644 tests/ui/traits/suggest-dereferences/multiple-1.stderr create mode 100644 tests/ui/traits/suggest-dereferences/root-obligation.fixed create mode 100644 tests/ui/traits/suggest-dereferences/root-obligation.rs create mode 100644 tests/ui/traits/suggest-dereferences/root-obligation.stderr create mode 100644 tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.fixed create mode 100644 tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.rs create mode 100644 tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr (limited to 'tests/ui/traits') diff --git a/tests/ui/traits/bad-method-typaram-kind.stderr b/tests/ui/traits/bad-method-typaram-kind.stderr index 56acfbe80..4c2d8e9f0 100644 --- a/tests/ui/traits/bad-method-typaram-kind.stderr +++ b/tests/ui/traits/bad-method-typaram-kind.stderr @@ -2,7 +2,9 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/bad-method-typaram-kind.rs:2:13 | LL | 1.bar::(); - | ^ `T` cannot be sent between threads safely + | --- ^ `T` cannot be sent between threads safely + | | + | required by a bound introduced by this call | note: required by a bound in `Bar::bar` --> $DIR/bad-method-typaram-kind.rs:6:14 diff --git a/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr b/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr index 61237a63e..530264b34 100644 --- a/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr +++ b/tests/ui/traits/bound/on-structs-and-enums-in-fns.stderr @@ -4,6 +4,11 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied LL | fn explode(x: Foo) {} | ^^^^^^^^ the trait `Trait` is not implemented for `u32` | +help: this trait has no implementations, consider adding one + --> $DIR/on-structs-and-enums-in-fns.rs:1:1 + | +LL | trait Trait {} + | ^^^^^^^^^^^ note: required by a bound in `Foo` --> $DIR/on-structs-and-enums-in-fns.rs:3:14 | @@ -16,6 +21,11 @@ error[E0277]: the trait bound `f32: Trait` is not satisfied LL | fn kaboom(y: Bar) {} | ^^^^^^^^ the trait `Trait` is not implemented for `f32` | +help: this trait has no implementations, consider adding one + --> $DIR/on-structs-and-enums-in-fns.rs:1:1 + | +LL | trait Trait {} + | ^^^^^^^^^^^ note: required by a bound in `Bar` --> $DIR/on-structs-and-enums-in-fns.rs:7:12 | diff --git a/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr b/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr index 8a4374226..372bbabbd 100644 --- a/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr +++ b/tests/ui/traits/bound/on-structs-and-enums-in-impls.stderr @@ -4,6 +4,11 @@ error[E0277]: the trait bound `u16: Trait` is not satisfied LL | impl PolyTrait> for Struct { | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u16` | +help: this trait has no implementations, consider adding one + --> $DIR/on-structs-and-enums-in-impls.rs:1:1 + | +LL | trait Trait {} + | ^^^^^^^^^^^ note: required by a bound in `Foo` --> $DIR/on-structs-and-enums-in-impls.rs:3:14 | diff --git a/tests/ui/traits/bound/on-structs-and-enums-locals.stderr b/tests/ui/traits/bound/on-structs-and-enums-locals.stderr index 20bbe69c0..01cf76c62 100644 --- a/tests/ui/traits/bound/on-structs-and-enums-locals.stderr +++ b/tests/ui/traits/bound/on-structs-and-enums-locals.stderr @@ -4,6 +4,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied LL | let baz: Foo = loop { }; | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` | +help: this trait has no implementations, consider adding one + --> $DIR/on-structs-and-enums-locals.rs:1:1 + | +LL | trait Trait { + | ^^^^^^^^^^^ note: required by a bound in `Foo` --> $DIR/on-structs-and-enums-locals.rs:5:14 | @@ -16,6 +21,11 @@ error[E0277]: the trait bound `{integer}: Trait` is not satisfied LL | x: 3 | ^ the trait `Trait` is not implemented for `{integer}` | +help: this trait has no implementations, consider adding one + --> $DIR/on-structs-and-enums-locals.rs:1:1 + | +LL | trait Trait { + | ^^^^^^^^^^^ note: required by a bound in `Foo` --> $DIR/on-structs-and-enums-locals.rs:5:14 | diff --git a/tests/ui/traits/bound/on-structs-and-enums-static.stderr b/tests/ui/traits/bound/on-structs-and-enums-static.stderr index fda734e85..fa14aff68 100644 --- a/tests/ui/traits/bound/on-structs-and-enums-static.stderr +++ b/tests/ui/traits/bound/on-structs-and-enums-static.stderr @@ -4,6 +4,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied LL | static X: Foo = Foo { | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` | +help: this trait has no implementations, consider adding one + --> $DIR/on-structs-and-enums-static.rs:1:1 + | +LL | trait Trait { + | ^^^^^^^^^^^ note: required by a bound in `Foo` --> $DIR/on-structs-and-enums-static.rs:5:14 | diff --git a/tests/ui/traits/bound/on-structs-and-enums.stderr b/tests/ui/traits/bound/on-structs-and-enums.stderr index fe05b8634..606f76485 100644 --- a/tests/ui/traits/bound/on-structs-and-enums.stderr +++ b/tests/ui/traits/bound/on-structs-and-enums.stderr @@ -20,6 +20,11 @@ error[E0277]: the trait bound `isize: Trait` is not satisfied LL | a: Foo, | ^^^^^^^^^^ the trait `Trait` is not implemented for `isize` | +help: this trait has no implementations, consider adding one + --> $DIR/on-structs-and-enums.rs:1:1 + | +LL | trait Trait {} + | ^^^^^^^^^^^ note: required by a bound in `Foo` --> $DIR/on-structs-and-enums.rs:3:14 | @@ -32,6 +37,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied LL | Quux(Bar), | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` | +help: this trait has no implementations, consider adding one + --> $DIR/on-structs-and-enums.rs:1:1 + | +LL | trait Trait {} + | ^^^^^^^^^^^ note: required by a bound in `Bar` --> $DIR/on-structs-and-enums.rs:7:12 | @@ -76,6 +86,11 @@ error[E0277]: the trait bound `i32: Trait` is not satisfied LL | Foo, | ^^^^^^^^ the trait `Trait` is not implemented for `i32` | +help: this trait has no implementations, consider adding one + --> $DIR/on-structs-and-enums.rs:1:1 + | +LL | trait Trait {} + | ^^^^^^^^^^^ note: required by a bound in `Foo` --> $DIR/on-structs-and-enums.rs:3:14 | @@ -88,6 +103,11 @@ error[E0277]: the trait bound `u8: Trait` is not satisfied LL | DictionaryLike { field: Bar }, | ^^^^^^^ the trait `Trait` is not implemented for `u8` | +help: this trait has no implementations, consider adding one + --> $DIR/on-structs-and-enums.rs:1:1 + | +LL | trait Trait {} + | ^^^^^^^^^^^ note: required by a bound in `Bar` --> $DIR/on-structs-and-enums.rs:7:12 | diff --git a/tests/ui/traits/deny-builtin-object-impl.current.stderr b/tests/ui/traits/deny-builtin-object-impl.current.stderr index 5c1987426..8ca3d3a05 100644 --- a/tests/ui/traits/deny-builtin-object-impl.current.stderr +++ b/tests/ui/traits/deny-builtin-object-impl.current.stderr @@ -4,6 +4,11 @@ error[E0277]: the trait bound `dyn NotObject: NotObject` is not satisfied LL | test_not_object::(); | ^^^^^^^^^^^^^ the trait `NotObject` is not implemented for `dyn NotObject` | +help: this trait has no implementations, consider adding one + --> $DIR/deny-builtin-object-impl.rs:10:1 + | +LL | trait NotObject {} + | ^^^^^^^^^^^^^^^ note: required by a bound in `test_not_object` --> $DIR/deny-builtin-object-impl.rs:14:23 | diff --git a/tests/ui/traits/deny-builtin-object-impl.next.stderr b/tests/ui/traits/deny-builtin-object-impl.next.stderr index 5c1987426..8ca3d3a05 100644 --- a/tests/ui/traits/deny-builtin-object-impl.next.stderr +++ b/tests/ui/traits/deny-builtin-object-impl.next.stderr @@ -4,6 +4,11 @@ error[E0277]: the trait bound `dyn NotObject: NotObject` is not satisfied LL | test_not_object::(); | ^^^^^^^^^^^^^ the trait `NotObject` is not implemented for `dyn NotObject` | +help: this trait has no implementations, consider adding one + --> $DIR/deny-builtin-object-impl.rs:10:1 + | +LL | trait NotObject {} + | ^^^^^^^^^^^^^^^ note: required by a bound in `test_not_object` --> $DIR/deny-builtin-object-impl.rs:14:23 | diff --git a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr index 934d20b22..a5d0e6ab0 100644 --- a/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr +++ b/tests/ui/traits/dont-autoderef-ty-with-escaping-var.stderr @@ -5,13 +5,16 @@ LL | >::ref_foo(unknown); | ^^^^^^^ not found in this scope error[E0277]: the trait bound `for<'a> &'a mut Vec<&'a u32>: Foo<'static, i32>` is not satisfied - --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:35 + --> $DIR/dont-autoderef-ty-with-escaping-var.rs:17:6 | LL | >::ref_foo(unknown); - | ----------------------------- ^^^^^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>` - | | - | required by a bound introduced by this call + | ^^^ the trait `for<'a> Foo<'static, i32>` is not implemented for `&'a mut Vec<&'a u32>` + | +help: this trait has no implementations, consider adding one + --> $DIR/dont-autoderef-ty-with-escaping-var.rs:3:1 | +LL | trait Foo<'x, T> {} + | ^^^^^^^^^^^^^^^^ note: required for `i32` to implement `RefFoo` --> $DIR/dont-autoderef-ty-with-escaping-var.rs:9:9 | diff --git a/tests/ui/traits/impl-bounds-checking.stderr b/tests/ui/traits/impl-bounds-checking.stderr index 1f969efe1..bfa8213ab 100644 --- a/tests/ui/traits/impl-bounds-checking.stderr +++ b/tests/ui/traits/impl-bounds-checking.stderr @@ -4,6 +4,11 @@ error[E0277]: the trait bound `isize: Clone2` is not satisfied LL | impl Getter for isize { | ^^^^^ the trait `Clone2` is not implemented for `isize` | +help: this trait has no implementations, consider adding one + --> $DIR/impl-bounds-checking.rs:1:1 + | +LL | pub trait Clone2 { + | ^^^^^^^^^^^^^^^^ note: required by a bound in `Getter` --> $DIR/impl-bounds-checking.rs:6:17 | diff --git a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr index 656e0d0bf..7027fa69e 100644 --- a/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr +++ b/tests/ui/traits/inheritance/repeated-supertrait-ambig.stderr @@ -24,12 +24,10 @@ LL | fn with_trait>(c: &C) -> bool { | ++++++++++++++++ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied - --> $DIR/repeated-supertrait-ambig.rs:34:37 + --> $DIR/repeated-supertrait-ambig.rs:34:6 | LL | ::same_as(c, 22) - | ---------------------------- ^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` | = help: the following other types implement trait `CompareTo`: > diff --git a/tests/ui/traits/issue-105231.rs b/tests/ui/traits/issue-105231.rs index bb2b13664..74c7afd6b 100644 --- a/tests/ui/traits/issue-105231.rs +++ b/tests/ui/traits/issue-105231.rs @@ -1,9 +1,9 @@ +//~ ERROR overflow evaluating the requirement `A>>>>>>: Send` struct A(B); //~^ ERROR recursive types `A` and `B` have infinite size struct B(A>); trait Foo {} impl Foo for T where T: Send {} -//~^ ERROR overflow evaluating the requirement `A>>>>>>: Send` impl Foo for B {} fn main() {} diff --git a/tests/ui/traits/issue-105231.stderr b/tests/ui/traits/issue-105231.stderr index 76a710673..fe20c47c5 100644 --- a/tests/ui/traits/issue-105231.stderr +++ b/tests/ui/traits/issue-105231.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive types `A` and `B` have infinite size - --> $DIR/issue-105231.rs:1:1 + --> $DIR/issue-105231.rs:2:1 | LL | struct A(B); | ^^^^^^^^^^^ ---- recursive without indirection @@ -15,14 +15,10 @@ LL ~ struct B(Box>>); | error[E0275]: overflow evaluating the requirement `A>>>>>>: Send` - --> $DIR/issue-105231.rs:5:28 - | -LL | impl Foo for T where T: Send {} - | ^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`) note: required because it appears within the type `B>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-105231.rs:3:8 + --> $DIR/issue-105231.rs:4:8 | LL | struct B(A>); | ^ diff --git a/tests/ui/traits/issue-66768.rs b/tests/ui/traits/issue-66768.rs new file mode 100644 index 000000000..ce42c8b01 --- /dev/null +++ b/tests/ui/traits/issue-66768.rs @@ -0,0 +1,205 @@ +// Regression test for #66768. +// check-pass +#![allow(dead_code)] +//-^ "dead code" is needed to reproduce the issue. + +use std::marker::PhantomData; +use std::ops::{Add, Mul}; + +fn problematic_function(material_surface_element: Edge2dElement) +where + DefaultAllocator: FiniteElementAllocator, +{ + let _: Point2 = material_surface_element.map_reference_coords().into(); +} + +impl ArrayLength for UTerm { + type ArrayType = (); +} +impl> ArrayLength for UInt { + type ArrayType = GenericArrayImplEven; +} +impl> ArrayLength for UInt { + type ArrayType = GenericArrayImplOdd; +} +impl Add for UTerm { + type Output = U; + fn add(self, _: U) -> Self::Output { + unimplemented!() + } +} +impl Add> for UInt +where + Ul: Add, +{ + type Output = UInt, B1>; + fn add(self, _: UInt) -> Self::Output { + unimplemented!() + } +} +impl Mul for UTerm { + type Output = UTerm; + fn mul(self, _: U) -> Self { + unimplemented!() + } +} +impl Mul> for UInt +where + Ul: Mul>, +{ + type Output = UInt>, B0>; + fn mul(self, _: UInt) -> Self::Output { + unimplemented!() + } +} +impl Mul> for UInt +where + Ul: Mul>, + UInt>, B0>: Add>, +{ + type Output = Sum>, B0>, UInt>; + fn mul(self, _: UInt) -> Self::Output { + unimplemented!() + } +} +impl Allocator for DefaultAllocator +where + R: DimName, + C: DimName, + R::Value: Mul, + Prod: ArrayLength, +{ + type Buffer = ArrayStorage; + fn allocate_uninitialized(_: R, _: C) -> Self::Buffer { + unimplemented!() + } + fn allocate_from_iterator(_: R, _: C, _: I) -> Self::Buffer { + unimplemented!() + } +} +impl Allocator for DefaultAllocator { + type Buffer = VecStorage; + fn allocate_uninitialized(_: Dynamic, _: C) -> Self::Buffer { + unimplemented!() + } + fn allocate_from_iterator(_: Dynamic, _: C, _: I) -> Self::Buffer { + unimplemented!() + } +} +impl DimName for DimU1 { + type Value = U1; + fn name() -> Self { + unimplemented!() + } +} +impl DimName for DimU2 { + type Value = U2; + fn name() -> Self { + unimplemented!() + } +} +impl From> for Point +where + DefaultAllocator: Allocator, +{ + fn from(_: VectorN) -> Self { + unimplemented!() + } +} +impl FiniteElementAllocator for DefaultAllocator where + DefaultAllocator: Allocator + Allocator +{ +} +impl ReferenceFiniteElement for Edge2dElement { + type NodalDim = DimU1; +} +impl FiniteElement for Edge2dElement { + fn map_reference_coords(&self) -> Vector2 { + unimplemented!() + } +} + +type Owned = >::Buffer; +type MatrixMN = Matrix>; +type VectorN = MatrixMN; +type Vector2 = VectorN; +type Point2 = Point; +type U1 = UInt; +type U2 = UInt, B0>; +type Sum = >::Output; +type Prod = >::Output; + +struct GenericArray> { + _data: U::ArrayType, +} +struct GenericArrayImplEven { + _parent2: U, + _marker: T, +} +struct GenericArrayImplOdd { + _parent2: U, + _data: T, +} +struct B0; +struct B1; +struct UTerm; +struct UInt { + _marker: PhantomData<(U, B)>, +} +struct DefaultAllocator; +struct Dynamic; +struct DimU1; +struct DimU2; +struct Matrix { + _data: S, + _phantoms: PhantomData<(N, R, C)>, +} +struct ArrayStorage +where + R: DimName, + C: DimName, + R::Value: Mul, + Prod: ArrayLength, +{ + _data: GenericArray>, +} +struct VecStorage { + _data: N, + _nrows: R, + _ncols: C, +} +struct Point +where + DefaultAllocator: Allocator, +{ + _coords: VectorN, +} +struct Edge2dElement; + +trait ArrayLength { + type ArrayType; +} +trait Allocator { + type Buffer; + fn allocate_uninitialized(nrows: R, ncols: C) -> Self::Buffer; + fn allocate_from_iterator(nrows: R, ncols: C, iter: I) -> Self::Buffer; +} +trait DimName { + type Value; + fn name() -> Self; +} +trait FiniteElementAllocator: + Allocator + Allocator +{ +} +trait ReferenceFiniteElement { + type NodalDim; +} +trait FiniteElement: ReferenceFiniteElement +where + DefaultAllocator: FiniteElementAllocator, +{ + fn map_reference_coords(&self) -> VectorN; +} + +fn main() {} diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr index d4fea05fe..33cc186ac 100644 --- a/tests/ui/traits/issue-77982.stderr +++ b/tests/ui/traits/issue-77982.stderr @@ -35,23 +35,12 @@ help: consider specifying the generic argument LL | opts.get::(opt.as_ref()); | +++++ -error[E0283]: type annotations needed +error[E0282]: type annotations needed --> $DIR/issue-77982.rs:13:59 | LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); - | --------- ^^^^ - | | - | required by a bound introduced by this call - | - = note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate: - - impl From for u32; - - impl From for u32; - - impl From for u32; - - impl From for u32; - - impl From for u32; - - impl From for u32; - - impl From for T; - - impl From for T; + | ^^^^ + | help: try using a fully qualified path to specify the expected types | LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(>::into(0u32))).collect(); @@ -95,4 +84,5 @@ LL | let _: Box = (&()).bar(); error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0283`. +Some errors have detailed explanations: E0282, E0283. +For more information about an error, try `rustc --explain E0282`. diff --git a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr index c6fc7bb12..4593fa2c4 100644 --- a/tests/ui/traits/issue-91949-hangs-on-recursion.stderr +++ b/tests/ui/traits/issue-91949-hangs-on-recursion.stderr @@ -23,7 +23,7 @@ LL | impl> Iterator for IteratorOfWrapped { | | | unsatisfied trait bound introduced here = note: 256 redundant requirements hidden - = note: required for `IteratorOfWrapped<(), Map>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>, [closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48]>>` to implement `Iterator` + = note: required for `IteratorOfWrapped<(), Map>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>, {closure@$DIR/issue-91949-hangs-on-recursion.rs:28:45: 28:48}>>` to implement `Iterator` error: aborting due to previous error; 1 warning emitted diff --git a/tests/ui/traits/issue-99875.stderr b/tests/ui/traits/issue-99875.stderr index fb6eebbd2..29e875715 100644 --- a/tests/ui/traits/issue-99875.stderr +++ b/tests/ui/traits/issue-99875.stderr @@ -16,11 +16,11 @@ help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return`, LL | takes(function as fn(Argument) -> Return); | +++++++++++++++++++++++++ -error[E0277]: the trait bound `[closure@$DIR/issue-99875.rs:14:11: 14:34]: Trait` is not satisfied +error[E0277]: the trait bound `{closure@$DIR/issue-99875.rs:14:11: 14:34}: Trait` is not satisfied --> $DIR/issue-99875.rs:14:11 | LL | takes(|_: Argument| -> Return { todo!() }); - | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `[closure@$DIR/issue-99875.rs:14:11: 14:34]` + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `{closure@$DIR/issue-99875.rs:14:11: 14:34}` | | | required by a bound introduced by this call | diff --git a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr index 8eda64e44..46677a583 100644 --- a/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr +++ b/tests/ui/traits/new-solver/alias_eq_substs_eq_not_intercrate.stderr @@ -5,6 +5,8 @@ LL | impl Overlaps> for ::Assoc {} | --------------------------------------------------------- first implementation here LL | impl Overlaps for ::Assoc {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as TraitB>::Assoc` + | + = note: downstream crates may implement trait `TraitB` for type `std::boxed::Box<_>` error: aborting due to previous error diff --git a/tests/ui/traits/new-solver/async.fail.stderr b/tests/ui/traits/new-solver/async.fail.stderr index 72fa2eb31..44097b556 100644 --- a/tests/ui/traits/new-solver/async.fail.stderr +++ b/tests/ui/traits/new-solver/async.fail.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving `<[async block@$DIR/async.rs:12:17: 12:25] as Future>::Output == i32` +error[E0271]: type mismatch resolving `<{async block@$DIR/async.rs:12:17: 12:25} as Future>::Output == i32` --> $DIR/async.rs:12:17 | LL | needs_async(async {}); diff --git a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs index e311a4af2..6b54718e3 100644 --- a/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs +++ b/tests/ui/traits/new-solver/auto-with-drop_tracking_mir.rs @@ -1,4 +1,4 @@ -// compile-flags: -Ztrait-solver=next -Zdrop-tracking-mir +// compile-flags: -Ztrait-solver=next // edition: 2021 // revisions: pass fail //[pass] check-pass diff --git a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr index f7551739b..4eaa25961 100644 --- a/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr +++ b/tests/ui/traits/new-solver/builtin-fn-must-return-sized.stderr @@ -1,10 +1,8 @@ error[E0277]: expected a `Fn<_>` closure, found `fn() -> str` - --> $DIR/builtin-fn-must-return-sized.rs:15:27 + --> $DIR/builtin-fn-must-return-sized.rs:15:11 | LL | foo:: str, _>(None, ()); - | --------------------- ^^^^ expected an `Fn<_>` closure, found `fn() -> str` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^ expected an `Fn<_>` closure, found `fn() -> str` | = help: the trait `Fn<_>` is not implemented for `fn() -> str` note: required by a bound in `foo` diff --git a/tests/ui/traits/new-solver/canonicalize-effect-var.rs b/tests/ui/traits/new-solver/canonicalize-effect-var.rs new file mode 100644 index 000000000..35b69ed1a --- /dev/null +++ b/tests/ui/traits/new-solver/canonicalize-effect-var.rs @@ -0,0 +1,22 @@ +// compile-flags: -Ztrait-solver=next +// check-pass + +#![feature(effects)] +#![feature(const_trait_impl)] + +#[const_trait] +trait Foo { + fn foo(); +} + +trait Bar {} + +impl const Foo for i32 { + fn foo() {} +} + +impl const Foo for T where T: Bar { + fn foo() {} +} + +fn main() {} diff --git a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr index 5d5f325e4..73d46c4df 100644 --- a/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr +++ b/tests/ui/traits/new-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr @@ -1,3 +1,7 @@ +WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <::Assoc as std::marker::Sized> +WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <::Assoc as std::marker::Sized> +WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <::Assoc as std::marker::Sized> +WARN rustc_trait_selection::traits::coherence expected an unknowable trait ref: <::Assoc as std::marker::Sized> error[E0119]: conflicting implementations of trait `Trait` for type `::Assoc` --> $DIR/trait_ref_is_knowable-norm-overflow.rs:17:1 | @@ -6,6 +10,8 @@ LL | impl Trait for T {} LL | struct LocalTy; LL | impl Trait for ::Assoc {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `::Assoc` + | + = note: upstream crates may add a new impl of trait `std::marker::Copy` for type `::Assoc` in future versions error: aborting due to previous error diff --git a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr index 7d3535e1f..a86115671 100644 --- a/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr +++ b/tests/ui/traits/new-solver/cycles/coinduction/fixpoint-exponential-growth.stderr @@ -5,10 +5,10 @@ LL | impls::>(); | ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls` error[E0275]: overflow evaluating the requirement `W<_>: Trait` - --> $DIR/fixpoint-exponential-growth.rs:29:5 + --> $DIR/fixpoint-exponential-growth.rs:29:13 | LL | impls::>(); - | ^^^^^^^^^^^^^ + | ^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`fixpoint_exponential_growth`) note: required by a bound in `impls` diff --git a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr index 4b8846da5..a3404da51 100644 --- a/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr +++ b/tests/ui/traits/new-solver/cycles/double-cycle-inductive-coinductive.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `(): Trait` - --> $DIR/double-cycle-inductive-coinductive.rs:32:5 + --> $DIR/double-cycle-inductive-coinductive.rs:32:19 | LL | impls_trait::<()>(); - | ^^^^^^^^^^^^^^^^^ + | ^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`) note: required by a bound in `impls_trait` @@ -12,10 +12,10 @@ LL | fn impls_trait() {} | ^^^^^ required by this bound in `impls_trait` error[E0275]: overflow evaluating the requirement `(): TraitRev` - --> $DIR/double-cycle-inductive-coinductive.rs:35:5 + --> $DIR/double-cycle-inductive-coinductive.rs:35:23 | LL | impls_trait_rev::<()>(); - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`double_cycle_inductive_coinductive`) note: required by a bound in `impls_trait_rev` diff --git a/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs new file mode 100644 index 000000000..279063923 --- /dev/null +++ b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.rs @@ -0,0 +1,53 @@ +// compile-flags: -Ztrait-solver=next +#![feature(rustc_attrs)] + +// Check that we correctly rerun the trait solver for heads of cycles, +// even if they are not the root. + +struct A(*const T); +struct B(*const T); +struct C(*const T); + +#[rustc_coinductive] +trait Trait<'a, 'b> {} +trait NotImplemented {} + +impl<'a, 'b, T: ?Sized> Trait<'a, 'b> for A where B: Trait<'a, 'b> {} + +// With this the root of `B` is `A`, even if the other impl does +// not have a cycle with `A`. This candidate never applies because of +// the `A: NotImplemented` bound. +impl<'a, 'b, T: ?Sized> Trait<'a, 'b> for B +where + A: Trait<'a, 'b>, + A: NotImplemented, +{ +} + +// This impl directly requires 'b to be equal to 'static. +// +// Because of the coinductive cycle through `C` it also requires +// 'a to be 'static. +impl<'a, T: ?Sized> Trait<'a, 'static> for B +where + C: Trait<'a, 'a>, +{} + +// In the first iteration of `B: Trait<'a, 'b>` we don't add any +// constraints here, only after setting the provisional result to require +// `'b == 'static` do we also add that constraint for `'a`. +impl<'a, 'b, T: ?Sized> Trait<'a, 'b> for C +where + B: Trait<'a, 'b>, +{} + +fn impls_trait<'a, 'b, T: Trait<'a, 'b> + ?Sized>() {} + +fn check<'a, T: ?Sized>() { + impls_trait::<'a, 'static, A>(); + //~^ ERROR lifetime may not live long enough +} + +fn main() { + check::<()>(); +} diff --git a/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr new file mode 100644 index 000000000..4cbd08981 --- /dev/null +++ b/tests/ui/traits/new-solver/cycles/fixpoint-rerun-all-cycle-heads.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/fixpoint-rerun-all-cycle-heads.rs:47:5 + | +LL | fn check<'a, T: ?Sized>() { + | -- lifetime `'a` defined here +LL | impls_trait::<'a, 'static, A>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs index 3cfe7ab87..f06b98a79 100644 --- a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs +++ b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs @@ -39,7 +39,7 @@ fn impls_ar() {} fn main() { impls_a::<()>(); - // FIXME(-Ztrait-solver=next): This is broken and should error. + //~^ ERROR overflow evaluating the requirement `(): A` impls_ar::<()>(); //~^ ERROR overflow evaluating the requirement `(): AR` diff --git a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr index 0e1c86c1b..859b3f3f1 100644 --- a/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr +++ b/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.stderr @@ -1,8 +1,21 @@ +error[E0275]: overflow evaluating the requirement `(): A` + --> $DIR/inductive-not-on-stack.rs:41:15 + | +LL | impls_a::<()>(); + | ^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`) +note: required by a bound in `impls_a` + --> $DIR/inductive-not-on-stack.rs:25:15 + | +LL | fn impls_a() {} + | ^ required by this bound in `impls_a` + error[E0275]: overflow evaluating the requirement `(): AR` - --> $DIR/inductive-not-on-stack.rs:44:5 + --> $DIR/inductive-not-on-stack.rs:44:16 | LL | impls_ar::<()>(); - | ^^^^^^^^^^^^^^ + | ^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`inductive_not_on_stack`) note: required by a bound in `impls_ar` @@ -11,6 +24,6 @@ note: required by a bound in `impls_ar` LL | fn impls_ar() {} | ^^ required by this bound in `impls_ar` -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs new file mode 100644 index 000000000..b9798c79d --- /dev/null +++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.rs @@ -0,0 +1,19 @@ +// compile-flags: -Ztrait-solver=next-coherence + +// Makes sure we don't ICE on associated const projection when the feature gate +// is not enabled, since we should avoid encountering ICEs on stable if possible. + +trait Bar { + const ASSOC: usize; +} +impl Bar for () { + const ASSOC: usize = 1; +} + +trait Foo {} +impl Foo for () {} +impl Foo for T where T: Bar {} +//~^ ERROR associated const equality is incomplete +//~| ERROR conflicting implementations of trait `Foo` for type `()` + +fn main() {} diff --git a/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr new file mode 100644 index 000000000..7ad495a35 --- /dev/null +++ b/tests/ui/traits/new-solver/dont-ice-on-assoc-projection.stderr @@ -0,0 +1,21 @@ +error[E0658]: associated const equality is incomplete + --> $DIR/dont-ice-on-assoc-projection.rs:15:32 + | +LL | impl Foo for T where T: Bar {} + | ^^^^^^^^^ + | + = note: see issue #92827 for more information + = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable + +error[E0119]: conflicting implementations of trait `Foo` for type `()` + --> $DIR/dont-ice-on-assoc-projection.rs:15:1 + | +LL | impl Foo for () {} + | --------------- first implementation here +LL | impl Foo for T where T: Bar {} + | ^^^^^^^^^^^^^^^^^ conflicting implementation for `()` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0119, E0658. +For more information about an error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr index ec1c3231a..a31bfd958 100644 --- a/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr +++ b/tests/ui/traits/new-solver/dont-type_of-tait-in-defining-scope.not_send.stderr @@ -1,8 +1,8 @@ error[E0283]: type annotations needed: cannot satisfy `Foo: Send` - --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:5 + --> $DIR/dont-type_of-tait-in-defining-scope.rs:16:18 | LL | needs_send::(); - | ^^^^^^^^^^^^^^^^^ + | ^^^ | = note: cannot satisfy `Foo: Send` note: required by a bound in `needs_send` diff --git a/tests/ui/traits/new-solver/generator.fail.stderr b/tests/ui/traits/new-solver/generator.fail.stderr index d94d41e35..e3fe4bf5a 100644 --- a/tests/ui/traits/new-solver/generator.fail.stderr +++ b/tests/ui/traits/new-solver/generator.fail.stderr @@ -1,4 +1,4 @@ -error[E0277]: the trait bound `[generator@$DIR/generator.rs:18:21: 18:23]: Generator` is not satisfied +error[E0277]: the trait bound `{generator@$DIR/generator.rs:18:21: 18:23}: Generator` is not satisfied --> $DIR/generator.rs:18:21 | LL | needs_generator(|| { @@ -10,7 +10,7 @@ LL | | LL | | LL | | yield (); LL | | }); - | |_____^ the trait `Generator` is not implemented for `[generator@$DIR/generator.rs:18:21: 18:23]` + | |_____^ the trait `Generator` is not implemented for `{generator@$DIR/generator.rs:18:21: 18:23}` | note: required by a bound in `needs_generator` --> $DIR/generator.rs:14:28 @@ -18,7 +18,7 @@ note: required by a bound in `needs_generator` LL | fn needs_generator(_: impl Generator) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_generator` -error[E0271]: type mismatch resolving `<[generator@$DIR/generator.rs:18:21: 18:23] as Generator>::Yield == B` +error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Generator>::Yield == B` --> $DIR/generator.rs:18:21 | LL | needs_generator(|| { @@ -38,7 +38,7 @@ note: required by a bound in `needs_generator` LL | fn needs_generator(_: impl Generator) {} | ^^^^^^^^^ required by this bound in `needs_generator` -error[E0271]: type mismatch resolving `<[generator@$DIR/generator.rs:18:21: 18:23] as Generator>::Return == C` +error[E0271]: type mismatch resolving `<{generator@$DIR/generator.rs:18:21: 18:23} as Generator>::Return == C` --> $DIR/generator.rs:18:21 | LL | needs_generator(|| { diff --git a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr index 28a99cbbc..beed40f36 100644 --- a/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr +++ b/tests/ui/traits/new-solver/overflow/exponential-trait-goals.stderr @@ -5,10 +5,10 @@ LL | impls::>(); | ^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the function `impls` error[E0275]: overflow evaluating the requirement `W<_>: Trait` - --> $DIR/exponential-trait-goals.rs:17:5 + --> $DIR/exponential-trait-goals.rs:17:13 | LL | impls::>(); - | ^^^^^^^^^^^^^ + | ^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`exponential_trait_goals`) note: required by a bound in `impls` diff --git a/tests/ui/traits/new-solver/overflow/global-cache.stderr b/tests/ui/traits/new-solver/overflow/global-cache.stderr index f3b86a083..ebb03d84b 100644 --- a/tests/ui/traits/new-solver/overflow/global-cache.stderr +++ b/tests/ui/traits/new-solver/overflow/global-cache.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `Inc>>>>>>: Trait` - --> $DIR/global-cache.rs:21:5 + --> $DIR/global-cache.rs:21:19 | LL | impls_trait::>>>>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "18"]` attribute to your crate (`global_cache`) note: required by a bound in `impls_trait` diff --git a/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs new file mode 100644 index 000000000..539c9614e --- /dev/null +++ b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.rs @@ -0,0 +1,12 @@ +//~ ERROR overflow evaluating the requirement `Self well-formed` +//~| ERROR overflow evaluating the requirement `Self: Trait` + +// This is a non-regression test for issue #115351, where a recursion limit of 0 caused an ICE. +// compile-flags: -Ztrait-solver=next --crate-type=lib +// check-fail + +#![recursion_limit = "0"] +trait Trait {} +impl Trait for u32 {} +//~^ ERROR overflow evaluating the requirement `u32: Trait` +//~| ERROR overflow evaluating the requirement `u32 well-formed` diff --git a/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr new file mode 100644 index 000000000..16b25d90a --- /dev/null +++ b/tests/ui/traits/new-solver/overflow/recursion-limit-zero-issue-115351.stderr @@ -0,0 +1,27 @@ +error[E0275]: overflow evaluating the requirement `Self: Trait` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`) + +error[E0275]: overflow evaluating the requirement `Self well-formed` + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`) + +error[E0275]: overflow evaluating the requirement `u32: Trait` + --> $DIR/recursion-limit-zero-issue-115351.rs:10:16 + | +LL | impl Trait for u32 {} + | ^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`) + +error[E0275]: overflow evaluating the requirement `u32 well-formed` + --> $DIR/recursion-limit-zero-issue-115351.rs:10:16 + | +LL | impl Trait for u32 {} + | ^^^ + | + = help: consider increasing the recursion limit by adding a `#![recursion_limit = "2"]` attribute to your crate (`recursion_limit_zero_issue_115351`) + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0275`. diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr index eebaf21d7..1dc63fae9 100644 --- a/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr +++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization-2.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `::Assoc1: Bar` - --> $DIR/recursive-self-normalization-2.rs:16:5 + --> $DIR/recursive-self-normalization-2.rs:16:17 | LL | needs_bar::(); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization_2`) note: required by a bound in `needs_bar` diff --git a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr index 6a87fe2f1..afc5bfa54 100644 --- a/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr +++ b/tests/ui/traits/new-solver/overflow/recursive-self-normalization.stderr @@ -1,8 +1,8 @@ error[E0275]: overflow evaluating the requirement `::Assoc: Bar` - --> $DIR/recursive-self-normalization.rs:12:5 + --> $DIR/recursive-self-normalization.rs:12:17 | LL | needs_bar::(); - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`recursive_self_normalization`) note: required by a bound in `needs_bar` diff --git a/tests/ui/traits/new-solver/projection-discr-kind.stderr b/tests/ui/traits/new-solver/projection-discr-kind.stderr index 03e28f993..e14953f19 100644 --- a/tests/ui/traits/new-solver/projection-discr-kind.stderr +++ b/tests/ui/traits/new-solver/projection-discr-kind.stderr @@ -6,6 +6,11 @@ LL | needs_bar(std::mem::discriminant(&x)); | | | required by a bound introduced by this call | +help: this trait has no implementations, consider adding one + --> $DIR/projection-discr-kind.rs:10:1 + | +LL | trait Bar {} + | ^^^^^^^^^ note: required by a bound in `needs_bar` --> $DIR/projection-discr-kind.rs:11:22 | diff --git a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr index 83a0452b0..b311ac6b5 100644 --- a/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr +++ b/tests/ui/traits/new-solver/two-projection-param-candidates-are-ambiguous.stderr @@ -1,8 +1,8 @@ error[E0283]: type annotations needed: cannot satisfy `T: Bar` - --> $DIR/two-projection-param-candidates-are-ambiguous.rs:26:5 + --> $DIR/two-projection-param-candidates-are-ambiguous.rs:26:17 | LL | needs_bar::(); - | ^^^^^^^^^^^^^^ + | ^ | = note: cannot satisfy `T: Bar` = help: the trait `Bar` is implemented for `T` diff --git a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs index 91c6dfb8e..bbae67f0b 100644 --- a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs +++ b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.rs @@ -4,7 +4,7 @@ fn b() where for [(); C]: Copy, - //~^ ERROR cannot capture late-bound const parameter in a constant + //~^ ERROR cannot capture late-bound const parameter in constant { } diff --git a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr index 69bb605bf..d65892ec6 100644 --- a/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr +++ b/tests/ui/traits/non_lifetime_binders/capture-late-ct-in-anon.stderr @@ -7,7 +7,7 @@ LL | #![feature(non_lifetime_binders)] = note: see issue #108185 for more information = note: `#[warn(incomplete_features)]` on by default -error: cannot capture late-bound const parameter in a constant +error: cannot capture late-bound const parameter in constant --> $DIR/capture-late-ct-in-anon.rs:6:30 | LL | for [(); C]: Copy, diff --git a/tests/ui/traits/non_lifetime_binders/fail.stderr b/tests/ui/traits/non_lifetime_binders/fail.stderr index 7bd02550f..240bcef7d 100644 --- a/tests/ui/traits/non_lifetime_binders/fail.stderr +++ b/tests/ui/traits/non_lifetime_binders/fail.stderr @@ -13,6 +13,11 @@ error[E0277]: the trait bound `T: Trait` is not satisfied LL | fail(); | ^^^^ the trait `Trait` is not implemented for `T` | +help: this trait has no implementations, consider adding one + --> $DIR/fail.rs:6:1 + | +LL | trait Trait {} + | ^^^^^^^^^^^ note: required by a bound in `fail` --> $DIR/fail.rs:10:15 | diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs index 3903bfe9b..64f09f823 100644 --- a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs +++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs @@ -5,7 +5,7 @@ fn foo() -> usize where for [i32; { let _: T = todo!(); 0 }]:, - //~^ ERROR cannot capture late-bound type parameter in a constant + //~^ ERROR cannot capture late-bound type parameter in constant {} fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr index fafff02de..dc54e1acc 100644 --- a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr +++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr @@ -15,7 +15,7 @@ LL | #![feature(non_lifetime_binders, generic_const_exprs)] | = note: see issue #76560 for more information -error: cannot capture late-bound type parameter in a constant +error: cannot capture late-bound type parameter in constant --> $DIR/late-bound-in-anon-ct.rs:7:27 | LL | for [i32; { let _: T = todo!(); 0 }]:, diff --git a/tests/ui/traits/object-does-not-impl-trait.stderr b/tests/ui/traits/object-does-not-impl-trait.stderr index f1dd508a4..81d67255a 100644 --- a/tests/ui/traits/object-does-not-impl-trait.stderr +++ b/tests/ui/traits/object-does-not-impl-trait.stderr @@ -6,6 +6,11 @@ LL | fn take_object(f: Box) { take_foo(f); } | | | required by a bound introduced by this call | +help: this trait has no implementations, consider adding one + --> $DIR/object-does-not-impl-trait.rs:4:1 + | +LL | trait Foo {} + | ^^^^^^^^^ note: required by a bound in `take_foo` --> $DIR/object-does-not-impl-trait.rs:5:15 | diff --git a/tests/ui/traits/object/enforce-supertrait-projection.rs b/tests/ui/traits/object/enforce-supertrait-projection.rs index 2c9b41eea..0ea944ec2 100644 --- a/tests/ui/traits/object/enforce-supertrait-projection.rs +++ b/tests/ui/traits/object/enforce-supertrait-projection.rs @@ -7,7 +7,7 @@ trait Trait: SuperTrait::B> {} fn transmute(x: A) -> B { foo::>(x) - //~^ ERROR type mismatch resolving ` as SuperTrait>::A == B` + //~^ ERROR type mismatch resolving ` as SuperTrait>::A == B` } fn foo(x: T::A) -> B diff --git a/tests/ui/traits/object/enforce-supertrait-projection.stderr b/tests/ui/traits/object/enforce-supertrait-projection.stderr index 848b4e69a..2fb94d348 100644 --- a/tests/ui/traits/object/enforce-supertrait-projection.stderr +++ b/tests/ui/traits/object/enforce-supertrait-projection.stderr @@ -1,4 +1,4 @@ -error[E0271]: type mismatch resolving ` as SuperTrait>::A == B` +error[E0271]: type mismatch resolving ` as SuperTrait>::A == B` --> $DIR/enforce-supertrait-projection.rs:9:17 | LL | fn transmute(x: A) -> B { diff --git a/tests/ui/traits/reservation-impl/no-use.next.stderr b/tests/ui/traits/reservation-impl/no-use.next.stderr index 542e3a28a..632f0f816 100644 --- a/tests/ui/traits/reservation-impl/no-use.next.stderr +++ b/tests/ui/traits/reservation-impl/no-use.next.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `(): MyTrait` is not satisfied - --> $DIR/no-use.rs:11:26 + --> $DIR/no-use.rs:11:6 | LL | <() as MyTrait>::foo(&()); - | -------------------- ^^^ the trait `MyTrait` is not implemented for `()` - | | - | required by a bound introduced by this call + | ^^ the trait `MyTrait` is not implemented for `()` | = help: the trait `MyTrait` is implemented for `()` diff --git a/tests/ui/traits/reservation-impl/no-use.old.stderr b/tests/ui/traits/reservation-impl/no-use.old.stderr index 542e3a28a..632f0f816 100644 --- a/tests/ui/traits/reservation-impl/no-use.old.stderr +++ b/tests/ui/traits/reservation-impl/no-use.old.stderr @@ -1,10 +1,8 @@ error[E0277]: the trait bound `(): MyTrait` is not satisfied - --> $DIR/no-use.rs:11:26 + --> $DIR/no-use.rs:11:6 | LL | <() as MyTrait>::foo(&()); - | -------------------- ^^^ the trait `MyTrait` is not implemented for `()` - | | - | required by a bound introduced by this call + | ^^ the trait `MyTrait` is not implemented for `()` | = help: the trait `MyTrait` is implemented for `()` diff --git a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs index 206ab0789..d37943b92 100644 --- a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs +++ b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs @@ -1,3 +1,4 @@ +//~ ERROR overflow // A regression test for #111729 checking that we correctly // track recursion depth for obligations returned by confirmation. use std::panic::RefUnwindSafe; @@ -14,7 +15,6 @@ struct RootDatabase { } impl Database for T { - //~^ ERROR overflow type Storage = SalsaStorage; } impl Database for RootDatabase { diff --git a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr index 4123a8199..8f9ce3ef1 100644 --- a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr +++ b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr @@ -1,17 +1,13 @@ error[E0275]: overflow evaluating the requirement `Runtime: RefUnwindSafe` - --> $DIR/cycle-via-builtin-auto-trait-impl.rs:16:9 - | -LL | impl Database for T { - | ^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`cycle_via_builtin_auto_trait_impl`) note: required because it appears within the type `RootDatabase` - --> $DIR/cycle-via-builtin-auto-trait-impl.rs:12:8 + --> $DIR/cycle-via-builtin-auto-trait-impl.rs:13:8 | LL | struct RootDatabase { | ^^^^^^^^^^^^ note: required for `RootDatabase` to implement `Database` - --> $DIR/cycle-via-builtin-auto-trait-impl.rs:16:24 + --> $DIR/cycle-via-builtin-auto-trait-impl.rs:17:24 | LL | impl Database for T { | ------------- ^^^^^^^^ ^ diff --git a/tests/ui/traits/suggest-deferences/issue-39029.fixed b/tests/ui/traits/suggest-deferences/issue-39029.fixed deleted file mode 100644 index a1abf668b..000000000 --- a/tests/ui/traits/suggest-deferences/issue-39029.fixed +++ /dev/null @@ -1,18 +0,0 @@ -// run-rustfix -use std::net::TcpListener; - -struct NoToSocketAddrs(String); - -impl std::ops::Deref for NoToSocketAddrs { - type Target = String; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -fn main() { - let _works = TcpListener::bind("some string"); - let bad = NoToSocketAddrs("bad".to_owned()); - let _errors = TcpListener::bind(&*bad); - //~^ ERROR the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied -} diff --git a/tests/ui/traits/suggest-deferences/issue-39029.rs b/tests/ui/traits/suggest-deferences/issue-39029.rs deleted file mode 100644 index 90d097105..000000000 --- a/tests/ui/traits/suggest-deferences/issue-39029.rs +++ /dev/null @@ -1,18 +0,0 @@ -// run-rustfix -use std::net::TcpListener; - -struct NoToSocketAddrs(String); - -impl std::ops::Deref for NoToSocketAddrs { - type Target = String; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -fn main() { - let _works = TcpListener::bind("some string"); - let bad = NoToSocketAddrs("bad".to_owned()); - let _errors = TcpListener::bind(&bad); - //~^ ERROR the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied -} diff --git a/tests/ui/traits/suggest-deferences/issue-39029.stderr b/tests/ui/traits/suggest-deferences/issue-39029.stderr deleted file mode 100644 index 49105de3d..000000000 --- a/tests/ui/traits/suggest-deferences/issue-39029.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0277]: the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied - --> $DIR/issue-39029.rs:16:38 - | -LL | let _errors = TcpListener::bind(&bad); - | ----------------- ^^^ the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` - | | - | required by a bound introduced by this call - | - = note: required for `&NoToSocketAddrs` to implement `ToSocketAddrs` -note: required by a bound in `TcpListener::bind` - --> $SRC_DIR/std/src/net/tcp.rs:LL:COL -help: consider dereferencing here - | -LL | let _errors = TcpListener::bind(&*bad); - | + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-deferences/issue-62530.fixed b/tests/ui/traits/suggest-deferences/issue-62530.fixed deleted file mode 100644 index 406caaa00..000000000 --- a/tests/ui/traits/suggest-deferences/issue-62530.fixed +++ /dev/null @@ -1,15 +0,0 @@ -// run-rustfix -fn takes_str(_x: &str) {} - -fn takes_type_parameter(_x: T) where T: SomeTrait {} - -trait SomeTrait {} -impl SomeTrait for &'_ str {} -impl SomeTrait for char {} - -fn main() { - let string = String::new(); - takes_str(&string); // Ok - takes_type_parameter(&*string); // Error - //~^ ERROR the trait bound `&String: SomeTrait` is not satisfied -} diff --git a/tests/ui/traits/suggest-deferences/issue-62530.rs b/tests/ui/traits/suggest-deferences/issue-62530.rs deleted file mode 100644 index 53846be73..000000000 --- a/tests/ui/traits/suggest-deferences/issue-62530.rs +++ /dev/null @@ -1,15 +0,0 @@ -// run-rustfix -fn takes_str(_x: &str) {} - -fn takes_type_parameter(_x: T) where T: SomeTrait {} - -trait SomeTrait {} -impl SomeTrait for &'_ str {} -impl SomeTrait for char {} - -fn main() { - let string = String::new(); - takes_str(&string); // Ok - takes_type_parameter(&string); // Error - //~^ ERROR the trait bound `&String: SomeTrait` is not satisfied -} diff --git a/tests/ui/traits/suggest-deferences/issue-62530.stderr b/tests/ui/traits/suggest-deferences/issue-62530.stderr deleted file mode 100644 index e47ae0b65..000000000 --- a/tests/ui/traits/suggest-deferences/issue-62530.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0277]: the trait bound `&String: SomeTrait` is not satisfied - --> $DIR/issue-62530.rs:13:26 - | -LL | takes_type_parameter(&string); // Error - | -------------------- ^^^^^^^ the trait `SomeTrait` is not implemented for `&String` - | | - | required by a bound introduced by this call - | -note: required by a bound in `takes_type_parameter` - --> $DIR/issue-62530.rs:4:44 - | -LL | fn takes_type_parameter(_x: T) where T: SomeTrait {} - | ^^^^^^^^^ required by this bound in `takes_type_parameter` -help: consider dereferencing here - | -LL | takes_type_parameter(&*string); // Error - | + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-deferences/multiple-0.fixed b/tests/ui/traits/suggest-deferences/multiple-0.fixed deleted file mode 100644 index b7160b75c..000000000 --- a/tests/ui/traits/suggest-deferences/multiple-0.fixed +++ /dev/null @@ -1,36 +0,0 @@ -// run-rustfix -use std::ops::Deref; - -trait Happy {} -struct LDM; -impl Happy for &LDM {} - -struct Foo(LDM); -struct Bar(Foo); -struct Baz(Bar); -impl Deref for Foo { - type Target = LDM; - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl Deref for Bar { - type Target = Foo; - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl Deref for Baz { - type Target = Bar; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -fn foo(_: T) where T: Happy {} - -fn main() { - let baz = Baz(Bar(Foo(LDM))); - foo(&***baz); - //~^ ERROR the trait bound `&Baz: Happy` is not satisfied -} diff --git a/tests/ui/traits/suggest-deferences/multiple-0.rs b/tests/ui/traits/suggest-deferences/multiple-0.rs deleted file mode 100644 index 9ac55177f..000000000 --- a/tests/ui/traits/suggest-deferences/multiple-0.rs +++ /dev/null @@ -1,36 +0,0 @@ -// run-rustfix -use std::ops::Deref; - -trait Happy {} -struct LDM; -impl Happy for &LDM {} - -struct Foo(LDM); -struct Bar(Foo); -struct Baz(Bar); -impl Deref for Foo { - type Target = LDM; - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl Deref for Bar { - type Target = Foo; - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl Deref for Baz { - type Target = Bar; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -fn foo(_: T) where T: Happy {} - -fn main() { - let baz = Baz(Bar(Foo(LDM))); - foo(&baz); - //~^ ERROR the trait bound `&Baz: Happy` is not satisfied -} diff --git a/tests/ui/traits/suggest-deferences/multiple-0.stderr b/tests/ui/traits/suggest-deferences/multiple-0.stderr deleted file mode 100644 index 6a4d4b8d5..000000000 --- a/tests/ui/traits/suggest-deferences/multiple-0.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0277]: the trait bound `&Baz: Happy` is not satisfied - --> $DIR/multiple-0.rs:34:9 - | -LL | foo(&baz); - | --- ^^^^ the trait `Happy` is not implemented for `&Baz` - | | - | required by a bound introduced by this call - | -note: required by a bound in `foo` - --> $DIR/multiple-0.rs:30:26 - | -LL | fn foo(_: T) where T: Happy {} - | ^^^^^ required by this bound in `foo` -help: consider dereferencing here - | -LL | foo(&***baz); - | +++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-deferences/multiple-1.rs b/tests/ui/traits/suggest-deferences/multiple-1.rs deleted file mode 100644 index 91c6c7924..000000000 --- a/tests/ui/traits/suggest-deferences/multiple-1.rs +++ /dev/null @@ -1,54 +0,0 @@ -use std::ops::{Deref, DerefMut}; - -trait Happy {} -struct LDM; -impl Happy for &mut LDM {} - -struct Foo(LDM); -struct Bar(Foo); -struct Baz(Bar); -impl Deref for Foo { - type Target = LDM; - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl Deref for Bar { - type Target = Foo; - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl Deref for Baz { - type Target = Bar; - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl DerefMut for Foo { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} -impl DerefMut for Bar { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} -impl DerefMut for Baz { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - - -fn foo(_: T) where T: Happy {} - -fn main() { - // Currently the compiler doesn't try to suggest dereferences for situations - // where DerefMut involves. So this test is meant to ensure compiler doesn't - // generate incorrect help message. - let mut baz = Baz(Bar(Foo(LDM))); - foo(&mut baz); - //~^ ERROR the trait bound `&mut Baz: Happy` is not satisfied -} diff --git a/tests/ui/traits/suggest-deferences/multiple-1.stderr b/tests/ui/traits/suggest-deferences/multiple-1.stderr deleted file mode 100644 index 6e12321c2..000000000 --- a/tests/ui/traits/suggest-deferences/multiple-1.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0277]: the trait bound `&mut Baz: Happy` is not satisfied - --> $DIR/multiple-1.rs:52:9 - | -LL | foo(&mut baz); - | --- ^^^^^^^^ the trait `Happy` is not implemented for `&mut Baz` - | | - | required by a bound introduced by this call - | - = help: the trait `Happy` is implemented for `&mut LDM` -note: required by a bound in `foo` - --> $DIR/multiple-1.rs:45:26 - | -LL | fn foo(_: T) where T: Happy {} - | ^^^^^ required by this bound in `foo` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-deferences/root-obligation.fixed b/tests/ui/traits/suggest-deferences/root-obligation.fixed deleted file mode 100644 index 7a8433f90..000000000 --- a/tests/ui/traits/suggest-deferences/root-obligation.fixed +++ /dev/null @@ -1,13 +0,0 @@ -// run-rustfix - -fn get_vowel_count(string: &str) -> usize { - string - .chars() - .filter(|c| "aeiou".contains(*c)) - //~^ ERROR expected a `Fn<(char,)>` closure, found `char` - .count() -} - -fn main() { - let _ = get_vowel_count("asdf"); -} diff --git a/tests/ui/traits/suggest-deferences/root-obligation.rs b/tests/ui/traits/suggest-deferences/root-obligation.rs deleted file mode 100644 index 51bac2107..000000000 --- a/tests/ui/traits/suggest-deferences/root-obligation.rs +++ /dev/null @@ -1,13 +0,0 @@ -// run-rustfix - -fn get_vowel_count(string: &str) -> usize { - string - .chars() - .filter(|c| "aeiou".contains(c)) - //~^ ERROR expected a `Fn<(char,)>` closure, found `char` - .count() -} - -fn main() { - let _ = get_vowel_count("asdf"); -} diff --git a/tests/ui/traits/suggest-deferences/root-obligation.stderr b/tests/ui/traits/suggest-deferences/root-obligation.stderr deleted file mode 100644 index 1363fb8c4..000000000 --- a/tests/ui/traits/suggest-deferences/root-obligation.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0277]: expected a `Fn<(char,)>` closure, found `char` - --> $DIR/root-obligation.rs:6:38 - | -LL | .filter(|c| "aeiou".contains(c)) - | -------- ^ expected an `Fn<(char,)>` closure, found `char` - | | - | required by a bound introduced by this call - | - = help: the trait `Fn<(char,)>` is not implemented for `char` - = note: required for `&char` to implement `FnOnce<(char,)>` - = note: required for `&char` to implement `Pattern<'_>` -note: required by a bound in `core::str::::contains` - --> $SRC_DIR/core/src/str/mod.rs:LL:COL -help: consider dereferencing here - | -LL | .filter(|c| "aeiou".contains(*c)) - | + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed b/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed deleted file mode 100644 index ea3d1bf85..000000000 --- a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.fixed +++ /dev/null @@ -1,14 +0,0 @@ -// run-rustfix - -struct TargetStruct; - -impl From for TargetStruct { - fn from(_unchecked: usize) -> Self { - TargetStruct - } -} - -fn main() { - let a = &3; - let _b: TargetStruct = (*a).into(); //~ ERROR the trait bound `TargetStruct: From<&{integer}>` is not satisfied -} diff --git a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs b/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs deleted file mode 100644 index 9eda68027..000000000 --- a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-rustfix - -struct TargetStruct; - -impl From for TargetStruct { - fn from(_unchecked: usize) -> Self { - TargetStruct - } -} - -fn main() { - let a = &3; - let _b: TargetStruct = a.into(); //~ ERROR the trait bound `TargetStruct: From<&{integer}>` is not satisfied -} diff --git a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr b/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr deleted file mode 100644 index ede31a2c7..000000000 --- a/tests/ui/traits/suggest-deferences/suggest-dereferencing-receiver-argument.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0277]: the trait bound `TargetStruct: From<&{integer}>` is not satisfied - --> $DIR/suggest-dereferencing-receiver-argument.rs:13:30 - | -LL | let _b: TargetStruct = a.into(); - | ^^^^ the trait `From<&{integer}>` is not implemented for `TargetStruct` - | - = note: required for `&{integer}` to implement `Into` -help: consider dereferencing here - | -LL | let _b: TargetStruct = (*a).into(); - | ++ + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs new file mode 100644 index 000000000..c6f9e3456 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.rs @@ -0,0 +1,15 @@ +fn use_iterator(itr: I) +where + I: IntoIterator, +{ +} + +fn pass_iterator(i: &dyn IntoIterator) +where + I: Iterator, +{ + use_iterator(i); + //~^ ERROR `&dyn IntoIterator` is not an iterator +} + +fn main() {} diff --git a/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr new file mode 100644 index 000000000..bd0e7ca2c --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/dont-suggest-unsize-deref.stderr @@ -0,0 +1,22 @@ +error[E0277]: `&dyn IntoIterator` is not an iterator + --> $DIR/dont-suggest-unsize-deref.rs:11:18 + | +LL | use_iterator(i); + | ------------ ^ `&dyn IntoIterator` is not an iterator + | | + | required by a bound introduced by this call + | + = help: the trait `Iterator` is not implemented for `&dyn IntoIterator` + = note: required for `&dyn IntoIterator` to implement `IntoIterator` +note: required by a bound in `use_iterator` + --> $DIR/dont-suggest-unsize-deref.rs:3:8 + | +LL | fn use_iterator(itr: I) + | ------------ required by a bound in this function +LL | where +LL | I: IntoIterator, + | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `use_iterator` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-dereferences/issue-39029.fixed b/tests/ui/traits/suggest-dereferences/issue-39029.fixed new file mode 100644 index 000000000..a1abf668b --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/issue-39029.fixed @@ -0,0 +1,18 @@ +// run-rustfix +use std::net::TcpListener; + +struct NoToSocketAddrs(String); + +impl std::ops::Deref for NoToSocketAddrs { + type Target = String; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +fn main() { + let _works = TcpListener::bind("some string"); + let bad = NoToSocketAddrs("bad".to_owned()); + let _errors = TcpListener::bind(&*bad); + //~^ ERROR the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied +} diff --git a/tests/ui/traits/suggest-dereferences/issue-39029.rs b/tests/ui/traits/suggest-dereferences/issue-39029.rs new file mode 100644 index 000000000..90d097105 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/issue-39029.rs @@ -0,0 +1,18 @@ +// run-rustfix +use std::net::TcpListener; + +struct NoToSocketAddrs(String); + +impl std::ops::Deref for NoToSocketAddrs { + type Target = String; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +fn main() { + let _works = TcpListener::bind("some string"); + let bad = NoToSocketAddrs("bad".to_owned()); + let _errors = TcpListener::bind(&bad); + //~^ ERROR the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied +} diff --git a/tests/ui/traits/suggest-dereferences/issue-39029.stderr b/tests/ui/traits/suggest-dereferences/issue-39029.stderr new file mode 100644 index 000000000..49105de3d --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/issue-39029.stderr @@ -0,0 +1,19 @@ +error[E0277]: the trait bound `NoToSocketAddrs: ToSocketAddrs` is not satisfied + --> $DIR/issue-39029.rs:16:38 + | +LL | let _errors = TcpListener::bind(&bad); + | ----------------- ^^^ the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` + | | + | required by a bound introduced by this call + | + = note: required for `&NoToSocketAddrs` to implement `ToSocketAddrs` +note: required by a bound in `TcpListener::bind` + --> $SRC_DIR/std/src/net/tcp.rs:LL:COL +help: consider dereferencing here + | +LL | let _errors = TcpListener::bind(&*bad); + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-dereferences/issue-62530.fixed b/tests/ui/traits/suggest-dereferences/issue-62530.fixed new file mode 100644 index 000000000..406caaa00 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/issue-62530.fixed @@ -0,0 +1,15 @@ +// run-rustfix +fn takes_str(_x: &str) {} + +fn takes_type_parameter(_x: T) where T: SomeTrait {} + +trait SomeTrait {} +impl SomeTrait for &'_ str {} +impl SomeTrait for char {} + +fn main() { + let string = String::new(); + takes_str(&string); // Ok + takes_type_parameter(&*string); // Error + //~^ ERROR the trait bound `&String: SomeTrait` is not satisfied +} diff --git a/tests/ui/traits/suggest-dereferences/issue-62530.rs b/tests/ui/traits/suggest-dereferences/issue-62530.rs new file mode 100644 index 000000000..53846be73 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/issue-62530.rs @@ -0,0 +1,15 @@ +// run-rustfix +fn takes_str(_x: &str) {} + +fn takes_type_parameter(_x: T) where T: SomeTrait {} + +trait SomeTrait {} +impl SomeTrait for &'_ str {} +impl SomeTrait for char {} + +fn main() { + let string = String::new(); + takes_str(&string); // Ok + takes_type_parameter(&string); // Error + //~^ ERROR the trait bound `&String: SomeTrait` is not satisfied +} diff --git a/tests/ui/traits/suggest-dereferences/issue-62530.stderr b/tests/ui/traits/suggest-dereferences/issue-62530.stderr new file mode 100644 index 000000000..e47ae0b65 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/issue-62530.stderr @@ -0,0 +1,21 @@ +error[E0277]: the trait bound `&String: SomeTrait` is not satisfied + --> $DIR/issue-62530.rs:13:26 + | +LL | takes_type_parameter(&string); // Error + | -------------------- ^^^^^^^ the trait `SomeTrait` is not implemented for `&String` + | | + | required by a bound introduced by this call + | +note: required by a bound in `takes_type_parameter` + --> $DIR/issue-62530.rs:4:44 + | +LL | fn takes_type_parameter(_x: T) where T: SomeTrait {} + | ^^^^^^^^^ required by this bound in `takes_type_parameter` +help: consider dereferencing here + | +LL | takes_type_parameter(&*string); // Error + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-dereferences/multiple-0.fixed b/tests/ui/traits/suggest-dereferences/multiple-0.fixed new file mode 100644 index 000000000..b7160b75c --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/multiple-0.fixed @@ -0,0 +1,36 @@ +// run-rustfix +use std::ops::Deref; + +trait Happy {} +struct LDM; +impl Happy for &LDM {} + +struct Foo(LDM); +struct Bar(Foo); +struct Baz(Bar); +impl Deref for Foo { + type Target = LDM; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Bar { + type Target = Foo; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Baz { + type Target = Bar; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +fn foo(_: T) where T: Happy {} + +fn main() { + let baz = Baz(Bar(Foo(LDM))); + foo(&***baz); + //~^ ERROR the trait bound `&Baz: Happy` is not satisfied +} diff --git a/tests/ui/traits/suggest-dereferences/multiple-0.rs b/tests/ui/traits/suggest-dereferences/multiple-0.rs new file mode 100644 index 000000000..9ac55177f --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/multiple-0.rs @@ -0,0 +1,36 @@ +// run-rustfix +use std::ops::Deref; + +trait Happy {} +struct LDM; +impl Happy for &LDM {} + +struct Foo(LDM); +struct Bar(Foo); +struct Baz(Bar); +impl Deref for Foo { + type Target = LDM; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Bar { + type Target = Foo; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Baz { + type Target = Bar; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +fn foo(_: T) where T: Happy {} + +fn main() { + let baz = Baz(Bar(Foo(LDM))); + foo(&baz); + //~^ ERROR the trait bound `&Baz: Happy` is not satisfied +} diff --git a/tests/ui/traits/suggest-dereferences/multiple-0.stderr b/tests/ui/traits/suggest-dereferences/multiple-0.stderr new file mode 100644 index 000000000..6a4d4b8d5 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/multiple-0.stderr @@ -0,0 +1,21 @@ +error[E0277]: the trait bound `&Baz: Happy` is not satisfied + --> $DIR/multiple-0.rs:34:9 + | +LL | foo(&baz); + | --- ^^^^ the trait `Happy` is not implemented for `&Baz` + | | + | required by a bound introduced by this call + | +note: required by a bound in `foo` + --> $DIR/multiple-0.rs:30:26 + | +LL | fn foo(_: T) where T: Happy {} + | ^^^^^ required by this bound in `foo` +help: consider dereferencing here + | +LL | foo(&***baz); + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-dereferences/multiple-1.rs b/tests/ui/traits/suggest-dereferences/multiple-1.rs new file mode 100644 index 000000000..91c6c7924 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/multiple-1.rs @@ -0,0 +1,54 @@ +use std::ops::{Deref, DerefMut}; + +trait Happy {} +struct LDM; +impl Happy for &mut LDM {} + +struct Foo(LDM); +struct Bar(Foo); +struct Baz(Bar); +impl Deref for Foo { + type Target = LDM; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Bar { + type Target = Foo; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl Deref for Baz { + type Target = Bar; + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl DerefMut for Foo { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl DerefMut for Bar { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl DerefMut for Baz { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + + +fn foo(_: T) where T: Happy {} + +fn main() { + // Currently the compiler doesn't try to suggest dereferences for situations + // where DerefMut involves. So this test is meant to ensure compiler doesn't + // generate incorrect help message. + let mut baz = Baz(Bar(Foo(LDM))); + foo(&mut baz); + //~^ ERROR the trait bound `&mut Baz: Happy` is not satisfied +} diff --git a/tests/ui/traits/suggest-dereferences/multiple-1.stderr b/tests/ui/traits/suggest-dereferences/multiple-1.stderr new file mode 100644 index 000000000..6e12321c2 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/multiple-1.stderr @@ -0,0 +1,18 @@ +error[E0277]: the trait bound `&mut Baz: Happy` is not satisfied + --> $DIR/multiple-1.rs:52:9 + | +LL | foo(&mut baz); + | --- ^^^^^^^^ the trait `Happy` is not implemented for `&mut Baz` + | | + | required by a bound introduced by this call + | + = help: the trait `Happy` is implemented for `&mut LDM` +note: required by a bound in `foo` + --> $DIR/multiple-1.rs:45:26 + | +LL | fn foo(_: T) where T: Happy {} + | ^^^^^ required by this bound in `foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.fixed b/tests/ui/traits/suggest-dereferences/root-obligation.fixed new file mode 100644 index 000000000..7a8433f90 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/root-obligation.fixed @@ -0,0 +1,13 @@ +// run-rustfix + +fn get_vowel_count(string: &str) -> usize { + string + .chars() + .filter(|c| "aeiou".contains(*c)) + //~^ ERROR expected a `Fn<(char,)>` closure, found `char` + .count() +} + +fn main() { + let _ = get_vowel_count("asdf"); +} diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.rs b/tests/ui/traits/suggest-dereferences/root-obligation.rs new file mode 100644 index 000000000..51bac2107 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/root-obligation.rs @@ -0,0 +1,13 @@ +// run-rustfix + +fn get_vowel_count(string: &str) -> usize { + string + .chars() + .filter(|c| "aeiou".contains(c)) + //~^ ERROR expected a `Fn<(char,)>` closure, found `char` + .count() +} + +fn main() { + let _ = get_vowel_count("asdf"); +} diff --git a/tests/ui/traits/suggest-dereferences/root-obligation.stderr b/tests/ui/traits/suggest-dereferences/root-obligation.stderr new file mode 100644 index 000000000..1363fb8c4 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/root-obligation.stderr @@ -0,0 +1,21 @@ +error[E0277]: expected a `Fn<(char,)>` closure, found `char` + --> $DIR/root-obligation.rs:6:38 + | +LL | .filter(|c| "aeiou".contains(c)) + | -------- ^ expected an `Fn<(char,)>` closure, found `char` + | | + | required by a bound introduced by this call + | + = help: the trait `Fn<(char,)>` is not implemented for `char` + = note: required for `&char` to implement `FnOnce<(char,)>` + = note: required for `&char` to implement `Pattern<'_>` +note: required by a bound in `core::str::::contains` + --> $SRC_DIR/core/src/str/mod.rs:LL:COL +help: consider dereferencing here + | +LL | .filter(|c| "aeiou".contains(*c)) + | + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.fixed b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.fixed new file mode 100644 index 000000000..ea3d1bf85 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.fixed @@ -0,0 +1,14 @@ +// run-rustfix + +struct TargetStruct; + +impl From for TargetStruct { + fn from(_unchecked: usize) -> Self { + TargetStruct + } +} + +fn main() { + let a = &3; + let _b: TargetStruct = (*a).into(); //~ ERROR the trait bound `TargetStruct: From<&{integer}>` is not satisfied +} diff --git a/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.rs b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.rs new file mode 100644 index 000000000..9eda68027 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.rs @@ -0,0 +1,14 @@ +// run-rustfix + +struct TargetStruct; + +impl From for TargetStruct { + fn from(_unchecked: usize) -> Self { + TargetStruct + } +} + +fn main() { + let a = &3; + let _b: TargetStruct = a.into(); //~ ERROR the trait bound `TargetStruct: From<&{integer}>` is not satisfied +} diff --git a/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr new file mode 100644 index 000000000..ede31a2c7 --- /dev/null +++ b/tests/ui/traits/suggest-dereferences/suggest-dereferencing-receiver-argument.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `TargetStruct: From<&{integer}>` is not satisfied + --> $DIR/suggest-dereferencing-receiver-argument.rs:13:30 + | +LL | let _b: TargetStruct = a.into(); + | ^^^^ the trait `From<&{integer}>` is not implemented for `TargetStruct` + | + = note: required for `&{integer}` to implement `Into` +help: consider dereferencing here + | +LL | let _b: TargetStruct = (*a).into(); + | ++ + + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/suggest-fully-qualified-closure.rs b/tests/ui/traits/suggest-fully-qualified-closure.rs index c077921c0..6bbb6a95d 100644 --- a/tests/ui/traits/suggest-fully-qualified-closure.rs +++ b/tests/ui/traits/suggest-fully-qualified-closure.rs @@ -1,6 +1,6 @@ // check-fail // known-bug: #103705 -// normalize-stderr-test "\[closure@.*\]" -> "[closure@]" +// normalize-stderr-test "\{closure@.*\}" -> "{closure@}" // normalize-stderr-test "\+* ~" -> "+++ ~" // The output of this currently suggests writing a closure in the qualified path. diff --git a/tests/ui/traits/suggest-fully-qualified-closure.stderr b/tests/ui/traits/suggest-fully-qualified-closure.stderr index 3df623c14..2aea3783f 100644 --- a/tests/ui/traits/suggest-fully-qualified-closure.stderr +++ b/tests/ui/traits/suggest-fully-qualified-closure.stderr @@ -6,7 +6,7 @@ LL | q.lol(||()); | help: try using a fully qualified path to specify the expected types | -LL | >::lol::<[closure@]>(&q, ||()); +LL | >::lol::<{closure@}>(&q, ||()); | +++ ~ error[E0283]: type annotations needed @@ -25,7 +25,7 @@ LL | impl MyTrait for Qqq{ | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using a fully qualified path to specify the expected types | -LL | >::lol::<[closure@]>(&q, ||()); +LL | >::lol::<{closure@}>(&q, ||()); | +++ ~ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/suggest-where-clause.stderr b/tests/ui/traits/suggest-where-clause.stderr index f3a4c6890..e3bbf768c 100644 --- a/tests/ui/traits/suggest-where-clause.stderr +++ b/tests/ui/traits/suggest-where-clause.stderr @@ -38,10 +38,10 @@ LL + fn check() { | error[E0277]: the trait bound `u64: From` is not satisfied - --> $DIR/suggest-where-clause.rs:15:5 + --> $DIR/suggest-where-clause.rs:15:6 | LL | >::from; - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `From` is not implemented for `u64` + | ^^^ the trait `From` is not implemented for `u64` | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | @@ -49,10 +49,10 @@ LL | fn check() where u64: From { | ++++++++++++++++++ error[E0277]: the trait bound `u64: From<::Item>` is not satisfied - --> $DIR/suggest-where-clause.rs:18:5 + --> $DIR/suggest-where-clause.rs:18:6 | LL | ::Item>>::from; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<::Item>` is not implemented for `u64` + | ^^^ the trait `From<::Item>` is not implemented for `u64` | help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | @@ -60,10 +60,10 @@ LL | fn check() where u64: From<::Item> { | ++++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `Misc<_>: From` is not satisfied - --> $DIR/suggest-where-clause.rs:23:5 + --> $DIR/suggest-where-clause.rs:23:6 | LL | as From>::from; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From` is not implemented for `Misc<_>` + | ^^^^^^^ the trait `From` is not implemented for `Misc<_>` error[E0277]: the size for values of type `[T]` cannot be known at compilation time --> $DIR/suggest-where-clause.rs:28:20 diff --git a/tests/ui/traits/unsend-future.rs b/tests/ui/traits/unsend-future.rs index fbbc07b11..a8367573f 100644 --- a/tests/ui/traits/unsend-future.rs +++ b/tests/ui/traits/unsend-future.rs @@ -13,6 +13,7 @@ fn require_handler(h: H) {} async fn handler() { let a = &1 as *const i32; async {}.await; + let b = a; } fn main() { diff --git a/tests/ui/traits/unsend-future.stderr b/tests/ui/traits/unsend-future.stderr index 6ce1cf452..01829021b 100644 --- a/tests/ui/traits/unsend-future.stderr +++ b/tests/ui/traits/unsend-future.stderr @@ -1,5 +1,5 @@ error: future cannot be sent between threads safely - --> $DIR/unsend-future.rs:19:21 + --> $DIR/unsend-future.rs:20:21 | LL | require_handler(handler) | ^^^^^^^ future returned by `handler` is not `Send` @@ -12,8 +12,6 @@ LL | let a = &1 as *const i32; | - has type `*const i32` which is not `Send` LL | async {}.await; | ^^^^^ await occurs here, with `a` maybe used later -LL | } - | - `a` is later dropped here note: required by a bound in `require_handler` --> $DIR/unsend-future.rs:11:23 | diff --git a/tests/ui/traits/vtable-res-trait-param.stderr b/tests/ui/traits/vtable-res-trait-param.stderr index 2b3e3de9b..4cfceefb2 100644 --- a/tests/ui/traits/vtable-res-trait-param.stderr +++ b/tests/ui/traits/vtable-res-trait-param.stderr @@ -6,6 +6,11 @@ LL | b.gimme_an_a(y) | | | required by a bound introduced by this call | +help: this trait has no implementations, consider adding one + --> $DIR/vtable-res-trait-param.rs:1:1 + | +LL | trait TraitA { + | ^^^^^^^^^^^^ note: required by a bound in `TraitB::gimme_an_a` --> $DIR/vtable-res-trait-param.rs:6:21 | -- cgit v1.2.3