Skip to content

Commit eb9da7b

Browse files
committedMay 25, 2023
Auto merge of rust-lang#111473 - compiler-errors:opaques, r=lcnr
Handle opaques in the new solver (take 2?) Implement a new strategy for handling opaques in the new solver. First, queries now carry both their defining anchor and the opaques that were defined in the inference context at the time of canonicalization. These are both used to pre-populate the inference context used by the canonical query. Second, use the normalizes-to goal to handle opaque types in the new solver. This means that opaques are handled like projection aliases, but with their own rules: * Can only define opaques if they're "defining uses" (i.e. have unique params in all their substs). * Can only define opaques that are from the anchor. * Opaque type definitions are modulo regions. So that means `Opaque<'?0r> = HiddenTy1` and `Opaque<?'1r> = HiddenTy2` equate `HiddenTy1` and `HiddenTy2` instead of defining them as different opaque type keys.
2 parents 0b011b7 + dd98198 commit eb9da7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+658
-189
lines changed
 

‎compiler/rustc_borrowck/src/consumers.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
55
use rustc_hir::def_id::LocalDefId;
66
use rustc_index::{IndexSlice, IndexVec};
7-
use rustc_infer::infer::{DefiningAnchor, TyCtxtInferExt};
7+
use rustc_infer::infer::TyCtxtInferExt;
88
use rustc_middle::mir::{Body, Promoted};
9+
use rustc_middle::traits::DefiningAnchor;
910
use rustc_middle::ty::TyCtxt;
1011
use std::rc::Rc;
1112

‎compiler/rustc_borrowck/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustc_hir::def_id::LocalDefId;
2626
use rustc_index::bit_set::ChunkedBitSet;
2727
use rustc_index::{IndexSlice, IndexVec};
2828
use rustc_infer::infer::{
29-
DefiningAnchor, InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin, TyCtxtInferExt,
29+
InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin, TyCtxtInferExt,
3030
};
3131
use rustc_middle::mir::{
3232
traversal, Body, ClearCrossCrate, Local, Location, Mutability, NonDivergingIntrinsic, Operand,
@@ -36,6 +36,7 @@ use rustc_middle::mir::{AggregateKind, BasicBlock, BorrowCheckResult, BorrowKind
3636
use rustc_middle::mir::{InlineAsmOperand, Terminator, TerminatorKind};
3737
use rustc_middle::mir::{ProjectionElem, Promoted, Rvalue, Statement, StatementKind};
3838
use rustc_middle::query::Providers;
39+
use rustc_middle::traits::DefiningAnchor;
3940
use rustc_middle::ty::{self, CapturedPlace, ParamEnv, RegionVid, TyCtxt};
4041
use rustc_session::lint::builtin::UNUSED_MUT;
4142
use rustc_span::{Span, Symbol};

0 commit comments

Comments
 (0)
Please sign in to comment.