about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/tests.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-19 06:19:22 +0000
committerbors <bors@rust-lang.org>2024-06-19 06:19:22 +0000
commit3c0f019b3c56c1a0e6e0cbed6f8a8b0b245e5665 (patch)
tree6731075def492ce83bcd2e64ae6d4d7b4bcc0f98 /compiler/rustc_mir_transform/src/coverage/tests.rs
parent9889a6f5d3f07eb2c8480060f46d5c0e710bba8e (diff)
parent586821eacd7389a4a30b60633ceb53596d06e238 (diff)
downloadrust-3c0f019b3c56c1a0e6e0cbed6f8a8b0b245e5665.tar.gz
rust-3c0f019b3c56c1a0e6e0cbed6f8a8b0b245e5665.zip
Auto merge of #125852 - bvanjoi:improve-tip-for-invisible-trait, r=compiler-errors
improve tip for inaccessible traits

Improve the tips when the candidate method is from an inaccessible trait.

For example:

```rs
mod m {
  trait Trait {
    fn f() {}
  }
  impl<T> Trait for T {}
}

fn main() {
  struct S;
  S::f();
}
```

The difference between before and now is:

```diff
error[E0599]: no function or associated item named `f` found for struct `S` in the current scope
  --> ./src/main.rs:88:6
   |
LL |   struct S;
   |   -------- function or associated item `f` not found for this struct
LL |   S::f();
   |      ^ function or associated item not found in `S`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
- help: trait `Trait` which provides `f` is implemented but not in scope; perhaps you want to import it
+ help: trait `crate::m::Trait` which provides `f` is implemented but not reachable
   |
- LL + use crate::m::Trait;
   |
```
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/tests.rs')
0 files changed, 0 insertions, 0 deletions