mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 05:26:47 +00:00
always enable TypingMode::Borrowck
This commit is contained in:
parent
d85f8b0222
commit
092d8ce411
@ -674,12 +674,7 @@ pub(crate) struct BorrowckInferCtxt<'tcx> {
|
||||
|
||||
impl<'tcx> BorrowckInferCtxt<'tcx> {
|
||||
pub(crate) fn new(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Self {
|
||||
let typing_mode = if tcx.use_typing_mode_borrowck() {
|
||||
TypingMode::borrowck(tcx, def_id)
|
||||
} else {
|
||||
TypingMode::analysis_in_body(tcx, def_id)
|
||||
};
|
||||
let infcx = tcx.infer_ctxt().build(typing_mode);
|
||||
let infcx = tcx.infer_ctxt().build(TypingMode::borrowck(tcx, def_id));
|
||||
let param_env = tcx.param_env(def_id);
|
||||
BorrowckInferCtxt { infcx, reg_var_to_origin: RefCell::new(Default::default()), param_env }
|
||||
}
|
||||
|
@ -198,14 +198,6 @@ pub(crate) fn handle_opaque_type_uses<'tcx>(
|
||||
)
|
||||
});
|
||||
|
||||
if !tcx.use_typing_mode_borrowck() {
|
||||
if let ty::Alias(ty::Opaque, alias_ty) = ty.kind()
|
||||
&& alias_ty.def_id == opaque_type_key.def_id.to_def_id()
|
||||
&& alias_ty.args == opaque_type_key.args
|
||||
{
|
||||
continue 'entry;
|
||||
}
|
||||
}
|
||||
root_cx.add_concrete_opaque_type(
|
||||
opaque_type_key.def_id,
|
||||
OpaqueHiddenType { span: hidden_type.span, ty },
|
||||
@ -213,15 +205,6 @@ pub(crate) fn handle_opaque_type_uses<'tcx>(
|
||||
}
|
||||
|
||||
for &(key, hidden_type) in &opaque_types {
|
||||
if !tcx.use_typing_mode_borrowck() {
|
||||
if let ty::Alias(ty::Opaque, alias_ty) = hidden_type.ty.kind()
|
||||
&& alias_ty.def_id == key.def_id.to_def_id()
|
||||
&& alias_ty.args == key.args
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
let Some(expected) = root_cx.get_concrete_opaque_type(key.def_id) else {
|
||||
let guar =
|
||||
tcx.dcx().span_err(hidden_type.span, "non-defining use in the defining scope");
|
||||
|
@ -3283,11 +3283,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
self.sess.opts.unstable_opts.next_solver.coherence
|
||||
}
|
||||
|
||||
#[allow(rustc::bad_opt_access)]
|
||||
pub fn use_typing_mode_borrowck(self) -> bool {
|
||||
self.next_trait_solver_globally() || self.sess.opts.unstable_opts.typing_mode_borrowck
|
||||
}
|
||||
|
||||
pub fn is_impl_trait_in_trait(self, def_id: DefId) -> bool {
|
||||
self.opt_rpitit_info(def_id).is_some()
|
||||
}
|
||||
|
@ -2559,9 +2559,6 @@ written to standard error output)"),
|
||||
"in diagnostics, use heuristics to shorten paths referring to items"),
|
||||
tune_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
|
||||
"select processor to schedule for (`rustc --print target-cpus` for details)"),
|
||||
#[rustc_lint_opt_deny_field_access("use `TyCtxt::use_typing_mode_borrowck` instead of this field")]
|
||||
typing_mode_borrowck: bool = (false, parse_bool, [TRACKED],
|
||||
"enable `TypingMode::Borrowck`, changing the way opaque types are handled during MIR borrowck"),
|
||||
#[rustc_lint_opt_deny_field_access("use `Session::ub_checks` instead of this field")]
|
||||
ub_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||
"emit runtime checks for Undefined Behavior (default: -Cdebug-assertions)"),
|
||||
|
Loading…
Reference in New Issue
Block a user