Skip to content

Commit

Permalink
UI test: "elided" has just the one 'l'; exercise underscore lifetime
Browse files Browse the repository at this point in the history
The files were named 'ellided-lifetimes', but the word "elided" only has
one 'l' (see, e.g., https://en.wiktionary.org/wiki/elide). We add a
couple lines to the test that exercise underscore lifetimes with the
elided-lifetimes-in-paths lint: in the current implementation, the lint
fires (as one can see in the expectation file), but it really shouldn't
(notice that the message says to use an underscore lifetime!); this is
to be fixed in another commit.
  • Loading branch information
zackmdavis committed Jul 14, 2018
1 parent 1731f0a commit 1a59677
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
// <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.
#![allow(warnings)]
#![allow(unused_variables, dead_code, unused, bad_style)]

#![allow(unused)]
#![deny(elided_lifetimes_in_paths)]

struct Foo<'a> { x: &'a u32 }

fn foo(x: &Foo) {
//~^ ERROR: hidden lifetime parameters are deprecated, try `Foo<'_>`
}

fn bar(x: &Foo<'_>) {
//~^ ERROR: hidden lifetime parameters are deprecated, try `Foo<'_>`
}

fn main() {}
20 changes: 20 additions & 0 deletions src/test/ui/in-band-lifetimes/elided-lifetimes.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: hidden lifetime parameters are deprecated, try `Foo<'_>`
--> $DIR/elided-lifetimes.rs:16:12
|
LL | fn foo(x: &Foo) {
| ^^^
|
note: lint level defined here
--> $DIR/elided-lifetimes.rs:12:9
|
LL | #![deny(elided_lifetimes_in_paths)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: hidden lifetime parameters are deprecated, try `Foo<'_>`
--> $DIR/elided-lifetimes.rs:20:16
|
LL | fn bar(x: &Foo<'_>) {
| ^^

error: aborting due to 2 previous errors

14 changes: 0 additions & 14 deletions src/test/ui/in-band-lifetimes/ellided-lifetimes.stderr

This file was deleted.

0 comments on commit 1a59677

Please sign in to comment.