mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Bless nll tests.
This commit is contained in:
parent
c6a3f5d606
commit
10cf626d0e
@ -2156,6 +2156,24 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
// When in async fn, prefer errors that come from inside the closure.
|
||||
if !categorized_path[i].from_closure {
|
||||
let span = categorized_path.iter().find_map(|p| {
|
||||
if p.from_closure
|
||||
&& p.category == categorized_path[i].category
|
||||
&& categorized_path[i].cause.span.contains(p.cause.span)
|
||||
{
|
||||
Some(p.cause.span)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
|
||||
if let Some(span) = span {
|
||||
categorized_path[i].cause.span = span;
|
||||
}
|
||||
}
|
||||
|
||||
return categorized_path[i].clone();
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/ret-impl-trait-one.rs:10:85
|
||||
--> $DIR/ret-impl-trait-one.rs:12:5
|
||||
|
|
||||
LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
| ________________________________--__--_______________________________________________^
|
||||
| | | |
|
||||
| | | lifetime `'b` defined here
|
||||
| | lifetime `'a` defined here
|
||||
LL | |
|
||||
LL | | (a, b)
|
||||
LL | | }
|
||||
| |_^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
|
||||
| -- -- lifetime `'b` defined here
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
LL |
|
||||
LL | (a, b)
|
||||
| ^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
|
||||
|
|
||||
= help: consider adding the following bound: `'a: 'b`
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
error[E0515]: cannot return value referencing local variable `raw_lines`
|
||||
--> $DIR/drop-with-active-borrows-2.rs:3:5
|
||||
--> $DIR/drop-with-active-borrows-2.rs:3:30
|
||||
|
|
||||
LL | raw_lines.iter().map(|l| l.trim()).collect()
|
||||
| ----------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ---------------- ^^^^^^^^ returns a value referencing data owned by the current function
|
||||
| |
|
||||
| returns a value referencing data owned by the current function
|
||||
| `raw_lines` is borrowed here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,7 +1,7 @@
|
||||
fn read_lines_borrowed<'a>() -> Vec<&'a str> {
|
||||
let rawLines: Vec<String> = vec!["foo ".to_string(), " bar".to_string()];
|
||||
rawLines //~ ERROR cannot return value referencing local variable `rawLines`
|
||||
.iter().map(|l| l.trim()).collect()
|
||||
rawLines.iter().map(|l| l.trim()).collect()
|
||||
//~^ ERROR cannot return value referencing local variable `rawLines`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,14 +1,10 @@
|
||||
error[E0515]: cannot return value referencing local variable `rawLines`
|
||||
--> $DIR/issue-13497-2.rs:3:5
|
||||
--> $DIR/issue-13497-2.rs:3:29
|
||||
|
|
||||
LL | rawLines
|
||||
| _____^
|
||||
| |_____|
|
||||
| ||
|
||||
LL | || .iter().map(|l| l.trim()).collect()
|
||||
| ||_______________-___________________________^ returns a value referencing data owned by the current function
|
||||
| |________________|
|
||||
| `rawLines` is borrowed here
|
||||
LL | rawLines.iter().map(|l| l.trim()).collect()
|
||||
| --------------- ^^^^^^^^ returns a value referencing data owned by the current function
|
||||
| |
|
||||
| `rawLines` is borrowed here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -20,9 +20,8 @@ error: lifetime may not live long enough
|
||||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
|
||||
|
|
||||
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
|
||||
| -- - ^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
|
||||
| | |
|
||||
| | let's call the lifetime of this reference `'1`
|
||||
| -- ---- has type `Pin<&'1 Foo>` ^^^ associated function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
|
||||
| |
|
||||
| lifetime `'a` defined here
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
Loading…
Reference in New Issue
Block a user