Auto merge of #131856 - lcnr:typing-mode, r= · rust-lang/rust@5c3ff89 (original) (raw)
`@@ -17,7 +17,7 @@ use rustc_middle::ty::fold::BottomUpFolder;
`
17
17
`use rustc_middle::ty::util::ExplicitSelf;
`
18
18
`use rustc_middle::ty::{
`
19
19
`self, GenericArgs, GenericParamDefKind, Ty, TyCtxt, TypeFoldable, TypeFolder,
`
20
``
`-
TypeSuperFoldable, TypeVisitableExt, Upcast,
`
``
20
`+
TypeSuperFoldable, TypeVisitableExt, TypingMode, Upcast,
`
21
21
`};
`
22
22
`use rustc_middle::{bug, span_bug};
`
23
23
`use rustc_span::Span;
`
`@@ -228,7 +228,7 @@ fn compare_method_predicate_entailment<'tcx>(
`
228
228
`let param_env = traits::normalize_param_env_or_error(tcx, param_env, normalize_cause);
`
229
229
`debug!(caller_bounds=?param_env.caller_bounds());
`
230
230
``
231
``
`-
let infcx = &tcx.infer_ctxt().build();
`
``
231
`+
let infcx = &tcx.infer_ctxt().build(TypingMode::non_body_analysis());
`
232
232
`let ocx = ObligationCtxt::new_with_diagnostics(infcx);
`
233
233
``
234
234
`// Create obligations for each predicate declared by the impl
`
`@@ -516,7 +516,7 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
`
516
516
`ObligationCause::misc(tcx.def_span(impl_m_def_id), impl_m_def_id),
`
517
517
`);
`
518
518
``
519
``
`-
let infcx = &tcx.infer_ctxt().build();
`
``
519
`+
let infcx = &tcx.infer_ctxt().build(TypingMode::non_body_analysis());
`
520
520
`let ocx = ObligationCtxt::new_with_diagnostics(infcx);
`
521
521
``
522
522
`// Normalize the impl signature with fresh variables for lifetime inference.
`
`@@ -1196,7 +1196,7 @@ fn compare_self_type<'tcx>(
`
1196
1196
`let self_arg_ty = tcx.fn_sig(method.def_id).instantiate_identity().input(0);
`
1197
1197
`let param_env = ty::ParamEnv::reveal_all();
`
1198
1198
``
1199
``
`-
let infcx = tcx.infer_ctxt().build();
`
``
1199
`+
let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis());
`
1200
1200
`let self_arg_ty = tcx.liberate_late_bound_regions(method.def_id, self_arg_ty);
`
1201
1201
`let can_eq_self = |ty| infcx.can_eq(param_env, untransformed_self_ty, ty);
`
1202
1202
`match ExplicitSelf::determine(self_arg_ty, can_eq_self) {
`
`@@ -1801,7 +1801,7 @@ fn compare_const_predicate_entailment<'tcx>(
`
1801
1801
`ObligationCause::misc(impl_ct_span, impl_ct_def_id),
`
1802
1802
`);
`
1803
1803
``
1804
``
`-
let infcx = tcx.infer_ctxt().build();
`
``
1804
`+
let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis());
`
1805
1805
`let ocx = ObligationCtxt::new_with_diagnostics(&infcx);
`
1806
1806
``
1807
1807
`let impl_ct_own_bounds = impl_ct_predicates.instantiate_own_identity();
`
`@@ -1951,7 +1951,7 @@ fn compare_type_predicate_entailment<'tcx>(
`
1951
1951
`let param_env = traits::normalize_param_env_or_error(tcx, param_env, normalize_cause);
`
1952
1952
`debug!(caller_bounds=?param_env.caller_bounds());
`
1953
1953
``
1954
``
`-
let infcx = tcx.infer_ctxt().build();
`
``
1954
`+
let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis());
`
1955
1955
`let ocx = ObligationCtxt::new_with_diagnostics(&infcx);
`
1956
1956
``
1957
1957
`for (predicate, span) in impl_ty_own_bounds {
`
`@@ -2036,7 +2036,7 @@ pub(super) fn check_type_bounds<'tcx>(
`
2036
2036
`let impl_ty_args = GenericArgs::identity_for_item(tcx, impl_ty.def_id);
`
2037
2037
`let rebased_args = impl_ty_args.rebase_onto(tcx, container_id, impl_trait_ref.args);
`
2038
2038
``
2039
``
`-
let infcx = tcx.infer_ctxt().build();
`
``
2039
`+
let infcx = tcx.infer_ctxt().build(TypingMode::non_body_analysis());
`
2040
2040
`let ocx = ObligationCtxt::new_with_diagnostics(&infcx);
`
2041
2041
``
2042
2042
`// A synthetic impl Trait for RPITIT desugaring or assoc type for effects desugaring has no HIR,
`