diff options
| author | Michael Goulet <michael@errs.io> | 2024-05-09 20:05:59 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-05-10 10:42:56 -0400 |
| commit | 4bde8a8f4b039c44baae49dea2f728a28d152122 (patch) | |
| tree | 9449a2c31786b9b8713cd5edf36e1a2bae8f2b72 /compiler/rustc_hir_analysis/src | |
| parent | 04c049498d8c24b890bc22f8ee2d541d5e4ee2f6 (diff) | |
| download | rust-4bde8a8f4b039c44baae49dea2f728a28d152122.tar.gz rust-4bde8a8f4b039c44baae49dea2f728a28d152122.zip | |
Remove glob imports for ObligationCauseCode
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/compare_impl_item.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/dropck.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/wfcheck.rs | 24 |
3 files changed, 24 insertions, 10 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs index 81178344407..55bf06c1ec8 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs @@ -2012,9 +2012,9 @@ pub(super) fn check_type_bounds<'tcx>( ); let mk_cause = |span: Span| { let code = if span.is_dummy() { - traits::ItemObligation(trait_ty.def_id) + ObligationCauseCode::ItemObligation(trait_ty.def_id) } else { - traits::BindingObligation(trait_ty.def_id, span) + ObligationCauseCode::BindingObligation(trait_ty.def_id, span) }; ObligationCause::new(impl_ty_span, impl_ty_def_id, code) }; @@ -2251,7 +2251,8 @@ fn try_report_async_mismatch<'tcx>( }; for error in errors { - if let traits::BindingObligation(def_id, _) = *error.root_obligation.cause.code() + if let ObligationCauseCode::BindingObligation(def_id, _) = + *error.root_obligation.cause.code() && def_id == async_future_def_id && let Some(proj) = error.root_obligation.predicate.to_opt_poly_projection_pred() && let Some(proj) = proj.no_bound_vars() diff --git a/compiler/rustc_hir_analysis/src/check/dropck.rs b/compiler/rustc_hir_analysis/src/check/dropck.rs index 82a6b6b6f2c..be412dde968 100644 --- a/compiler/rustc_hir_analysis/src/check/dropck.rs +++ b/compiler/rustc_hir_analysis/src/check/dropck.rs @@ -5,6 +5,7 @@ use rustc_data_structures::fx::FxHashSet; use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed}; use rustc_infer::infer::outlives::env::OutlivesEnvironment; use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt}; +use rustc_infer::traits::ObligationCauseCode; use rustc_middle::ty::util::CheckRegions; use rustc_middle::ty::GenericArgsRef; use rustc_middle::ty::{self, TyCtxt}; @@ -139,7 +140,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>( for (pred, span) in tcx.predicates_of(drop_impl_def_id).instantiate_identity(tcx) { let normalize_cause = traits::ObligationCause::misc(span, adt_def_id); let pred = ocx.normalize(&normalize_cause, param_env, pred); - let cause = traits::ObligationCause::new(span, adt_def_id, traits::DropImpl); + let cause = traits::ObligationCause::new(span, adt_def_id, ObligationCauseCode::DropImpl); ocx.register_obligation(traits::Obligation::new(tcx, cause, param_env, pred)); } diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index ddfb88d72d8..124de69140e 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -1136,7 +1136,7 @@ fn check_type_defn<'tcx>( traits::ObligationCause::new( hir_ty.span, wfcx.body_def_id, - traits::FieldSized { + ObligationCauseCode::FieldSized { adt_kind: match &item.kind { ItemKind::Struct(..) => AdtKind::Struct, ItemKind::Union(..) => AdtKind::Union, @@ -1161,7 +1161,7 @@ fn check_type_defn<'tcx>( let cause = traits::ObligationCause::new( tcx.def_span(discr_def_id), wfcx.body_def_id, - traits::MiscObligation, + ObligationCauseCode::MiscObligation, ); wfcx.register_obligation(traits::Obligation::new( tcx, @@ -1278,7 +1278,11 @@ fn check_item_type( wfcx.register_wf_obligation(ty_span, Some(WellFormedLoc::Ty(item_id)), item_ty.into()); if forbid_unsized { wfcx.register_bound( - traits::ObligationCause::new(ty_span, wfcx.body_def_id, traits::WellFormed(None)), + traits::ObligationCause::new( + ty_span, + wfcx.body_def_id, + ObligationCauseCode::WellFormed(None), + ), wfcx.param_env, item_ty, tcx.require_lang_item(LangItem::Sized, None), @@ -1293,7 +1297,11 @@ fn check_item_type( if should_check_for_sync { wfcx.register_bound( - traits::ObligationCause::new(ty_span, wfcx.body_def_id, traits::SharedStatic), + traits::ObligationCause::new( + ty_span, + wfcx.body_def_id, + ObligationCauseCode::SharedStatic, + ), wfcx.param_env, item_ty, tcx.require_lang_item(LangItem::Sync, Some(ty_span)), @@ -1542,7 +1550,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id let cause = traits::ObligationCause::new( sp, wfcx.body_def_id, - traits::ItemObligation(def_id.to_def_id()), + ObligationCauseCode::ItemObligation(def_id.to_def_id()), ); traits::Obligation::new(tcx, cause, wfcx.param_env, pred) }); @@ -1982,7 +1990,11 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> { let obligation = traits::Obligation::new( tcx, - traits::ObligationCause::new(span, self.body_def_id, traits::TrivialBound), + traits::ObligationCause::new( + span, + self.body_def_id, + ObligationCauseCode::TrivialBound, + ), empty_env, pred, ); |
