]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #90819 - JakobDegen:issue-90804, r=petrochenkov
authorYuki Okushi <jtitor@2k36.org>
Tue, 16 Nov 2021 06:59:40 +0000 (15:59 +0900)
committerGitHub <noreply@github.com>
Tue, 16 Nov 2021 06:59:40 +0000 (15:59 +0900)
commitd44cec3453ce1645c1b17b54b8fbec989d4ab0d3
tree91dd1bb4de99e3ab2e3b4a8289230a83798ca9e4
parentb17de50a4182c1e5df1abec5374a09d28dcb387a
parentd58d52a39759960009ca2817f7edcdf22d8722df
Rollup merge of #90819 - JakobDegen:issue-90804, r=petrochenkov

Fixes incorrect handling of TraitRefs when emitting suggestions.

Closes #90804 , although there were more issues here that were hidden by the thing that caused this ICE.

Underlying problem was that substitutions were being thrown out, which not only leads to an ICE but also incorrect diagnostics. On top of that, in some cases the self types from the root obligations were being mixed in with those from derived obligations.

This makes a couple diagnostics arguable worse ("`B<C>` does not implement `Copy`" instead of "`C` does not implement `Copy`") but the worse diagnostics are at least still correct and that downside is in my opinion clearly outweighed by the benefits of fixing the ICE and unambiguously wrong diagnostics.
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs