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#78162 - GuillaumeGomez:rollup-6a4qiqu, r=Guil…
…laumeGomez Rollup of 9 pull requests Successful merges: - rust-lang#78046 (Add codegen test for issue rust-lang#73827) - rust-lang#78061 (Optimize const value interning for ZST types) - rust-lang#78070 (we can test std and core panic macros together) - rust-lang#78076 (Move orphan module-name/mod.rs files into module-name.rs files) - rust-lang#78129 (Wrapping intrinsics doc links update.) - rust-lang#78133 (Add some MIR-related regression tests) - rust-lang#78144 (Don't update `entries` in `TypedArena` if T does not need drop) - rust-lang#78145 (Drop unneeded `mut`) - rust-lang#78157 (Remove unused type from librustdoc) Failed merges: r? `@ghost`
- Loading branch information
Showing
22 changed files
with
242 additions
and
90 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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
18 changes: 18 additions & 0 deletions
18
src/test/codegen/issue-73827-bounds-check-index-in-subexpr.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,18 @@ | ||
// This test checks that bounds checks are elided when | ||
// index is part of a (x | y) < C style condition | ||
|
||
// min-llvm-version: 11.0.0 | ||
// compile-flags: -O | ||
|
||
#![crate_type = "lib"] | ||
|
||
// CHECK-LABEL: @get | ||
#[no_mangle] | ||
pub fn get(array: &[u8; 8], x: usize, y: usize) -> u8 { | ||
if x > 7 || y > 7 { | ||
0 | ||
} else { | ||
// CHECK-NOT: panic_bounds_check | ||
array[y] | ||
} | ||
} |
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,11 +1,26 @@ | ||
#![feature(const_panic)] | ||
#![crate_type = "lib"] | ||
|
||
pub const Z: () = panic!("cheese"); | ||
const Z: () = std::panic!("cheese"); | ||
//~^ ERROR any use of this value will cause an error | ||
|
||
pub const Y: () = unreachable!(); | ||
const Z2: () = std::panic!(); | ||
//~^ ERROR any use of this value will cause an error | ||
|
||
pub const X: () = unimplemented!(); | ||
const Y: () = std::unreachable!(); | ||
//~^ ERROR any use of this value will cause an error | ||
|
||
const X: () = std::unimplemented!(); | ||
//~^ ERROR any use of this value will cause an error | ||
|
||
const Z_CORE: () = core::panic!("cheese"); | ||
//~^ ERROR any use of this value will cause an error | ||
|
||
const Z2_CORE: () = core::panic!(); | ||
//~^ ERROR any use of this value will cause an error | ||
|
||
const Y_CORE: () = core::unreachable!(); | ||
//~^ ERROR any use of this value will cause an error | ||
|
||
const X_CORE: () = core::unimplemented!(); | ||
//~^ ERROR any use of this value will cause an 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,83 @@ | ||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:4:19 | ||
--> $DIR/const_panic.rs:4:15 | ||
| | ||
LL | pub const Z: () = panic!("cheese"); | ||
| ------------------^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:4:19 | ||
LL | const Z: () = std::panic!("cheese"); | ||
| --------------^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:4:15 | ||
| | ||
= note: `#[deny(const_err)]` on by default | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:7:19 | ||
--> $DIR/const_panic.rs:7:16 | ||
| | ||
LL | pub const Y: () = unreachable!(); | ||
| ------------------^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:7:19 | ||
LL | const Z2: () = std::panic!(); | ||
| ---------------^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:7:16 | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:10:19 | ||
--> $DIR/const_panic.rs:10:15 | ||
| | ||
LL | pub const X: () = unimplemented!(); | ||
| ------------------^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:10:19 | ||
LL | const Y: () = std::unreachable!(); | ||
| --------------^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:10:15 | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 3 previous errors | ||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:13:15 | ||
| | ||
LL | const X: () = std::unimplemented!(); | ||
| --------------^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:13:15 | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:16:20 | ||
| | ||
LL | const Z_CORE: () = core::panic!("cheese"); | ||
| -------------------^^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:16:20 | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:19:21 | ||
| | ||
LL | const Z2_CORE: () = core::panic!(); | ||
| --------------------^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:19:21 | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:22:20 | ||
| | ||
LL | const Y_CORE: () = core::unreachable!(); | ||
| -------------------^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:22:20 | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:25:20 | ||
| | ||
LL | const X_CORE: () = core::unimplemented!(); | ||
| -------------------^^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:25:20 | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 8 previous errors | ||
|
This file was deleted.
Oops, something went wrong.
File renamed without changes.
12 changes: 6 additions & 6 deletions
12
...sts/const-eval/const_panic_libcore.stderr → ...const-eval/const_panic_libcore_bin.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
33 changes: 0 additions & 33 deletions
33
src/test/ui/consts/const-eval/const_panic_libcore_main.stderr
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
// build-pass | ||
|
||
fn main() { | ||
println!("{}", [(); std::usize::MAX].len()); | ||
} |
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 @@ | ||
// edition:2018 | ||
// compile-flags: -Z mir-opt-level=2 -Z unsound-mir-opts | ||
|
||
#[inline(always)] | ||
pub fn f(s: bool) -> String { | ||
let a = "Hello world!".to_string(); | ||
let b = a; | ||
let c = b; | ||
if s { | ||
c | ||
} else { | ||
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,15 @@ | ||
// compile-flags: -Z mir-opt-level=2 | ||
// edition:2018 | ||
// build-pass | ||
|
||
#![feature(async_closure)] | ||
|
||
use std::future::Future; | ||
|
||
fn async_closure() -> impl Future<Output = u8> { | ||
(async move || -> u8 { 42 })() | ||
} | ||
|
||
fn main() { | ||
let _fut = async_closure(); | ||
} |
Oops, something went wrong.