Skip to content

Commit 03cabe7

Browse files
committed
bless more than merely diagnostics change
1 parent 1c1372c commit 03cabe7

15 files changed

Lines changed: 145 additions & 268 deletions

tests/crashes/101557.rs

Lines changed: 0 additions & 42 deletions
This file was deleted.

tests/crashes/119692.rs

Lines changed: 0 additions & 48 deletions
This file was deleted.

tests/crashes/136859.rs

Lines changed: 0 additions & 27 deletions
This file was deleted.

tests/ui/traits/next-solver/object-projection-with-unsatisfied-bound-2.rs renamed to tests/crashes/155761-1.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
//@ revisions: current next
2-
//@[next] compile-flags: -Znext-solver
3-
//@ ignore-compare-mode-next-solver (explicit revisions)
1+
//@ known-bug: #155761
2+
//@compile-flags: -Znext-solver
43

54
// A regression test for https://github.com/rust-lang/rust/issues/151329.
65
// Ensures we do not trigger an ICE when normalization fails for a
76
// projection on a trait object, even if the projection has the same
87
// trait id as the object's bound.
98

9+
// ICE again after moving to eager normalization in the next solver.
10+
// #155761 has a simplified variant which causes ICE without eager normalization.
11+
1012
trait Foo {
1113
type V;
1214
}
@@ -18,12 +20,8 @@ struct Bar<T: Foo + ?Sized> {
1820
}
1921

2022
impl<T: Foo> Bar<dyn Callback<T>> {
21-
//~^ ERROR: the trait bound `(dyn Callback<T> + 'static): Foo` is not satisfied
2223
fn event(&self) {
23-
//~^ ERROR: the trait bound `(dyn Callback<T> + 'static): Foo` is not satisfied
2424
(self.callback)(any(), any());
25-
//~^ ERROR: the trait bound `(dyn Callback<T> + 'static): Foo` is not satisfied
26-
//~| ERROR: expected function
2725
}
2826
}
2927

tests/ui/const-generics/issues/issue-89304.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
//@ check-pass
2-
31
#![feature(generic_const_exprs)]
42
#![allow(incomplete_features)]
53

64
struct GenericStruct<const T: usize> { val: i64 }
75

86
impl<const T: usize> From<GenericStruct<T>> for GenericStruct<{T + 1}> {
7+
//~^ ERROR: conflicting implementations of trait `From<GenericStruct<_>>` for type `GenericStruct<_>`
98
fn from(other: GenericStruct<T>) -> Self {
109
Self { val: other.val }
1110
}
1211
}
1312

1413
impl<const T: usize> From<GenericStruct<{T + 1}>> for GenericStruct<T> {
14+
//~^ ERROR: conflicting implementations of trait `From<GenericStruct<_>>` for type `GenericStruct<_>`
1515
fn from(other: GenericStruct<{T + 1}>) -> Self {
1616
Self { val: other.val }
1717
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0119]: conflicting implementations of trait `From<GenericStruct<_>>` for type `GenericStruct<_>`
2+
--> $DIR/issue-89304.rs:6:1
3+
|
4+
LL | impl<const T: usize> From<GenericStruct<T>> for GenericStruct<{T + 1}> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: conflicting implementation in crate `core`:
8+
- impl<T> From<T> for T;
9+
10+
error[E0119]: conflicting implementations of trait `From<GenericStruct<_>>` for type `GenericStruct<_>`
11+
--> $DIR/issue-89304.rs:13:1
12+
|
13+
LL | impl<const T: usize> From<GenericStruct<{T + 1}>> for GenericStruct<T> {
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: conflicting implementation in crate `core`:
17+
- impl<T> From<T> for T;
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0119`.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//@compile-flags: -Znext-solver
2+
3+
// Regression test for #151308
4+
5+
#![feature(lazy_type_alias)]
6+
trait Trait {
7+
type Associated;
8+
}
9+
10+
trait Generic<T> {}
11+
12+
type TraitObject = dyn Generic<<i32 as Trait>::Associated>;
13+
//~^ ERROR: the trait bound `i32: Trait` is not satisfied
14+
15+
struct Wrap(TraitObject);
16+
//~^ ERROR: the trait bound `i32: Trait` is not satisfied
17+
18+
fn cast(x: *mut Wrap) {
19+
x as *mut Wrap;
20+
}
21+
22+
fn main() {}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error[E0277]: the trait bound `i32: Trait` is not satisfied
2+
--> $DIR/dont-ice-on-normalization-failure.rs:12:32
3+
|
4+
LL | type TraitObject = dyn Generic<<i32 as Trait>::Associated>;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `i32`
6+
|
7+
help: this trait has no implementations, consider adding one
8+
--> $DIR/dont-ice-on-normalization-failure.rs:6:1
9+
|
10+
LL | trait Trait {
11+
| ^^^^^^^^^^^
12+
13+
error[E0277]: the trait bound `i32: Trait` is not satisfied
14+
--> $DIR/dont-ice-on-normalization-failure.rs:15:13
15+
|
16+
LL | struct Wrap(TraitObject);
17+
| ^^^^^^^^^^^ the trait `Trait` is not implemented for `i32`
18+
|
19+
help: this trait has no implementations, consider adding one
20+
--> $DIR/dont-ice-on-normalization-failure.rs:6:1
21+
|
22+
LL | trait Trait {
23+
| ^^^^^^^^^^^
24+
25+
error: aborting due to 2 previous errors
26+
27+
For more information about this error, try `rustc --explain E0277`.

tests/ui/traits/next-solver/object-projection-with-unsatisfied-bound-2.current.stderr

Lines changed: 0 additions & 58 deletions
This file was deleted.

tests/ui/traits/next-solver/object-projection-with-unsatisfied-bound-2.next.stderr

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)