about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-11-08 20:46:12 -0800
committerGitHub <noreply@github.com>2024-11-08 20:46:12 -0800
commit7a4970476e8a9cb387ca48a14a657051769b094f (patch)
treed17e627b0f5a78ae04210b464cfee240e3ec50fd /compiler/rustc_middle/src
parent1077c08ad5fbf4c8aad28e8681fa80d9297005bc (diff)
parent97dfe8b87115c44d480b6282aae7754e7c4ab4fe (diff)
Rollup merge of #132757 - compiler-errors:yeet-check-wf, r=lcnr
Get rid of `check_opaque_type_well_formed`

Instead, replicate it by improving the span of the opaque in `check_opaque_meets_bounds`.

This has two consequences:
1. We now prefer "concrete type differs" errors, since we'll hit those first before we check the opaque is WF.
2. Spans have gotten slightly worse.

Specifically, (2.) could be improved by adding a new obligation cause that explains that the definition's environment has stronger assumptions than the declaration.

r? lcnr
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/traits/mod.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs
index 40e5ec45959..09731d565b6 100644
--- a/compiler/rustc_middle/src/traits/mod.rs
+++ b/compiler/rustc_middle/src/traits/mod.rs
@@ -193,6 +193,11 @@ pub enum ObligationCauseCode<'tcx> {
     /// The span corresponds to the clause.
     WhereClause(DefId, Span),
 
+    /// Represents a bound for an opaque we are checking the well-formedness of.
+    /// The def-id corresponds to a specific definition site that we found the
+    /// hidden type from, if any.
+    OpaqueTypeBound(Span, Option<LocalDefId>),
+
     /// Like `WhereClause`, but also identifies the expression
     /// which requires the `where` clause to be proven, and also
     /// identifies the index of the predicate in the `predicates_of`