From 79009ed728f73b92d5e53b4212844e2dbc51ac5f Mon Sep 17 00:00:00 2001 From: Alexander Regueiro Date: Tue, 14 Aug 2018 18:29:53 +0100 Subject: [PATCH] Updated diagnostics. --- src/librustc_resolve/diagnostics.rs | 8 ++++---- src/librustc_resolve/lib.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 6593e239bc3..794e57a1ab2 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -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 -::foo; // error: use of `Self` outside of an impl or trait +::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 { diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 072240eeef4..2ce2173e2e4 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -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) {