about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-02-20 22:12:18 +0100
committerGitHub <noreply@github.com>2023-02-20 22:12:18 +0100
commit194d52cc182241348e2372dfaf96896565fb51d9 (patch)
tree2ba84089967739288c8b724beab42355bc3e674c /compiler/rustc_codegen_gcc
parent52fa8fe376de2bf9ad5ae39aba018f9b965e6194 (diff)
parentfbcca2aaf0280190111982e931bc113b21f7ec0d (diff)
downloadrust-194d52cc182241348e2372dfaf96896565fb51d9.tar.gz
rust-194d52cc182241348e2372dfaf96896565fb51d9.zip
Rollup merge of #108254 - Nathan-Fenner:nathanf/error-span-ref-trait-refine, r=WaffleLapkin
Refine error span for trait error into borrowed expression

Extends the error span refinement in #106477 to drill into borrowed expressions just like tuples/struct/enum literals. For example,

```rs
trait Fancy {}
trait Good {}
impl <'a, T> Fancy for &'a T where T: Good {}
impl <S> Good for Option<S> where S: Iterator {}

fn want_fancy<F>(f: F) where F: Fancy {}

fn example() {
    want_fancy(&Some(5));
//  (BEFORE)   ^^^^^^^^ `{integer}` is not an iterator
//  (AFTER)          ^  `{integer}` is not an iterator
}
```

Existing heuristics try to find the right part of the expression to "point at"; current heuristics look at e.g. struct constructors and tuples. This PR adds a new check for borrowed expressions when looking into a borrowed type.
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions