]> git.lizzy.rs Git - rust.git/commit
Add new error comparision to hide desugaring
authorChristopher Vittal <christopher.vittal@gmail.com>
Fri, 10 Nov 2017 17:47:33 +0000 (12:47 -0500)
committerChristopher Vittal <christopher.vittal@gmail.com>
Wed, 15 Nov 2017 20:46:01 +0000 (15:46 -0500)
commit109f2dd36b38d0642246ad50101bba21f5c0fba9
treea5d5704dab57dea70cf32c8cd01a7ce65e444f50
parentf225fe43f14a8a3887aca558f20c7d7e990b591e
Add new error comparision to hide desugaring

First some background:
To the compiler, the following two signatures in the trait vs the impl
are the same.

```rust
trait Foo {
    fn foo(&self, &impl Debug);
}
impl Foo for () {
    fn foo<U: Debug>(&self, x: &U) { ... }
}
```

We do not want to allow this, and so we add a new error and check.

The check just tests that all paramters 'syntheticness' match up. As
during collection, the impl Trait parameters are transformed into
anonymous synthetic generics.

Furthermore, causes a check for unused type parameters to be skipped in
check_bounds_are_used if there is already a TyError. Thus, an unused
input will not trigger `type parameter unused` errors.

Update the one test that checked for this error in the case of
a TyError.
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/diagnostics.rs
src/test/ui/resolve/use_suggestion_placement.stderr