Add multiple borrow test.

This commit is contained in:
Camille GILLOT 2023-05-13 10:31:55 +00:00
parent 13fb0794ac
commit 8fb888dfaa
3 changed files with 89 additions and 55 deletions

View file

@ -52,6 +52,9 @@
// gdb-command:print *f64_ref
// gdb-check:$14 = 3.5
// gdb-command:print *f64_double_ref
// gdb-check:$15 = 3.5
// === LLDB TESTS ==================================================================================
@ -112,6 +115,10 @@
// lldbg-check:[...]$12 = 3.5
// lldbr-check:(f64) *f64_ref = 3.5
// lldb-command:print *f64_double_ref
// lldbg-check:[...]$13 = 3.5
// lldbr-check:(f64) **f64_double_ref = 3.5
#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
@ -158,6 +165,7 @@ fn main() {
let f64_val: f64 = 3.5;
let f64_ref: &f64 = &f64_val;
let f64_double_ref: &f64 = &f64_ref;
zzz(); // #break
}

View file

@ -9,41 +9,50 @@
let _6: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +12:6
let mut _7: std::option::Option<i32>; // in scope 0 at $DIR/reference_prop.rs:+9:11: +9:18
let mut _8: isize; // in scope 0 at $DIR/reference_prop.rs:+10:9: +10:13
let mut _10: &[i32]; // in scope 0 at $DIR/reference_prop.rs:+16:82: +16:94
let _11: &[i32]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:94
let mut _12: &[i32; 10]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:90
let _13: [i32; 10]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:90
let mut _14: std::ops::RangeFull; // in scope 0 at $DIR/reference_prop.rs:+16:91: +16:93
let mut _15: usize; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
let _10: (); // in scope 0 at $DIR/reference_prop.rs:+16:5: +17:6
let mut _11: &[i32]; // in scope 0 at $DIR/reference_prop.rs:+16:82: +16:94
let _12: &[i32]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:94
let mut _13: &[i32; 10]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:90
let _14: [i32; 10]; // in scope 0 at $DIR/reference_prop.rs:+16:83: +16:90
let mut _15: std::ops::RangeFull; // in scope 0 at $DIR/reference_prop.rs:+16:91: +16:93
let mut _16: usize; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
let mut _17: bool; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
let mut _17: usize; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
let mut _18: bool; // in scope 0 at $DIR/reference_prop.rs:+16:12: +16:79
let _23: &&mut u8; // in scope 0 at $DIR/reference_prop.rs:+19:28: +19:40
let _24: &mut u8; // in scope 0 at $DIR/reference_prop.rs:+19:29: +19:40
let mut _25: debuginfo::T; // in scope 0 at $DIR/reference_prop.rs:+19:34: +19:38
scope 1 {
- debug ref_mut_u8 => _1; // in scope 1 at $DIR/reference_prop.rs:+3:9: +3:19
+ debug ref_mut_u8 => &_2; // in scope 1 at $DIR/reference_prop.rs:+3:9: +3:19
let _3: &u8; // in scope 1 at $DIR/reference_prop.rs:+4:9: +4:14
let mut _23: &debuginfo::T; // in scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
let mut _28: &debuginfo::T; // in scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
scope 2 {
- debug field => _3; // in scope 2 at $DIR/reference_prop.rs:+4:9: +4:14
+ debug field => &((*_23).0: u8); // in scope 2 at $DIR/reference_prop.rs:+4:9: +4:14
+ debug field => &((*_28).0: u8); // in scope 2 at $DIR/reference_prop.rs:+4:9: +4:14
let _5: &u8; // in scope 2 at $DIR/reference_prop.rs:+7:9: +7:17
scope 3 {
- debug reborrow => _5; // in scope 3 at $DIR/reference_prop.rs:+7:9: +7:17
+ debug reborrow => &_2; // in scope 3 at $DIR/reference_prop.rs:+7:9: +7:17
let _9: &i32; // in scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
let mut _22: &std::option::Option<i32>; // in scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
let _22: &&&mut u8; // in scope 3 at $DIR/reference_prop.rs:+19:9: +19:24
let mut _27: &std::option::Option<i32>; // in scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
scope 4 {
- debug variant_field => _9; // in scope 4 at $DIR/reference_prop.rs:+11:14: +11:31
+ debug variant_field => &(((*_22) as Some).0: i32); // in scope 4 at $DIR/reference_prop.rs:+11:14: +11:31
+ debug variant_field => &(((*_27) as Some).0: i32); // in scope 4 at $DIR/reference_prop.rs:+11:14: +11:31
}
scope 5 {
- debug constant_index => _18; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
+ debug constant_index => &(*_10)[1 of 3]; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
debug subslice => _19; // in scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
debug constant_index_from_end => _20; // in scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
let _18: &i32; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
let _19: &[i32]; // in scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
let _20: &i32; // in scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
let mut _21: &[i32; 10]; // in scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
- debug constant_index => _19; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
+ debug constant_index => &(*_11)[1 of 3]; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
debug subslice => _20; // in scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
debug constant_index_from_end => _21; // in scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
let _19: &i32; // in scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
let _20: &[i32]; // in scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
let _21: &i32; // in scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
let mut _26: &[i32; 10]; // in scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
}
scope 6 {
- debug multiple_borrow => _22; // in scope 6 at $DIR/reference_prop.rs:+19:9: +19:24
+ debug multiple_borrow => &&&(_25.0: u8); // in scope 6 at $DIR/reference_prop.rs:+19:9: +19:24
}
}
}
@ -55,11 +64,11 @@
_2 = const 5_u8; // scope 0 at $DIR/reference_prop.rs:+3:27: +3:31
- _1 = &mut _2; // scope 0 at $DIR/reference_prop.rs:+3:22: +3:31
- StorageLive(_3); // scope 1 at $DIR/reference_prop.rs:+4:9: +4:14
_23 = const _; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
_28 = const _; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
// mir::Constant
// + span: $DIR/reference_prop.rs:535:17: 535:24
// + literal: Const { ty: &T, val: Unevaluated(debuginfo, [], Some(promoted[2])) }
- _3 = &((*_23).0: u8); // scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
- _3 = &((*_28).0: u8); // scope 1 at $DIR/reference_prop.rs:+4:17: +4:24
- StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+7:9: +7:17
- _5 = &(*_1); // scope 2 at $DIR/reference_prop.rs:+7:20: +7:32
- StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+9:5: +12:6
@ -71,11 +80,11 @@
bb1: {
- StorageLive(_9); // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
_22 = const _; // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
_27 = const _; // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
// mir::Constant
// + span: $DIR/reference_prop.rs:542:14: 542:31
// + literal: Const { ty: &Option<i32>, val: Unevaluated(debuginfo, [], Some(promoted[1])) }
- _9 = &(((*_22) as Some).0: i32); // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
- _9 = &(((*_27) as Some).0: i32); // scope 3 at $DIR/reference_prop.rs:+11:14: +11:31
- _6 = const (); // scope 4 at $DIR/reference_prop.rs:+11:36: +11:38
- StorageDead(_9); // scope 3 at $DIR/reference_prop.rs:+11:37: +11:38
goto -> bb4; // scope 3 at $DIR/reference_prop.rs:+11:37: +11:38
@ -93,59 +102,74 @@
bb4: {
StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+12:5: +12:6
- StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+12:5: +12:6
StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+16:82: +16:94
StorageLive(_11); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:94
StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
_21 = const _; // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
- StorageLive(_10); // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6
StorageLive(_11); // scope 5 at $DIR/reference_prop.rs:+16:82: +16:94
StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:94
StorageLive(_13); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
_26 = const _; // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
// mir::Constant
// + span: $DIR/reference_prop.rs:547:83: 547:90
// + literal: Const { ty: &[i32; 10], val: Unevaluated(debuginfo, [], Some(promoted[0])) }
_12 = &(*_21); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
StorageLive(_14); // scope 5 at $DIR/reference_prop.rs:+16:91: +16:93
_14 = RangeFull; // scope 5 at $DIR/reference_prop.rs:+16:91: +16:93
_11 = <[i32; 10] as Index<RangeFull>>::index(move _12, move _14) -> bb5; // scope 5 at $DIR/reference_prop.rs:+16:83: +16:94
_13 = &(*_26); // scope 5 at $DIR/reference_prop.rs:+16:83: +16:90
StorageLive(_15); // scope 5 at $DIR/reference_prop.rs:+16:91: +16:93
_15 = RangeFull; // scope 5 at $DIR/reference_prop.rs:+16:91: +16:93
_12 = <[i32; 10] as Index<RangeFull>>::index(move _13, move _15) -> bb5; // scope 5 at $DIR/reference_prop.rs:+16:83: +16:94
// mir::Constant
// + span: $DIR/reference_prop.rs:547:83: 547:94
// + literal: Const { ty: for<'a> fn(&'a [i32; 10], RangeFull) -> &'a <[i32; 10] as Index<RangeFull>>::Output {<[i32; 10] as Index<RangeFull>>::index}, val: Value(<ZST>) }
}
bb5: {
StorageDead(_14); // scope 5 at $DIR/reference_prop.rs:+16:93: +16:94
StorageDead(_12); // scope 5 at $DIR/reference_prop.rs:+16:93: +16:94
_10 = &(*_11); // scope 5 at $DIR/reference_prop.rs:+16:82: +16:94
_15 = Len((*_10)); // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
_16 = const 3_usize; // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
_17 = Ge(move _15, move _16); // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
switchInt(move _17) -> [0: bb7, otherwise: bb6]; // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
StorageDead(_15); // scope 5 at $DIR/reference_prop.rs:+16:93: +16:94
StorageDead(_13); // scope 5 at $DIR/reference_prop.rs:+16:93: +16:94
_11 = &(*_12); // scope 5 at $DIR/reference_prop.rs:+16:82: +16:94
_16 = Len((*_11)); // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
_17 = const 3_usize; // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
_18 = Ge(move _16, move _17); // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
switchInt(move _18) -> [0: bb7, otherwise: bb6]; // scope 5 at $DIR/reference_prop.rs:+16:12: +16:79
}
bb6: {
- StorageLive(_18); // scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
- _18 = &(*_10)[1 of 3]; // scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
StorageLive(_19); // scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
_19 = &(*_10)[2:-1]; // scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
StorageLive(_20); // scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
_20 = &(*_10)[-1 of 3]; // scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
_0 = const (); // scope 5 at $DIR/reference_prop.rs:+16:95: +17:6
- StorageLive(_19); // scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
- _19 = &(*_11)[1 of 3]; // scope 5 at $DIR/reference_prop.rs:+16:16: +16:34
StorageLive(_20); // scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
_20 = &(*_11)[2:-1]; // scope 5 at $DIR/reference_prop.rs:+16:36: +16:44
StorageLive(_21); // scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
_21 = &(*_11)[-1 of 3]; // scope 5 at $DIR/reference_prop.rs:+16:51: +16:78
- _10 = const (); // scope 5 at $DIR/reference_prop.rs:+16:95: +17:6
StorageDead(_21); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
StorageDead(_20); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
StorageDead(_19); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
- StorageDead(_18); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
- StorageDead(_19); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
goto -> bb8; // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6
}
bb7: {
_0 = const (); // scope 3 at $DIR/reference_prop.rs:+17:6: +17:6
- _10 = const (); // scope 3 at $DIR/reference_prop.rs:+17:6: +17:6
goto -> bb8; // scope 3 at $DIR/reference_prop.rs:+16:5: +17:6
}
bb8: {
- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+18:1: +18:2
- StorageDead(_3); // scope 1 at $DIR/reference_prop.rs:+18:1: +18:2
StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+18:1: +18:2
- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+18:1: +18:2
StorageDead(_11); // scope 0 at $DIR/reference_prop.rs:+18:1: +18:2
StorageDead(_10); // scope 0 at $DIR/reference_prop.rs:+18:1: +18:2
return; // scope 0 at $DIR/reference_prop.rs:+18:2: +18:2
StorageDead(_12); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
StorageDead(_11); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
- StorageDead(_10); // scope 3 at $DIR/reference_prop.rs:+17:5: +17:6
- StorageLive(_22); // scope 3 at $DIR/reference_prop.rs:+19:9: +19:24
- StorageLive(_23); // scope 3 at $DIR/reference_prop.rs:+19:28: +19:40
- StorageLive(_24); // scope 3 at $DIR/reference_prop.rs:+19:29: +19:40
StorageLive(_25); // scope 3 at $DIR/reference_prop.rs:+19:34: +19:38
_25 = T(const 6_u8); // scope 3 at $DIR/reference_prop.rs:+19:34: +19:38
- _24 = &mut (_25.0: u8); // scope 3 at $DIR/reference_prop.rs:+19:29: +19:40
- _23 = &_24; // scope 3 at $DIR/reference_prop.rs:+19:28: +19:40
- _22 = &_23; // scope 3 at $DIR/reference_prop.rs:+19:27: +19:40
_0 = const (); // scope 0 at $DIR/reference_prop.rs:+0:16: +20:2
StorageDead(_25); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
- StorageDead(_24); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
- StorageDead(_23); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
- StorageDead(_22); // scope 3 at $DIR/reference_prop.rs:+20:1: +20:2
- StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+20:1: +20:2
- StorageDead(_3); // scope 1 at $DIR/reference_prop.rs:+20:1: +20:2
StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+20:1: +20:2
- StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+20:1: +20:2
return; // scope 0 at $DIR/reference_prop.rs:+20:2: +20:2
}
}

View file

@ -546,6 +546,8 @@ fn debuginfo() {
// on the slice length.
if let [_, ref constant_index, subslice @ .., ref constant_index_from_end] = &[6; 10][..] {
}
let multiple_borrow = &&&mut T(6).0;
}
fn many_debuginfo() {