diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2018-10-08 00:00:58 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2018-10-19 22:26:01 -0700 |
| commit | ae130b0889181e63b96bc32d5ce17b432f9225b1 (patch) | |
| tree | 051a4792d78ba4ba8fb92235e6b0a2a6e33fb9a5 | |
| parent | faf68f473ff70743c316e91632c4616ea62f820f (diff) | |
| download | rust-ae130b0889181e63b96bc32d5ce17b432f9225b1.tar.gz rust-ae130b0889181e63b96bc32d5ce17b432f9225b1.zip | |
Move an underscore-lifetime error test to an IHLE success test
3 files changed, 24 insertions, 15 deletions
diff --git a/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs b/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs new file mode 100644 index 00000000000..d4b8acd6010 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs @@ -0,0 +1,19 @@ +// Copyright 2017 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-pass + +struct Foo<'a>(&'a u8); + +impl Foo<'_> { + fn x() {} +} + +fn main() {} diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs index 2652fc62bb6..9048e65648a 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs @@ -11,10 +11,6 @@ struct Foo<'a>(&'a u8); struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier -impl Foo<'_> { //~ ERROR missing lifetime specifier - fn x() {} -} - fn foo<'_> //~ ERROR cannot be used here (_: Foo<'_>) {} diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr index fc9f3e642d4..bccecd60e1c 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -1,11 +1,11 @@ error[E0637]: `'_` cannot be used here - --> $DIR/underscore-lifetime-binders.rs:18:8 + --> $DIR/underscore-lifetime-binders.rs:14:8 | LL | fn foo<'_> //~ ERROR cannot be used here | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/underscore-lifetime-binders.rs:24:21 + --> $DIR/underscore-lifetime-binders.rs:20:21 | LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here | ^^ `'_` is a reserved lifetime name @@ -17,13 +17,7 @@ LL | struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier | ^^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:14:10 - | -LL | impl Foo<'_> { //~ ERROR missing lifetime specifier - | ^^ expected lifetime parameter - -error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:24:29 + --> $DIR/underscore-lifetime-binders.rs:20:29 | LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here | ^^ expected lifetime parameter @@ -32,14 +26,14 @@ LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR cannot be used here = help: consider giving it a 'static lifetime error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:30:35 + --> $DIR/underscore-lifetime-binders.rs:26:35 | LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } //~ ERROR missing lifetime specifier | ^^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_` or `y` -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors Some errors occurred: E0106, E0637. For more information about an error, try `rustc --explain E0106`. |
