Use revisions or ignore-compare-mode-nll for NLL in generic-associated-types
This commit is contained in:
parent
62806f7536
commit
0fbb315be7
@ -1,12 +0,0 @@
|
|||||||
error[E0276]: impl has stricter requirements than trait
|
|
||||||
--> $DIR/lending_iterator.rs:14:45
|
|
||||||
|
|
|
||||||
LL | fn from_iter<T: for<'x> LendingIterator<Item<'x> = A>>(iter: T) -> Self;
|
|
||||||
| ------------------------------------------------------------------------ definition of `from_iter` from trait
|
|
||||||
...
|
|
||||||
LL | fn from_iter<I: for<'x> LendingIterator<Item<'x> = A>>(mut iter: I) -> Self {
|
|
||||||
| ^^^^^^^^^^^^ impl has extra requirement `I: 'x`
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0276`.
|
|
@ -1,5 +1,5 @@
|
|||||||
error[E0276]: impl has stricter requirements than trait
|
error[E0276]: impl has stricter requirements than trait
|
||||||
--> $DIR/lending_iterator.rs:14:45
|
--> $DIR/lending_iterator.rs:16:45
|
||||||
|
|
|
|
||||||
LL | fn from_iter<T: for<'x> LendingIterator<Item<'x> = A>>(iter: T) -> Self;
|
LL | fn from_iter<T: for<'x> LendingIterator<Item<'x> = A>>(iter: T) -> Self;
|
||||||
| ------------------------------------------------------------------------ definition of `from_iter` from trait
|
| ------------------------------------------------------------------------ definition of `from_iter` from trait
|
||||||
@ -8,7 +8,7 @@ LL | fn from_iter<I: for<'x> LendingIterator<Item<'x> = A>>(mut iter: I) ->
|
|||||||
| ^^^^^^^^^^^^ impl has extra requirement `I: 'x`
|
| ^^^^^^^^^^^^ impl has extra requirement `I: 'x`
|
||||||
|
|
||||||
error[E0311]: the parameter type `Self` may not live long enough
|
error[E0311]: the parameter type `Self` may not live long enough
|
||||||
--> $DIR/lending_iterator.rs:35:9
|
--> $DIR/lending_iterator.rs:37:9
|
||||||
|
|
|
|
||||||
LL | <B as FromLendingIterator<A>>::from_iter(self)
|
LL | <B as FromLendingIterator<A>>::from_iter(self)
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -16,7 +16,7 @@ LL | <B as FromLendingIterator<A>>::from_iter(self)
|
|||||||
= help: consider adding an explicit lifetime bound `Self: 'a`...
|
= help: consider adding an explicit lifetime bound `Self: 'a`...
|
||||||
= note: ...so that the type `Self` will meet its required lifetime bounds...
|
= note: ...so that the type `Self` will meet its required lifetime bounds...
|
||||||
note: ...that is required by this bound
|
note: ...that is required by this bound
|
||||||
--> $DIR/lending_iterator.rs:10:45
|
--> $DIR/lending_iterator.rs:12:45
|
||||||
|
|
|
|
||||||
LL | fn from_iter<T: for<'x> LendingIterator<Item<'x> = A>>(iter: T) -> Self;
|
LL | fn from_iter<T: for<'x> LendingIterator<Item<'x> = A>>(iter: T) -> Self;
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// FIXME(nll): this is experimental anyways, don't really care about the output
|
||||||
|
// ignore-compare-mode-nll
|
||||||
// revisions: base extended
|
// revisions: base extended
|
||||||
//[base] check-fail
|
//[base] check-fail
|
||||||
//[extended] check-pass
|
//[extended] check-pass
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||||
--> $DIR/projection-type-lifetime-mismatch.rs:17:7
|
--> $DIR/projection-type-lifetime-mismatch.rs:21:7
|
||||||
|
|
|
|
||||||
LL | fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
|
LL | fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
|
||||||
| ------------------------------- this data with an anonymous lifetime `'_`...
|
| ------------------------------- this data with an anonymous lifetime `'_`...
|
||||||
@ -9,7 +9,7 @@ LL | x.m()
|
|||||||
| ...is used and required to live as long as `'static` here
|
| ...is used and required to live as long as `'static` here
|
||||||
|
|
||||||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||||
--> $DIR/projection-type-lifetime-mismatch.rs:22:7
|
--> $DIR/projection-type-lifetime-mismatch.rs:27:7
|
||||||
|
|
|
|
||||||
LL | fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
|
LL | fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
|
||||||
| -- this data with an anonymous lifetime `'_`...
|
| -- this data with an anonymous lifetime `'_`...
|
||||||
@ -19,7 +19,7 @@ LL | x.m()
|
|||||||
| ...is used and required to live as long as `'static` here
|
| ...is used and required to live as long as `'static` here
|
||||||
|
|
||||||
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||||
--> $DIR/projection-type-lifetime-mismatch.rs:27:7
|
--> $DIR/projection-type-lifetime-mismatch.rs:33:7
|
||||||
|
|
|
|
||||||
LL | fn h(x: &()) -> &'static () {
|
LL | fn h(x: &()) -> &'static () {
|
||||||
| --- this data with an anonymous lifetime `'_`...
|
| --- this data with an anonymous lifetime `'_`...
|
@ -1,5 +1,5 @@
|
|||||||
error: lifetime may not live long enough
|
error: lifetime may not live long enough
|
||||||
--> $DIR/projection-type-lifetime-mismatch.rs:17:5
|
--> $DIR/projection-type-lifetime-mismatch.rs:21:5
|
||||||
|
|
|
|
||||||
LL | fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
|
LL | fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
|
||||||
| - let's call the lifetime of this reference `'1`
|
| - let's call the lifetime of this reference `'1`
|
||||||
@ -7,7 +7,7 @@ LL | x.m()
|
|||||||
| ^^^^^ returning this value requires that `'1` must outlive `'static`
|
| ^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||||
|
|
||||||
error: lifetime may not live long enough
|
error: lifetime may not live long enough
|
||||||
--> $DIR/projection-type-lifetime-mismatch.rs:22:5
|
--> $DIR/projection-type-lifetime-mismatch.rs:27:5
|
||||||
|
|
|
|
||||||
LL | fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
|
LL | fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
|
||||||
| - let's call the lifetime of this reference `'1`
|
| - let's call the lifetime of this reference `'1`
|
||||||
@ -15,7 +15,7 @@ LL | x.m()
|
|||||||
| ^^^^^ returning this value requires that `'1` must outlive `'static`
|
| ^^^^^ returning this value requires that `'1` must outlive `'static`
|
||||||
|
|
||||||
error: lifetime may not live long enough
|
error: lifetime may not live long enough
|
||||||
--> $DIR/projection-type-lifetime-mismatch.rs:27:5
|
--> $DIR/projection-type-lifetime-mismatch.rs:33:5
|
||||||
|
|
|
|
||||||
LL | fn h(x: &()) -> &'static () {
|
LL | fn h(x: &()) -> &'static () {
|
||||||
| - let's call the lifetime of this reference `'1`
|
| - let's call the lifetime of this reference `'1`
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
// ignore-compare-mode-nll
|
||||||
|
// revisions: base nll
|
||||||
|
// [nll]compile-flags: -Zborrowck=mir
|
||||||
|
|
||||||
#![feature(generic_associated_types)]
|
#![feature(generic_associated_types)]
|
||||||
|
|
||||||
pub trait X {
|
pub trait X {
|
||||||
@ -15,17 +19,20 @@ impl X for () {
|
|||||||
|
|
||||||
fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
|
fn f(x: &impl for<'a> X<Y<'a> = &'a ()>) -> &'static () {
|
||||||
x.m()
|
x.m()
|
||||||
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
//[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||||
|
//[nll]~^^ ERROR lifetime may not live long enough
|
||||||
}
|
}
|
||||||
|
|
||||||
fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
|
fn g<T: for<'a> X<Y<'a> = &'a ()>>(x: &T) -> &'static () {
|
||||||
x.m()
|
x.m()
|
||||||
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
//[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||||
|
//[nll]~^^ ERROR lifetime may not live long enough
|
||||||
}
|
}
|
||||||
|
|
||||||
fn h(x: &()) -> &'static () {
|
fn h(x: &()) -> &'static () {
|
||||||
x.m()
|
x.m()
|
||||||
//~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
//[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
|
||||||
|
//[nll]~^^ ERROR lifetime may not live long enough
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
error[E0038]: the trait `StreamingIterator` cannot be made into an object
|
error[E0038]: the trait `StreamingIterator` cannot be made into an object
|
||||||
--> $DIR/trait-objects.rs:14:21
|
--> $DIR/trait-objects.rs:16:21
|
||||||
|
|
|
|
||||||
LL | fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize {
|
LL | fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `StreamingIterator` cannot be made into an object
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `StreamingIterator` cannot be made into an object
|
||||||
|
|
|
|
||||||
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
|
||||||
--> $DIR/trait-objects.rs:8:10
|
--> $DIR/trait-objects.rs:10:10
|
||||||
|
|
|
|
||||||
LL | trait StreamingIterator {
|
LL | trait StreamingIterator {
|
||||||
| ----------------- this trait cannot be made into an object...
|
| ----------------- this trait cannot be made into an object...
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
error[E0521]: borrowed data escapes outside of function
|
|
||||||
--> $DIR/trait-objects.rs:16:5
|
|
||||||
|
|
|
||||||
LL | fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize {
|
|
||||||
| - - let's call the lifetime of this reference `'1`
|
|
||||||
| |
|
|
||||||
| `x` is a reference that is only valid in the function body
|
|
||||||
LL |
|
|
||||||
LL | x.size_hint().0
|
|
||||||
| ^^^^^^^^^^^^^
|
|
||||||
| |
|
|
||||||
| `x` escapes the function body here
|
|
||||||
| argument requires that `'1` must outlive `'static`
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0521`.
|
|
@ -1,5 +1,5 @@
|
|||||||
error[E0621]: explicit lifetime required in the type of `x`
|
error[E0621]: explicit lifetime required in the type of `x`
|
||||||
--> $DIR/trait-objects.rs:16:7
|
--> $DIR/trait-objects.rs:18:7
|
||||||
|
|
|
|
||||||
LL | fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize {
|
LL | fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize {
|
||||||
| ------------------------------------------------------ help: add explicit lifetime `'a` to the type of `x`: `&'a mut (dyn StreamingIterator<for<'a> Item = &'a i32> + 'a)`
|
| ------------------------------------------------------ help: add explicit lifetime `'a` to the type of `x`: `&'a mut (dyn StreamingIterator<for<'a> Item = &'a i32> + 'a)`
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// FIXME(nll): this is experimental anyways, don't really care about the output
|
||||||
|
// ignore-compare-mode-nll
|
||||||
// revisions: base extended
|
// revisions: base extended
|
||||||
|
|
||||||
#![feature(generic_associated_types)]
|
#![feature(generic_associated_types)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user