Skip to content

Commit d82419b

Browse files
authored
Rollup merge of #83954 - estebank:issue-83613, r=varkor
Do not ICE when closure is involved in Trait Alias Impl Trait Fix #83613.
2 parents d7d42cc + 18cf44b commit d82419b

File tree

64 files changed

+125
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+125
-84
lines changed

compiler/rustc_trait_selection/src/traits/coherence.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,11 @@ fn ty_is_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> bool {
586586
false
587587
}
588588

589+
ty::Closure(..) => {
590+
// Similar to the `Opaque` case (#83613).
591+
false
592+
}
593+
589594
ty::Dynamic(ref tt, ..) => {
590595
if let Some(principal) = tt.principal() {
591596
def_id_is_local(principal.def_id(), in_crate)
@@ -596,7 +601,7 @@ fn ty_is_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> bool {
596601

597602
ty::Error(_) => true,
598603

599-
ty::Closure(..) | ty::Generator(..) | ty::GeneratorWitness(..) => {
604+
ty::Generator(..) | ty::GeneratorWitness(..) => {
600605
bug!("ty_is_local invoked on unexpected type: {:?}", ty)
601606
}
602607
}

compiler/rustc_trait_selection/src/traits/specialize/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,14 @@ fn report_conflicting_impls(
395395
// that's passed in.
396396
let decorate = |err: LintDiagnosticBuilder<'_>| {
397397
let msg = format!(
398-
"conflicting implementations of trait `{}`{}:{}",
398+
"conflicting implementations of trait `{}`{}{}",
399399
overlap.trait_desc,
400400
overlap
401401
.self_desc
402402
.clone()
403403
.map_or_else(String::new, |ty| { format!(" for type `{}`", ty) }),
404404
match used_to_be_allowed {
405-
Some(FutureCompatOverlapErrorKind::Issue33140) => " (E0119)",
405+
Some(FutureCompatOverlapErrorKind::Issue33140) => ": (E0119)",
406406
_ => "",
407407
}
408408
);

src/test/ui/associated-types/associated-types-coherence-failure.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Cow<'_, _>`:
1+
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Cow<'_, _>`
22
--> $DIR/associated-types-coherence-failure.rs:21:1
33
|
44
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
@@ -7,7 +7,7 @@ LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwn
77
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>`
99

10-
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_`:
10+
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_`
1111
--> $DIR/associated-types-coherence-failure.rs:28:1
1212
|
1313
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {

src/test/ui/async-await/issue-67651.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0119]: conflicting implementations of trait `From` for type `()`:
1+
error[E0119]: conflicting implementations of trait `From` for type `()`
22
--> $DIR/issue-67651.rs:11:1
33
|
44
LL | impl From for () {

src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0119]: conflicting implementations of trait `MyTrait`:
1+
error[E0119]: conflicting implementations of trait `MyTrait`
22
--> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:24:1
33
|
44
LL | impl<T:Even> MyTrait for T {

src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0119]: conflicting implementations of trait `MyTrait`:
1+
error[E0119]: conflicting implementations of trait `MyTrait`
22
--> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:20:1
33
|
44
LL | impl<T:Even> MyTrait for T {

src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`:
1+
error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`
22
--> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:15:1
33
|
44
LL | impl GoMut for MyThingy {

src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0119]: conflicting implementations of trait `MyTrait<MyType>` for type `MyType`:
1+
error[E0119]: conflicting implementations of trait `MyTrait<MyType>` for type `MyType`
22
--> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:22:1
33
|
44
LL | impl<T> MyTrait<T> for T {

src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`:
1+
error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`
22
--> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:20:1
33
|
44
LL | impl<T:OtherTrait> MyTrait for T {

src/test/ui/coherence/coherence-blanket-conflicts-with-specific.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`:
1+
error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`
22
--> $DIR/coherence-blanket-conflicts-with-specific.rs:19:1
33
|
44
LL | impl<T> MyTrait for T {

0 commit comments

Comments
 (0)