diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2018-02-27 16:03:23 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2018-02-28 12:31:27 -0300 |
| commit | a17a2e3f839a6c5c00ee8f00ac4c7d92e2ad634b (patch) | |
| tree | 9a4402725bbf518b3fa1797353bf169b31e1d858 /src/test | |
| parent | 29f5c699b11a6a148f097f82eaa05202f8799bbc (diff) | |
| download | rust-a17a2e3f839a6c5c00ee8f00ac4c7d92e2ad634b.tar.gz rust-a17a2e3f839a6c5c00ee8f00ac4c7d92e2ad634b.zip | |
Do not report _#nr lifetimes names in errors
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/nll/borrowed-local-error.rs | 26 | ||||
| -rw-r--r-- | src/test/ui/nll/borrowed-local-error.stderr | 17 | ||||
| -rw-r--r-- | src/test/ui/nll/borrowed-temporary-error.rs | 26 | ||||
| -rw-r--r-- | src/test/ui/nll/borrowed-temporary-error.stderr | 14 |
4 files changed, 83 insertions, 0 deletions
diff --git a/src/test/ui/nll/borrowed-local-error.rs b/src/test/ui/nll/borrowed-local-error.rs new file mode 100644 index 00000000000..785a38da959 --- /dev/null +++ b/src/test/ui/nll/borrowed-local-error.rs @@ -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); +} diff --git a/src/test/ui/nll/borrowed-local-error.stderr b/src/test/ui/nll/borrowed-local-error.stderr new file mode 100644 index 00000000000..3bc19785548 --- /dev/null +++ b/src/test/ui/nll/borrowed-local-error.stderr @@ -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" diff --git a/src/test/ui/nll/borrowed-temporary-error.rs b/src/test/ui/nll/borrowed-temporary-error.rs new file mode 100644 index 00000000000..e1a6112d173 --- /dev/null +++ b/src/test/ui/nll/borrowed-temporary-error.rs @@ -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); +} diff --git a/src/test/ui/nll/borrowed-temporary-error.stderr b/src/test/ui/nll/borrowed-temporary-error.stderr new file mode 100644 index 00000000000..f5cb1dccc37 --- /dev/null +++ b/src/test/ui/nll/borrowed-temporary-error.stderr @@ -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" |
