mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
it's not a borrow checker limitation :<
This commit is contained in:
@@ -90,7 +90,7 @@ borrowck_lifetime_constraints_error =
|
||||
lifetime may not live long enough
|
||||
|
||||
borrowck_limitations_implies_static =
|
||||
due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
|
||||
borrowck_move_closure_suggestion =
|
||||
consider adding 'move' keyword before the nested closure
|
||||
|
||||
@@ -9,7 +9,7 @@ LL | print_items::<WindowsMut<'_>>(windows);
|
||||
LL | }
|
||||
| - temporary value is freed at the end of this statement
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/hrtb-implied-1.rs:26:5
|
||||
|
|
||||
LL | for<'a> I::Item<'a>: Debug,
|
||||
|
||||
@@ -15,7 +15,7 @@ LL | let _next = iter2.next();
|
||||
= note: requirement occurs because of a mutable reference to `Eat<&mut I, F>`
|
||||
= note: mutable references are invariant over their type parameter
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/hrtb-implied-2.rs:31:8
|
||||
|
|
||||
LL | F: FnMut(I::Item<'_>),
|
||||
|
||||
@@ -11,7 +11,7 @@ LL | trivial_bound(iter);
|
||||
| `iter` escapes the function body here
|
||||
| argument requires that `'1` must outlive `'static`
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/hrtb-implied-3.rs:14:5
|
||||
|
|
||||
LL | for<'a> I::Item<'a>: Sized,
|
||||
|
||||
@@ -7,7 +7,7 @@ LL | | let _x = x;
|
||||
LL | | };
|
||||
| |_____^
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/collectivity-regression.rs:11:16
|
||||
|
|
||||
LL | for<'a> T: Get<Value<'a> = ()>,
|
||||
|
||||
@@ -13,7 +13,7 @@ error: `Self` does not live long enough
|
||||
LL | <B as FromLendingIterator<A>>::from_iter(self)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/lending_iterator.rs:4:21
|
||||
|
|
||||
LL | fn from_iter<T: for<'x> LendingIterator<Item<'x> = A>>(iter: T) -> Self;
|
||||
|
||||
@@ -15,7 +15,7 @@ LL | fn give_some<'a>() {
|
||||
LL | want_hrtb::<&'a u32>()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/hrtb-just-for-static.rs:9:15
|
||||
|
|
||||
LL | where T : for<'a> Foo<&'a isize>
|
||||
|
||||
@@ -47,7 +47,7 @@ LL | fn foo_hrtb_bar_not<'b, T>(mut t: T)
|
||||
LL | foo_hrtb_bar_not(&mut t);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static`
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/hrtb-perfect-forwarding.rs:37:8
|
||||
|
|
||||
LL | T: for<'a> Foo<&'a isize> + Bar<&'b isize>,
|
||||
|
||||
@@ -31,7 +31,7 @@ LL | fn test_lifetime<'lt, T: Trait>(_: Foo<&'lt u8>) {}
|
||||
| | lifetime `'lt` defined here
|
||||
| requires that `'lt` must outlive `'static`
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/normalization-placeholder-leak.rs:19:5
|
||||
|
|
||||
LL | for<'x> T::Ty<'x>: Sized;
|
||||
@@ -46,7 +46,7 @@ LL | fn test_alias<'lt, T: AnotherTrait>(_: Foo<T::Ty2::<'lt>>) {}
|
||||
| | lifetime `'lt` defined here
|
||||
| requires that `'lt` must outlive `'static`
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/normalization-placeholder-leak.rs:19:5
|
||||
|
|
||||
LL | for<'x> T::Ty<'x>: Sized;
|
||||
|
||||
@@ -6,7 +6,7 @@ LL | fn bar<'a>() {
|
||||
LL | foo::<&'a i32>();
|
||||
| ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/issue-26217.rs:1:19
|
||||
|
|
||||
LL | fn foo<T>() where for<'a> T: 'a {}
|
||||
|
||||
@@ -25,8 +25,8 @@ impl<T> ProjectedMyTrait for T
|
||||
where
|
||||
T: Project,
|
||||
for<'a> T::Projected<'a>: MyTrait,
|
||||
//~^ NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
//~| NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
//~^ NOTE due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
//~| NOTE due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
{}
|
||||
|
||||
fn require_trait<T: MyTrait>(_: T) {}
|
||||
|
||||
@@ -25,8 +25,8 @@ impl<T> ProjectedMyTrait for T
|
||||
where
|
||||
T: Project,
|
||||
for<'a> T::Projected<'a>: MyTrait,
|
||||
//~^ NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
//~| NOTE due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
//~^ NOTE due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
//~| NOTE due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
{}
|
||||
|
||||
fn require_trait<T: MyTrait>(_: T) {}
|
||||
|
||||
@@ -4,7 +4,7 @@ error: `T` does not live long enough
|
||||
LL | require_trait(wrap);
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/issue-105507.rs:27:35
|
||||
|
|
||||
LL | for<'a> T::Projected<'a>: MyTrait,
|
||||
@@ -20,7 +20,7 @@ error: `U` does not live long enough
|
||||
LL | require_trait(wrap1);
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/issue-105507.rs:27:35
|
||||
|
|
||||
LL | for<'a> T::Projected<'a>: MyTrait,
|
||||
|
||||
@@ -57,7 +57,7 @@ LL | baz(f);
|
||||
= note: requirement occurs because of a mutable pointer to `&u32`
|
||||
= note: mutable pointers are invariant over their type parameter
|
||||
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/closure-arg-type-mismatch.rs:8:11
|
||||
|
|
||||
LL | fn baz<F: Fn(*mut &u32)>(_: F) {}
|
||||
|
||||
@@ -12,7 +12,7 @@ LL | assert_static_via_hrtb_with_assoc_type(&&local);
|
||||
LL | }
|
||||
| - `local` dropped here while still borrowed
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/local-outlives-static-via-hrtb.rs:15:42
|
||||
|
|
||||
LL | fn assert_static_via_hrtb<G>(_: G) where for<'a> G: Outlives<'a> {}
|
||||
@@ -32,7 +32,7 @@ LL | assert_static_via_hrtb_with_assoc_type(&&local);
|
||||
LL | }
|
||||
| - `local` dropped here while still borrowed
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/local-outlives-static-via-hrtb.rs:19:5
|
||||
|
|
||||
LL | for<'a> &'a T: Reference<AssociatedType = &'a ()>,
|
||||
|
||||
@@ -13,7 +13,7 @@ LL | let b = |_| &a;
|
||||
LL | }
|
||||
| - `a` dropped here while still borrowed
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/location-insensitive-scopes-issue-117146.rs:20:11
|
||||
|
|
||||
LL | fn bad<F: Fn(&()) -> &()>(_: F) {}
|
||||
|
||||
@@ -13,7 +13,7 @@ LL | let b = |_| &a;
|
||||
LL | }
|
||||
| - `a` dropped here while still borrowed
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/location-insensitive-scopes-issue-117146.rs:20:11
|
||||
|
|
||||
LL | fn bad<F: Fn(&()) -> &()>(_: F) {}
|
||||
|
||||
@@ -12,7 +12,7 @@ LL | fn test2<'a>() {
|
||||
LL | outlives_forall::<Value<'a>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static`
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/type-test-universe.rs:6:5
|
||||
|
|
||||
LL | for<'u> T: 'u,
|
||||
|
||||
@@ -67,7 +67,7 @@ LL | unsafe { extend_hrtb(src) }
|
||||
| `src` escapes the function body here
|
||||
| argument requires that `'a` must outlive `'static`
|
||||
|
|
||||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
note: due to a current limitation of the type system, this implies a `'static` lifetime
|
||||
--> $DIR/reject_lifetime_extension.rs:85:9
|
||||
|
|
||||
LL | for<'b> &'b u8: TransmuteFrom<&'a u8>,
|
||||
|
||||
Reference in New Issue
Block a user