]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Auto merge of #80828 - SNCPlay42:opaque-projections, r=estebank
authorbors <bors@rust-lang.org>
Fri, 2 Apr 2021 03:39:32 +0000 (03:39 +0000)
committerbors <bors@rust-lang.org>
Fri, 2 Apr 2021 03:39:32 +0000 (03:39 +0000)
commit4fa76a4a7742bb9c1febe33019f5a9e7e4839a65
tree7c88fcaa165ab8a48e30f8e8345e756633cf5a55
parentd1065e6cefa41fe6c55c9819552cdd61529096fc
parent525e23adafc06aec29338cbe46794c63920608a7
Auto merge of #80828 - SNCPlay42:opaque-projections, r=estebank

Fix expected/found order on impl trait projection mismatch error

fixes #68561

This PR adds a new `ObligationCauseCode` used when checking the concrete type of an impl trait satisfies its bounds, and checks for that cause code in the existing test to see if a projection's normalized type should be the "expected" or "found" type.

The second commit adds a `peel_derives` to that test, which appears to be necessary in some cases (see projection-mismatch-in-impl-where-clause.rs, which would still give expected/found in the wrong order otherwise). This caused some other changes in diagnostics not involving impl trait, but they look correct to me.
compiler/rustc_middle/src/traits/mod.rs
compiler/rustc_middle/src/ty/error.rs
compiler/rustc_trait_selection/src/opaque_types.rs
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs