Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
where
T: TypeVisitable<TyCtxt<'tcx>>,
{
t.has_free_regions() || t.has_aliases() || t.has_infer_types()
t.has_free_regions() || t.has_aliases() || t.has_infer_types() || t.has_param()
}

pub(crate) fn node_ty(&self, id: HirId) -> Ty<'tcx> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@
+ StorageLive(_40);
+ _40 = &raw mut _19;
+ _39 = copy _40 as *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>> (PtrToPtr);
+ StorageDead(_40);
+ _37 = copy ((*_39).0: &mut std::future::Ready<()>);
+ StorageDead(_40);
+ StorageLive(_42);
+ _42 = Option::<()>::None;
+ _35 = copy ((*_37).0: std::option::Option<()>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@
+ StorageLive(_40);
+ _40 = &raw mut _19;
+ _39 = copy _40 as *mut std::pin::helper::PinHelper<&mut std::future::Ready<()>> (PtrToPtr);
+ StorageDead(_40);
+ _37 = copy ((*_39).0: &mut std::future::Ready<()>);
+ StorageDead(_40);
+ StorageLive(_42);
+ _42 = Option::<()>::None;
+ _35 = copy ((*_37).0: std::option::Option<()>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
let mut _4: *const &u8;
scope 1 (inlined generic_cast::<&u8, &u8>) {
let mut _5: *const &u8;
let mut _6: *const &u8;
}

bb0: {
Expand All @@ -17,9 +18,12 @@
StorageLive(_4);
_4 = copy _1;
StorageLive(_5);
_5 = copy _4;
- _3 = move _5 as *const &u8 (PtrToPtr);
+ _3 = move _5;
StorageLive(_6);
_6 = copy _4;
- _5 = move _6 as *const &u8 (PtrToPtr);
+ _5 = move _6;
_3 = copy _5;
StorageDead(_6);
StorageDead(_5);
StorageDead(_4);
- _2 = move _3 as *const &u8 (PtrToPtr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
let _8: usize;
scope 3 {
scope 6 (inlined core::slice::index::get_offset_len_mut_noubcheck::<u32>) {
let _9: *mut u32;
let mut _9: *mut u32;
scope 7 {
let _10: *mut u32;
scope 8 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range<usize>) ->
let _8: usize;
scope 3 {
scope 6 (inlined core::slice::index::get_offset_len_mut_noubcheck::<u32>) {
let _9: *mut u32;
let mut _9: *mut u32;
scope 7 {
let _10: *mut u32;
scope 8 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
let mut _6: usize;
}
scope 4 (inlined core::slice::index::get_offset_len_noubcheck::<u32>) {
let _10: *const u32;
let mut _10: *const u32;
scope 5 {
let _11: *const u32;
scope 6 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range<usize>) -> &[u32] {
let mut _6: usize;
}
scope 4 (inlined core::slice::index::get_offset_len_noubcheck::<u32>) {
let _10: *const u32;
let mut _10: *const u32;
scope 5 {
let _11: *const u32;
scope 6 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) -
let _7: usize;
scope 3 {
scope 6 (inlined core::slice::index::get_offset_len_noubcheck::<u32>) {
let _8: *const u32;
let mut _8: *const u32;
scope 7 {
let _9: *const u32;
scope 8 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn slice_ptr_get_unchecked_range(_1: *const [u32], _2: std::ops::Range<usize>) -
let _7: usize;
scope 3 {
scope 6 (inlined core::slice::index::get_offset_len_noubcheck::<u32>) {
let _8: *const u32;
let mut _8: *const u32;
scope 7 {
let _9: *const u32;
scope 8 {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/consts/issue-102117.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-102117.rs:17:26
|
LL | type_id: TypeId::of::<T>(),
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^
| |
| the parameter type `T` must be valid for the static lifetime...
| ...so that the type `T` will meet its required lifetime bounds
Expand All @@ -16,7 +16,7 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-102117.rs:17:26
|
LL | type_id: TypeId::of::<T>(),
| ^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^
| |
| the parameter type `T` must be valid for the static lifetime...
| ...so that the type `T` will meet its required lifetime bounds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ error[E0308]: mismatched types
--> $DIR/candidate-from-env-universe-err-project.rs:38:5
|
LL | projection_bound::<T>();
| ^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
| ^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected associated type `<T as Trait<'static>>::Assoc`
found associated type `<T as Trait<'a>>::Assoc`
note: the lifetime requirement is introduced here
--> $DIR/candidate-from-env-universe-err-project.rs:19:42
|
LL | fn projection_bound<T: for<'a> Trait<'a, Assoc = usize>>() {}
| ^^^^^^^^^^^^^

error[E0308]: mismatched types
--> $DIR/candidate-from-env-universe-err-project.rs:52:30
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/nll/issue-98693.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0310]: the parameter type `T` may not live long enough
--> $DIR/issue-98693.rs:16:9
|
LL | assert_static::<T>();
| ^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^
| |
| the parameter type `T` must be valid for the static lifetime...
| ...so that the type `T` will meet its required lifetime bounds
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/nll/type-test-universe.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: `S` does not live long enough
--> $DIR/type-test-universe.rs:11:5
|
LL | outlives_forall::<S>();
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^

error: lifetime may not live long enough
--> $DIR/type-test-universe.rs:17:5
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/regions/forall-wf-ref-reflexive.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: `T` does not live long enough
--> $DIR/forall-wf-ref-reflexive.rs:12:5
|
LL | self_wf2::<T>();
| ^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^

error: aborting due to 1 previous error

11 changes: 11 additions & 0 deletions tests/ui/regions/wf-bound-region-in-local-issue-115175.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// A regression test for https://github.com/rust-lang/rust/issues/115175.
// This used to compile without error despite of unsatisfied outlives bound `T: 'static` on local.

struct Static<T: 'static>(T);

fn test<T>() {
let _ = None::<Static<T>>;
//~^ ERROR the parameter type `T` may not live long enough
}

fn main() {}
17 changes: 17 additions & 0 deletions tests/ui/regions/wf-bound-region-in-local-issue-115175.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
error[E0310]: the parameter type `T` may not live long enough
--> $DIR/wf-bound-region-in-local-issue-115175.rs:7:13
|
LL | let _ = None::<Static<T>>;
| ^^^^^^^^^^^^^^^^^
| |
| the parameter type `T` must be valid for the static lifetime...
| ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | fn test<T: 'static>() {
| +++++++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0310`.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/implied_lifetime_wf_check3.rs:55:5
|
LL | test_type_param::assert_static::<A>()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the parameter type `A` must be valid for the static lifetime...
| ...so that the type `A` will meet its required lifetime bounds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ error[E0310]: the parameter type `A` may not live long enough
--> $DIR/implied_lifetime_wf_check4_static.rs:15:5
|
LL | assert_static::<A>()
| ^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^
| |
| the parameter type `A` must be valid for the static lifetime...
| ...so that the type `A` will meet its required lifetime bounds
Expand Down
Loading