Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f418859

Browse files
committedMar 28, 2023
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
2 parents cbc064b + a694960 commit f418859

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+215
-41
lines changed
 

‎compiler/rustc_error_codes/src/error_codes/E0223.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,33 @@ An attempt was made to retrieve an associated type, but the type was ambiguous.
33
Erroneous code example:
44

55
```compile_fail,E0223
6-
trait MyTrait {type X; }
6+
trait Trait { type X; }
77
88
fn main() {
9-
let foo: MyTrait::X;
9+
let foo: Trait::X;
1010
}
1111
```
1212

13-
The problem here is that we're attempting to take the type of X from MyTrait.
14-
Unfortunately, the type of X is not defined, because it's only made concrete in
15-
implementations of the trait. A working version of this code might look like:
13+
The problem here is that we're attempting to take the associated type of `X`
14+
from `Trait`. Unfortunately, the type of `X` is not defined, because it's only
15+
made concrete in implementations of the trait. A working version of this code
16+
might look like:
1617

1718
```
18-
trait MyTrait {type X; }
19-
struct MyStruct;
19+
trait Trait { type X; }
2020
21-
impl MyTrait for MyStruct {
21+
struct Struct;
22+
impl Trait for Struct {
2223
type X = u32;
2324
}
2425
2526
fn main() {
26-
let foo: <MyStruct as MyTrait>::X;
27+
let foo: <Struct as Trait>::X;
2728
}
2829
```
2930

30-
This syntax specifies that we want the X type from MyTrait, as made concrete in
31-
MyStruct. The reason that we cannot simply use `MyStruct::X` is that MyStruct
32-
might implement two different traits with identically-named associated types.
33-
This syntax allows disambiguation between the two.
31+
This syntax specifies that we want the associated type `X` from `Struct`'s
32+
implementation of `Trait`.
33+
34+
Due to internal limitations of the current compiler implementation we cannot
35+
simply use `Struct::X`.

‎compiler/rustc_interface/src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub type MakeBackendFn = fn() -> Box<dyn CodegenBackend>;
3434
/// specific features (SSE, NEON etc.).
3535
///
3636
/// This is performed by checking whether a set of permitted features
37-
/// is available on the target machine, by querying LLVM.
37+
/// is available on the target machine, by querying the codegen backend.
3838
pub fn add_configuration(
3939
cfg: &mut CrateConfig,
4040
sess: &mut Session,

0 commit comments

Comments
 (0)
Please sign in to comment.