diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-01-10 13:00:45 -0800 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2025-01-15 22:17:57 -0800 |
| commit | c18718c9c28cc4c700312775c2b7f87cd79d3063 (patch) | |
| tree | 7a2b8e3faab3a4a953a2f6af19c7afe6d27f2397 /tests/mir-opt/pre-codegen | |
| parent | 5cd16b7f2bc3624f2d658aa87151279878d2652a (diff) | |
| download | rust-c18718c9c28cc4c700312775c2b7f87cd79d3063.tar.gz rust-c18718c9c28cc4c700312775c2b7f87cd79d3063.zip | |
Less unsafe in `dangling`/`without_provenance`
Diffstat (limited to 'tests/mir-opt/pre-codegen')
6 files changed, 50 insertions, 38 deletions
diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir index a2ef53e0e13..496ec78fd8d 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-abort.mir @@ -19,30 +19,30 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { debug i => _22; debug x => _23; } - scope 18 (inlined <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next) { + scope 19 (inlined <Enumerate<std::slice::Iter<'_, T>> as Iterator>::next) { let mut _14: &mut std::slice::Iter<'_, T>; let mut _15: std::option::Option<&T>; let mut _19: (usize, bool); let mut _20: (usize, &T); - scope 19 { + scope 20 { let _18: usize; - scope 24 { + scope 25 { } } - scope 20 { - scope 21 { - scope 27 (inlined <Option<(usize, &T)> as FromResidual<Option<Infallible>>>::from_residual) { + scope 21 { + scope 22 { + scope 28 (inlined <Option<(usize, &T)> as FromResidual<Option<Infallible>>>::from_residual) { } } } - scope 22 { - scope 23 { + scope 23 { + scope 24 { } } - scope 25 (inlined <Option<&T> as Try>::branch) { + scope 26 (inlined <Option<&T> as Try>::branch) { let mut _16: isize; let _17: &T; - scope 26 { + scope 27 { } } } @@ -60,10 +60,12 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { scope 7 { } scope 12 (inlined without_provenance::<T>) { + scope 13 (inlined without_provenance_mut::<T>) { + } } - scope 13 (inlined NonNull::<T>::as_ptr) { + scope 14 (inlined NonNull::<T>::as_ptr) { } - scope 14 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { + scope 15 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { } } scope 8 (inlined <NonNull<[T]> as From<&[T]>>::from) { @@ -79,11 +81,11 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } } } - scope 15 (inlined <std::slice::Iter<'_, T> as Iterator>::enumerate) { - scope 16 (inlined Enumerate::<std::slice::Iter<'_, T>>::new) { + scope 16 (inlined <std::slice::Iter<'_, T> as Iterator>::enumerate) { + scope 17 (inlined Enumerate::<std::slice::Iter<'_, T>>::new) { } } - scope 17 (inlined <Enumerate<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { + scope 18 (inlined <Enumerate<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { } bb0: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir index c1b846e662b..c4547cb888f 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.enumerated_loop.PreCodegen.after.panic-unwind.mir @@ -35,10 +35,12 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { scope 7 { } scope 12 (inlined without_provenance::<T>) { + scope 13 (inlined without_provenance_mut::<T>) { + } } - scope 13 (inlined NonNull::<T>::as_ptr) { + scope 14 (inlined NonNull::<T>::as_ptr) { } - scope 14 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { + scope 15 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { } } scope 8 (inlined <NonNull<[T]> as From<&[T]>>::from) { @@ -54,11 +56,11 @@ fn enumerated_loop(_1: &[T], _2: impl Fn(usize, &T)) -> () { } } } - scope 15 (inlined <std::slice::Iter<'_, T> as Iterator>::enumerate) { - scope 16 (inlined Enumerate::<std::slice::Iter<'_, T>>::new) { + scope 16 (inlined <std::slice::Iter<'_, T> as Iterator>::enumerate) { + scope 17 (inlined Enumerate::<std::slice::Iter<'_, T>>::new) { } } - scope 17 (inlined <Enumerate<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { + scope 18 (inlined <Enumerate<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { } bb0: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir index 8cebf2c6bac..7d011ea3347 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-abort.mir @@ -32,10 +32,12 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 7 { } scope 12 (inlined without_provenance::<T>) { + scope 13 (inlined without_provenance_mut::<T>) { + } } - scope 13 (inlined NonNull::<T>::as_ptr) { + scope 14 (inlined NonNull::<T>::as_ptr) { } - scope 14 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { + scope 15 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { } } scope 8 (inlined <NonNull<[T]> as From<&[T]>>::from) { @@ -51,7 +53,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } } - scope 15 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) { + scope 16 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) { } bb0: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir index e7e39240fed..75e6542a3a4 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.forward_loop.PreCodegen.after.panic-unwind.mir @@ -32,10 +32,12 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 7 { } scope 12 (inlined without_provenance::<T>) { + scope 13 (inlined without_provenance_mut::<T>) { + } } - scope 13 (inlined NonNull::<T>::as_ptr) { + scope 14 (inlined NonNull::<T>::as_ptr) { } - scope 14 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { + scope 15 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { } } scope 8 (inlined <NonNull<[T]> as From<&[T]>>::from) { @@ -51,7 +53,7 @@ fn forward_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } } - scope 15 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) { + scope 16 (inlined <std::slice::Iter<'_, T> as IntoIterator>::into_iter) { } bb0: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir index 58f95d0a432..41bc91ab028 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-abort.mir @@ -18,7 +18,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 2 { debug x => _17; } - scope 18 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { + scope 19 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { let mut _14: &mut std::slice::Iter<'_, T>; } } @@ -35,10 +35,12 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 7 { } scope 12 (inlined without_provenance::<T>) { + scope 13 (inlined without_provenance_mut::<T>) { + } } - scope 13 (inlined NonNull::<T>::as_ptr) { + scope 14 (inlined NonNull::<T>::as_ptr) { } - scope 14 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { + scope 15 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { } } scope 8 (inlined <NonNull<[T]> as From<&[T]>>::from) { @@ -54,11 +56,11 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } } - scope 15 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) { - scope 16 (inlined Rev::<std::slice::Iter<'_, T>>::new) { + scope 16 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) { + scope 17 (inlined Rev::<std::slice::Iter<'_, T>>::new) { } } - scope 17 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { + scope 18 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { } bb0: { diff --git a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir index e7ddacf3144..6ed8ef9715b 100644 --- a/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/slice_iter.reverse_loop.PreCodegen.after.panic-unwind.mir @@ -18,7 +18,7 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 2 { debug x => _17; } - scope 18 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { + scope 19 (inlined <Rev<std::slice::Iter<'_, T>> as Iterator>::next) { let mut _14: &mut std::slice::Iter<'_, T>; } } @@ -35,10 +35,12 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { scope 7 { } scope 12 (inlined without_provenance::<T>) { + scope 13 (inlined without_provenance_mut::<T>) { + } } - scope 13 (inlined NonNull::<T>::as_ptr) { + scope 14 (inlined NonNull::<T>::as_ptr) { } - scope 14 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { + scope 15 (inlined std::ptr::mut_ptr::<impl *mut T>::add) { } } scope 8 (inlined <NonNull<[T]> as From<&[T]>>::from) { @@ -54,11 +56,11 @@ fn reverse_loop(_1: &[T], _2: impl Fn(&T)) -> () { } } } - scope 15 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) { - scope 16 (inlined Rev::<std::slice::Iter<'_, T>>::new) { + scope 16 (inlined <std::slice::Iter<'_, T> as Iterator>::rev) { + scope 17 (inlined Rev::<std::slice::Iter<'_, T>>::new) { } } - scope 17 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { + scope 18 (inlined <Rev<std::slice::Iter<'_, T>> as IntoIterator>::into_iter) { } bb0: { |
