Skip to content

Commit 22d34c4

Browse files
committed
always enable TypingMode::Borrowck
1 parent b796696 commit 22d34c4

File tree

4 files changed

+1
-31
lines changed

4 files changed

+1
-31
lines changed

compiler/rustc_borrowck/src/lib.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -634,12 +634,7 @@ pub(crate) struct BorrowckInferCtxt<'tcx> {
634634

635635
impl<'tcx> BorrowckInferCtxt<'tcx> {
636636
pub(crate) fn new(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Self {
637-
let typing_mode = if tcx.use_typing_mode_borrowck() {
638-
TypingMode::borrowck(tcx, def_id)
639-
} else {
640-
TypingMode::analysis_in_body(tcx, def_id)
641-
};
642-
let infcx = tcx.infer_ctxt().build(typing_mode);
637+
let infcx = tcx.infer_ctxt().build(TypingMode::borrowck(tcx, def_id));
643638
let param_env = tcx.param_env(def_id);
644639
BorrowckInferCtxt { infcx, reg_var_to_origin: RefCell::new(Default::default()), param_env }
645640
}

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

-17
Original file line numberDiff line numberDiff line change
@@ -213,30 +213,13 @@ pub(crate) fn handle_opaque_type_uses<'tcx>(
213213
)
214214
});
215215

216-
if !tcx.use_typing_mode_borrowck() {
217-
if let ty::Alias(ty::Opaque, alias_ty) = ty.kind()
218-
&& alias_ty.def_id == opaque_type_key.def_id.to_def_id()
219-
&& alias_ty.args == opaque_type_key.args
220-
{
221-
continue 'entry;
222-
}
223-
}
224216
root_cx.add_concrete_opaque_type(
225217
opaque_type_key.def_id,
226218
OpaqueHiddenType { span: hidden_type.span, ty },
227219
);
228220
}
229221

230222
for &(key, hidden_type) in &opaque_types {
231-
if !tcx.use_typing_mode_borrowck() {
232-
if let ty::Alias(ty::Opaque, alias_ty) = hidden_type.ty.kind()
233-
&& alias_ty.def_id == key.def_id.to_def_id()
234-
&& alias_ty.args == key.args
235-
{
236-
continue;
237-
}
238-
}
239-
240223
let Some(expected) = root_cx.get_concrete_opaque_type(key.def_id) else {
241224
let guar =
242225
tcx.dcx().span_err(hidden_type.span, "non-defining use in the defining scope");

compiler/rustc_middle/src/ty/context.rs

-5
Original file line numberDiff line numberDiff line change
@@ -3279,11 +3279,6 @@ impl<'tcx> TyCtxt<'tcx> {
32793279
self.sess.opts.unstable_opts.next_solver.coherence
32803280
}
32813281

3282-
#[allow(rustc::bad_opt_access)]
3283-
pub fn use_typing_mode_borrowck(self) -> bool {
3284-
self.next_trait_solver_globally() || self.sess.opts.unstable_opts.typing_mode_borrowck
3285-
}
3286-
32873282
pub fn is_impl_trait_in_trait(self, def_id: DefId) -> bool {
32883283
self.opt_rpitit_info(def_id).is_some()
32893284
}

compiler/rustc_session/src/options.rs

-3
Original file line numberDiff line numberDiff line change
@@ -2559,9 +2559,6 @@ written to standard error output)"),
25592559
"in diagnostics, use heuristics to shorten paths referring to items"),
25602560
tune_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
25612561
"select processor to schedule for (`rustc --print target-cpus` for details)"),
2562-
#[rustc_lint_opt_deny_field_access("use `TyCtxt::use_typing_mode_borrowck` instead of this field")]
2563-
typing_mode_borrowck: bool = (false, parse_bool, [TRACKED],
2564-
"enable `TypingMode::Borrowck`, changing the way opaque types are handled during MIR borrowck"),
25652562
#[rustc_lint_opt_deny_field_access("use `Session::ub_checks` instead of this field")]
25662563
ub_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
25672564
"emit runtime checks for Undefined Behavior (default: -Cdebug-assertions)"),

0 commit comments

Comments
 (0)