mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
Updated diagnostics.
This commit is contained in:
parent
856e84f9a3
commit
79009ed728
@ -770,17 +770,17 @@ match x {
|
||||
"##,
|
||||
|
||||
E0411: r##"
|
||||
The `Self` keyword was used outside an impl or a trait.
|
||||
The `Self` keyword was used outside an impl, trait, or type definition.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0411
|
||||
<Self>::foo; // error: use of `Self` outside of an impl or trait
|
||||
<Self>::foo; // error: use of `Self` outside of an impl, trait, or type definition
|
||||
```
|
||||
|
||||
The `Self` keyword represents the current type, which explains why it can only
|
||||
be used inside an impl or a trait. It gives access to the associated items of a
|
||||
type:
|
||||
be used inside an impl, trait, or type definition. It gives access to the
|
||||
associated items of a type:
|
||||
|
||||
```
|
||||
trait Foo {
|
||||
|
@ -2977,7 +2977,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
|
||||
if is_self_type(path, ns) {
|
||||
__diagnostic_used!(E0411);
|
||||
err.code(DiagnosticId::Error("E0411".into()));
|
||||
err.span_label(span, "`Self` is only available in traits and impls");
|
||||
err.span_label(span, "`Self` is only available in traits, impls, and type definitions");
|
||||
return (err, Vec::new());
|
||||
}
|
||||
if is_self_value(path, ns) {
|
||||
|
Loading…
Reference in New Issue
Block a user