Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not report _#nr lifetimes names in errors
- Loading branch information
1 parent
29f5c69
commit a17a2e3
Showing
5 changed files
with
128 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// compile-flags: -Znll-dump-cause | ||
|
||
#![feature(nll)] | ||
|
||
fn gimme(x: &(u32,)) -> &u32 { | ||
&x.0 | ||
} | ||
|
||
fn main() { | ||
let x = gimme({ | ||
let v = (22,); | ||
&v | ||
//~^ ERROR `v` does not live long enough [E0597] | ||
}); | ||
println!("{:?}", x); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error[E0597]: `v` does not live long enough | ||
--> $DIR/borrowed-local-error.rs:22:9 | ||
| | ||
LL | let x = gimme({ | ||
| _____________- | ||
LL | | let v = (22,); | ||
LL | | &v | ||
| | ^^ borrowed value does not live long enough | ||
LL | | //~^ ERROR `v` does not live long enough [E0597] | ||
LL | | }); | ||
| |_____-- borrow later used here | ||
| | | ||
| borrowed value only lives until here | ||
|
||
error: aborting due to previous error | ||
|
||
If you want more information on this error, try using "rustc --explain E0597" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// compile-flags: -Znll-dump-cause | ||
|
||
#![feature(nll)] | ||
|
||
fn gimme(x: &(u32,)) -> &u32 { | ||
&x.0 | ||
} | ||
|
||
fn main() { | ||
let x = gimme({ | ||
let v = 22; | ||
&(v,) | ||
//~^ ERROR borrowed value does not live long enough [E0597] | ||
}); | ||
println!("{:?}", x); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error[E0597]: borrowed value does not live long enough | ||
--> $DIR/borrowed-temporary-error.rs:22:10 | ||
| | ||
LL | &(v,) | ||
| ^^^^ temporary value does not live long enough | ||
LL | //~^ ERROR borrowed value does not live long enough [E0597] | ||
LL | }); | ||
| - temporary value only lives until here | ||
LL | println!("{:?}", x); | ||
| - borrow later used here | ||
|
||
error: aborting due to previous error | ||
|
||
If you want more information on this error, try using "rustc --explain E0597" |