Skip to content

Commit 320e3dc

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#35368 - shantanuraj:master, r=jonathandturner
Update E0207 to use struct_span_err, add span_label Fixes rust-lang#35302 part of rust-lang#35233 r? @jonathandturner
2 parents 2139a0a + 58b618e commit 320e3dc

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

src/librustc_typeck/collect.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,8 +2317,12 @@ fn report_unused_parameter(ccx: &CrateCtxt,
23172317
kind: &str,
23182318
name: &str)
23192319
{
2320-
span_err!(ccx.tcx.sess, span, E0207,
2321-
"the {} parameter `{}` is not constrained by the \
2322-
impl trait, self type, or predicates",
2323-
kind, name);
2320+
struct_span_err!(
2321+
ccx.tcx.sess, span, E0207,
2322+
"the {} parameter `{}` is not constrained by the \
2323+
impl trait, self type, or predicates",
2324+
kind, name)
2325+
.span_label(span, &format!("unconstrained lifetime parameter"))
2326+
.emit();
2327+
23242328
}

src/test/compile-fail/E0207.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
struct Foo;
1212

1313
impl<T: Default> Foo { //~ ERROR E0207
14+
//~| NOTE unconstrained lifetime parameter
1415
fn get(&self) -> T {
1516
<T as Default>::default()
1617
}

src/test/compile-fail/impl-unused-rps-in-assoc-type.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ trait Fun {
1919
struct Holder { x: String }
2020

2121
impl<'a> Fun for Holder { //~ ERROR E0207
22+
//~| NOTE unconstrained lifetime parameter
2223
type Output = &'a str;
2324
fn call<'b>(&'b self) -> &'b str {
2425
&self.x[..]

src/test/compile-fail/issue-22886.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ fn crash_please() {
2121
struct Newtype(Option<Box<usize>>);
2222

2323
impl<'a> Iterator for Newtype { //~ ERROR E0207
24+
//~| NOTE unconstrained lifetime parameter
2425
type Item = &'a Box<usize>;
2526

2627
fn next(&mut self) -> Option<&Box<usize>> {

src/test/compile-fail/issue-35139.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub trait MethodType {
1717
pub struct MTFn;
1818

1919
impl<'a> MethodType for MTFn { //~ ERROR E0207
20+
//~| NOTE unconstrained lifetime parameter
2021
type GetProp = fmt::Debug + 'a;
2122
}
2223

0 commit comments

Comments
 (0)