diff --git a/compiler/rustc_hir_analysis/src/coherence/orphan.rs b/compiler/rustc_hir_analysis/src/coherence/orphan.rs index d2c3a08eb714f..b875b2a8620bf 100644 --- a/compiler/rustc_hir_analysis/src/coherence/orphan.rs +++ b/compiler/rustc_hir_analysis/src/coherence/orphan.rs @@ -396,7 +396,7 @@ fn emit_orphan_check_error<'tcx>( let impl_ = item.expect_impl(); let of_trait = impl_.of_trait.unwrap(); - let span = tcx.def_span(impl_def_id); + let span = impl_.self_ty.span; let mut diag = tcx.dcx().create_err(match trait_ref.self_ty().kind() { ty::Adt(..) => diagnostics::OnlyCurrentTraits::Outside { span, note: () }, _ if trait_ref.self_ty().is_primitive() => { diff --git a/tests/ui/any/reject_manual_impl.stderr b/tests/ui/any/reject_manual_impl.stderr index 37be37c47ea79..6f40832facfaf 100644 --- a/tests/ui/any/reject_manual_impl.stderr +++ b/tests/ui/any/reject_manual_impl.stderr @@ -29,12 +29,10 @@ LL | impl TryAsDynCompatible<'static> for dyn Iterator {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `TryAsDynCompatible` not allowed error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/reject_manual_impl.rs:25:1 + --> $DIR/reject_manual_impl.rs:25:38 | LL | impl TryAsDynCompatible<'static> for dyn Iterator {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------ - | | - | `dyn Iterator` is not defined in the current crate + | ^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Iterator` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-cow.re_a.stderr b/tests/ui/coherence/coherence-cow.re_a.stderr index 67de3629491dd..ee5d880600660 100644 --- a/tests/ui/coherence/coherence-cow.re_a.stderr +++ b/tests/ui/coherence/coherence-cow.re_a.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-cow.rs:18:1 + --> $DIR/coherence-cow.rs:18:20 | LL | impl Remote for Pair> { } - | ^^^^^^^^^^^^^^^^^^^---------------- - | | - | `Pair` is not defined in the current crate + | ^^^^^^^^^^^^^^^^ `Pair` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-cow.re_b.stderr b/tests/ui/coherence/coherence-cow.re_b.stderr index 360900cc7fff6..6ca91839e1d7f 100644 --- a/tests/ui/coherence/coherence-cow.re_b.stderr +++ b/tests/ui/coherence/coherence-cow.re_b.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-cow.rs:22:1 + --> $DIR/coherence-cow.rs:22:20 | LL | impl Remote for Pair,T> { } - | ^^^^^^^^^^^^^^^^^^^---------------- - | | - | `Pair` is not defined in the current crate + | ^^^^^^^^^^^^^^^^ `Pair` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-cow.re_c.stderr b/tests/ui/coherence/coherence-cow.re_c.stderr index 73f2aa196fd4b..9a07000f2265b 100644 --- a/tests/ui/coherence/coherence-cow.re_c.stderr +++ b/tests/ui/coherence/coherence-cow.re_c.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-cow.rs:26:1 + --> $DIR/coherence-cow.rs:26:22 | LL | impl Remote for Pair,U> { } - | ^^^^^^^^^^^^^^^^^^^^^---------------- - | | - | `Pair` is not defined in the current crate + | ^^^^^^^^^^^^^^^^ `Pair` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-fundamental-trait-objects.stderr b/tests/ui/coherence/coherence-fundamental-trait-objects.stderr index ca43d70e0b1b8..abfe33b8f548a 100644 --- a/tests/ui/coherence/coherence-fundamental-trait-objects.stderr +++ b/tests/ui/coherence/coherence-fundamental-trait-objects.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-fundamental-trait-objects.rs:12:1 + --> $DIR/coherence-fundamental-trait-objects.rs:12:15 | LL | impl Misc for dyn Fundamental {} - | ^^^^^^^^^^^^^^---------------------- - | | - | `dyn Fundamental` is not defined in the current crate + | ^^^^^^^^^^^^^^^^^^^^^^ `dyn Fundamental` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr index bc81dd6f286dd..471cd84653dbd 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr +++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr @@ -35,12 +35,10 @@ LL | impl !Marker2 for dyn Object {} = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:22:1 + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:22:16 | LL | impl !Send for dyn Marker2 {} - | ^^^^^^^^^^^^^^^----------- - | | - | `dyn Marker2` is not defined in the current crate + | ^^^^^^^^^^^ `dyn Marker2` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr index f38aeaed0aaca..65d09c75b685d 100644 --- a/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr +++ b/tests/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr @@ -35,12 +35,10 @@ LL | impl Marker2 for dyn Object {} = note: a trait object implements `Marker2` if and only if `Marker2` is one of the trait object's trait bounds error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22:1 + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22:22 | LL | unsafe impl Send for dyn Marker2 {} - | ^^^^^^^^^^^^^^^^^^^^^----------- - | | - | `dyn Marker2` is not defined in the current crate + | ^^^^^^^^^^^ `dyn Marker2` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-impls-copy.stderr b/tests/ui/coherence/coherence-impls-copy.stderr index 79fe044c4cf4a..9a336d4ccb62b 100644 --- a/tests/ui/coherence/coherence-impls-copy.stderr +++ b/tests/ui/coherence/coherence-impls-copy.stderr @@ -9,24 +9,20 @@ LL | impl Copy for &'static NotSync {} where T: ?Sized; error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:33:1 + --> $DIR/coherence-impls-copy.rs:33:15 | LL | impl Copy for &'static [NotSync] {} - | ^^^^^^^^^^^^^^------------------ - | | - | this is not defined in the current crate because slices are always foreign + | ^^^^^^^^^^^^^^^^^^ this is not defined in the current crate because slices are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/coherence-impls-copy.rs:5:1 + --> $DIR/coherence-impls-copy.rs:5:15 | LL | impl Copy for i32 {} - | ^^^^^^^^^^^^^^--- - | | - | `i32` is not defined in the current crate + | ^^^ `i32` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules @@ -39,12 +35,10 @@ LL | impl Copy for &'static mut MyType {} | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:25:1 + --> $DIR/coherence-impls-copy.rs:25:15 | LL | impl Copy for (MyType, MyType) {} - | ^^^^^^^^^^^^^^---------------- - | | - | this is not defined in the current crate because tuples are always foreign + | ^^^^^^^^^^^^^^^^ this is not defined in the current crate because tuples are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules @@ -57,12 +51,10 @@ LL | impl Copy for (MyType, MyType) {} | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:30:1 + --> $DIR/coherence-impls-copy.rs:30:15 | LL | impl Copy for [MyType] {} - | ^^^^^^^^^^^^^^-------- - | | - | this is not defined in the current crate because slices are always foreign + | ^^^^^^^^ this is not defined in the current crate because slices are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-impls-send.stderr b/tests/ui/coherence/coherence-impls-send.stderr index 78e89eb55409f..b6fff84cce0a4 100644 --- a/tests/ui/coherence/coherence-impls-send.stderr +++ b/tests/ui/coherence/coherence-impls-send.stderr @@ -1,22 +1,18 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:25:1 + --> $DIR/coherence-impls-send.rs:25:22 | LL | unsafe impl Send for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^^^^------------------ - | | - | this is not defined in the current crate because slices are always foreign + | ^^^^^^^^^^^^^^^^^^ this is not defined in the current crate because slices are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:16:1 + --> $DIR/coherence-impls-send.rs:16:22 | LL | unsafe impl Send for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^^^^^^^---------------- - | | - | this is not defined in the current crate because tuples are always foreign + | ^^^^^^^^^^^^^^^^ this is not defined in the current crate because tuples are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules @@ -29,12 +25,10 @@ LL | unsafe impl Send for &'static NotSync {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:22:1 + --> $DIR/coherence-impls-send.rs:22:22 | LL | unsafe impl Send for [MyType] {} - | ^^^^^^^^^^^^^^^^^^^^^-------- - | | - | this is not defined in the current crate because slices are always foreign + | ^^^^^^^^ this is not defined in the current crate because slices are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-impls-sized.stderr b/tests/ui/coherence/coherence-impls-sized.stderr index 3201f1b25def8..5e93cbcf955b1 100644 --- a/tests/ui/coherence/coherence-impls-sized.stderr +++ b/tests/ui/coherence/coherence-impls-sized.stderr @@ -17,12 +17,10 @@ LL | impl Sized for (MyType, MyType) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:20:1 + --> $DIR/coherence-impls-sized.rs:20:16 | LL | impl Sized for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^---------------- - | | - | this is not defined in the current crate because tuples are always foreign + | ^^^^^^^^^^^^^^^^ this is not defined in the current crate because tuples are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules @@ -41,12 +39,10 @@ LL | impl Sized for [MyType] {} | ^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:27:1 + --> $DIR/coherence-impls-sized.rs:27:16 | LL | impl Sized for [MyType] {} - | ^^^^^^^^^^^^^^^-------- - | | - | this is not defined in the current crate because slices are always foreign + | ^^^^^^^^ this is not defined in the current crate because slices are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules @@ -59,12 +55,10 @@ LL | impl Sized for &'static [NotSync] {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `Sized` not allowed error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:31:1 + --> $DIR/coherence-impls-sized.rs:31:16 | LL | impl Sized for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^------------------ - | | - | this is not defined in the current crate because slices are always foreign + | ^^^^^^^^^^^^^^^^^^ this is not defined in the current crate because slices are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-negative-impls-copy-bad.stderr b/tests/ui/coherence/coherence-negative-impls-copy-bad.stderr index 074cd87ba9246..2ef5f2a3c58a7 100644 --- a/tests/ui/coherence/coherence-negative-impls-copy-bad.stderr +++ b/tests/ui/coherence/coherence-negative-impls-copy-bad.stderr @@ -1,34 +1,28 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-negative-impls-copy-bad.rs:4:1 + --> $DIR/coherence-negative-impls-copy-bad.rs:4:16 | LL | impl !Copy for str {} - | ^^^^^^^^^^^^^^^--- - | | - | `str` is not defined in the current crate + | ^^^ `str` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-negative-impls-copy-bad.rs:7:1 + --> $DIR/coherence-negative-impls-copy-bad.rs:7:16 | LL | impl !Copy for fn() {} - | ^^^^^^^^^^^^^^^---- - | | - | `fn()` is not defined in the current crate + | ^^^^ `fn()` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-negative-impls-copy-bad.rs:10:1 + --> $DIR/coherence-negative-impls-copy-bad.rs:10:16 | LL | impl !Copy for () {} - | ^^^^^^^^^^^^^^^-- - | | - | this is not defined in the current crate because tuples are always foreign + | ^^ this is not defined in the current crate because tuples are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-orphan-foreign-adt-diagnostic.stderr b/tests/ui/coherence/coherence-orphan-foreign-adt-diagnostic.stderr index 65030aefb08ed..e3ec9f2648938 100644 --- a/tests/ui/coherence/coherence-orphan-foreign-adt-diagnostic.stderr +++ b/tests/ui/coherence/coherence-orphan-foreign-adt-diagnostic.stderr @@ -1,10 +1,9 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-orphan-foreign-adt-diagnostic.rs:10:1 + --> $DIR/coherence-orphan-foreign-adt-diagnostic.rs:10:20 | LL | impl PartialEq for Option { - | ^^^^^---------^^^^^----------- - | | | - | | `Option` is not defined in the current crate + | --------- ^^^^^^^^^^^ `Option` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters @@ -12,12 +11,11 @@ LL | impl PartialEq for Option { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-orphan-foreign-adt-diagnostic.rs:27:1 + --> $DIR/coherence-orphan-foreign-adt-diagnostic.rs:27:28 | LL | impl PartialEq for Option { - | ^^^^^-----------------^^^^^----------- - | | | - | | `Option` is not defined in the current crate + | ----------------- ^^^^^^^^^^^ `Option` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters @@ -25,12 +23,11 @@ LL | impl PartialEq for Option { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-orphan-foreign-adt-diagnostic.rs:38:1 + --> $DIR/coherence-orphan-foreign-adt-diagnostic.rs:38:30 | LL | impl PartialEq<[i32; 3]> for Option { - | ^^^^^-------------------^^^^^----------- - | | | - | | `Option` is not defined in the current crate + | ------------------- ^^^^^^^^^^^ `Option` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters @@ -38,12 +35,11 @@ LL | impl PartialEq<[i32; 3]> for Option { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/coherence-orphan-foreign-adt-diagnostic.rs:18:1 + --> $DIR/coherence-orphan-foreign-adt-diagnostic.rs:18:14 | LL | impl Add for u32 { - | ^^^^^---^^^^^--- - | | | - | | `u32` is not defined in the current crate + | --- ^^^ `u32` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters diff --git a/tests/ui/coherence/coherence-orphan.stderr b/tests/ui/coherence/coherence-orphan.stderr index a8de82e23a98c..6ca171ddb6f5b 100644 --- a/tests/ui/coherence/coherence-orphan.stderr +++ b/tests/ui/coherence/coherence-orphan.stderr @@ -1,10 +1,9 @@ error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/coherence-orphan.rs:10:1 + --> $DIR/coherence-orphan.rs:10:26 | LL | impl TheTrait for isize {} - | ^^^^^---------------^^^^^----- - | | | - | | `isize` is not defined in the current crate + | --------------- ^^^^^ `isize` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters @@ -12,12 +11,10 @@ LL | impl TheTrait for isize {} = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-orphan.rs:17:1 + --> $DIR/coherence-orphan.rs:17:16 | LL | impl !Send for Vec {} - | ^^^^^^^^^^^^^^^---------- - | | - | `Vec` is not defined in the current crate + | ^^^^^^^^^^ `Vec` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-overlapping-pairs.stderr b/tests/ui/coherence/coherence-overlapping-pairs.stderr index 6e7a90ac369c4..c1d97634f8260 100644 --- a/tests/ui/coherence/coherence-overlapping-pairs.stderr +++ b/tests/ui/coherence/coherence-overlapping-pairs.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-overlapping-pairs.rs:8:1 + --> $DIR/coherence-overlapping-pairs.rs:8:20 | LL | impl Remote for lib::Pair { } - | ^^^^^^^^^^^^^^^^^^^---------------- - | | - | `Pair` is not defined in the current crate + | ^^^^^^^^^^^^^^^^ `Pair` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-pair-covered-uncovered-1.stderr b/tests/ui/coherence/coherence-pair-covered-uncovered-1.stderr index 016cd0a4a866a..3ad46d98026a5 100644 --- a/tests/ui/coherence/coherence-pair-covered-uncovered-1.stderr +++ b/tests/ui/coherence/coherence-pair-covered-uncovered-1.stderr @@ -1,10 +1,9 @@ error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/coherence-pair-covered-uncovered-1.rs:12:1 + --> $DIR/coherence-pair-covered-uncovered-1.rs:12:43 | LL | impl Remote1>> for i32 { } - | ^^^^^^^^^^^--------------------------^^^^^--- - | | | - | | `i32` is not defined in the current crate + | -------------------------- ^^^ `i32` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters diff --git a/tests/ui/coherence/coherence-pair-covered-uncovered.stderr b/tests/ui/coherence/coherence-pair-covered-uncovered.stderr index fa3d170f81d4f..5d35f155373b1 100644 --- a/tests/ui/coherence/coherence-pair-covered-uncovered.stderr +++ b/tests/ui/coherence/coherence-pair-covered-uncovered.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-pair-covered-uncovered.rs:8:1 + --> $DIR/coherence-pair-covered-uncovered.rs:8:22 | LL | impl Remote for Pair> { } - | ^^^^^^^^^^^^^^^^^^^^^---------------- - | | - | `Pair` is not defined in the current crate + | ^^^^^^^^^^^^^^^^ `Pair` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-vec-local-2.stderr b/tests/ui/coherence/coherence-vec-local-2.stderr index cb12275cf01cb..94cf97aee1770 100644 --- a/tests/ui/coherence/coherence-vec-local-2.stderr +++ b/tests/ui/coherence/coherence-vec-local-2.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-vec-local-2.rs:11:1 + --> $DIR/coherence-vec-local-2.rs:11:20 | LL | impl Remote for Vec> { } - | ^^^^^^^^^^^^^^^^^^^------------- - | | - | `Vec` is not defined in the current crate + | ^^^^^^^^^^^^^ `Vec` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence-vec-local.stderr b/tests/ui/coherence/coherence-vec-local.stderr index 9278b9458d56e..c0a2ef2eb00d7 100644 --- a/tests/ui/coherence/coherence-vec-local.stderr +++ b/tests/ui/coherence/coherence-vec-local.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence-vec-local.rs:11:1 + --> $DIR/coherence-vec-local.rs:11:17 | LL | impl Remote for Vec { } - | ^^^^^^^^^^^^^^^^---------- - | | - | `Vec` is not defined in the current crate + | ^^^^^^^^^^ `Vec` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence_local_err_struct.stderr b/tests/ui/coherence/coherence_local_err_struct.stderr index 280dd57bd42d4..ae453e5dcccfe 100644 --- a/tests/ui/coherence/coherence_local_err_struct.stderr +++ b/tests/ui/coherence/coherence_local_err_struct.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/coherence_local_err_struct.rs:14:1 + --> $DIR/coherence_local_err_struct.rs:14:22 | LL | impl lib::MyCopy for lib::MyStruct { } - | ^^^^^^^^^^^^^^^^^^^^^--------------------- - | | - | `MyStruct` is not defined in the current crate + | ^^^^^^^^^^^^^^^^^^^^^ `MyStruct` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/coherence_local_err_tuple.stderr b/tests/ui/coherence/coherence_local_err_tuple.stderr index d07adab0014e2..feadcb7603d54 100644 --- a/tests/ui/coherence/coherence_local_err_tuple.stderr +++ b/tests/ui/coherence/coherence_local_err_tuple.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence_local_err_tuple.rs:14:1 + --> $DIR/coherence_local_err_tuple.rs:14:22 | LL | impl lib::MyCopy for (MyType,) { } - | ^^^^^^^^^^^^^^^^^^^^^--------- - | | - | this is not defined in the current crate because tuples are always foreign + | ^^^^^^^^^ this is not defined in the current crate because tuples are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/impl-foreign-for-box[foreign_local].stderr b/tests/ui/coherence/impl-foreign-for-box[foreign_local].stderr index 26094c7effa9a..67201d1b84e1f 100644 --- a/tests/ui/coherence/impl-foreign-for-box[foreign_local].stderr +++ b/tests/ui/coherence/impl-foreign-for-box[foreign_local].stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/impl-foreign-for-box[foreign_local].rs:24:1 + --> $DIR/impl-foreign-for-box[foreign_local].rs:24:17 | LL | impl Remote for Box {} - | ^^^^^^^^^^^^^^^^--------------- - | | - | `str` is not defined in the current crate + | ^^^^^^^^^^^^^^^ `str` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/impl-foreign-for-foreign.stderr b/tests/ui/coherence/impl-foreign-for-foreign.stderr index 4ff965290c883..5cb5c3c4a7190 100644 --- a/tests/ui/coherence/impl-foreign-for-foreign.stderr +++ b/tests/ui/coherence/impl-foreign-for-foreign.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign-for-foreign.rs:10:1 + --> $DIR/impl-foreign-for-foreign.rs:10:17 | LL | impl Remote for i32 { - | ^^^^^^^^^^^^^^^^--- - | | - | `i32` is not defined in the current crate + | ^^^ `i32` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/impl-foreign-for-foreign[foreign].stderr b/tests/ui/coherence/impl-foreign-for-foreign[foreign].stderr index 8f64d8ae1b2fd..ba7198625d771 100644 --- a/tests/ui/coherence/impl-foreign-for-foreign[foreign].stderr +++ b/tests/ui/coherence/impl-foreign-for-foreign[foreign].stderr @@ -1,10 +1,9 @@ error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign-for-foreign[foreign].rs:10:1 + --> $DIR/impl-foreign-for-foreign[foreign].rs:10:27 | LL | impl Remote1> for i32 { - | ^^^^^----------------^^^^^--- - | | | - | | `i32` is not defined in the current crate + | ---------------- ^^^ `i32` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters @@ -12,12 +11,11 @@ LL | impl Remote1> for i32 { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign-for-foreign[foreign].rs:14:1 + --> $DIR/impl-foreign-for-foreign[foreign].rs:14:29 | LL | impl Remote1> for f64 { - | ^^^^^------------------^^^^^--- - | | | - | | `f64` is not defined in the current crate + | ------------------ ^^^ `f64` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters @@ -25,12 +23,11 @@ LL | impl Remote1> for f64 { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign-for-foreign[foreign].rs:18:1 + --> $DIR/impl-foreign-for-foreign[foreign].rs:18:28 | LL | impl Remote1> for f32 { - | ^^^^^^^^--------------^^^^^--- - | | | - | | `f32` is not defined in the current crate + | -------------- ^^^ `f32` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters diff --git a/tests/ui/coherence/impl-foreign-for-fundamental[foreign].stderr b/tests/ui/coherence/impl-foreign-for-fundamental[foreign].stderr index bdd75df6b77fe..8db648f05316d 100644 --- a/tests/ui/coherence/impl-foreign-for-fundamental[foreign].stderr +++ b/tests/ui/coherence/impl-foreign-for-fundamental[foreign].stderr @@ -1,22 +1,18 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/impl-foreign-for-fundamental[foreign].rs:10:1 + --> $DIR/impl-foreign-for-fundamental[foreign].rs:10:17 | LL | impl Remote for Box { - | ^^^^^^^^^^^^^^^^-------- - | | - | `i32` is not defined in the current crate + | ^^^^^^^^ `i32` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/impl-foreign-for-fundamental[foreign].rs:14:1 + --> $DIR/impl-foreign-for-fundamental[foreign].rs:14:20 | LL | impl Remote for Box> { - | ^^^^^^^^^^^^^^^^^^^---------- - | | - | `Rc` is not defined in the current crate + | ^^^^^^^^^^ `Rc` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/impl-foreign[foreign]-for-foreign.stderr b/tests/ui/coherence/impl-foreign[foreign]-for-foreign.stderr index 0d84c643fca0e..36665594cbc8f 100644 --- a/tests/ui/coherence/impl-foreign[foreign]-for-foreign.stderr +++ b/tests/ui/coherence/impl-foreign[foreign]-for-foreign.stderr @@ -1,10 +1,9 @@ error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign[foreign]-for-foreign.rs:10:1 + --> $DIR/impl-foreign[foreign]-for-foreign.rs:10:23 | LL | impl Remote1 for f64 { - | ^^^^^------------^^^^^--- - | | | - | | `f64` is not defined in the current crate + | ------------ ^^^ `f64` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters diff --git a/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr b/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr index cdc686ad09707..7ee545390e4d2 100644 --- a/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr +++ b/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr @@ -1,10 +1,9 @@ error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:11:1 + --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:11:31 | LL | impl Remote1> for i32 { - | ^^^^^--------------------^^^^^--- - | | | - | | `i32` is not defined in the current crate + | -------------------- ^^^ `i32` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters @@ -12,12 +11,11 @@ LL | impl Remote1> for i32 { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:15:1 + --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:15:32 | LL | impl Remote1>> for f64 { - | ^^^^^---------------------^^^^^--- - | | | - | | `f64` is not defined in the current crate + | --------------------- ^^^ `f64` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters @@ -25,12 +23,11 @@ LL | impl Remote1>> for f64 { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:19:1 + --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:19:33 | LL | impl Remote1>> for f32 { - | ^^^^^^^^-------------------^^^^^--- - | | | - | | `f32` is not defined in the current crate + | ------------------- ^^^ `f32` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters diff --git a/tests/ui/coherence/impl[t]-foreign-for-foreign[t].stderr b/tests/ui/coherence/impl[t]-foreign-for-foreign[t].stderr index 306a5d1610d70..3fae20dcee9d5 100644 --- a/tests/ui/coherence/impl[t]-foreign-for-foreign[t].stderr +++ b/tests/ui/coherence/impl[t]-foreign-for-foreign[t].stderr @@ -1,22 +1,18 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/impl[t]-foreign-for-foreign[t].rs:11:1 + --> $DIR/impl[t]-foreign-for-foreign[t].rs:11:17 | LL | impl Remote for Rc { - | ^^^^^^^^^^^^^^^^--------- - | | - | `Rc` is not defined in the current crate + | ^^^^^^^^^ `Rc` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/impl[t]-foreign-for-foreign[t].rs:16:1 + --> $DIR/impl[t]-foreign-for-foreign[t].rs:16:20 | LL | impl Remote for Arc { - | ^^^^^^^^^^^^^^^^^^^------ - | | - | `Arc` is not defined in the current crate + | ^^^^^^ `Arc` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/coherence/orphan-check-error-reporting-ty-var.stderr b/tests/ui/coherence/orphan-check-error-reporting-ty-var.stderr index 113632c0eecbc..7bd0a3fca24e4 100644 --- a/tests/ui/coherence/orphan-check-error-reporting-ty-var.stderr +++ b/tests/ui/coherence/orphan-check-error-reporting-ty-var.stderr @@ -1,10 +1,9 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/orphan-check-error-reporting-ty-var.rs:14:1 + --> $DIR/orphan-check-error-reporting-ty-var.rs:14:28 | LL | impl From> for as MyTrait>::Item {} - | ^^^^^^^^^-------------^^^^^-------------------------- - | | | - | | `Vec` is not defined in the current crate + | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ `Vec` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters diff --git a/tests/ui/coherence/orphan-foreign-trait-box.rs b/tests/ui/coherence/orphan-foreign-trait-box.rs new file mode 100644 index 0000000000000..c36ca65c4601d --- /dev/null +++ b/tests/ui/coherence/orphan-foreign-trait-box.rs @@ -0,0 +1,7 @@ +//! Regression test for #164592: the primary span and labels of E0117 +//! must not overlap. + +impl Into for Box {} +//~^ ERROR only traits defined in the current crate can be implemented for types defined outside of the crate + +fn main() {} diff --git a/tests/ui/coherence/orphan-foreign-trait-box.stderr b/tests/ui/coherence/orphan-foreign-trait-box.stderr new file mode 100644 index 0000000000000..8838b1d060e33 --- /dev/null +++ b/tests/ui/coherence/orphan-foreign-trait-box.stderr @@ -0,0 +1,15 @@ +error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate + --> $DIR/orphan-foreign-trait-box.rs:4:20 + | +LL | impl Into for Box {} + | --------- ^^^^^^^^ `i32` is not defined in the current crate + | | + | this is not defined in the current crate because this is a foreign trait + | + = note: impl doesn't have any local type before any uncovered type parameters + = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules + = note: define and implement a trait or new type instead + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/tests/ui/field_representing_types/incoherent-impl.next.stderr b/tests/ui/field_representing_types/incoherent-impl.next.stderr index fc9f663ac076e..8c3285b9abee6 100644 --- a/tests/ui/field_representing_types/incoherent-impl.next.stderr +++ b/tests/ui/field_representing_types/incoherent-impl.next.stderr @@ -1,22 +1,18 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/incoherent-impl.rs:23:1 + --> $DIR/incoherent-impl.rs:23:23 | LL | impl ForeignTrait for field_of!(Point, x) {} - | ^^^^^^^^^^^^^^^^^^^^^^------------------- - | | - | `Point` is not defined in the current crate + | ^^^^^^^^^^^^^^^^^^^ `Point` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/incoherent-impl.rs:26:1 + --> $DIR/incoherent-impl.rs:26:23 | LL | impl ForeignTrait for field_of!((usize, usize), 0) {} - | ^^^^^^^^^^^^^^^^^^^^^^---------------------------- - | | - | this is not defined in the current crate because tuples are always foreign + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this is not defined in the current crate because tuples are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/field_representing_types/incoherent-impl.old.stderr b/tests/ui/field_representing_types/incoherent-impl.old.stderr index fc9f663ac076e..8c3285b9abee6 100644 --- a/tests/ui/field_representing_types/incoherent-impl.old.stderr +++ b/tests/ui/field_representing_types/incoherent-impl.old.stderr @@ -1,22 +1,18 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/incoherent-impl.rs:23:1 + --> $DIR/incoherent-impl.rs:23:23 | LL | impl ForeignTrait for field_of!(Point, x) {} - | ^^^^^^^^^^^^^^^^^^^^^^------------------- - | | - | `Point` is not defined in the current crate + | ^^^^^^^^^^^^^^^^^^^ `Point` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/incoherent-impl.rs:26:1 + --> $DIR/incoherent-impl.rs:26:23 | LL | impl ForeignTrait for field_of!((usize, usize), 0) {} - | ^^^^^^^^^^^^^^^^^^^^^^---------------------------- - | | - | this is not defined in the current crate because tuples are always foreign + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this is not defined in the current crate because tuples are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/pin-ergonomics/impl-unpin.tait.stderr b/tests/ui/pin-ergonomics/impl-unpin.tait.stderr index 7fb1c6973834d..468f14487b9c2 100644 --- a/tests/ui/pin-ergonomics/impl-unpin.tait.stderr +++ b/tests/ui/pin-ergonomics/impl-unpin.tait.stderr @@ -1,22 +1,18 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/impl-unpin.rs:50:5 + --> $DIR/impl-unpin.rs:50:20 | LL | impl Unpin for FooAlias {} - | ^^^^^^^^^^^^^^^-------- - | | - | `FooAlias` is not defined in the current crate + | ^^^^^^^^ `FooAlias` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/impl-unpin.rs:52:5 + --> $DIR/impl-unpin.rs:52:20 | LL | impl Unpin for BarAlias {} - | ^^^^^^^^^^^^^^^-------- - | | - | `BarAlias` is not defined in the current crate + | ^^^^^^^^ `BarAlias` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/traits/const-traits/const-and-non-const-impl.stderr b/tests/ui/traits/const-traits/const-and-non-const-impl.stderr index d4cde4ede8b7c..396b1e46815a0 100644 --- a/tests/ui/traits/const-traits/const-and-non-const-impl.stderr +++ b/tests/ui/traits/const-traits/const-and-non-const-impl.stderr @@ -8,12 +8,11 @@ LL | const impl std::ops::Add for Int { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Int` error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/const-and-non-const-impl.rs:5:1 + --> $DIR/const-and-non-const-impl.rs:5:30 | LL | const impl std::ops::Add for i32 { - | ^^^^^^^^^^^-------------^^^^^--- - | | | - | | `i32` is not defined in the current crate + | ------------- ^^^ `i32` is not defined in the current crate + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters diff --git a/tests/ui/traits/trait-implementation-for-non-local-types-67535.stderr b/tests/ui/traits/trait-implementation-for-non-local-types-67535.stderr index ef20f0c60ce19..4d5d635c9981d 100644 --- a/tests/ui/traits/trait-implementation-for-non-local-types-67535.stderr +++ b/tests/ui/traits/trait-implementation-for-non-local-types-67535.stderr @@ -1,10 +1,9 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/trait-implementation-for-non-local-types-67535.rs:4:1 + --> $DIR/trait-implementation-for-non-local-types-67535.rs:4:30 | LL | impl std::ops::AddAssign for () { - | ^^^^^-------------------^^^^^-- - | | | - | | this is not defined in the current crate because tuples are always foreign + | ------------------- ^^ this is not defined in the current crate because tuples are always foreign + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters @@ -12,12 +11,11 @@ LL | impl std::ops::AddAssign for () { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/trait-implementation-for-non-local-types-67535.rs:11:1 + --> $DIR/trait-implementation-for-non-local-types-67535.rs:11:30 | LL | impl std::ops::AddAssign for [(); 1] { - | ^^^^^-------------------^^^^^------- - | | | - | | this is not defined in the current crate because arrays are always foreign + | ------------------- ^^^^^^^ this is not defined in the current crate because arrays are always foreign + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters @@ -25,12 +23,11 @@ LL | impl std::ops::AddAssign for [(); 1] { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/trait-implementation-for-non-local-types-67535.rs:18:1 + --> $DIR/trait-implementation-for-non-local-types-67535.rs:18:30 | LL | impl std::ops::AddAssign for &[u8] { - | ^^^^^-------------------^^^^^----- - | | | - | | this is not defined in the current crate because slices are always foreign + | ------------------- ^^^^^ this is not defined in the current crate because slices are always foreign + | | | this is not defined in the current crate because this is a foreign trait | = note: impl doesn't have any local type before any uncovered type parameters diff --git a/tests/ui/type-alias-impl-trait/coherence/coherence.stderr b/tests/ui/type-alias-impl-trait/coherence/coherence.stderr index ac763d78ff93d..0e99c1d518c3a 100644 --- a/tests/ui/type-alias-impl-trait/coherence/coherence.stderr +++ b/tests/ui/type-alias-impl-trait/coherence/coherence.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence.rs:15:1 + --> $DIR/coherence.rs:15:38 | LL | impl foreign_crate::ForeignTrait for AliasOfForeignType<()> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------- - | | - | `AliasOfForeignType<()>` is not defined in the current crate + | ^^^^^^^^^^^^^^^^^^^^^^ `AliasOfForeignType<()>` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/type/pattern_types/range_patterns_trait_impls2.stderr b/tests/ui/type/pattern_types/range_patterns_trait_impls2.stderr index 4517c7e910f4e..6436b3f45bb50 100644 --- a/tests/ui/type/pattern_types/range_patterns_trait_impls2.stderr +++ b/tests/ui/type/pattern_types/range_patterns_trait_impls2.stderr @@ -1,10 +1,8 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/range_patterns_trait_impls2.rs:12:1 + --> $DIR/range_patterns_trait_impls2.rs:12:13 | LL | impl Eq for Y {} - | ^^^^^^^^^^^^- - | | - | `pattern_type!(u32 is 1..=)` is not defined in the current crate + | ^ `pattern_type!(u32 is 1..=)` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules diff --git a/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr b/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr index c7d714dcb1adb..95e685bdfbec8 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr @@ -1,22 +1,18 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:13:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:13:25 | LL | impl DefaultedTrait for (A,) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^---- - | | - | this is not defined in the current crate because tuples are always foreign + | ^^^^ this is not defined in the current crate because tuples are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:16:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:16:26 | LL | impl !DefaultedTrait for (B,) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^---- - | | - | this is not defined in the current crate because tuples are always foreign + | ^^^^ this is not defined in the current crate because tuples are always foreign | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules @@ -29,12 +25,10 @@ LL | impl DefaultedTrait for Box {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait for type in another crate error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:21:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:21:25 | LL | impl DefaultedTrait for lib::Something {} - | ^^^^^^^^^^^^^^^^^^^^^^^^----------------- - | | - | `Something` is not defined in the current crate + | ^^^^^^^^^^^^^^^^^ `Something` is not defined in the current crate | = note: impl doesn't have any local type before any uncovered type parameters = note: for more information see https://doc.rust-lang.org/reference/items/implementations.html#orphan-rules