Merge branch 'master' into issue-69276
This commit is contained in:
commit
2f311b07c8
589 changed files with 7983 additions and 3099 deletions
9
src/test/codegen/target-feature-multiple.rs
Normal file
9
src/test/codegen/target-feature-multiple.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// only-x86_64
|
||||
// compile-flags: -C target-feature=+sse2,-avx,+avx2 -C target-feature=+avx,-avx2
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#[no_mangle]
|
||||
pub fn foo() {
|
||||
// CHECK: attributes #0 = { {{.*}}"target-features"="+sse2,-avx,+avx2,+avx,-avx2"{{.*}} }
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// revisions:cfail1
|
||||
#![feature(const_generics)]
|
||||
//[cfail1]~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//[cfail1]~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
struct S<T, const N: usize>([T; N]);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// revisions:cfail1
|
||||
#![feature(const_generics)]
|
||||
//[cfail1]~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//[cfail1]~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
fn combinator<T, const S: usize>() -> [T; S] {}
|
||||
//[cfail1]~^ ERROR mismatched types
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ fn main() -> () {
|
|||
_1 = const b"foo"; // scope 0 at $DIR/byte_slice.rs:5:13: 5:19
|
||||
// ty::Const
|
||||
// + ty: &[u8; 3]
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/byte_slice.rs:5:13: 5:19
|
||||
// + literal: Const { ty: &[u8; 3], val: Value(Scalar(alloc0+0x0)) }
|
||||
// + literal: Const { ty: &[u8; 3], val: Value(Scalar(alloc0)) }
|
||||
StorageLive(_2); // scope 1 at $DIR/byte_slice.rs:6:9: 6:10
|
||||
_2 = [const 5u8, const 120u8]; // scope 1 at $DIR/byte_slice.rs:6:13: 6:24
|
||||
// ty::Const
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ promoted[0] in BAR: &[&i32; 1] = {
|
|||
let mut _3: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
|
||||
bb0: {
|
||||
_3 = const {alloc0+0x0: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
_3 = const {alloc0: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc0+0x0)) }
|
||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc0)) }
|
||||
_2 = _3; // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||
_1 = [move _2]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
_0 = &_1; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
|
|
|
|||
|
|
@ -16,16 +16,16 @@
|
|||
- StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||
- StorageLive(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
- _5 = const {alloc0+0x0: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
- _5 = const {alloc0: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
+ _6 = const BAR::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
// ty::Const
|
||||
- // + ty: &i32
|
||||
- // + val: Value(Scalar(alloc0+0x0))
|
||||
- // + val: Value(Scalar(alloc0))
|
||||
+ // + ty: &[&i32; 1]
|
||||
+ // + val: Unevaluated(DefId(0:6 ~ const_promotion_extern_static[317d]::BAR[0]), [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
|
||||
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc0+0x0)) }
|
||||
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc0)) }
|
||||
- _4 = &(*_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
|
||||
- _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
- _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ promoted[0] in FOO: &[&i32; 1] = {
|
|||
}
|
||||
|
||||
bb0: {
|
||||
_3 = const {alloc2+0x0: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
_3 = const {alloc2: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Value(Scalar(alloc2+0x0))
|
||||
// + val: Value(Scalar(alloc2))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc2+0x0)) }
|
||||
// + literal: Const { ty: &i32, val: Value(Scalar(alloc2)) }
|
||||
_2 = _3; // scope 0 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
|
||||
_1 = [move _2]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
_0 = &_1; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
|
|
|
|||
|
|
@ -18,16 +18,16 @@
|
|||
- StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
|
||||
- StorageLive(_5); // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
- _5 = const {alloc2+0x0: &i32}; // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
- _5 = const {alloc2: &i32}; // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
+ _6 = const FOO::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
// ty::Const
|
||||
- // + ty: &i32
|
||||
- // + val: Value(Scalar(alloc2+0x0))
|
||||
- // + val: Value(Scalar(alloc2))
|
||||
+ // + ty: &[&i32; 1]
|
||||
+ // + val: Unevaluated(DefId(0:7 ~ const_promotion_extern_static[317d]::FOO[0]), [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/const-promotion-extern-static.rs:13:42: 13:43
|
||||
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc2+0x0)) }
|
||||
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc2)) }
|
||||
- _4 = &(*_5); // scope 1 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
|
||||
- _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
- _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ fn main() -> () {
|
|||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
StorageLive(_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
_2 = const {alloc0+0x0: &&[(std::option::Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
_2 = const {alloc0: &&[(std::option::Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
// ty::Const
|
||||
// + ty: &&[(std::option::Option<i32>, &[&str])]
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation.rs:8:5: 8:8
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc0+0x0)) }
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc0)) }
|
||||
_1 = (*_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
StorageDead(_2); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
|
||||
StorageDead(_1); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
|
||||
|
|
@ -30,19 +30,19 @@ fn main() -> () {
|
|||
}
|
||||
|
||||
alloc0 (static: FOO, size: 8, align: 4) {
|
||||
╾─a17+0x0─╼ 03 00 00 00 │ ╾──╼....
|
||||
╾─alloc17─╼ 03 00 00 00 │ ╾──╼....
|
||||
}
|
||||
|
||||
alloc17 (size: 48, align: 4) {
|
||||
0x00 │ 00 00 00 00 __ __ __ __ ╾─a4+0x0──╼ 00 00 00 00 │ ....░░░░╾──╼....
|
||||
0x10 │ 00 00 00 00 __ __ __ __ ╾─a8+0x0──╼ 02 00 00 00 │ ....░░░░╾──╼....
|
||||
0x20 │ 01 00 00 00 2a 00 00 00 ╾─a13+0x0─╼ 03 00 00 00 │ ....*...╾──╼....
|
||||
0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc4──╼ 00 00 00 00 │ ....░░░░╾──╼....
|
||||
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc8──╼ 02 00 00 00 │ ....░░░░╾──╼....
|
||||
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc13─╼ 03 00 00 00 │ ....*...╾──╼....
|
||||
}
|
||||
|
||||
alloc4 (size: 0, align: 4) {}
|
||||
|
||||
alloc8 (size: 16, align: 4) {
|
||||
╾─a7+0x0──╼ 03 00 00 00 ╾─a9+0x0──╼ 03 00 00 00 │ ╾──╼....╾──╼....
|
||||
╾─alloc7──╼ 03 00 00 00 ╾─alloc9──╼ 03 00 00 00 │ ╾──╼....╾──╼....
|
||||
}
|
||||
|
||||
alloc7 (size: 3, align: 1) {
|
||||
|
|
@ -54,8 +54,8 @@ alloc9 (size: 3, align: 1) {
|
|||
}
|
||||
|
||||
alloc13 (size: 24, align: 4) {
|
||||
0x00 │ ╾─a12+0x0─╼ 03 00 00 00 ╾─a14+0x0─╼ 03 00 00 00 │ ╾──╼....╾──╼....
|
||||
0x10 │ ╾─a15+0x0─╼ 04 00 00 00 │ ╾──╼....
|
||||
0x00 │ ╾─alloc12─╼ 03 00 00 00 ╾─alloc14─╼ 03 00 00 00 │ ╾──╼....╾──╼....
|
||||
0x10 │ ╾─alloc15─╼ 04 00 00 00 │ ╾──╼....
|
||||
}
|
||||
|
||||
alloc12 (size: 3, align: 1) {
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ fn main() -> () {
|
|||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
StorageLive(_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
_2 = const {alloc0+0x0: &&[(std::option::Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
_2 = const {alloc0: &&[(std::option::Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
// ty::Const
|
||||
// + ty: &&[(std::option::Option<i32>, &[&str])]
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation.rs:8:5: 8:8
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc0+0x0)) }
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc0)) }
|
||||
_1 = (*_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
|
||||
StorageDead(_2); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
|
||||
StorageDead(_1); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
|
||||
|
|
@ -30,22 +30,22 @@ fn main() -> () {
|
|||
}
|
||||
|
||||
alloc0 (static: FOO, size: 16, align: 8) {
|
||||
╾─────alloc17+0x0─────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
╾───────alloc17───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
alloc17 (size: 72, align: 8) {
|
||||
0x00 │ 00 00 00 00 __ __ __ __ ╾─────alloc4+0x0──────╼ │ ....░░░░╾──────╼
|
||||
0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc4────────╼ │ ....░░░░╾──────╼
|
||||
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
|
||||
0x20 │ ╾─────alloc8+0x0──────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x30 │ 01 00 00 00 2a 00 00 00 ╾─────alloc13+0x0─────╼ │ ....*...╾──────╼
|
||||
0x20 │ ╾───────alloc8────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc13───────╼ │ ....*...╾──────╼
|
||||
0x40 │ 03 00 00 00 00 00 00 00 │ ........
|
||||
}
|
||||
|
||||
alloc4 (size: 0, align: 8) {}
|
||||
|
||||
alloc8 (size: 32, align: 8) {
|
||||
0x00 │ ╾─────alloc7+0x0──────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x10 │ ╾─────alloc9+0x0──────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x00 │ ╾───────alloc7────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x10 │ ╾───────alloc9────────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
alloc7 (size: 3, align: 1) {
|
||||
|
|
@ -57,9 +57,9 @@ alloc9 (size: 3, align: 1) {
|
|||
}
|
||||
|
||||
alloc13 (size: 48, align: 8) {
|
||||
0x00 │ ╾─────alloc12+0x0─────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x10 │ ╾─────alloc14+0x0─────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x20 │ ╾─────alloc15+0x0─────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x00 │ ╾───────alloc12───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x10 │ ╾───────alloc14───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x20 │ ╾───────alloc15───────╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
alloc12 (size: 3, align: 1) {
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ fn main() -> () {
|
|||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
StorageLive(_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0x0: &&[(std::option::Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
_2 = const {alloc0: &&[(std::option::Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
// ty::Const
|
||||
// + ty: &&[(std::option::Option<i32>, &[&u8])]
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation2.rs:5:5: 5:8
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc0+0x0)) }
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc0)) }
|
||||
_1 = (*_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
StorageDead(_2); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
|
||||
StorageDead(_1); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
|
||||
|
|
@ -30,19 +30,19 @@ fn main() -> () {
|
|||
}
|
||||
|
||||
alloc0 (static: FOO, size: 8, align: 4) {
|
||||
╾─a21+0x0─╼ 03 00 00 00 │ ╾──╼....
|
||||
╾─alloc21─╼ 03 00 00 00 │ ╾──╼....
|
||||
}
|
||||
|
||||
alloc21 (size: 48, align: 4) {
|
||||
0x00 │ 00 00 00 00 __ __ __ __ ╾─a4+0x0──╼ 00 00 00 00 │ ....░░░░╾──╼....
|
||||
0x10 │ 00 00 00 00 __ __ __ __ ╾─a9+0x0──╼ 02 00 00 00 │ ....░░░░╾──╼....
|
||||
0x20 │ 01 00 00 00 2a 00 00 00 ╾─a19+0x0─╼ 03 00 00 00 │ ....*...╾──╼....
|
||||
0x00 │ 00 00 00 00 __ __ __ __ ╾─alloc4──╼ 00 00 00 00 │ ....░░░░╾──╼....
|
||||
0x10 │ 00 00 00 00 __ __ __ __ ╾─alloc9──╼ 02 00 00 00 │ ....░░░░╾──╼....
|
||||
0x20 │ 01 00 00 00 2a 00 00 00 ╾─alloc19─╼ 03 00 00 00 │ ....*...╾──╼....
|
||||
}
|
||||
|
||||
alloc4 (size: 0, align: 4) {}
|
||||
|
||||
alloc9 (size: 8, align: 4) {
|
||||
╾─a7+0x0──╼ ╾─a8+0x0──╼ │ ╾──╼╾──╼
|
||||
╾─alloc7──╼ ╾─alloc8──╼ │ ╾──╼╾──╼
|
||||
}
|
||||
|
||||
alloc7 (size: 1, align: 1) {
|
||||
|
|
@ -54,7 +54,7 @@ alloc8 (size: 1, align: 1) {
|
|||
}
|
||||
|
||||
alloc19 (size: 12, align: 4) {
|
||||
╾─a15+0x3─╼ ╾─a16+0x0─╼ ╾─a18+0x2─╼ │ ╾──╼╾──╼╾──╼
|
||||
╾─a15+0x3─╼ ╾─alloc16─╼ ╾─a18+0x2─╼ │ ╾──╼╾──╼╾──╼
|
||||
}
|
||||
|
||||
alloc15 (size: 4, align: 1) {
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ fn main() -> () {
|
|||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
StorageLive(_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0x0: &&[(std::option::Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
_2 = const {alloc0: &&[(std::option::Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
// ty::Const
|
||||
// + ty: &&[(std::option::Option<i32>, &[&u8])]
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation2.rs:5:5: 5:8
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc0+0x0)) }
|
||||
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc0)) }
|
||||
_1 = (*_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
|
||||
StorageDead(_2); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
|
||||
StorageDead(_1); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
|
||||
|
|
@ -30,21 +30,21 @@ fn main() -> () {
|
|||
}
|
||||
|
||||
alloc0 (static: FOO, size: 16, align: 8) {
|
||||
╾─────alloc21+0x0─────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
╾───────alloc21───────╼ 03 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
}
|
||||
|
||||
alloc21 (size: 72, align: 8) {
|
||||
0x00 │ 00 00 00 00 __ __ __ __ ╾─────alloc4+0x0──────╼ │ ....░░░░╾──────╼
|
||||
0x00 │ 00 00 00 00 __ __ __ __ ╾───────alloc4────────╼ │ ....░░░░╾──────╼
|
||||
0x10 │ 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ │ ............░░░░
|
||||
0x20 │ ╾─────alloc9+0x0──────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x30 │ 01 00 00 00 2a 00 00 00 ╾─────alloc19+0x0─────╼ │ ....*...╾──────╼
|
||||
0x20 │ ╾───────alloc9────────╼ 02 00 00 00 00 00 00 00 │ ╾──────╼........
|
||||
0x30 │ 01 00 00 00 2a 00 00 00 ╾───────alloc19───────╼ │ ....*...╾──────╼
|
||||
0x40 │ 03 00 00 00 00 00 00 00 │ ........
|
||||
}
|
||||
|
||||
alloc4 (size: 0, align: 8) {}
|
||||
|
||||
alloc9 (size: 16, align: 8) {
|
||||
╾─────alloc7+0x0──────╼ ╾─────alloc8+0x0──────╼ │ ╾──────╼╾──────╼
|
||||
╾───────alloc7────────╼ ╾───────alloc8────────╼ │ ╾──────╼╾──────╼
|
||||
}
|
||||
|
||||
alloc7 (size: 1, align: 1) {
|
||||
|
|
@ -56,7 +56,7 @@ alloc8 (size: 1, align: 1) {
|
|||
}
|
||||
|
||||
alloc19 (size: 24, align: 8) {
|
||||
0x00 │ ╾─────alloc15+0x3─────╼ ╾─────alloc16+0x0─────╼ │ ╾──────╼╾──────╼
|
||||
0x00 │ ╾─────alloc15+0x3─────╼ ╾───────alloc16───────╼ │ ╾──────╼╾──────╼
|
||||
0x10 │ ╾─────alloc18+0x2─────╼ │ ╾──────╼
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ fn main() -> () {
|
|||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
StorageLive(_2); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0x0: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
_2 = const {alloc0: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
// ty::Const
|
||||
// + ty: &&Packed
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation3.rs:5:5: 5:8
|
||||
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0+0x0)) }
|
||||
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0)) }
|
||||
_1 = (*_2); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
StorageDead(_2); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
|
||||
StorageDead(_1); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
|
||||
|
|
@ -30,19 +30,19 @@ fn main() -> () {
|
|||
}
|
||||
|
||||
alloc0 (static: FOO, size: 4, align: 4) {
|
||||
╾─a9+0x0──╼ │ ╾──╼
|
||||
╾─alloc9──╼ │ ╾──╼
|
||||
}
|
||||
|
||||
alloc9 (size: 168, align: 1) {
|
||||
0x00 │ ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab │ ................
|
||||
0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾─a4+0x0──╼ │ ............╾──╼
|
||||
0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾─alloc4──╼ │ ............╾──╼
|
||||
0x20 │ 01 ef cd ab 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
0x30 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
0x40 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
0x50 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
0x60 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
0x70 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
0x80 │ 00 00 00 00 00 00 00 00 00 00 ╾─a6+0x0──╼ 00 00 │ ..........╾──╼..
|
||||
0x80 │ 00 00 00 00 00 00 00 00 00 00 ╾─alloc6──╼ 00 00 │ ..........╾──╼..
|
||||
0x90 │ ╾─a7+0x63─╼ 00 00 00 00 00 00 00 00 00 00 00 00 │ ╾──╼............
|
||||
0xa0 │ 00 00 00 00 00 00 00 00 │ ........
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ fn main() -> () {
|
|||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
StorageLive(_2); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
_2 = const {alloc0+0x0: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
_2 = const {alloc0: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
// ty::Const
|
||||
// + ty: &&Packed
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_allocation3.rs:5:5: 5:8
|
||||
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0+0x0)) }
|
||||
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0)) }
|
||||
_1 = (*_2); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
|
||||
StorageDead(_2); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
|
||||
StorageDead(_1); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
|
||||
|
|
@ -30,12 +30,12 @@ fn main() -> () {
|
|||
}
|
||||
|
||||
alloc0 (static: FOO, size: 8, align: 8) {
|
||||
╾─────alloc9+0x0──────╼ │ ╾──────╼
|
||||
╾───────alloc9────────╼ │ ╾──────╼
|
||||
}
|
||||
|
||||
alloc9 (size: 180, align: 1) {
|
||||
0x00 │ ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab │ ................
|
||||
0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾alloc4+0x0 │ ............╾───
|
||||
0x10 │ ab ab ab ab ab ab ab ab ab ab ab ab ╾──alloc4── │ ............╾───
|
||||
0x20 │ ──────────╼ 01 ef cd ab 00 00 00 00 00 00 00 00 │ ───╼............
|
||||
0x30 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
0x40 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
|
|
@ -43,7 +43,7 @@ alloc9 (size: 180, align: 1) {
|
|||
0x60 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
0x70 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
0x80 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ╾──── │ ..............╾─
|
||||
0x90 │ ───alloc6+0x0───╼ 00 00 ╾─────alloc7+0x63─────╼ │ ─────╼..╾──────╼
|
||||
0x90 │ ─────alloc6─────╼ 00 00 ╾─────alloc7+0x63─────╼ │ ─────╼..╾──────╼
|
||||
0xa0 │ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
|
||||
0xb0 │ 00 00 00 00 │ ....
|
||||
}
|
||||
|
|
|
|||
8
src/test/mir-opt/const_prop/mutable_variable.rs
Normal file
8
src/test/mir-opt/const_prop/mutable_variable.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let mut x = 42;
|
||||
x = 99;
|
||||
let y = x;
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable.rs:4:11: 4:11
|
||||
let mut _1: i32; // in scope 0 at $DIR/mutable_variable.rs:5:9: 5:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable.rs:5:9: 5:14
|
||||
let _2: i32; // in scope 1 at $DIR/mutable_variable.rs:7:9: 7:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/mutable_variable.rs:7:9: 7:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable.rs:5:9: 5:14
|
||||
_1 = const 42i32; // scope 0 at $DIR/mutable_variable.rs:5:17: 5:19
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable.rs:5:17: 5:19
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
|
||||
_1 = const 99i32; // scope 1 at $DIR/mutable_variable.rs:6:5: 6:11
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000063))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable.rs:6:9: 6:11
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000063)) }
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable.rs:7:9: 7:10
|
||||
- _2 = _1; // scope 1 at $DIR/mutable_variable.rs:7:13: 7:14
|
||||
+ _2 = const 99i32; // scope 1 at $DIR/mutable_variable.rs:7:13: 7:14
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x00000063))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/mutable_variable.rs:7:13: 7:14
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000063)) }
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable.rs:4:11: 8:2
|
||||
// ty::Const
|
||||
// + ty: ()
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable.rs:4:11: 8:2
|
||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable.rs:8:1: 8:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable.rs:8:1: 8:2
|
||||
return; // scope 0 at $DIR/mutable_variable.rs:8:2: 8:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let mut x = (42, 43);
|
||||
x.1 = 99;
|
||||
let y = x;
|
||||
}
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate.rs:4:11: 4:11
|
||||
let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate.rs:5:9: 5:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate.rs:5:9: 5:14
|
||||
let _2: (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate.rs:7:9: 7:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate.rs:7:9: 7:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:5:9: 5:14
|
||||
_1 = (const 42i32, const 43i32); // scope 0 at $DIR/mutable_variable_aggregate.rs:5:17: 5:25
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/mutable_variable_aggregate.rs:5:18: 5:20
|
||||
+ // + span: $DIR/mutable_variable_aggregate.rs:5:17: 5:25
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000002b))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/mutable_variable_aggregate.rs:5:22: 5:24
|
||||
+ // + span: $DIR/mutable_variable_aggregate.rs:5:17: 5:25
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002b)) }
|
||||
(_1.1: i32) = const 99i32; // scope 1 at $DIR/mutable_variable_aggregate.rs:6:5: 6:13
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000063))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate.rs:6:11: 6:13
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000063)) }
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:7:9: 7:10
|
||||
- _2 = _1; // scope 1 at $DIR/mutable_variable_aggregate.rs:7:13: 7:14
|
||||
+ _2 = (const 42i32, const 99i32); // scope 1 at $DIR/mutable_variable_aggregate.rs:7:13: 7:14
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x0000002a))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/mutable_variable_aggregate.rs:7:13: 7:14
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x00000063))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/mutable_variable_aggregate.rs:7:13: 7:14
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000063)) }
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_aggregate.rs:4:11: 8:2
|
||||
// ty::Const
|
||||
// + ty: ()
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate.rs:4:11: 8:2
|
||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate.rs:8:1: 8:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate.rs:8:1: 8:2
|
||||
return; // scope 0 at $DIR/mutable_variable_aggregate.rs:8:2: 8:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let mut x = (42, 43);
|
||||
let z = &mut x;
|
||||
z.1 = 99;
|
||||
let y = x;
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:4:11: 4:11
|
||||
let mut _1: (i32, i32); // in scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:5:9: 5:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:5:9: 5:14
|
||||
let _2: &mut (i32, i32); // in scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:6:9: 6:10
|
||||
scope 2 {
|
||||
debug z => _2; // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:6:9: 6:10
|
||||
let _3: (i32, i32); // in scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:8:9: 8:10
|
||||
scope 3 {
|
||||
debug y => _3; // in scope 3 at $DIR/mutable_variable_aggregate_mut_ref.rs:8:9: 8:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:5:9: 5:14
|
||||
_1 = (const 42i32, const 43i32); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:5:17: 5:25
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate_mut_ref.rs:5:18: 5:20
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000002b))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate_mut_ref.rs:5:22: 5:24
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002b)) }
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:6:9: 6:10
|
||||
_2 = &mut _1; // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:6:13: 6:19
|
||||
((*_2).1: i32) = const 99i32; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:7:5: 7:13
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000063))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate_mut_ref.rs:7:11: 7:13
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000063)) }
|
||||
StorageLive(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:8:9: 8:10
|
||||
_3 = _1; // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:8:13: 8:14
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:4:11: 9:2
|
||||
// ty::Const
|
||||
// + ty: ()
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate_mut_ref.rs:4:11: 9:2
|
||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
StorageDead(_3); // scope 2 at $DIR/mutable_variable_aggregate_mut_ref.rs:9:1: 9:2
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_mut_ref.rs:9:1: 9:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:9:1: 9:2
|
||||
return; // scope 0 at $DIR/mutable_variable_aggregate_mut_ref.rs:9:2: 9:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let mut x: (i32, i32) = foo();
|
||||
x.1 = 99;
|
||||
x.0 = 42;
|
||||
let y = x.1;
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
fn foo() -> (i32, i32) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:4:11: 4:11
|
||||
let mut _1: (i32, i32) as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:5:9: 5:14
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:5:9: 5:14
|
||||
let _2: i32; // in scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:8:9: 8:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/mutable_variable_aggregate_partial_read.rs:8:9: 8:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:5:9: 5:14
|
||||
_1 = const foo() -> bb1; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:5:29: 5:34
|
||||
// ty::Const
|
||||
// + ty: fn() -> (i32, i32) {foo}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate_partial_read.rs:5:29: 5:32
|
||||
// + literal: Const { ty: fn() -> (i32, i32) {foo}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
(_1.1: i32) = const 99i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:6:5: 6:13
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000063))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate_partial_read.rs:6:11: 6:13
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000063)) }
|
||||
(_1.0: i32) = const 42i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:7:5: 7:13
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate_partial_read.rs:7:11: 7:13
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:8:9: 8:10
|
||||
- _2 = (_1.1: i32); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:8:13: 8:16
|
||||
+ _2 = const 99i32; // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:8:13: 8:16
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x00000063))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/mutable_variable_aggregate_partial_read.rs:8:13: 8:16
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000063)) }
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:4:11: 9:2
|
||||
// ty::Const
|
||||
// + ty: ()
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_aggregate_partial_read.rs:4:11: 9:2
|
||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_aggregate_partial_read.rs:9:1: 9:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:9:1: 9:2
|
||||
return; // scope 0 at $DIR/mutable_variable_aggregate_partial_read.rs:9:2: 9:2
|
||||
}
|
||||
}
|
||||
|
||||
12
src/test/mir-opt/const_prop/mutable_variable_no_prop.rs
Normal file
12
src/test/mir-opt/const_prop/mutable_variable_no_prop.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// compile-flags: -O
|
||||
|
||||
static mut STATIC: u32 = 42;
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let mut x = 42;
|
||||
unsafe {
|
||||
x = STATIC;
|
||||
}
|
||||
let y = x;
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_no_prop.rs:6:11: 6:11
|
||||
let mut _1: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:7:9: 7:14
|
||||
let _2: (); // in scope 0 at $DIR/mutable_variable_no_prop.rs:8:5: 10:6
|
||||
let mut _3: u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
|
||||
let mut _4: *mut u32; // in scope 0 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/mutable_variable_no_prop.rs:7:9: 7:14
|
||||
let _5: u32; // in scope 1 at $DIR/mutable_variable_no_prop.rs:11:9: 11:10
|
||||
scope 2 {
|
||||
}
|
||||
scope 3 {
|
||||
debug y => _5; // in scope 3 at $DIR/mutable_variable_no_prop.rs:11:9: 11:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:7:9: 7:14
|
||||
_1 = const 42u32; // scope 0 at $DIR/mutable_variable_no_prop.rs:7:17: 7:19
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_no_prop.rs:7:17: 7:19
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:8:5: 10:6
|
||||
StorageLive(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
|
||||
StorageLive(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
|
||||
_4 = const {alloc0: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
|
||||
// ty::Const
|
||||
// + ty: *mut u32
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_no_prop.rs:9:13: 9:19
|
||||
// + literal: Const { ty: *mut u32, val: Value(Scalar(alloc0)) }
|
||||
_3 = (*_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
|
||||
_1 = move _3; // scope 2 at $DIR/mutable_variable_no_prop.rs:9:9: 9:19
|
||||
StorageDead(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:9:18: 9:19
|
||||
StorageDead(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:9:19: 9:20
|
||||
_2 = const (); // scope 2 at $DIR/mutable_variable_no_prop.rs:8:5: 10:6
|
||||
// ty::Const
|
||||
// + ty: ()
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_no_prop.rs:8:5: 10:6
|
||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:10:5: 10:6
|
||||
StorageLive(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:11:9: 11:10
|
||||
_5 = _1; // scope 1 at $DIR/mutable_variable_no_prop.rs:11:13: 11:14
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_no_prop.rs:6:11: 12:2
|
||||
// ty::Const
|
||||
// + ty: ()
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_no_prop.rs:6:11: 12:2
|
||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
StorageDead(_5); // scope 1 at $DIR/mutable_variable_no_prop.rs:12:1: 12:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_no_prop.rs:12:1: 12:2
|
||||
return; // scope 0 at $DIR/mutable_variable_no_prop.rs:12:2: 12:2
|
||||
}
|
||||
}
|
||||
|
||||
alloc0 (static: STATIC, size: 4, align: 4) {
|
||||
2a 00 00 00 │ *...
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let a = foo();
|
||||
let mut x: (i32, i32) = (1, 2);
|
||||
x.1 = a;
|
||||
let y = x.1;
|
||||
let z = x.0; // this could theoretically be allowed, but we can't handle it right now
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
fn foo() -> i32 {
|
||||
unimplemented!()
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/mutable_variable_unprop_assign.rs:4:11: 4:11
|
||||
let _1: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:5:9: 5:10
|
||||
let mut _3: i32; // in scope 0 at $DIR/mutable_variable_unprop_assign.rs:7:11: 7:12
|
||||
scope 1 {
|
||||
debug a => _1; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:5:9: 5:10
|
||||
let mut _2: (i32, i32) as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 1 at $DIR/mutable_variable_unprop_assign.rs:6:9: 6:14
|
||||
scope 2 {
|
||||
debug x => _2; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:6:9: 6:14
|
||||
let _4: i32; // in scope 2 at $DIR/mutable_variable_unprop_assign.rs:8:9: 8:10
|
||||
scope 3 {
|
||||
debug y => _4; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:8:9: 8:10
|
||||
let _5: i32; // in scope 3 at $DIR/mutable_variable_unprop_assign.rs:9:9: 9:10
|
||||
scope 4 {
|
||||
debug z => _5; // in scope 4 at $DIR/mutable_variable_unprop_assign.rs:9:9: 9:10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:5:9: 5:10
|
||||
_1 = const foo() -> bb1; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:5:13: 5:18
|
||||
// ty::Const
|
||||
// + ty: fn() -> i32 {foo}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_unprop_assign.rs:5:13: 5:16
|
||||
// + literal: Const { ty: fn() -> i32 {foo}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageLive(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:6:9: 6:14
|
||||
_2 = (const 1i32, const 2i32); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:6:29: 6:35
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/mutable_variable_unprop_assign.rs:6:30: 6:31
|
||||
+ // + span: $DIR/mutable_variable_unprop_assign.rs:6:29: 6:35
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/mutable_variable_unprop_assign.rs:6:33: 6:34
|
||||
+ // + span: $DIR/mutable_variable_unprop_assign.rs:6:29: 6:35
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
|
||||
StorageLive(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:7:11: 7:12
|
||||
_3 = _1; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:7:11: 7:12
|
||||
(_2.1: i32) = move _3; // scope 2 at $DIR/mutable_variable_unprop_assign.rs:7:5: 7:12
|
||||
StorageDead(_3); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:7:11: 7:12
|
||||
StorageLive(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:8:9: 8:10
|
||||
_4 = (_2.1: i32); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:8:13: 8:16
|
||||
StorageLive(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:9:9: 9:10
|
||||
_5 = (_2.0: i32); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:9:13: 9:16
|
||||
_0 = const (); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:4:11: 10:2
|
||||
// ty::Const
|
||||
// + ty: ()
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/mutable_variable_unprop_assign.rs:4:11: 10:2
|
||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
StorageDead(_5); // scope 3 at $DIR/mutable_variable_unprop_assign.rs:10:1: 10:2
|
||||
StorageDead(_4); // scope 2 at $DIR/mutable_variable_unprop_assign.rs:10:1: 10:2
|
||||
StorageDead(_2); // scope 1 at $DIR/mutable_variable_unprop_assign.rs:10:1: 10:2
|
||||
StorageDead(_1); // scope 0 at $DIR/mutable_variable_unprop_assign.rs:10:1: 10:2
|
||||
return; // scope 0 at $DIR/mutable_variable_unprop_assign.rs:10:2: 10:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -16,13 +16,13 @@
|
|||
StorageLive(_1); // scope 0 at $DIR/read_immutable_static.rs:7:9: 7:10
|
||||
StorageLive(_2); // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
StorageLive(_3); // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
_3 = const {alloc0+0x0: &u8}; // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
_3 = const {alloc0: &u8}; // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
// ty::Const
|
||||
// + ty: &u8
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0+0x0)) }
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0)) }
|
||||
- _2 = (*_3); // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
+ _2 = const 2u8; // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
+ // ty::Const
|
||||
|
|
@ -33,13 +33,13 @@
|
|||
+ // + literal: Const { ty: u8, val: Value(Scalar(0x02)) }
|
||||
StorageLive(_4); // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
StorageLive(_5); // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
_5 = const {alloc0+0x0: &u8}; // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
_5 = const {alloc0: &u8}; // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
// ty::Const
|
||||
// + ty: &u8
|
||||
// + val: Value(Scalar(alloc0+0x0))
|
||||
// + val: Value(Scalar(alloc0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0+0x0)) }
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0)) }
|
||||
- _4 = (*_5); // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
- _1 = Add(move _2, move _4); // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:22
|
||||
+ _4 = const 2u8; // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000007b))
|
||||
// mir::Constant
|
||||
// + span: $DIR/copy_propagation_arg.rs:29:5: 29:12
|
||||
// + span: $DIR/copy_propagation_arg.rs:29:9: 29:12
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000007b)) }
|
||||
_0 = _2; // scope 1 at $DIR/copy_propagation_arg.rs:30:5: 30:6
|
||||
StorageDead(_2); // scope 0 at $DIR/copy_propagation_arg.rs:31:1: 31:2
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
// + ty: u8
|
||||
// + val: Value(Scalar(0x05))
|
||||
// mir::Constant
|
||||
// + span: $DIR/copy_propagation_arg.rs:17:5: 17:10
|
||||
// + span: $DIR/copy_propagation_arg.rs:17:9: 17:10
|
||||
// + literal: Const { ty: u8, val: Value(Scalar(0x05)) }
|
||||
_0 = const (); // scope 0 at $DIR/copy_propagation_arg.rs:15:19: 18:2
|
||||
// ty::Const
|
||||
|
|
|
|||
|
|
@ -35,9 +35,38 @@
|
|||
// mir::Constant
|
||||
// + span: $DIR/simplify-arm-identity.rs:20:9: 20:20
|
||||
// + literal: Const { ty: isize, val: Value(Scalar(0x00000000)) }
|
||||
goto -> bb3; // scope 1 at $DIR/simplify-arm-identity.rs:20:9: 20:20
|
||||
}
|
||||
|
||||
bb1: {
|
||||
((_2 as Foo).0: u8) = const 0u8; // scope 1 at $DIR/simplify-arm-identity.rs:21:21: 21:32
|
||||
// ty::Const
|
||||
// + ty: u8
|
||||
// + val: Value(Scalar(0x00))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify-arm-identity.rs:21:30: 21:31
|
||||
// + literal: Const { ty: u8, val: Value(Scalar(0x00)) }
|
||||
discriminant(_2) = 0; // scope 1 at $DIR/simplify-arm-identity.rs:21:21: 21:32
|
||||
goto -> bb4; // scope 1 at $DIR/simplify-arm-identity.rs:19:18: 22:6
|
||||
}
|
||||
|
||||
bb2: {
|
||||
unreachable; // scope 1 at $DIR/simplify-arm-identity.rs:19:24: 19:25
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageLive(_4); // scope 1 at $DIR/simplify-arm-identity.rs:20:18: 20:19
|
||||
_4 = ((_1 as Foo).0: u8); // scope 1 at $DIR/simplify-arm-identity.rs:20:18: 20:19
|
||||
((_2 as Foo).0: u8) = move _4; // scope 3 at $DIR/simplify-arm-identity.rs:20:24: 20:35
|
||||
StorageLive(_5); // scope 3 at $DIR/simplify-arm-identity.rs:20:33: 20:34
|
||||
_5 = _4; // scope 3 at $DIR/simplify-arm-identity.rs:20:33: 20:34
|
||||
((_2 as Foo).0: u8) = move _5; // scope 3 at $DIR/simplify-arm-identity.rs:20:24: 20:35
|
||||
discriminant(_2) = 0; // scope 3 at $DIR/simplify-arm-identity.rs:20:24: 20:35
|
||||
StorageDead(_5); // scope 3 at $DIR/simplify-arm-identity.rs:20:34: 20:35
|
||||
StorageDead(_4); // scope 1 at $DIR/simplify-arm-identity.rs:20:35: 20:36
|
||||
goto -> bb4; // scope 1 at $DIR/simplify-arm-identity.rs:19:18: 22:6
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageDead(_2); // scope 1 at $DIR/simplify-arm-identity.rs:22:6: 22:7
|
||||
_0 = const (); // scope 0 at $DIR/simplify-arm-identity.rs:17:11: 23:2
|
||||
// ty::Const
|
||||
|
|
|
|||
|
|
@ -35,9 +35,38 @@
|
|||
// mir::Constant
|
||||
// + span: $DIR/simplify-arm-identity.rs:20:9: 20:20
|
||||
// + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000000)) }
|
||||
goto -> bb3; // scope 1 at $DIR/simplify-arm-identity.rs:20:9: 20:20
|
||||
}
|
||||
|
||||
bb1: {
|
||||
((_2 as Foo).0: u8) = const 0u8; // scope 1 at $DIR/simplify-arm-identity.rs:21:21: 21:32
|
||||
// ty::Const
|
||||
// + ty: u8
|
||||
// + val: Value(Scalar(0x00))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify-arm-identity.rs:21:30: 21:31
|
||||
// + literal: Const { ty: u8, val: Value(Scalar(0x00)) }
|
||||
discriminant(_2) = 0; // scope 1 at $DIR/simplify-arm-identity.rs:21:21: 21:32
|
||||
goto -> bb4; // scope 1 at $DIR/simplify-arm-identity.rs:19:18: 22:6
|
||||
}
|
||||
|
||||
bb2: {
|
||||
unreachable; // scope 1 at $DIR/simplify-arm-identity.rs:19:24: 19:25
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageLive(_4); // scope 1 at $DIR/simplify-arm-identity.rs:20:18: 20:19
|
||||
_4 = ((_1 as Foo).0: u8); // scope 1 at $DIR/simplify-arm-identity.rs:20:18: 20:19
|
||||
((_2 as Foo).0: u8) = move _4; // scope 3 at $DIR/simplify-arm-identity.rs:20:24: 20:35
|
||||
StorageLive(_5); // scope 3 at $DIR/simplify-arm-identity.rs:20:33: 20:34
|
||||
_5 = _4; // scope 3 at $DIR/simplify-arm-identity.rs:20:33: 20:34
|
||||
((_2 as Foo).0: u8) = move _5; // scope 3 at $DIR/simplify-arm-identity.rs:20:24: 20:35
|
||||
discriminant(_2) = 0; // scope 3 at $DIR/simplify-arm-identity.rs:20:24: 20:35
|
||||
StorageDead(_5); // scope 3 at $DIR/simplify-arm-identity.rs:20:34: 20:35
|
||||
StorageDead(_4); // scope 1 at $DIR/simplify-arm-identity.rs:20:35: 20:36
|
||||
goto -> bb4; // scope 1 at $DIR/simplify-arm-identity.rs:19:18: 22:6
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageDead(_2); // scope 1 at $DIR/simplify-arm-identity.rs:22:6: 22:7
|
||||
_0 = const (); // scope 0 at $DIR/simplify-arm-identity.rs:17:11: 23:2
|
||||
// ty::Const
|
||||
|
|
|
|||
32
src/test/mir-opt/simplify-arm.rs
Normal file
32
src/test/mir-opt/simplify-arm.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// compile-flags: -Z mir-opt-level=1
|
||||
// EMIT_MIR rustc.id.SimplifyArmIdentity.diff
|
||||
// EMIT_MIR rustc.id.SimplifyBranchSame.diff
|
||||
// EMIT_MIR rustc.id_result.SimplifyArmIdentity.diff
|
||||
// EMIT_MIR rustc.id_result.SimplifyBranchSame.diff
|
||||
// EMIT_MIR rustc.id_try.SimplifyArmIdentity.diff
|
||||
// EMIT_MIR rustc.id_try.SimplifyBranchSame.diff
|
||||
|
||||
fn id(o: Option<u8>) -> Option<u8> {
|
||||
match o {
|
||||
Some(v) => Some(v),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn id_result(r: Result<u8, i32>) -> Result<u8, i32> {
|
||||
match r {
|
||||
Ok(x) => Ok(x),
|
||||
Err(y) => Err(y),
|
||||
}
|
||||
}
|
||||
|
||||
fn id_try(r: Result<u8, i32>) -> Result<u8, i32> {
|
||||
let x = r?;
|
||||
Ok(x)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
id(None);
|
||||
id_result(Ok(4));
|
||||
id_try(Ok(4));
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
- // MIR for `id` before SimplifyArmIdentity
|
||||
+ // MIR for `id` after SimplifyArmIdentity
|
||||
|
||||
fn id(_1: std::option::Option<u8>) -> std::option::Option<u8> {
|
||||
debug o => _1; // in scope 0 at $DIR/simplify-arm.rs:9:7: 9:8
|
||||
let mut _0: std::option::Option<u8>; // return place in scope 0 at $DIR/simplify-arm.rs:9:25: 9:35
|
||||
let mut _2: isize; // in scope 0 at $DIR/simplify-arm.rs:11:9: 11:16
|
||||
let _3: u8; // in scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
|
||||
let mut _4: u8; // in scope 0 at $DIR/simplify-arm.rs:11:25: 11:26
|
||||
scope 1 {
|
||||
debug v => _3; // in scope 1 at $DIR/simplify-arm.rs:11:14: 11:15
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_2 = discriminant(_1); // scope 0 at $DIR/simplify-arm.rs:11:9: 11:16
|
||||
switchInt(move _2) -> [0isize: bb1, 1isize: bb3, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:11:9: 11:16
|
||||
}
|
||||
|
||||
bb1: {
|
||||
discriminant(_0) = 0; // scope 0 at $DIR/simplify-arm.rs:12:17: 12:21
|
||||
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:10:5: 13:6
|
||||
}
|
||||
|
||||
bb2: {
|
||||
unreachable; // scope 0 at $DIR/simplify-arm.rs:10:11: 10:12
|
||||
}
|
||||
|
||||
bb3: {
|
||||
- StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
|
||||
- _3 = ((_1 as Some).0: u8); // scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
|
||||
- StorageLive(_4); // scope 1 at $DIR/simplify-arm.rs:11:25: 11:26
|
||||
- _4 = _3; // scope 1 at $DIR/simplify-arm.rs:11:25: 11:26
|
||||
- ((_0 as Some).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
|
||||
- discriminant(_0) = 1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
|
||||
- StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:11:26: 11:27
|
||||
- StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:11:27: 11:28
|
||||
+ _0 = move _1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
|
||||
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:10:5: 13:6
|
||||
}
|
||||
|
||||
bb4: {
|
||||
return; // scope 0 at $DIR/simplify-arm.rs:14:2: 14:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
- // MIR for `id` before SimplifyBranchSame
|
||||
+ // MIR for `id` after SimplifyBranchSame
|
||||
|
||||
fn id(_1: std::option::Option<u8>) -> std::option::Option<u8> {
|
||||
debug o => _1; // in scope 0 at $DIR/simplify-arm.rs:9:7: 9:8
|
||||
let mut _0: std::option::Option<u8>; // return place in scope 0 at $DIR/simplify-arm.rs:9:25: 9:35
|
||||
let mut _2: isize; // in scope 0 at $DIR/simplify-arm.rs:11:9: 11:16
|
||||
let _3: u8; // in scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
|
||||
let mut _4: u8; // in scope 0 at $DIR/simplify-arm.rs:11:25: 11:26
|
||||
scope 1 {
|
||||
debug v => _3; // in scope 1 at $DIR/simplify-arm.rs:11:14: 11:15
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_2 = discriminant(_1); // scope 0 at $DIR/simplify-arm.rs:11:9: 11:16
|
||||
switchInt(move _2) -> [0isize: bb1, 1isize: bb3, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:11:9: 11:16
|
||||
}
|
||||
|
||||
bb1: {
|
||||
discriminant(_0) = 0; // scope 0 at $DIR/simplify-arm.rs:12:17: 12:21
|
||||
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:10:5: 13:6
|
||||
}
|
||||
|
||||
bb2: {
|
||||
unreachable; // scope 0 at $DIR/simplify-arm.rs:10:11: 10:12
|
||||
}
|
||||
|
||||
bb3: {
|
||||
_0 = move _1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
|
||||
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:10:5: 13:6
|
||||
}
|
||||
|
||||
bb4: {
|
||||
return; // scope 0 at $DIR/simplify-arm.rs:14:2: 14:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
- // MIR for `id_result` before SimplifyArmIdentity
|
||||
+ // MIR for `id_result` after SimplifyArmIdentity
|
||||
|
||||
fn id_result(_1: std::result::Result<u8, i32>) -> std::result::Result<u8, i32> {
|
||||
debug r => _1; // in scope 0 at $DIR/simplify-arm.rs:16:14: 16:15
|
||||
let mut _0: std::result::Result<u8, i32>; // return place in scope 0 at $DIR/simplify-arm.rs:16:37: 16:52
|
||||
let mut _2: isize; // in scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
|
||||
let _3: u8; // in scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
|
||||
let mut _4: u8; // in scope 0 at $DIR/simplify-arm.rs:18:21: 18:22
|
||||
let _5: i32; // in scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
|
||||
let mut _6: i32; // in scope 0 at $DIR/simplify-arm.rs:19:23: 19:24
|
||||
scope 1 {
|
||||
debug x => _3; // in scope 1 at $DIR/simplify-arm.rs:18:12: 18:13
|
||||
}
|
||||
scope 2 {
|
||||
debug y => _5; // in scope 2 at $DIR/simplify-arm.rs:19:13: 19:14
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_2 = discriminant(_1); // scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
|
||||
switchInt(move _2) -> [0isize: bb3, 1isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- StorageLive(_5); // scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
|
||||
- _5 = ((_1 as Err).0: i32); // scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
|
||||
- StorageLive(_6); // scope 2 at $DIR/simplify-arm.rs:19:23: 19:24
|
||||
- _6 = _5; // scope 2 at $DIR/simplify-arm.rs:19:23: 19:24
|
||||
- ((_0 as Err).0: i32) = move _6; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
|
||||
- discriminant(_0) = 1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
|
||||
- StorageDead(_6); // scope 2 at $DIR/simplify-arm.rs:19:24: 19:25
|
||||
- StorageDead(_5); // scope 0 at $DIR/simplify-arm.rs:19:25: 19:26
|
||||
+ _0 = move _1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
|
||||
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
|
||||
}
|
||||
|
||||
bb2: {
|
||||
unreachable; // scope 0 at $DIR/simplify-arm.rs:17:11: 17:12
|
||||
}
|
||||
|
||||
bb3: {
|
||||
- StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
|
||||
- _3 = ((_1 as Ok).0: u8); // scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
|
||||
- StorageLive(_4); // scope 1 at $DIR/simplify-arm.rs:18:21: 18:22
|
||||
- _4 = _3; // scope 1 at $DIR/simplify-arm.rs:18:21: 18:22
|
||||
- ((_0 as Ok).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
|
||||
- discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
|
||||
- StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:18:22: 18:23
|
||||
- StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:18:23: 18:24
|
||||
+ _0 = move _1; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
|
||||
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
|
||||
}
|
||||
|
||||
bb4: {
|
||||
return; // scope 0 at $DIR/simplify-arm.rs:21:2: 21:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
- // MIR for `id_result` before SimplifyBranchSame
|
||||
+ // MIR for `id_result` after SimplifyBranchSame
|
||||
|
||||
fn id_result(_1: std::result::Result<u8, i32>) -> std::result::Result<u8, i32> {
|
||||
debug r => _1; // in scope 0 at $DIR/simplify-arm.rs:16:14: 16:15
|
||||
let mut _0: std::result::Result<u8, i32>; // return place in scope 0 at $DIR/simplify-arm.rs:16:37: 16:52
|
||||
let mut _2: isize; // in scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
|
||||
let _3: u8; // in scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
|
||||
let mut _4: u8; // in scope 0 at $DIR/simplify-arm.rs:18:21: 18:22
|
||||
let _5: i32; // in scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
|
||||
let mut _6: i32; // in scope 0 at $DIR/simplify-arm.rs:19:23: 19:24
|
||||
scope 1 {
|
||||
debug x => _3; // in scope 1 at $DIR/simplify-arm.rs:18:12: 18:13
|
||||
}
|
||||
scope 2 {
|
||||
debug y => _5; // in scope 2 at $DIR/simplify-arm.rs:19:13: 19:14
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_2 = discriminant(_1); // scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
|
||||
- switchInt(move _2) -> [0isize: bb3, 1isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
|
||||
+ goto -> bb1; // scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _0 = move _1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
|
||||
- goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
|
||||
- }
|
||||
-
|
||||
- bb2: {
|
||||
- unreachable; // scope 0 at $DIR/simplify-arm.rs:17:11: 17:12
|
||||
- }
|
||||
-
|
||||
- bb3: {
|
||||
_0 = move _1; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
|
||||
- goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
|
||||
+ goto -> bb2; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
|
||||
}
|
||||
|
||||
- bb4: {
|
||||
+ bb2: {
|
||||
return; // scope 0 at $DIR/simplify-arm.rs:21:2: 21:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
- // MIR for `id_try` before SimplifyArmIdentity
|
||||
+ // MIR for `id_try` after SimplifyArmIdentity
|
||||
|
||||
fn id_try(_1: std::result::Result<u8, i32>) -> std::result::Result<u8, i32> {
|
||||
debug r => _1; // in scope 0 at $DIR/simplify-arm.rs:23:11: 23:12
|
||||
let mut _0: std::result::Result<u8, i32>; // return place in scope 0 at $DIR/simplify-arm.rs:23:34: 23:49
|
||||
let _2: u8; // in scope 0 at $DIR/simplify-arm.rs:24:9: 24:10
|
||||
let mut _3: std::result::Result<u8, i32>; // in scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
let mut _4: std::result::Result<u8, i32>; // in scope 0 at $DIR/simplify-arm.rs:24:13: 24:14
|
||||
let mut _5: isize; // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
let _6: i32; // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
let mut _7: !; // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
let mut _8: i32; // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
let mut _9: i32; // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
let _10: u8; // in scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
let mut _11: u8; // in scope 0 at $DIR/simplify-arm.rs:25:8: 25:9
|
||||
scope 1 {
|
||||
debug x => _2; // in scope 1 at $DIR/simplify-arm.rs:24:9: 24:10
|
||||
}
|
||||
scope 2 {
|
||||
debug err => _6; // in scope 2 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
scope 3 {
|
||||
}
|
||||
}
|
||||
scope 4 {
|
||||
debug val => _10; // in scope 4 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
scope 5 {
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/simplify-arm.rs:24:9: 24:10
|
||||
StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
StorageLive(_4); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:14
|
||||
_4 = _1; // scope 0 at $DIR/simplify-arm.rs:24:13: 24:14
|
||||
_3 = const <std::result::Result<u8, i32> as std::ops::Try>::into_result(move _4) -> bb1; // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
// ty::Const
|
||||
// + ty: fn(std::result::Result<u8, i32>) -> std::result::Result<<std::result::Result<u8, i32> as std::ops::Try>::Ok, <std::result::Result<u8, i32> as std::ops::Try>::Error> {<std::result::Result<u8, i32> as std::ops::Try>::into_result}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify-arm.rs:24:13: 24:15
|
||||
// + literal: Const { ty: fn(std::result::Result<u8, i32>) -> std::result::Result<<std::result::Result<u8, i32> as std::ops::Try>::Ok, <std::result::Result<u8, i32> as std::ops::Try>::Error> {<std::result::Result<u8, i32> as std::ops::Try>::into_result}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_4); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
_5 = discriminant(_3); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
switchInt(move _5) -> [0isize: bb2, 1isize: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
}
|
||||
|
||||
bb2: {
|
||||
- StorageLive(_10); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
- _10 = ((_3 as Ok).0: u8); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
- _2 = _10; // scope 5 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
- StorageDead(_10); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
+ _0 = move _3; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
|
||||
StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:24:15: 24:16
|
||||
- StorageLive(_11); // scope 1 at $DIR/simplify-arm.rs:25:8: 25:9
|
||||
- _11 = _2; // scope 1 at $DIR/simplify-arm.rs:25:8: 25:9
|
||||
- ((_0 as Ok).0: u8) = move _11; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
|
||||
- discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
|
||||
- StorageDead(_11); // scope 1 at $DIR/simplify-arm.rs:25:9: 25:10
|
||||
StorageDead(_2); // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
|
||||
goto -> bb7; // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
|
||||
}
|
||||
|
||||
bb3: {
|
||||
unreachable; // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageLive(_6); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
_6 = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
StorageLive(_8); // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
StorageLive(_9); // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
_9 = _6; // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
_8 = const <i32 as std::convert::From<i32>>::from(move _9) -> bb5; // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
// ty::Const
|
||||
// + ty: fn(i32) -> i32 {<i32 as std::convert::From<i32>>::from}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify-arm.rs:24:14: 24:15
|
||||
// + literal: Const { ty: fn(i32) -> i32 {<i32 as std::convert::From<i32>>::from}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageDead(_9); // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
_0 = const <std::result::Result<u8, i32> as std::ops::Try>::from_error(move _8) -> bb6; // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
// ty::Const
|
||||
// + ty: fn(<std::result::Result<u8, i32> as std::ops::Try>::Error) -> std::result::Result<u8, i32> {<std::result::Result<u8, i32> as std::ops::Try>::from_error}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify-arm.rs:24:13: 24:15
|
||||
// + literal: Const { ty: fn(<std::result::Result<u8, i32> as std::ops::Try>::Error) -> std::result::Result<u8, i32> {<std::result::Result<u8, i32> as std::ops::Try>::from_error}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb6: {
|
||||
StorageDead(_8); // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
StorageDead(_6); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:24:15: 24:16
|
||||
StorageDead(_2); // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
|
||||
goto -> bb7; // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
|
||||
}
|
||||
|
||||
bb7: {
|
||||
return; // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
- // MIR for `id_try` before SimplifyBranchSame
|
||||
+ // MIR for `id_try` after SimplifyBranchSame
|
||||
|
||||
fn id_try(_1: std::result::Result<u8, i32>) -> std::result::Result<u8, i32> {
|
||||
debug r => _1; // in scope 0 at $DIR/simplify-arm.rs:23:11: 23:12
|
||||
let mut _0: std::result::Result<u8, i32>; // return place in scope 0 at $DIR/simplify-arm.rs:23:34: 23:49
|
||||
let _2: u8; // in scope 0 at $DIR/simplify-arm.rs:24:9: 24:10
|
||||
let mut _3: std::result::Result<u8, i32>; // in scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
let mut _4: std::result::Result<u8, i32>; // in scope 0 at $DIR/simplify-arm.rs:24:13: 24:14
|
||||
let mut _5: isize; // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
let _6: i32; // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
let mut _7: !; // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
let mut _8: i32; // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
let mut _9: i32; // in scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
let _10: u8; // in scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
let mut _11: u8; // in scope 0 at $DIR/simplify-arm.rs:25:8: 25:9
|
||||
scope 1 {
|
||||
debug x => _2; // in scope 1 at $DIR/simplify-arm.rs:24:9: 24:10
|
||||
}
|
||||
scope 2 {
|
||||
debug err => _6; // in scope 2 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
scope 3 {
|
||||
}
|
||||
}
|
||||
scope 4 {
|
||||
debug val => _10; // in scope 4 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
scope 5 {
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/simplify-arm.rs:24:9: 24:10
|
||||
StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
StorageLive(_4); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:14
|
||||
_4 = _1; // scope 0 at $DIR/simplify-arm.rs:24:13: 24:14
|
||||
_3 = const <std::result::Result<u8, i32> as std::ops::Try>::into_result(move _4) -> bb1; // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
// ty::Const
|
||||
// + ty: fn(std::result::Result<u8, i32>) -> std::result::Result<<std::result::Result<u8, i32> as std::ops::Try>::Ok, <std::result::Result<u8, i32> as std::ops::Try>::Error> {<std::result::Result<u8, i32> as std::ops::Try>::into_result}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify-arm.rs:24:13: 24:15
|
||||
// + literal: Const { ty: fn(std::result::Result<u8, i32>) -> std::result::Result<<std::result::Result<u8, i32> as std::ops::Try>::Ok, <std::result::Result<u8, i32> as std::ops::Try>::Error> {<std::result::Result<u8, i32> as std::ops::Try>::into_result}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_4); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
_5 = discriminant(_3); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
switchInt(move _5) -> [0isize: bb2, 1isize: bb4, otherwise: bb3]; // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_0 = move _3; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
|
||||
StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:24:15: 24:16
|
||||
StorageDead(_2); // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
|
||||
goto -> bb7; // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
|
||||
}
|
||||
|
||||
bb3: {
|
||||
unreachable; // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageLive(_6); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
_6 = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
StorageLive(_8); // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
StorageLive(_9); // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
_9 = _6; // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
_8 = const <i32 as std::convert::From<i32>>::from(move _9) -> bb5; // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
// ty::Const
|
||||
// + ty: fn(i32) -> i32 {<i32 as std::convert::From<i32>>::from}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify-arm.rs:24:14: 24:15
|
||||
// + literal: Const { ty: fn(i32) -> i32 {<i32 as std::convert::From<i32>>::from}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageDead(_9); // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
_0 = const <std::result::Result<u8, i32> as std::ops::Try>::from_error(move _8) -> bb6; // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
// ty::Const
|
||||
// + ty: fn(<std::result::Result<u8, i32> as std::ops::Try>::Error) -> std::result::Result<u8, i32> {<std::result::Result<u8, i32> as std::ops::Try>::from_error}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify-arm.rs:24:13: 24:15
|
||||
// + literal: Const { ty: fn(<std::result::Result<u8, i32> as std::ops::Try>::Error) -> std::result::Result<u8, i32> {<std::result::Result<u8, i32> as std::ops::Try>::from_error}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb6: {
|
||||
StorageDead(_8); // scope 3 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
StorageDead(_6); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
|
||||
StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:24:15: 24:16
|
||||
StorageDead(_2); // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
|
||||
goto -> bb7; // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
|
||||
}
|
||||
|
||||
bb7: {
|
||||
return; // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -15,16 +15,16 @@
|
|||
let _10: u32; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:7:8: 7:9
|
||||
scope 1 {
|
||||
debug y => _10; // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
|
||||
debug y => _2; // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
|
||||
}
|
||||
scope 2 {
|
||||
debug err => _6; // in scope 2 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
scope 3 {
|
||||
scope 7 {
|
||||
debug t => _6; // in scope 7 at $SRC_DIR/libcore/convert/mod.rs:LL:COL
|
||||
debug t => _9; // in scope 7 at $SRC_DIR/libcore/convert/mod.rs:LL:COL
|
||||
}
|
||||
scope 8 {
|
||||
debug v => _6; // in scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
debug v => _8; // in scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
}
|
||||
}
|
||||
|
|
@ -35,31 +35,54 @@
|
|||
}
|
||||
}
|
||||
scope 6 {
|
||||
debug self => _1; // in scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
debug self => _4; // in scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_5 = discriminant(_1); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:6:9: 6:10
|
||||
StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
|
||||
_4 = _1; // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
|
||||
_3 = move _4; // scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
_5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
switchInt(move _5) -> [0isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _10 = ((_1 as Ok).0: u32); // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
- ((_0 as Ok).0: u32) = move _10; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
- StorageLive(_10); // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
- _10 = ((_3 as Ok).0: u32); // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
- _2 = _10; // scope 5 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
- StorageDead(_10); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
+ _0 = move _3; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:6:15: 6:16
|
||||
- StorageLive(_11); // scope 1 at $DIR/simplify_try.rs:7:8: 7:9
|
||||
- _11 = _2; // scope 1 at $DIR/simplify_try.rs:7:8: 7:9
|
||||
- ((_0 as Ok).0: u32) = move _11; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
- discriminant(_0) = 0; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
+ _0 = move _1; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
+ nop; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
+ nop; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
- StorageDead(_11); // scope 1 at $DIR/simplify_try.rs:7:9: 7:10
|
||||
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:8:1: 8:2
|
||||
goto -> bb3; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
|
||||
}
|
||||
|
||||
bb2: {
|
||||
- _6 = ((_1 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
- ((_0 as Err).0: i32) = move _6; // scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
- StorageLive(_6); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
- _6 = ((_3 as Err).0: i32); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
- StorageLive(_8); // scope 3 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
- StorageLive(_9); // scope 3 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
- _9 = _6; // scope 3 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
- _8 = move _9; // scope 7 at $SRC_DIR/libcore/convert/mod.rs:LL:COL
|
||||
- StorageDead(_9); // scope 3 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
- StorageLive(_12); // scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
- _12 = move _8; // scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
- ((_0 as Err).0: i32) = move _12; // scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
- discriminant(_0) = 1; // scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
+ _0 = move _1; // scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
+ nop; // scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
+ nop; // scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
- StorageDead(_12); // scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
- StorageDead(_8); // scope 3 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
- StorageDead(_6); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
+ _0 = move _3; // scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:6:15: 6:16
|
||||
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:8:1: 8:2
|
||||
goto -> bb3; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,16 +14,16 @@ fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i
|
|||
let _10: u32; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
let mut _11: u32; // in scope 0 at $DIR/simplify_try.rs:7:8: 7:9
|
||||
scope 1 {
|
||||
debug y => _10; // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
|
||||
debug y => _2; // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
|
||||
}
|
||||
scope 2 {
|
||||
debug err => _6; // in scope 2 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
scope 3 {
|
||||
scope 7 {
|
||||
debug t => _6; // in scope 7 at $SRC_DIR/libcore/convert/mod.rs:LL:COL
|
||||
debug t => _9; // in scope 7 at $SRC_DIR/libcore/convert/mod.rs:LL:COL
|
||||
}
|
||||
scope 8 {
|
||||
debug v => _6; // in scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
debug v => _8; // in scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
let mut _12: i32; // in scope 8 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
}
|
||||
}
|
||||
|
|
@ -34,18 +34,24 @@ fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i
|
|||
}
|
||||
}
|
||||
scope 6 {
|
||||
debug self => _1; // in scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
debug self => _4; // in scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_5 = discriminant(_1); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:6:9: 6:10
|
||||
StorageLive(_3); // scope 0 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
StorageLive(_4); // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
|
||||
_4 = _1; // scope 0 at $DIR/simplify_try.rs:6:13: 6:14
|
||||
_3 = move _4; // scope 6 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
StorageDead(_4); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
_5 = discriminant(_3); // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
goto -> bb1; // scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_0 = move _1; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
nop; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
nop; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
_0 = move _3; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:6:15: 6:16
|
||||
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:8:1: 8:2
|
||||
goto -> bb2; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,24 +3,27 @@
|
|||
fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i32> {
|
||||
debug x => _1; // in scope 0 at $DIR/simplify_try.rs:5:17: 5:18
|
||||
let mut _0: std::result::Result<u32, i32>; // return place in scope 0 at $DIR/simplify_try.rs:5:41: 5:57
|
||||
let _2: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
let _3: u32; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
let _2: u32; // in scope 0 at $DIR/simplify_try.rs:6:9: 6:10
|
||||
let _3: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
let mut _4: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
let mut _5: i32; // in scope 0 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
let _6: u32; // in scope 0 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
scope 1 {
|
||||
debug y => _3; // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
|
||||
debug y => _2; // in scope 1 at $DIR/simplify_try.rs:6:9: 6:10
|
||||
}
|
||||
scope 2 {
|
||||
debug err => _2; // in scope 2 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
debug err => _3; // in scope 2 at $DIR/simplify_try.rs:6:14: 6:15
|
||||
scope 3 {
|
||||
scope 7 {
|
||||
debug t => _2; // in scope 7 at $SRC_DIR/libcore/convert/mod.rs:LL:COL
|
||||
debug t => _5; // in scope 7 at $SRC_DIR/libcore/convert/mod.rs:LL:COL
|
||||
}
|
||||
scope 8 {
|
||||
debug v => _2; // in scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
debug v => _4; // in scope 8 at $SRC_DIR/libcore/result.rs:LL:COL
|
||||
}
|
||||
}
|
||||
}
|
||||
scope 4 {
|
||||
debug val => _3; // in scope 4 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
debug val => _6; // in scope 4 at $DIR/simplify_try.rs:6:13: 6:15
|
||||
scope 5 {
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +32,9 @@ fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i
|
|||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // scope 0 at $DIR/simplify_try.rs:6:9: 6:10
|
||||
_0 = move _1; // scope 1 at $DIR/simplify_try.rs:7:5: 7:10
|
||||
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:8:1: 8:2
|
||||
return; // scope 0 at $DIR/simplify_try.rs:8:2: 8:2
|
||||
}
|
||||
}
|
||||
|
|
|
|||
40
src/test/mir-opt/simplify_try_if_let.rs
Normal file
40
src/test/mir-opt/simplify_try_if_let.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
// compile-flags: -Zmir-opt-level=1
|
||||
// EMIT_MIR rustc.{{impl}}-append.SimplifyArmIdentity.diff
|
||||
|
||||
use std::ptr::NonNull;
|
||||
|
||||
pub struct LinkedList {
|
||||
head: Option<NonNull<Node>>,
|
||||
tail: Option<NonNull<Node>>,
|
||||
}
|
||||
|
||||
pub struct Node {
|
||||
next: Option<NonNull<Node>>,
|
||||
}
|
||||
|
||||
impl LinkedList {
|
||||
pub fn new() -> Self {
|
||||
Self { head: None, tail: None }
|
||||
}
|
||||
|
||||
pub fn append(&mut self, other: &mut Self) {
|
||||
match self.tail {
|
||||
None => { },
|
||||
Some(mut tail) => {
|
||||
// `as_mut` is okay here because we have exclusive access to the entirety
|
||||
// of both lists.
|
||||
if let Some(other_head) = other.head.take() {
|
||||
unsafe {
|
||||
tail.as_mut().next = Some(other_head);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut one = LinkedList::new();
|
||||
let mut two = LinkedList::new();
|
||||
one.append(&mut two);
|
||||
}
|
||||
|
|
@ -0,0 +1,127 @@
|
|||
- // MIR for `<impl at $DIR/simplify_try_if_let.rs:15:1: 34:2>::append` before SimplifyArmIdentity
|
||||
+ // MIR for `<impl at $DIR/simplify_try_if_let.rs:15:1: 34:2>::append` after SimplifyArmIdentity
|
||||
|
||||
fn <impl at $DIR/simplify_try_if_let.rs:15:1: 34:2>::append(_1: &mut LinkedList, _2: &mut LinkedList) -> () {
|
||||
debug self => _1; // in scope 0 at $DIR/simplify_try_if_let.rs:20:19: 20:28
|
||||
debug other => _2; // in scope 0 at $DIR/simplify_try_if_let.rs:20:30: 20:35
|
||||
let mut _0: (); // return place in scope 0 at $DIR/simplify_try_if_let.rs:20:48: 20:48
|
||||
let mut _3: isize; // in scope 0 at $DIR/simplify_try_if_let.rs:22:13: 22:17
|
||||
let mut _4: std::ptr::NonNull<Node>; // in scope 0 at $DIR/simplify_try_if_let.rs:23:18: 23:26
|
||||
let mut _5: std::option::Option<std::ptr::NonNull<Node>>; // in scope 0 at $DIR/simplify_try_if_let.rs:26:43: 26:60
|
||||
let mut _6: &mut std::option::Option<std::ptr::NonNull<Node>>; // in scope 0 at $DIR/simplify_try_if_let.rs:26:43: 26:53
|
||||
let mut _7: isize; // in scope 0 at $DIR/simplify_try_if_let.rs:26:24: 26:40
|
||||
let mut _9: std::option::Option<std::ptr::NonNull<Node>>; // in scope 0 at $DIR/simplify_try_if_let.rs:28:46: 28:62
|
||||
let mut _10: std::ptr::NonNull<Node>; // in scope 0 at $DIR/simplify_try_if_let.rs:28:51: 28:61
|
||||
let mut _11: &mut Node; // in scope 0 at $DIR/simplify_try_if_let.rs:28:25: 28:38
|
||||
let mut _12: &mut std::ptr::NonNull<Node>; // in scope 0 at $DIR/simplify_try_if_let.rs:28:25: 28:29
|
||||
scope 1 {
|
||||
debug tail => _4; // in scope 1 at $DIR/simplify_try_if_let.rs:23:18: 23:26
|
||||
let _8: std::ptr::NonNull<Node>; // in scope 1 at $DIR/simplify_try_if_let.rs:26:29: 26:39
|
||||
scope 2 {
|
||||
debug other_head => _8; // in scope 2 at $DIR/simplify_try_if_let.rs:26:29: 26:39
|
||||
scope 3 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_3 = discriminant(((*_1).1: std::option::Option<std::ptr::NonNull<Node>>)); // scope 0 at $DIR/simplify_try_if_let.rs:22:13: 22:17
|
||||
switchInt(move _3) -> [0isize: bb3, 1isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify_try_if_let.rs:22:13: 22:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageLive(_4); // scope 0 at $DIR/simplify_try_if_let.rs:23:18: 23:26
|
||||
_4 = ((((*_1).1: std::option::Option<std::ptr::NonNull<Node>>) as Some).0: std::ptr::NonNull<Node>); // scope 0 at $DIR/simplify_try_if_let.rs:23:18: 23:26
|
||||
StorageLive(_5); // scope 1 at $DIR/simplify_try_if_let.rs:26:43: 26:60
|
||||
StorageLive(_6); // scope 1 at $DIR/simplify_try_if_let.rs:26:43: 26:53
|
||||
_6 = &mut ((*_2).0: std::option::Option<std::ptr::NonNull<Node>>); // scope 1 at $DIR/simplify_try_if_let.rs:26:43: 26:53
|
||||
_5 = const std::option::Option::<std::ptr::NonNull<Node>>::take(move _6) -> bb4; // scope 1 at $DIR/simplify_try_if_let.rs:26:43: 26:60
|
||||
// ty::Const
|
||||
// + ty: for<'r> fn(&'r mut std::option::Option<std::ptr::NonNull<Node>>) -> std::option::Option<std::ptr::NonNull<Node>> {std::option::Option::<std::ptr::NonNull<Node>>::take}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify_try_if_let.rs:26:54: 26:58
|
||||
// + literal: Const { ty: for<'r> fn(&'r mut std::option::Option<std::ptr::NonNull<Node>>) -> std::option::Option<std::ptr::NonNull<Node>> {std::option::Option::<std::ptr::NonNull<Node>>::take}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
unreachable; // scope 0 at $DIR/simplify_try_if_let.rs:21:15: 21:24
|
||||
}
|
||||
|
||||
bb3: {
|
||||
_0 = const (); // scope 0 at $DIR/simplify_try_if_let.rs:22:21: 22:24
|
||||
// ty::Const
|
||||
// + ty: ()
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify_try_if_let.rs:22:21: 22:24
|
||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
goto -> bb9; // scope 0 at $DIR/simplify_try_if_let.rs:21:9: 32:10
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageDead(_6); // scope 1 at $DIR/simplify_try_if_let.rs:26:59: 26:60
|
||||
_7 = discriminant(_5); // scope 1 at $DIR/simplify_try_if_let.rs:26:24: 26:40
|
||||
switchInt(move _7) -> [1isize: bb6, otherwise: bb5]; // scope 1 at $DIR/simplify_try_if_let.rs:26:24: 26:40
|
||||
}
|
||||
|
||||
bb5: {
|
||||
_0 = const (); // scope 1 at $DIR/simplify_try_if_let.rs:26:17: 30:18
|
||||
// ty::Const
|
||||
// + ty: ()
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify_try_if_let.rs:26:17: 30:18
|
||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
goto -> bb8; // scope 1 at $DIR/simplify_try_if_let.rs:26:17: 30:18
|
||||
}
|
||||
|
||||
bb6: {
|
||||
StorageLive(_8); // scope 1 at $DIR/simplify_try_if_let.rs:26:29: 26:39
|
||||
_8 = ((_5 as Some).0: std::ptr::NonNull<Node>); // scope 1 at $DIR/simplify_try_if_let.rs:26:29: 26:39
|
||||
StorageLive(_9); // scope 3 at $DIR/simplify_try_if_let.rs:28:46: 28:62
|
||||
- StorageLive(_10); // scope 3 at $DIR/simplify_try_if_let.rs:28:51: 28:61
|
||||
- _10 = _8; // scope 3 at $DIR/simplify_try_if_let.rs:28:51: 28:61
|
||||
- ((_9 as Some).0: std::ptr::NonNull<Node>) = move _10; // scope 3 at $DIR/simplify_try_if_let.rs:28:46: 28:62
|
||||
- discriminant(_9) = 1; // scope 3 at $DIR/simplify_try_if_let.rs:28:46: 28:62
|
||||
- StorageDead(_10); // scope 3 at $DIR/simplify_try_if_let.rs:28:61: 28:62
|
||||
+ _9 = move _5; // scope 3 at $DIR/simplify_try_if_let.rs:28:46: 28:62
|
||||
StorageLive(_11); // scope 3 at $DIR/simplify_try_if_let.rs:28:25: 28:38
|
||||
StorageLive(_12); // scope 3 at $DIR/simplify_try_if_let.rs:28:25: 28:29
|
||||
_12 = &mut _4; // scope 3 at $DIR/simplify_try_if_let.rs:28:25: 28:29
|
||||
_11 = const std::ptr::NonNull::<Node>::as_mut(move _12) -> bb7; // scope 3 at $DIR/simplify_try_if_let.rs:28:25: 28:38
|
||||
// ty::Const
|
||||
// + ty: for<'r> unsafe fn(&'r mut std::ptr::NonNull<Node>) -> &'r mut Node {std::ptr::NonNull::<Node>::as_mut}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify_try_if_let.rs:28:30: 28:36
|
||||
// + literal: Const { ty: for<'r> unsafe fn(&'r mut std::ptr::NonNull<Node>) -> &'r mut Node {std::ptr::NonNull::<Node>::as_mut}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb7: {
|
||||
StorageDead(_12); // scope 3 at $DIR/simplify_try_if_let.rs:28:37: 28:38
|
||||
((*_11).0: std::option::Option<std::ptr::NonNull<Node>>) = move _9; // scope 3 at $DIR/simplify_try_if_let.rs:28:25: 28:62
|
||||
StorageDead(_9); // scope 3 at $DIR/simplify_try_if_let.rs:28:61: 28:62
|
||||
StorageDead(_11); // scope 3 at $DIR/simplify_try_if_let.rs:28:62: 28:63
|
||||
_0 = const (); // scope 3 at $DIR/simplify_try_if_let.rs:27:21: 29:22
|
||||
// ty::Const
|
||||
// + ty: ()
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/simplify_try_if_let.rs:27:21: 29:22
|
||||
// + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
StorageDead(_8); // scope 1 at $DIR/simplify_try_if_let.rs:30:17: 30:18
|
||||
goto -> bb8; // scope 1 at $DIR/simplify_try_if_let.rs:26:17: 30:18
|
||||
}
|
||||
|
||||
bb8: {
|
||||
StorageDead(_5); // scope 1 at $DIR/simplify_try_if_let.rs:31:13: 31:14
|
||||
StorageDead(_4); // scope 0 at $DIR/simplify_try_if_let.rs:32:9: 32:10
|
||||
goto -> bb9; // scope 0 at $DIR/simplify_try_if_let.rs:21:9: 32:10
|
||||
}
|
||||
|
||||
bb9: {
|
||||
return; // scope 0 at $DIR/simplify_try_if_let.rs:33:6: 33:6
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
// ignore-order
|
||||
|
||||
const QUERY = '+';
|
||||
|
||||
const EXPECTED = {
|
||||
'others': [
|
||||
{ 'path': 'std::ops', 'name': 'AddAssign' },
|
||||
{ 'path': 'std::ops', 'name': 'Add' },
|
||||
{ 'path': 'core::ops', 'name': 'AddAssign' },
|
||||
{ 'path': 'core::ops', 'name': 'Add' },
|
||||
],
|
||||
};
|
||||
|
|
|
|||
263
src/test/rustdoc-js/doc-alias.js
Normal file
263
src/test/rustdoc-js/doc-alias.js
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
// exact-check
|
||||
|
||||
const QUERY = [
|
||||
'StructItem',
|
||||
'StructFieldItem',
|
||||
'StructMethodItem',
|
||||
'ImplTraitItem',
|
||||
'ImplAssociatedConstItem',
|
||||
'ImplTraitFunction',
|
||||
'EnumItem',
|
||||
'VariantItem',
|
||||
'EnumMethodItem',
|
||||
'TypedefItem',
|
||||
'TraitItem',
|
||||
'TraitTypeItem',
|
||||
'AssociatedConstItem',
|
||||
'TraitFunctionItem',
|
||||
'FunctionItem',
|
||||
'ModuleItem',
|
||||
'ConstItem',
|
||||
'StaticItem',
|
||||
'UnionItem',
|
||||
'UnionFieldItem',
|
||||
'UnionMethodItem',
|
||||
'MacroItem',
|
||||
];
|
||||
|
||||
const EXPECTED = [
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Struct',
|
||||
'alias': 'StructItem',
|
||||
'href': '../doc_alias/struct.Struct.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Struct',
|
||||
'name': 'field',
|
||||
'alias': 'StructFieldItem',
|
||||
'href': '../doc_alias/struct.Struct.html#structfield.field',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Struct',
|
||||
'name': 'method',
|
||||
'alias': 'StructMethodItem',
|
||||
'href': '../doc_alias/struct.Struct.html#method.method',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
// ImplTraitItem
|
||||
'others': [],
|
||||
},
|
||||
{
|
||||
// ImplAssociatedConstItem
|
||||
'others': [],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Struct',
|
||||
'name': 'function',
|
||||
'alias': 'ImplTraitFunction',
|
||||
'href': '../doc_alias/struct.Struct.html#method.function',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Enum',
|
||||
'alias': 'EnumItem',
|
||||
'href': '../doc_alias/enum.Enum.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Enum',
|
||||
'name': 'Variant',
|
||||
'alias': 'VariantItem',
|
||||
'href': '../doc_alias/enum.Enum.html#variant.Variant',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Enum',
|
||||
'name': 'method',
|
||||
'alias': 'EnumMethodItem',
|
||||
'href': '../doc_alias/enum.Enum.html#method.method',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Typedef',
|
||||
'alias': 'TypedefItem',
|
||||
'href': '../doc_alias/type.Typedef.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Trait',
|
||||
'alias': 'TraitItem',
|
||||
'href': '../doc_alias/trait.Trait.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Trait',
|
||||
'name': 'Target',
|
||||
'alias': 'TraitTypeItem',
|
||||
'href': '../doc_alias/trait.Trait.html#associatedtype.Target',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Trait',
|
||||
'name': 'AssociatedConst',
|
||||
'alias': 'AssociatedConstItem',
|
||||
'href': '../doc_alias/trait.Trait.html#associatedconstant.AssociatedConst',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Trait',
|
||||
'name': 'function',
|
||||
'alias': 'TraitFunctionItem',
|
||||
'href': '../doc_alias/trait.Trait.html#tymethod.function',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'function',
|
||||
'alias': 'FunctionItem',
|
||||
'href': '../doc_alias/fn.function.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Module',
|
||||
'alias': 'ModuleItem',
|
||||
'href': '../doc_alias/Module/index.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Const',
|
||||
'alias': 'ConstItem',
|
||||
'href': '../doc_alias/constant.Const.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Static',
|
||||
'alias': 'StaticItem',
|
||||
'href': '../doc_alias/static.Static.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Union',
|
||||
'alias': 'UnionItem',
|
||||
'href': '../doc_alias/union.Union.html',
|
||||
'is_alias': true
|
||||
},
|
||||
// Not an alias!
|
||||
{
|
||||
'path': 'doc_alias::Union',
|
||||
'name': 'union_item',
|
||||
'href': '../doc_alias/union.Union.html#structfield.union_item'
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Union',
|
||||
'name': 'union_item',
|
||||
'alias': 'UnionFieldItem',
|
||||
'href': '../doc_alias/union.Union.html#structfield.union_item',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias::Union',
|
||||
'name': 'method',
|
||||
'alias': 'UnionMethodItem',
|
||||
'href': '../doc_alias/union.Union.html#method.method',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'others': [
|
||||
{
|
||||
'path': 'doc_alias',
|
||||
'name': 'Macro',
|
||||
'alias': 'MacroItem',
|
||||
'href': '../doc_alias/macro.Macro.html',
|
||||
'is_alias': true
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
79
src/test/rustdoc-js/doc-alias.rs
Normal file
79
src/test/rustdoc-js/doc-alias.rs
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
#![feature(doc_alias)]
|
||||
|
||||
#[doc(alias = "StructItem")]
|
||||
pub struct Struct {
|
||||
#[doc(alias = "StructFieldItem")]
|
||||
pub field: u32,
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
#[doc(alias = "StructMethodItem")]
|
||||
pub fn method(&self) {}
|
||||
}
|
||||
|
||||
impl Trait for Struct {
|
||||
// Shouldn't be listed in aliases!
|
||||
#[doc(alias = "ImplTraitItem")]
|
||||
type Target = u32;
|
||||
// Shouldn't be listed in aliases!
|
||||
#[doc(alias = "ImplAssociatedConstItem")]
|
||||
const AssociatedConst: i32 = 12;
|
||||
|
||||
#[doc(alias = "ImplTraitFunction")]
|
||||
fn function() -> Self::Target { 0 }
|
||||
}
|
||||
|
||||
#[doc(alias = "EnumItem")]
|
||||
pub enum Enum {
|
||||
#[doc(alias = "VariantItem")]
|
||||
Variant,
|
||||
}
|
||||
|
||||
impl Enum {
|
||||
#[doc(alias = "EnumMethodItem")]
|
||||
pub fn method(&self) {}
|
||||
}
|
||||
|
||||
#[doc(alias = "TypedefItem")]
|
||||
pub type Typedef = i32;
|
||||
|
||||
#[doc(alias = "TraitItem")]
|
||||
pub trait Trait {
|
||||
#[doc(alias = "TraitTypeItem")]
|
||||
type Target;
|
||||
#[doc(alias = "AssociatedConstItem")]
|
||||
const AssociatedConst: i32;
|
||||
|
||||
#[doc(alias = "TraitFunctionItem")]
|
||||
fn function() -> Self::Target;
|
||||
}
|
||||
|
||||
#[doc(alias = "FunctionItem")]
|
||||
pub fn function() {}
|
||||
|
||||
#[doc(alias = "ModuleItem")]
|
||||
pub mod Module {}
|
||||
|
||||
#[doc(alias = "ConstItem")]
|
||||
pub const Const: u32 = 0;
|
||||
|
||||
#[doc(alias = "StaticItem")]
|
||||
pub static Static: u32 = 0;
|
||||
|
||||
#[doc(alias = "UnionItem")]
|
||||
pub union Union {
|
||||
#[doc(alias = "UnionFieldItem")]
|
||||
pub union_item: u32,
|
||||
pub y: f32,
|
||||
}
|
||||
|
||||
impl Union {
|
||||
#[doc(alias = "UnionMethodItem")]
|
||||
pub fn method(&self) {}
|
||||
}
|
||||
|
||||
#[doc(alias = "MacroItem")]
|
||||
#[macro_export]
|
||||
macro_rules! Macro {
|
||||
() => {}
|
||||
}
|
||||
35
src/test/rustdoc/intra-link-trait-impl.rs
Normal file
35
src/test/rustdoc/intra-link-trait-impl.rs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#![crate_name = "foo"]
|
||||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
pub struct MyStruct;
|
||||
|
||||
impl MyTrait for MyStruct {
|
||||
|
||||
// @has foo/struct.MyStruct.html '//a/@href' '../foo/struct.MyStruct.html#associatedtype.AssoType'
|
||||
|
||||
/// [`AssoType`]
|
||||
///
|
||||
/// [`AssoType`]: MyStruct::AssoType
|
||||
type AssoType = u32;
|
||||
|
||||
// @has foo/struct.MyStruct.html '//a/@href' '../foo/struct.MyStruct.html#associatedconstant.ASSO_CONST'
|
||||
|
||||
/// [`ASSO_CONST`]
|
||||
///
|
||||
/// [`ASSO_CONST`]: MyStruct::ASSO_CONST
|
||||
const ASSO_CONST: i32 = 10;
|
||||
|
||||
// @has foo/struct.MyStruct.html '//a/@href' '../foo/struct.MyStruct.html#method.trait_fn'
|
||||
|
||||
/// [`trait_fn`]
|
||||
///
|
||||
/// [`trait_fn`]: MyStruct::trait_fn
|
||||
fn trait_fn() { }
|
||||
}
|
||||
|
||||
pub trait MyTrait {
|
||||
type AssoType;
|
||||
const ASSO_CONST: i32 = 1;
|
||||
fn trait_fn();
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
// @matches issue_32374/index.html '//*[@class="docblock-short"]/text()' 'Docs'
|
||||
|
||||
// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]' \
|
||||
// 'Deprecated since 1.0.0: text'
|
||||
// '👎 Deprecated since 1.0.0: text'
|
||||
// @has - '<code>test</code> <a href="http://issue_url/32374">#32374</a>'
|
||||
// @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \
|
||||
// '🔬 This is a nightly-only experimental API. \(test\s#32374\)$'
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
pub struct T;
|
||||
|
||||
// @has issue_32374/struct.U.html '//*[@class="stab deprecated"]' \
|
||||
// 'Deprecated since 1.0.0: deprecated'
|
||||
// '👎 Deprecated since 1.0.0: deprecated'
|
||||
// @has issue_32374/struct.U.html '//*[@class="stab unstable"]' \
|
||||
// '🔬 This is a nightly-only experimental API. (test #32374)'
|
||||
// @has issue_32374/struct.U.html '//details' \
|
||||
|
|
|
|||
6
src/test/rustdoc/test-strikethrough.rs
Normal file
6
src/test/rustdoc/test-strikethrough.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#![crate_name = "foo"]
|
||||
|
||||
// @has foo/fn.f.html
|
||||
// @has - //del "Y"
|
||||
/// ~~Y~~
|
||||
pub fn f() {}
|
||||
|
|
@ -32,7 +32,6 @@ fn main() {
|
|||
TyKind::Never => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
TyKind::Tuple(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
TyKind::Projection(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
TyKind::UnnormalizedProjection(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
TyKind::Opaque(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
TyKind::Param(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
TyKind::Bound(..) => (), //~ ERROR usage of `ty::TyKind::<kind>`
|
||||
|
|
|
|||
|
|
@ -139,58 +139,52 @@ LL | TyKind::Projection(..) => (),
|
|||
error: usage of `ty::TyKind::<kind>`
|
||||
--> $DIR/ty_tykind_usage.rs:35:9
|
||||
|
|
||||
LL | TyKind::UnnormalizedProjection(..) => (),
|
||||
LL | TyKind::Opaque(..) => (),
|
||||
| ^^^^^^ help: try using ty::<kind> directly: `ty`
|
||||
|
||||
error: usage of `ty::TyKind::<kind>`
|
||||
--> $DIR/ty_tykind_usage.rs:36:9
|
||||
|
|
||||
LL | TyKind::Opaque(..) => (),
|
||||
LL | TyKind::Param(..) => (),
|
||||
| ^^^^^^ help: try using ty::<kind> directly: `ty`
|
||||
|
||||
error: usage of `ty::TyKind::<kind>`
|
||||
--> $DIR/ty_tykind_usage.rs:37:9
|
||||
|
|
||||
LL | TyKind::Param(..) => (),
|
||||
LL | TyKind::Bound(..) => (),
|
||||
| ^^^^^^ help: try using ty::<kind> directly: `ty`
|
||||
|
||||
error: usage of `ty::TyKind::<kind>`
|
||||
--> $DIR/ty_tykind_usage.rs:38:9
|
||||
|
|
||||
LL | TyKind::Bound(..) => (),
|
||||
LL | TyKind::Placeholder(..) => (),
|
||||
| ^^^^^^ help: try using ty::<kind> directly: `ty`
|
||||
|
||||
error: usage of `ty::TyKind::<kind>`
|
||||
--> $DIR/ty_tykind_usage.rs:39:9
|
||||
|
|
||||
LL | TyKind::Placeholder(..) => (),
|
||||
LL | TyKind::Infer(..) => (),
|
||||
| ^^^^^^ help: try using ty::<kind> directly: `ty`
|
||||
|
||||
error: usage of `ty::TyKind::<kind>`
|
||||
--> $DIR/ty_tykind_usage.rs:40:9
|
||||
|
|
||||
LL | TyKind::Infer(..) => (),
|
||||
| ^^^^^^ help: try using ty::<kind> directly: `ty`
|
||||
|
||||
error: usage of `ty::TyKind::<kind>`
|
||||
--> $DIR/ty_tykind_usage.rs:41:9
|
||||
|
|
||||
LL | TyKind::Error => (),
|
||||
| ^^^^^^ help: try using ty::<kind> directly: `ty`
|
||||
|
||||
error: usage of `ty::TyKind::<kind>`
|
||||
--> $DIR/ty_tykind_usage.rs:46:12
|
||||
--> $DIR/ty_tykind_usage.rs:45:12
|
||||
|
|
||||
LL | if let TyKind::Int(int_ty) = kind {}
|
||||
| ^^^^^^ help: try using ty::<kind> directly: `ty`
|
||||
|
||||
error: usage of `ty::TyKind`
|
||||
--> $DIR/ty_tykind_usage.rs:48:24
|
||||
--> $DIR/ty_tykind_usage.rs:47:24
|
||||
|
|
||||
LL | fn ty_kind(ty_bad: TyKind<'_>, ty_good: Ty<'_>) {}
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= help: try using `Ty` instead
|
||||
|
||||
error: aborting due to 31 previous errors
|
||||
error: aborting due to 30 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
fn is_123<const N: usize>(x: [u32; N]) -> bool {
|
||||
match x {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/match_arr_unknown_len.rs:1:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/match_arr_unknown_len.rs:6:9
|
||||
|
|
@ -13,7 +14,7 @@ LL | [1, 2] => true,
|
|||
| ^^^^^^ expected `2usize`, found `N`
|
||||
|
|
||||
= note: expected array `[u32; 2]`
|
||||
found array `[u32; _]`
|
||||
found array `[u32; N]`
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -16,11 +16,13 @@ error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` is not an iterato
|
|||
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
||||
|
|
||||
LL | fn assume_case1<T: Case1>() {
|
||||
| ^^^^^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::iter::Iterator`
|
||||
| |
|
||||
| `<<T as Case1>::C as std::iter::Iterator>::Item` is not an iterator
|
||||
| ^^^^^ `<<T as Case1>::C as std::iter::Iterator>::Item` is not an iterator
|
||||
|
|
||||
= help: the trait `std::iter::Iterator` is not implemented for `<<T as Case1>::C as std::iter::Iterator>::Item`
|
||||
help: consider further restricting the associated type
|
||||
|
|
||||
LL | fn assume_case1<T: Case1>() where <<T as Case1>::C as std::iter::Iterator>::Item: std::iter::Iterator {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be sent between threads safely
|
||||
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
||||
|
|
@ -32,11 +34,13 @@ LL | Send + Iterator<Item:
|
|||
| ---- required by this bound in `Case1`
|
||||
...
|
||||
LL | fn assume_case1<T: Case1>() {
|
||||
| ^^^^^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::marker::Send`
|
||||
| |
|
||||
| `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be sent between threads safely
|
||||
| ^^^^^ `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be sent between threads safely
|
||||
|
|
||||
= help: the trait `std::marker::Send` is not implemented for `<<T as Case1>::C as std::iter::Iterator>::Item`
|
||||
help: consider further restricting the associated type
|
||||
|
|
||||
LL | fn assume_case1<T: Case1>() where <<T as Case1>::C as std::iter::Iterator>::Item: std::marker::Send {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be shared between threads safely
|
||||
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
||||
|
|
@ -48,11 +52,13 @@ LL | > + Sync>;
|
|||
| ---- required by this bound in `Case1`
|
||||
...
|
||||
LL | fn assume_case1<T: Case1>() {
|
||||
| ^^^^^ - help: consider further restricting the associated type: `where <<T as Case1>::C as std::iter::Iterator>::Item: std::marker::Sync`
|
||||
| |
|
||||
| `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be shared between threads safely
|
||||
| ^^^^^ `<<T as Case1>::C as std::iter::Iterator>::Item` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `std::marker::Sync` is not implemented for `<<T as Case1>::C as std::iter::Iterator>::Item`
|
||||
help: consider further restricting the associated type
|
||||
|
|
||||
LL | fn assume_case1<T: Case1>() where <<T as Case1>::C as std::iter::Iterator>::Item: std::marker::Sync {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `<_ as Lam<&'a u8>>::App` doesn't implement `std::fmt::Debug`
|
||||
--> $DIR/bad-bounds-on-assoc-in-trait.rs:36:20
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![feature(impl_trait_in_bindings)] //~ WARN the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash [incomplete_features]
|
||||
#![feature(impl_trait_in_bindings)] //~ WARN the feature `impl_trait_in_bindings` is incomplete
|
||||
#![feature(untagged_unions)]
|
||||
|
||||
use std::iter;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/duplicate.rs:5:12
|
||||
|
|
||||
LL | #![feature(impl_trait_in_bindings)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
|
||||
|
||||
error[E0719]: the value of the associated type `Item` (from trait `std::iter::Iterator`) is already specified
|
||||
--> $DIR/duplicate.rs:10:36
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/dyn-lcsit.rs:4:12
|
||||
|
|
||||
LL | #![feature(impl_trait_in_bindings)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `impl_trait_in_bindings` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `impl_trait_in_bindings` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/lcsit.rs:4:12
|
||||
|
|
||||
LL | #![feature(impl_trait_in_bindings)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #63065 <https://github.com/rust-lang/rust/issues/63065> for more information
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ pub trait GetToInt
|
|||
}
|
||||
|
||||
fn foo<G>(g: G) -> isize
|
||||
where G : GetToInt, <G as GetToInt>::R: ToInt
|
||||
where G : GetToInt, <G as GetToInt>::R: ToInt
|
||||
{
|
||||
ToInt::to_int(&g.get()) //~ ERROR E0277
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,13 @@ error[E0277]: the trait bound `<G as GetToInt>::R: ToInt` is not satisfied
|
|||
LL | fn to_int(&self) -> isize;
|
||||
| -------------------------- required by `ToInt::to_int`
|
||||
...
|
||||
LL | where G : GetToInt
|
||||
| - help: consider further restricting the associated type: `, <G as GetToInt>::R: ToInt`
|
||||
LL | {
|
||||
LL | ToInt::to_int(&g.get())
|
||||
| ^^^^^^^^ the trait `ToInt` is not implemented for `<G as GetToInt>::R`
|
||||
|
|
||||
help: consider further restricting the associated type
|
||||
|
|
||||
LL | where G : GetToInt, <G as GetToInt>::R: ToInt
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ trait Get {
|
|||
}
|
||||
|
||||
trait Other {
|
||||
fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
|
||||
fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
|
||||
//~^ ERROR the trait bound `Self: Get` is not satisfied
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ error[E0277]: the trait bound `Self: Get` is not satisfied
|
|||
--> $DIR/associated-types-for-unimpl-trait.rs:10:5
|
||||
|
|
||||
LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^^
|
||||
| | |
|
||||
| | help: consider further restricting `Self`: `where Self: Get`
|
||||
| the trait `Get` is not implemented for `Self`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
|
||||
|
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ error[E0277]: the trait bound `Self: Get` is not satisfied
|
|||
--> $DIR/associated-types-no-suitable-supertrait-2.rs:17:5
|
||||
|
|
||||
LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^^
|
||||
| | |
|
||||
| | help: consider further restricting `Self`: `where Self: Get`
|
||||
| the trait `Get` is not implemented for `Self`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
|
||||
|
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ error[E0277]: the trait bound `Self: Get` is not satisfied
|
|||
--> $DIR/associated-types-no-suitable-supertrait.rs:17:5
|
||||
|
|
||||
LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^^
|
||||
| | |
|
||||
| | help: consider further restricting `Self`: `where Self: Get`
|
||||
| the trait `Get` is not implemented for `Self`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
|
||||
|
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `(T, U): Get` is not satisfied
|
||||
--> $DIR/associated-types-no-suitable-supertrait.rs:22:5
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ trait Get {
|
|||
}
|
||||
|
||||
trait Other {
|
||||
fn okay<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get ;
|
||||
fn okay<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get;
|
||||
//~^ ERROR E0277
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ error[E0277]: the trait bound `Self: Get` is not satisfied
|
|||
--> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:10:5
|
||||
|
|
||||
LL | fn okay<U:Get>(&self, foo: U, bar: <Self as Get>::Value);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-
|
||||
| | |
|
||||
| | help: consider further restricting `Self`: `where Self: Get`
|
||||
| the trait `Get` is not implemented for `Self`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
|
||||
|
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | fn okay<U:Get>(&self, foo: U, bar: <Self as Get>::Value) where Self: Get;
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ trait Get {
|
|||
fn get(&self) -> <Self as Get>::Value;
|
||||
}
|
||||
|
||||
fn foo<T:Get>(t: T) where <T as Get>::Value: std::marker::Sized {
|
||||
fn foo<T:Get>(t: T) where <T as Get>::Value: std::marker::Sized {
|
||||
let x = t.get(); //~ ERROR the size for values of type
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
error[E0277]: the size for values of type `<T as Get>::Value` cannot be known at compilation time
|
||||
--> $DIR/associated-types-unsized.rs:10:9
|
||||
|
|
||||
LL | fn foo<T:Get>(t: T) {
|
||||
| - help: consider further restricting the associated type: `where <T as Get>::Value: std::marker::Sized`
|
||||
LL | let x = t.get();
|
||||
| ^ doesn't have a size known at compile-time
|
||||
|
|
||||
|
|
@ -10,6 +8,10 @@ LL | let x = t.get();
|
|||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
= note: all local variables must have a statically known size
|
||||
= help: unsized locals are gated as an unstable feature
|
||||
help: consider further restricting the associated type
|
||||
|
|
||||
LL | fn foo<T:Get>(t: T) where <T as Get>::Value: std::marker::Sized {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -85,25 +85,29 @@ error[E0277]: the trait bound `<Self as Foo2<T>>::Baz: std::clone::Clone` is not
|
|||
--> $DIR/defaults-suitability.rs:72:15
|
||||
|
|
||||
LL | trait Foo2<T> {
|
||||
| -------------- help: consider further restricting the associated type: `where <Self as Foo2<T>>::Baz: std::clone::Clone`
|
||||
| |
|
||||
| required by `Foo2`
|
||||
| ------------- required by `Foo2`
|
||||
LL | type Bar: Clone = Vec<Self::Baz>;
|
||||
| ^^^^^ the trait `std::clone::Clone` is not implemented for `<Self as Foo2<T>>::Baz`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec<<Self as Foo2<T>>::Baz>`
|
||||
help: consider further restricting the associated type
|
||||
|
|
||||
LL | trait Foo2<T> where <Self as Foo2<T>>::Baz: std::clone::Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `<Self as Foo25<T>>::Baz: std::clone::Clone` is not satisfied
|
||||
--> $DIR/defaults-suitability.rs:81:15
|
||||
|
|
||||
LL | trait Foo25<T: Clone> {
|
||||
| ---------------------- help: consider further restricting the associated type: `where <Self as Foo25<T>>::Baz: std::clone::Clone`
|
||||
| |
|
||||
| required by `Foo25`
|
||||
| --------------------- required by `Foo25`
|
||||
LL | type Bar: Clone = Vec<Self::Baz>;
|
||||
| ^^^^^ the trait `std::clone::Clone` is not implemented for `<Self as Foo25<T>>::Baz`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `std::clone::Clone` for `std::vec::Vec<<Self as Foo25<T>>::Baz>`
|
||||
help: consider further restricting the associated type
|
||||
|
|
||||
LL | trait Foo25<T: Clone> where <Self as Foo25<T>>::Baz: std::clone::Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `T: std::clone::Clone` is not satisfied
|
||||
--> $DIR/defaults-suitability.rs:90:16
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ LL | trait UncheckedCopy: Sized {
|
|||
...
|
||||
LL | type Output: Copy
|
||||
| ^^^^ the trait `std::marker::Copy` is not implemented for `Self`
|
||||
|
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | trait UncheckedCopy: Sized + std::marker::Copy {
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: cannot add-assign `&'static str` to `Self`
|
||||
--> $DIR/defaults-unsound-62211-1.rs:25:7
|
||||
|
|
@ -17,6 +22,10 @@ LL | + AddAssign<&'static str>
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `Self += &'static str`
|
||||
|
|
||||
= help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `Self`
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | trait UncheckedCopy: Sized + std::ops::AddAssign<&'static str> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `Self: std::ops::Deref` is not satisfied
|
||||
--> $DIR/defaults-unsound-62211-1.rs:23:7
|
||||
|
|
@ -26,6 +35,11 @@ LL | trait UncheckedCopy: Sized {
|
|||
...
|
||||
LL | + Deref<Target = str>
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `Self`
|
||||
|
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | trait UncheckedCopy: Sized + std::ops::Deref {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `Self` doesn't implement `std::fmt::Display`
|
||||
--> $DIR/defaults-unsound-62211-1.rs:28:7
|
||||
|
|
@ -38,6 +52,10 @@ LL | + Display = Self;
|
|||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `Self`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | trait UncheckedCopy: Sized + std::fmt::Display {
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `T` doesn't implement `std::fmt::Display`
|
||||
--> $DIR/defaults-unsound-62211-1.rs:41:9
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ LL | trait UncheckedCopy: Sized {
|
|||
...
|
||||
LL | type Output: Copy
|
||||
| ^^^^ the trait `std::marker::Copy` is not implemented for `Self`
|
||||
|
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | trait UncheckedCopy: Sized + std::marker::Copy {
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: cannot add-assign `&'static str` to `Self`
|
||||
--> $DIR/defaults-unsound-62211-2.rs:25:7
|
||||
|
|
@ -17,6 +22,10 @@ LL | + AddAssign<&'static str>
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `Self += &'static str`
|
||||
|
|
||||
= help: the trait `std::ops::AddAssign<&'static str>` is not implemented for `Self`
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | trait UncheckedCopy: Sized + std::ops::AddAssign<&'static str> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `Self: std::ops::Deref` is not satisfied
|
||||
--> $DIR/defaults-unsound-62211-2.rs:23:7
|
||||
|
|
@ -26,6 +35,11 @@ LL | trait UncheckedCopy: Sized {
|
|||
...
|
||||
LL | + Deref<Target = str>
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Deref` is not implemented for `Self`
|
||||
|
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | trait UncheckedCopy: Sized + std::ops::Deref {
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `Self` doesn't implement `std::fmt::Display`
|
||||
--> $DIR/defaults-unsound-62211-2.rs:28:7
|
||||
|
|
@ -38,6 +52,10 @@ LL | + Display = Self;
|
|||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `Self`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | trait UncheckedCopy: Sized + std::fmt::Display {
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `T` doesn't implement `std::fmt::Display`
|
||||
--> $DIR/defaults-unsound-62211-2.rs:41:9
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ LL | type This = Self;
|
|||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `Self`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | trait MyTrait: std::marker::Sized {
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
use std::ops::{Add, Sub, Mul, Div};
|
||||
|
||||
trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> {}
|
||||
//~^ ERROR the size for values of type `Self` cannot be known at compilation time
|
||||
|
||||
impl<T> ArithmeticOps for T where T: Add<Output=T> + Sub<Output=T> + Mul<Output=T> + Div<Output=T> {
|
||||
// Nothing to implement, since T already supports the other traits.
|
||||
// It has the functions it needs already
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
||||
--> $DIR/trait-with-supertraits-needing-sized-self.rs:3:22
|
||||
|
|
||||
LL | trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> {}
|
||||
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
::: $SRC_DIR/libcore/ops/arith.rs:LL:COL
|
||||
|
|
||||
LL | pub trait Add<Rhs = Self> {
|
||||
| --- required by this bound in `std::ops::Add`
|
||||
|
|
||||
= help: the trait `std::marker::Sized` is not implemented for `Self`
|
||||
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | trait ArithmeticOps: Add<Output=Self> + Sub<Output=Self> + Mul<Output=Self> + Div<Output=Self> + std::marker::Sized {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
@ -237,7 +237,10 @@ error[E0277]: the `?` operator can only be applied to values that implement `std
|
|||
--> $DIR/incorrect-syntax-suggestions.rs:16:19
|
||||
|
|
||||
LL | let _ = await bar()?;
|
||||
| ^^^^^^ the `?` operator cannot be applied to type `impl std::future::Future`
|
||||
| ^^^^^^
|
||||
| |
|
||||
| the `?` operator cannot be applied to type `impl std::future::Future`
|
||||
| help: consider using `.await` here: `bar().await?`
|
||||
|
|
||||
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
|
||||
= note: required by `std::ops::Try::into_result`
|
||||
|
|
|
|||
32
src/test/ui/async-await/issue-61076.rs
Normal file
32
src/test/ui/async-await/issue-61076.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// edition:2018
|
||||
|
||||
use core::future::Future;
|
||||
use core::pin::Pin;
|
||||
use core::task::{Context, Poll};
|
||||
|
||||
struct T;
|
||||
|
||||
impl Future for T {
|
||||
type Output = Result<(), ()>;
|
||||
|
||||
fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
Poll::Pending
|
||||
}
|
||||
}
|
||||
|
||||
async fn foo() -> Result<(), ()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn bar() -> Result<(), ()> {
|
||||
foo()?; //~ ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn baz() -> Result<(), ()> {
|
||||
let t = T;
|
||||
t?; //~ ERROR the `?` operator can only be applied to values that implement `std::ops::Try`
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
27
src/test/ui/async-await/issue-61076.stderr
Normal file
27
src/test/ui/async-await/issue-61076.stderr
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
|
||||
--> $DIR/issue-61076.rs:22:5
|
||||
|
|
||||
LL | foo()?;
|
||||
| ^^^^^^
|
||||
| |
|
||||
| the `?` operator cannot be applied to type `impl std::future::Future`
|
||||
| help: consider using `.await` here: `foo().await?`
|
||||
|
|
||||
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
|
||||
= note: required by `std::ops::Try::into_result`
|
||||
|
||||
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
|
||||
--> $DIR/issue-61076.rs:28:5
|
||||
|
|
||||
LL | t?;
|
||||
| ^^
|
||||
| |
|
||||
| the `?` operator cannot be applied to type `T`
|
||||
| help: consider using `.await` here: `t.await?`
|
||||
|
|
||||
= help: the trait `std::ops::Try` is not implemented for `T`
|
||||
= note: required by `std::ops::Try::into_result`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
@ -6,4 +6,4 @@ LL | pub async fn new(_bar: &'a i32) -> Self {
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0754`.
|
||||
For more information about this error, try `rustc --explain E0755`.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ async fn an_async_block() -> u32 {
|
|||
let x: Option<u32> = None;
|
||||
x?; //~ ERROR the `?` operator
|
||||
22
|
||||
}.await
|
||||
}
|
||||
.await
|
||||
}
|
||||
|
||||
async fn async_closure_containing_fn() -> u32 {
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ LL | | let x: Option<u32> = None;
|
|||
LL | | x?;
|
||||
| | ^^ cannot use the `?` operator in an async block that returns `{integer}`
|
||||
LL | | 22
|
||||
LL | | }.await
|
||||
LL | | }
|
||||
| |_____- this function should return `Result` or `Option` to accept `?`
|
||||
|
|
||||
= help: the trait `std::ops::Try` is not implemented for `{integer}`
|
||||
= note: required by `std::ops::Try::from_error`
|
||||
|
||||
error[E0277]: the `?` operator can only be used in an async closure that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
|
||||
--> $DIR/try-on-option-in-async.rs:16:9
|
||||
--> $DIR/try-on-option-in-async.rs:17:9
|
||||
|
|
||||
LL | let async_closure = async || {
|
||||
| __________________________________-
|
||||
|
|
@ -29,7 +29,7 @@ LL | | };
|
|||
= note: required by `std::ops::Try::from_error`
|
||||
|
||||
error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
|
||||
--> $DIR/try-on-option-in-async.rs:25:5
|
||||
--> $DIR/try-on-option-in-async.rs:26:5
|
||||
|
|
||||
LL | async fn an_async_function() -> u32 {
|
||||
| _____________________________________-
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/const-param.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
error[E0158]: const parameters cannot be referenced in patterns
|
||||
--> $DIR/const-param.rs:7:9
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
trait Trait {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/apit-with-const-param.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
struct Bad<const N: usize, T> { //~ ERROR type parameters must be declared prior
|
||||
arr: [u8; { N }],
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@ error: type parameters must be declared prior to const parameters
|
|||
LL | struct Bad<const N: usize, T> {
|
||||
| -----------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const N: usize>`
|
||||
|
||||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/argument_order.rs:1:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ LL | let boxed_array = <Box<[i32; 33]>>::try_from(boxed_slice);
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::TryFrom<std::boxed::Box<[i32]>>` is not implemented for `std::boxed::Box<[i32; 33]>`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<std::boxed::Box<[T; _]> as std::convert::TryFrom<std::boxed::Box<[T]>>>
|
||||
<std::boxed::Box<[T; N]> as std::convert::TryFrom<std::boxed::Box<[T]>>>
|
||||
|
||||
error[E0277]: the trait bound `std::rc::Rc<[i32; 33]>: std::convert::From<std::rc::Rc<[i32]>>` is not satisfied
|
||||
--> $DIR/alloc-types-no-impls-length-33.rs:19:23
|
||||
|
|
@ -53,7 +53,7 @@ LL | let boxed_array = <Rc<[i32; 33]>>::try_from(boxed_slice);
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::TryFrom<std::rc::Rc<[i32]>>` is not implemented for `std::rc::Rc<[i32; 33]>`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<std::rc::Rc<[T; _]> as std::convert::TryFrom<std::rc::Rc<[T]>>>
|
||||
<std::rc::Rc<[T; N]> as std::convert::TryFrom<std::rc::Rc<[T]>>>
|
||||
|
||||
error[E0277]: the trait bound `std::sync::Arc<[i32; 33]>: std::convert::From<std::sync::Arc<[i32]>>` is not satisfied
|
||||
--> $DIR/alloc-types-no-impls-length-33.rs:26:23
|
||||
|
|
@ -77,7 +77,7 @@ LL | let boxed_array = <Arc<[i32; 33]>>::try_from(boxed_slice);
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::TryFrom<std::sync::Arc<[i32]>>` is not implemented for `std::sync::Arc<[i32; 33]>`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<std::sync::Arc<[T; _]> as std::convert::TryFrom<std::sync::Arc<[T]>>>
|
||||
<std::sync::Arc<[T; N]> as std::convert::TryFrom<std::sync::Arc<[T]>>>
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ LL | for _ in &[0_usize; 33] {
|
|||
| ^^^^^^^^^^^^^^ the trait `std::iter::IntoIterator` is not implemented for `&[usize; 33]`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<&'a [T; _] as std::iter::IntoIterator>
|
||||
<&'a [T; N] as std::iter::IntoIterator>
|
||||
<&'a [T] as std::iter::IntoIterator>
|
||||
<&'a mut [T; _] as std::iter::IntoIterator>
|
||||
<&'a mut [T; N] as std::iter::IntoIterator>
|
||||
<&'a mut [T] as std::iter::IntoIterator>
|
||||
= note: required by `std::iter::IntoIterator::into_iter`
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
#[allow(dead_code)]
|
||||
struct ArithArrayLen<const N: usize>([u32; 0 + N]);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/array-size-in-generic-struct-param.rs:1:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
error: constant expression depends on a generic parameter
|
||||
--> $DIR/array-size-in-generic-struct-param.rs:5:38
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/array-wrapper-struct-ctor.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
pub trait Foo {
|
||||
fn foo(&self);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/broken-mir-1.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,20 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/broken-mir-2.rs:1:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
error[E0277]: arrays only have std trait implementations for lengths 0..=32
|
||||
--> $DIR/broken-mir-2.rs:7:36
|
||||
|
|
||||
LL | struct S<T: Debug, const N: usize>([T; N]);
|
||||
| ^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[T; _]`
|
||||
| ^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[T; N]`
|
||||
|
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `[T; _]`
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[T; _]`
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `[T; N]`
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[T; N]`
|
||||
= note: required for the cast to the object type `dyn std::fmt::Debug`
|
||||
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
fn foo<const X: usize>() -> usize {
|
||||
0
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/cannot-infer-const-args.rs:1:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/cannot-infer-const-args.rs:9:5
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// check-pass
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
// This test confirms that the types can be inferred correctly for this example with const
|
||||
// generics. Previously this would ICE, and more recently error.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/cannot-infer-type-for-const-param.rs:2:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
//~^ WARN the feature `const_generics` is incomplete
|
||||
|
||||
struct A<const N: usize>; // ok
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue