Skip to content

Commit 06926b6

Browse files
committed
Add tests for multiple underscore and non-underscore lifetimes
1 parent f64af7a commit 06926b6

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/test/compile-fail/underscore-lifetime-binders.rs

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR invalid lifetime parameter name: `'_`
2525
Box::new(5u8)
2626
}
2727

28+
fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } //~ ERROR missing lifetime specifier
29+
2830
fn main() {
2931
let x = 5;
3032
foo(Foo(&x));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(underscore_lifetimes)]
12+
13+
fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch
14+
15+
fn main() {}

0 commit comments

Comments
 (0)