forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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 rust-lang#118492 - cuviper:beta-next, r=cuviper
[beta] backports - Build pre-coroutine-transform coroutine body rust-lang#117686 - Fix coroutine validation for mixed panic strategy rust-lang#118422 - ConstProp: Remove const when rvalue check fails. rust-lang#118426 - Dispose llvm::TargetMachines prior to llvm::Context being disposed rust-lang#118464 r? ghost
- Loading branch information
Showing
13 changed files
with
145 additions
and
29 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
26 changes: 26 additions & 0 deletions
26
tests/mir-opt/const_prop/overwrite_with_const_with_params.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,26 @@ | ||
// unit-test: ConstProp | ||
// compile-flags: -O | ||
|
||
// Regression test for https://github.com/rust-lang/rust/issues/118328 | ||
|
||
#![allow(unused_assignments)] | ||
|
||
struct SizeOfConst<T>(std::marker::PhantomData<T>); | ||
impl<T> SizeOfConst<T> { | ||
const SIZE: usize = std::mem::size_of::<T>(); | ||
} | ||
|
||
// EMIT_MIR overwrite_with_const_with_params.size_of.ConstProp.diff | ||
fn size_of<T>() -> usize { | ||
// CHECK-LABEL: fn size_of( | ||
// CHECK: _1 = const 0_usize; | ||
// CHECK-NEXT: _1 = const _; | ||
// CHECK-NEXT: _0 = _1; | ||
let mut a = 0; | ||
a = SizeOfConst::<T>::SIZE; | ||
a | ||
} | ||
|
||
fn main() { | ||
assert_eq!(size_of::<u32>(), std::mem::size_of::<u32>()); | ||
} |
20 changes: 20 additions & 0 deletions
20
tests/mir-opt/const_prop/overwrite_with_const_with_params.size_of.ConstProp.diff
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 @@ | ||
- // MIR for `size_of` before ConstProp | ||
+ // MIR for `size_of` after ConstProp | ||
|
||
fn size_of() -> usize { | ||
let mut _0: usize; | ||
let mut _1: usize; | ||
scope 1 { | ||
debug a => _1; | ||
} | ||
|
||
bb0: { | ||
StorageLive(_1); | ||
_1 = const 0_usize; | ||
_1 = const _; | ||
_0 = _1; | ||
StorageDead(_1); | ||
return; | ||
} | ||
} | ||
|
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,21 @@ | ||
// compile-flags: -O | ||
// run-pass | ||
|
||
// Regression test for https://github.com/rust-lang/rust/issues/118328 | ||
|
||
#![allow(unused_assignments)] | ||
|
||
struct SizeOfConst<T>(std::marker::PhantomData<T>); | ||
impl<T> SizeOfConst<T> { | ||
const SIZE: usize = std::mem::size_of::<T>(); | ||
} | ||
|
||
fn size_of<T>() -> usize { | ||
let mut a = 0; | ||
a = SizeOfConst::<T>::SIZE; | ||
a | ||
} | ||
|
||
fn main() { | ||
assert_eq!(size_of::<u32>(), std::mem::size_of::<u32>()); | ||
} |
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 @@ | ||
// compile-flags: -Cpanic=unwind --crate-type=lib | ||
// no-prefer-dynamic | ||
// edition:2021 | ||
|
||
#![feature(coroutines)] | ||
pub fn run<T>(a: T) { | ||
let _ = move || { | ||
drop(a); | ||
yield; | ||
}; | ||
} |
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,13 @@ | ||
// Ensure that coroutine drop glue is valid when mixing different panic | ||
// strategies. Regression test for #116953. | ||
// | ||
// no-prefer-dynamic | ||
// build-pass | ||
// aux-build:unwind-aux.rs | ||
// compile-flags: -Cpanic=abort | ||
// needs-unwind | ||
extern crate unwind_aux; | ||
|
||
pub fn main() { | ||
unwind_aux::run(String::new()); | ||
} |
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 @@ | ||
// edition: 2021 | ||
|
||
async fn asyncfn() { | ||
let binding = match true {}; | ||
//~^ ERROR non-exhaustive patterns: type `bool` is non-empty | ||
} | ||
|
||
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[E0004]: non-exhaustive patterns: type `bool` is non-empty | ||
--> $DIR/build-async-error-body-correctly.rs:4:25 | ||
| | ||
LL | let binding = match true {}; | ||
| ^^^^ | ||
| | ||
= note: the matched value is of type `bool` | ||
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern as shown | ||
| | ||
LL ~ let binding = match true { | ||
LL + _ => todo!(), | ||
LL ~ }; | ||
| | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0004`. |