-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #80417 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backports This backports the following to 1.49: * Revert change to trait evaluation order #80132 * Don't allow `const` to begin a nonterminal #80135 * Prevent caching normalization results with a cycle #80246 r? `@Mark-Simulacrum`
- Loading branch information
Showing
16 changed files
with
220 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
error[E0271]: type mismatch resolving `<bool as Tr>::B == _` | ||
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B == _` | ||
--> $DIR/defaults-cyclic-fail-1.rs:26:5 | ||
| | ||
LL | type A = Box<Self::B>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0271]: type mismatch resolving `<usize as Tr>::A == _` | ||
error[E0275]: overflow evaluating the requirement `<usize as Tr>::A == _` | ||
--> $DIR/defaults-cyclic-fail-1.rs:32:5 | ||
| | ||
LL | type B = &'static Self::A; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0271`. | ||
For more information about this error, try `rustc --explain E0275`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
error[E0271]: type mismatch resolving `<bool as Tr>::B == _` | ||
error[E0275]: overflow evaluating the requirement `<bool as Tr>::B == _` | ||
--> $DIR/defaults-cyclic-fail-2.rs:27:5 | ||
| | ||
LL | type A = Box<Self::B>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error[E0271]: type mismatch resolving `<usize as Tr>::A == _` | ||
error[E0275]: overflow evaluating the requirement `<usize as Tr>::A == _` | ||
--> $DIR/defaults-cyclic-fail-2.rs:33:5 | ||
| | ||
LL | type B = &'static Self::A; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0271`. | ||
For more information about this error, try `rustc --explain E0275`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Regression test for #79714 | ||
|
||
trait Baz {} | ||
impl Baz for () {} | ||
impl<T> Baz for (T,) {} | ||
|
||
trait Fiz {} | ||
impl Fiz for bool {} | ||
|
||
trait Grault { | ||
type A; | ||
type B; | ||
} | ||
|
||
impl<T: Grault> Grault for (T,) | ||
where | ||
Self::A: Baz, | ||
Self::B: Fiz, | ||
{ | ||
type A = (); | ||
//~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` | ||
type B = bool; | ||
//~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` | ||
} | ||
//~^^^^^^^^^^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` | ||
|
||
fn main() { | ||
let x: <(_,) as Grault>::A = (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` | ||
--> $DIR/impl-wf-cycle-1.rs:15:1 | ||
| | ||
LL | / impl<T: Grault> Grault for (T,) | ||
LL | | where | ||
LL | | Self::A: Baz, | ||
LL | | Self::B: Fiz, | ||
... | | ||
LL | | | ||
LL | | } | ||
| |_^ | ||
| | ||
= note: required because of the requirements on the impl of `Grault` for `(T,)` | ||
= note: required because of the requirements on the impl of `Grault` for `(T,)` | ||
|
||
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` | ||
--> $DIR/impl-wf-cycle-1.rs:20:5 | ||
| | ||
LL | type A = (); | ||
| ^^^^^^^^^^^^ | ||
| | ||
= note: required because of the requirements on the impl of `Grault` for `(T,)` | ||
= note: required because of the requirements on the impl of `Grault` for `(T,)` | ||
|
||
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` | ||
--> $DIR/impl-wf-cycle-1.rs:22:5 | ||
| | ||
LL | type B = bool; | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: required because of the requirements on the impl of `Grault` for `(T,)` | ||
= note: required because of the requirements on the impl of `Grault` for `(T,)` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0275`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Regression test for #79714 | ||
|
||
trait Grault { | ||
type A; | ||
} | ||
|
||
impl<T: Grault> Grault for (T,) | ||
where | ||
Self::A: Copy, | ||
{ | ||
type A = (); | ||
//~^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` | ||
} | ||
//~^^^^^^^ ERROR overflow evaluating the requirement `<(T,) as Grault>::A == _` | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` | ||
--> $DIR/impl-wf-cycle-2.rs:7:1 | ||
| | ||
LL | / impl<T: Grault> Grault for (T,) | ||
LL | | where | ||
LL | | Self::A: Copy, | ||
LL | | { | ||
LL | | type A = (); | ||
LL | | | ||
LL | | } | ||
| |_^ | ||
| | ||
= note: required because of the requirements on the impl of `Grault` for `(T,)` | ||
|
||
error[E0275]: overflow evaluating the requirement `<(T,) as Grault>::A == _` | ||
--> $DIR/impl-wf-cycle-2.rs:11:5 | ||
| | ||
LL | type A = (); | ||
| ^^^^^^^^^^^^ | ||
| | ||
= note: required because of the requirements on the impl of `Grault` for `(T,)` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0275`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// check-pass | ||
|
||
macro_rules! exp { | ||
(const $n:expr) => { | ||
$n | ||
}; | ||
} | ||
|
||
macro_rules! stmt { | ||
(exp $e:expr) => { | ||
$e | ||
}; | ||
(exp $($t:tt)+) => { | ||
exp!($($t)+) | ||
}; | ||
} | ||
|
||
fn main() { | ||
stmt!(exp const 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Regression test for #79902 | ||
|
||
// Check that evaluation (which is used to determine whether to copy a type in | ||
// MIR building) evaluates bounds from normalizing an impl after evaluating | ||
// any bounds on the impl. | ||
|
||
// check-pass | ||
|
||
trait A { | ||
type B; | ||
} | ||
trait M {} | ||
|
||
struct G<T, U>(*const T, *const U); | ||
|
||
impl<T, U> Clone for G<T, U> { | ||
fn clone(&self) -> Self { | ||
G { ..*self } | ||
} | ||
} | ||
|
||
impl<T, U> Copy for G<T, U::B> | ||
where | ||
T: A<B = U>, | ||
U: A, | ||
{ | ||
} | ||
|
||
impl A for () { | ||
type B = (); | ||
} | ||
|
||
fn is_m<T: M>(_: T) {} | ||
|
||
fn main() { | ||
let x = G(&(), &()); | ||
drop(x); | ||
drop(x); | ||
} |