-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #67063 - Mark-Simulacrum:beta-backports, r=Mark-Simulacrum
[beta] backports This pull request backports the following pull requests, which have all been beta-accepted by the compiler team. * Handle non_exhaustive in borrow checking #66722 * Do not ICE on trait aliases with missing obligations #66392 * Do not ICE in `if` without `else` in `async fn` #66391 * Fix ICE when trying to suggest `Type<>` instead of `Type()` #66390 * Do not ICE on recovery from unmet associated type bound obligation #66388 * find_deprecation: deprecation attr may be ill-formed meta. #66381 * parser: don't use `unreachable!()` in `fn unexpected`. #66361 * Undo an assert causing an ICE until we fix the underlying problem #66250 * Do not ICE with a precision flag in formatting str and no format arguments #66093 * Fix two OOM issues related to `ConstProp` #66394
- Loading branch information
Showing
29 changed files
with
335 additions
and
38 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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// edition:2018 | ||
async fn f() -> i32 { | ||
if true { //~ ERROR if may be missing an else clause | ||
return 0; | ||
} | ||
// An `if` block without `else` causes the type table not to have a type for this expr. | ||
// Check that we do not unconditionally access the type table and we don't ICE. | ||
} | ||
|
||
fn main() {} |
16 changes: 16 additions & 0 deletions
16
src/test/ui/async-await/issue-66387-if-without-else.stderr
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 @@ | ||
error[E0317]: if may be missing an else clause | ||
--> $DIR/issue-66387-if-without-else.rs:3:5 | ||
| | ||
LL | / if true { | ||
LL | | return 0; | ||
LL | | } | ||
| |_____^ expected (), found i32 | ||
| | ||
= note: expected type `()` | ||
found type `i32` | ||
= note: `if` expressions without `else` evaluate to `()` | ||
= help: consider adding an `else` block that evaluates to the expected type | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0317`. |
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,12 @@ | ||
// check-pass | ||
// only-x86_64 | ||
|
||
// Checks that the compiler does not actually try to allocate 4 TB during compilation and OOM crash. | ||
|
||
fn foo() -> [u8; 4 * 1024 * 1024 * 1024 * 1024] { | ||
unimplemented!() | ||
} | ||
|
||
fn main() { | ||
foo(); | ||
} |
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,8 @@ | ||
// check-pass | ||
// only-x86_64 | ||
|
||
// Checks that the compiler does not actually try to allocate 4 TB during compilation and OOM crash. | ||
|
||
fn main() { | ||
[0; 4 * 1024 * 1024 * 1024 * 1024]; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs
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,11 @@ | ||
// The original problem in #66340 was that `find_deprecation_generic` | ||
// called `attr.meta().unwrap()` under the assumption that the attribute | ||
// was a well-formed `MetaItem`. | ||
|
||
fn main() { | ||
foo() | ||
} | ||
|
||
#[deprecated(note = test)] | ||
//~^ ERROR expected unsuffixed literal or identifier, found `test` | ||
fn foo() {} |
8 changes: 8 additions & 0 deletions
8
src/test/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr
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,8 @@ | ||
error: expected unsuffixed literal or identifier, found `test` | ||
--> $DIR/issue-66340-deprecated-attr-non-meta-grammar.rs:9:21 | ||
| | ||
LL | #[deprecated(note = test)] | ||
| ^^^^ | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// build-pass | ||
|
||
enum Empty {} | ||
enum Enum { | ||
Empty( Empty ) | ||
} | ||
|
||
fn foobar() -> Option< Enum > { | ||
let value: Option< Empty > = None; | ||
Some( Enum::Empty( value? ) ) | ||
} | ||
|
||
fn main() { | ||
foobar(); | ||
} |
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,12 @@ | ||
#![feature(trait_alias)] // Enabled to reduce stderr output, but can be triggered even if disabled. | ||
trait Trait {} | ||
trait WithType { | ||
type Ctx; | ||
} | ||
trait Alias<T> = where T: Trait; | ||
|
||
impl<T> WithType for T { | ||
type Ctx = dyn Alias<T>; | ||
//~^ ERROR the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time | ||
} | ||
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,17 @@ | ||
error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time | ||
--> $DIR/issue-65673.rs:9:5 | ||
| | ||
LL | type Ctx; | ||
| --- associated type defined here | ||
... | ||
LL | impl<T> WithType for T { | ||
| ---------------------- in this `impl` item | ||
LL | type Ctx = dyn Alias<T>; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | ||
| | ||
= help: the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)` | ||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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,15 @@ | ||
// #66353: ICE when trying to recover from incorrect associated type | ||
|
||
trait _Func<T> { | ||
fn func(_: Self); | ||
} | ||
|
||
trait _A { | ||
type AssocT; | ||
} | ||
|
||
fn main() { | ||
_Func::< <() as _A>::AssocT >::func(()); | ||
//~^ ERROR the trait bound `(): _A` is not satisfied | ||
//~| ERROR the trait bound `(): _Func<_>` is not satisfied | ||
} |
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,18 @@ | ||
error[E0277]: the trait bound `(): _A` is not satisfied | ||
--> $DIR/issue-66353.rs:12:14 | ||
| | ||
LL | _Func::< <() as _A>::AssocT >::func(()); | ||
| ^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()` | ||
|
||
error[E0277]: the trait bound `(): _Func<_>` is not satisfied | ||
--> $DIR/issue-66353.rs:12:41 | ||
| | ||
LL | fn func(_: Self); | ||
| ----------------- required by `_Func::func` | ||
... | ||
LL | _Func::< <() as _A>::AssocT >::func(()); | ||
| ^^ the trait `_Func<_>` is not implemented for `()` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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,14 @@ | ||
// The problem in #66357 was that the call trace: | ||
// | ||
// - parse_fn_block_decl | ||
// - expect_or | ||
// - unexpected | ||
// - expect_one_of | ||
// - expected_one_of_not_found | ||
// - recover_closing_delimiter | ||
// | ||
// ended up bubbling up `Ok(true)` to `unexpected` which then used `unreachable!()`. | ||
|
||
fn f() { |[](* } | ||
//~^ ERROR expected one of `,` or `:`, found `(` | ||
//~| ERROR expected one of `)`, `-`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*` |
Oops, something went wrong.