Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
None => match rscope.anon_regions(default_span, 1) {
Ok(rs) => rs[0],
Err(params) => {
let mut err = struct_span_err!(self.tcx().sess, default_span, E0106,
"missing lifetime specifier");
let ampersand_span = Span { hi: default_span.lo, ..default_span};

let mut err = struct_span_err!(self.tcx().sess, ampersand_span, E0106,
"missing lifetime specifier");
err.span_label(ampersand_span, &format!("expected lifetime parameter"));

if let Some(params) = params {
report_elision_failure(&mut err, params);
}
Expand Down
12 changes: 9 additions & 3 deletions src/test/compile-fail/E0106.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@
// except according to those terms.

struct Foo {
x: &bool, //~ ERROR E0106
x: &bool,
//~^ ERROR E0106
//~| NOTE expected lifetime parameter
}
enum Bar {
A(u8),
B(&bool), //~ ERROR E0106
B(&bool),
//~^ ERROR E0106
//~| NOTE expected lifetime parameter
}
type MyStr = &str; //~ ERROR E0106
type MyStr = &str;
//~^ ERROR E0106
//~| NOTE expected lifetime parameter

fn main() {
}