Skip to content

Commit 4f2261f

Browse files
committed
WF check lifetime bounds for locals with type params
1 parent cf8a955 commit 4f2261f

19 files changed

+52
-25
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
547547
where
548548
T: TypeVisitable<TyCtxt<'tcx>>,
549549
{
550-
t.has_free_regions() || t.has_aliases() || t.has_infer_types()
550+
t.has_free_regions() || t.has_aliases() || t.has_infer_types() || t.has_param()
551551
}
552552

553553
pub(crate) fn node_ty(&self, id: HirId) -> Ty<'tcx> {

tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@
197197
+ StorageLive(_40);
198198
+ _40 = &raw mut _19;
199199
+ _39 = copy _40 as *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>> (PtrToPtr);
200-
+ StorageDead(_40);
201200
+ _37 = copy ((*_39).0: &mut std::future::Ready<()>);
201+
+ StorageDead(_40);
202202
+ StorageLive(_42);
203203
+ _42 = Option::<()>::None;
204204
+ _35 = copy ((*_37).0: std::option::Option<()>);

tests/mir-opt/inline_coroutine_body.run2-{closure#0}.Inline.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@
208208
+ StorageLive(_40);
209209
+ _40 = &raw mut _19;
210210
+ _39 = copy _40 as *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>> (PtrToPtr);
211-
+ StorageDead(_40);
212211
+ _37 = copy ((*_39).0: &mut std::future::Ready<()>);
212+
+ StorageDead(_40);
213213
+ StorageLive(_42);
214214
+ _42 = Option::<()>::None;
215215
+ _35 = copy ((*_37).0: std::option::Option<()>);

tests/mir-opt/instsimplify/casts.redundant.InstSimplify-after-simplifycfg.diff

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
let mut _4: *const &u8;
1010
scope 1 (inlined generic_cast::<&u8, &u8>) {
1111
let mut _5: *const &u8;
12+
let mut _6: *const &u8;
1213
}
1314

1415
bb0: {
@@ -17,9 +18,12 @@
1718
StorageLive(_4);
1819
_4 = copy _1;
1920
StorageLive(_5);
20-
_5 = copy _4;
21-
- _3 = move _5 as *const &u8 (PtrToPtr);
22-
+ _3 = move _5;
21+
StorageLive(_6);
22+
_6 = copy _4;
23+
- _5 = move _6 as *const &u8 (PtrToPtr);
24+
+ _5 = move _6;
25+
_3 = copy _5;
26+
StorageDead(_6);
2327
StorageDead(_5);
2428
StorageDead(_4);
2529
- _2 = move _3 as *const &u8 (PtrToPtr);

tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-abort.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
1515
let _8: usize;
1616
scope 3 {
1717
scope 6 (inlined core::slice::index::get_offset_len_mut_noubcheck::<u32>) {
18-
let _9: *mut u32;
18+
let mut _9: *mut u32;
1919
scope 7 {
2020
let _10: *mut u32;
2121
scope 8 {

tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.panic-unwind.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
1515
let _8: usize;
1616
scope 3 {
1717
scope 6 (inlined core::slice::index::get_offset_len_mut_noubcheck::<u32>) {
18-
let _9: *mut u32;
18+
let mut _9: *mut u32;
1919
scope 7 {
2020
let _10: *mut u32;
2121
scope 8 {

tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-abort.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
1919
let mut _6: usize;
2020
}
2121
scope 4 (inlined core::slice::index::get_offset_len_noubcheck::<u32>) {
22-
let _10: *const u32;
22+
let mut _10: *const u32;
2323
scope 5 {
2424
let _11: *const u32;
2525
scope 6 {

tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.panic-unwind.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
1919
let mut _6: usize;
2020
}
2121
scope 4 (inlined core::slice::index::get_offset_len_noubcheck::<u32>) {
22-
let _10: *const u32;
22+
let mut _10: *const u32;
2323
scope 5 {
2424
let _11: *const u32;
2525
scope 6 {

tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-abort.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) -
1313
let _7: usize;
1414
scope 3 {
1515
scope 6 (inlined core::slice::index::get_offset_len_noubcheck::<u32>) {
16-
let _8: *const u32;
16+
let mut _8: *const u32;
1717
scope 7 {
1818
let _9: *const u32;
1919
scope 8 {

tests/mir-opt/pre-codegen/slice_index.slice_ptr_get_unchecked_range.PreCodegen.after.panic-unwind.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) -
1313
let _7: usize;
1414
scope 3 {
1515
scope 6 (inlined core::slice::index::get_offset_len_noubcheck::<u32>) {
16-
let _8: *const u32;
16+
let mut _8: *const u32;
1717
scope 7 {
1818
let _9: *const u32;
1919
scope 8 {

0 commit comments

Comments
 (0)