mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
fix "X is not a member of trait Y" span labels
The span labels for associated types and consts were hardcoded to `Foo` rather than substituting the name of the trait. This also normalizes the wording for associated methods', traits', and consts' span labels. Fixes #36428.
This commit is contained in:
parent
5531c314a2
commit
0a62676c73
@ -247,7 +247,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
|
||||
"method `{}` is not a member of trait `{}`",
|
||||
method,
|
||||
trait_);
|
||||
err.span_label(span, &format!("not a member of `{}`", trait_));
|
||||
err.span_label(span, &format!("not a member of trait `{}`", trait_));
|
||||
err
|
||||
}
|
||||
ResolutionError::TypeNotMemberOfTrait(type_, trait_) => {
|
||||
@ -257,7 +257,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
|
||||
"type `{}` is not a member of trait `{}`",
|
||||
type_,
|
||||
trait_);
|
||||
err.span_label(span, &format!("not a member of trait `Foo`"));
|
||||
err.span_label(span, &format!("not a member of trait `{}`", trait_));
|
||||
err
|
||||
}
|
||||
ResolutionError::ConstNotMemberOfTrait(const_, trait_) => {
|
||||
@ -267,7 +267,7 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
|
||||
"const `{}` is not a member of trait `{}`",
|
||||
const_,
|
||||
trait_);
|
||||
err.span_label(span, &format!("not a member of trait `Foo`"));
|
||||
err.span_label(span, &format!("not a member of trait `{}`", trait_));
|
||||
err
|
||||
}
|
||||
ResolutionError::VariableNotBoundInPattern(variable_name, from, to) => {
|
||||
|
@ -18,7 +18,7 @@ impl Foo for Bar {
|
||||
fn a() {}
|
||||
fn b() {}
|
||||
//~^ ERROR E0407
|
||||
//~| NOTE not a member of `Foo`
|
||||
//~| NOTE not a member of trait `Foo`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
#![feature(associated_consts)]
|
||||
|
||||
trait Foo {}
|
||||
trait Bar {}
|
||||
|
||||
impl Foo for i32 {
|
||||
impl Bar for i32 {
|
||||
const BAR: bool = true; //~ ERROR E0438
|
||||
//~| NOTE not a member of trait `Foo`
|
||||
//~| NOTE not a member of trait `Bar`
|
||||
}
|
||||
|
||||
fn main () {
|
||||
|
Loading…
Reference in New Issue
Block a user