diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-06-23 13:18:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-23 13:18:16 +0200 |
| commit | c5fd53774fde96b74b31c280972142c04e3a3445 (patch) | |
| tree | 583ef1002164999982cf99c256bace32b8722e41 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 8d6b02fb3b832d9e96efe5a9f4845570039f8805 (diff) | |
| parent | 48167bd4bddec03d1969e2cc2c1155cb5667d6ad (diff) | |
| download | rust-c5fd53774fde96b74b31c280972142c04e3a3445.tar.gz rust-c5fd53774fde96b74b31c280972142c04e3a3445.zip | |
Rollup merge of #112948 - bkrl:trait-impl-suggestion, r=compiler-errors
Avoid guessing unknown trait implementation in suggestions
When a trait is used without specifying the implementation (e.g. calling a non-member associated function without fully-qualified syntax) and there are multiple implementations available, use a placeholder comment for the implementation type in the suggestion instead of picking a random implementation.
Example:
```
fn main() {
let _ = Default::default();
}
```
Previous output:
```
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
--> test.rs:2:13
|
2 | let _ = Default::default();
| ^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
help: use a fully-qualified path to a specific available implementation (273 found)
|
2 | let _ = <FileTimes as Default>::default();
| +++++++++++++ +
```
New output:
```
error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
--> test.rs:2:13
|
2 | let _ = Default::default();
| ^^^^^^^^^^^^^^^^ cannot call associated function of trait
|
help: use a fully-qualified path to a specific available implementation (273 found)
|
2 | let _ = </* self type */ as Default>::default();
| +++++++++++++++++++ +
```
Fixes #112897
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
