about summary refs log tree commit diff
path: root/src/test/debuginfo/enum-thinlto.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-06-20 14:44:50 -0700
committerGitHub <noreply@github.com>2020-06-20 14:44:50 -0700
commita1404a93f9632d768d7268934e6380a9b9614834 (patch)
tree9532ddbaad645d10a3af580206546e96ce0f14bc /src/test/debuginfo/enum-thinlto.rs
parent033013cab3a861224fd55f494c8be1cb0349eb49 (diff)
parentf1e07103d3ebac4e820311254e077481d00bed49 (diff)
downloadrust-a1404a93f9632d768d7268934e6380a9b9614834.tar.gz
rust-a1404a93f9632d768d7268934e6380a9b9614834.zip
Rollup merge of #72456 - ldm0:dereftrait, r=estebank
Try to suggest dereferences on trait selection failed

Fixes #39029 Fixes #62530
This PR consists of two parts:
1. Decouple `Autoderef` with `FnCtxt` and move `Autoderef` to `librustc_trait_selection`.
2. Try to suggest dereferences when trait selection failed.

The first is needed because:
1. For suggesting dereferences, the struct `Autoderef` should be used. But before this PR, it is placed in `librustc_typeck`, which depends on `librustc_trait_selection`. But trait selection error emitting happens in `librustc_trait_selection`, if we want to use `Autoderef` in it, dependency loop is inevitable. So I moved the `Autoderef` to `librustc_trait_selection`.
2. Before this PR, `FnCtxt` is coupled to `Autoderef`, and `FnCtxt` only exists in `librustc_typeck`. So decoupling is needed.

After this PR, we can get suggestion like this:
```
error[E0277]: the trait bound `&Baz: Happy` is not satisfied
  --> $DIR/trait-suggest-deferences-multiple.rs:34:9
   |
LL | fn foo<T>(_: T) where T: Happy {}
   |                          ----- required by this bound in `foo`
...
LL |     foo(&baz);
   |         ^^^^
   |         |
   |         the trait `Happy` is not implemented for `&Baz`
   |         help: consider adding dereference here: `&***baz`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
```

r? @estebank
Diffstat (limited to 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions