about summary refs log tree commit diff
path: root/compiler/rustc_error_codes/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-28 07:02:21 +0000
committerbors <bors@rust-lang.org>2023-03-28 07:02:21 +0000
commitf418859d8a464fb9ff5b5b1a4459d35fb8cfab1d (patch)
treeba5671b3f24a587b97680fab2e4f3156e6dc38a1 /compiler/rustc_error_codes/src
parentcbc064b341be231403d181402a786cce7f1c73f1 (diff)
parenta69496002cd08d73fe1c901f2f179ca0a87fefb8 (diff)
downloadrust-f418859d8a464fb9ff5b5b1a4459d35fb8cfab1d.tar.gz
rust-f418859d8a464fb9ff5b5b1a4459d35fb8cfab1d.zip
Auto merge of #109690 - matthiaskrgr:rollup-6p5m0es, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #108548 (Clarify the 'use a constant in a pattern' error message)
 - #109565 (Improve documentation for E0223)
 - #109661 (Fix LVI test post LLVM 16 update)
 - #109667 (Always set `RUSTC_BOOTSTRAP` with `x doc`)
 - #109669 (Update books)
 - #109678 (Don't shadow the `dep_node` var in `incremental_verify_ich_failed`)
 - #109682 (Add `#[inline]` to CStr trait implementations)
 - #109685 (Make doc comment a little bit more accurate)
 - #109687 (Document the heuristics IsTerminal uses on Windows)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_error_codes/src')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0223.md28
1 files changed, 15 insertions, 13 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0223.md b/compiler/rustc_error_codes/src/error_codes/E0223.md
index 0d49f514ccf..ba5f0052821 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0223.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0223.md
@@ -3,31 +3,33 @@ An attempt was made to retrieve an associated type, but the type was ambiguous.
 Erroneous code example:
 
 ```compile_fail,E0223
-trait MyTrait {type X; }
+trait Trait { type X; }
 
 fn main() {
-    let foo: MyTrait::X;
+    let foo: Trait::X;
 }
 ```
 
-The problem here is that we're attempting to take the type of X from MyTrait.
-Unfortunately, the type of X is not defined, because it's only made concrete in
-implementations of the trait. A working version of this code might look like:
+The problem here is that we're attempting to take the associated type of `X`
+from `Trait`. Unfortunately, the type of `X` is not defined, because it's only
+made concrete in implementations of the trait. A working version of this code
+might look like:
 
 ```
-trait MyTrait {type X; }
-struct MyStruct;
+trait Trait { type X; }
 
-impl MyTrait for MyStruct {
+struct Struct;
+impl Trait for Struct {
     type X = u32;
 }
 
 fn main() {
-    let foo: <MyStruct as MyTrait>::X;
+    let foo: <Struct as Trait>::X;
 }
 ```
 
-This syntax specifies that we want the X type from MyTrait, as made concrete in
-MyStruct. The reason that we cannot simply use `MyStruct::X` is that MyStruct
-might implement two different traits with identically-named associated types.
-This syntax allows disambiguation between the two.
+This syntax specifies that we want the associated type `X` from `Struct`'s
+implementation of `Trait`.
+
+Due to internal limitations of the current compiler implementation we cannot
+simply use `Struct::X`.