Skip to content

Commit c23068c

Browse files
authored
Rollup merge of #104094 - lcnr:on_unimplemented-move, r=wesleywiser
fully move `on_unimplemented` to `error_reporting` the `traits` module has a few too many submodules in my opinion.
2 parents 2b9e099 + 80e4e72 commit c23068c

File tree

6 files changed

+404
-411
lines changed

6 files changed

+404
-411
lines changed

compiler/rustc_hir_analysis/src/check/check.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use rustc_session::lint::builtin::{UNINHABITED_STATIC, UNSUPPORTED_CALLING_CONVE
2626
use rustc_span::symbol::sym;
2727
use rustc_span::{self, Span};
2828
use rustc_target::spec::abi::Abi;
29+
use rustc_trait_selection::traits::error_reporting::on_unimplemented::OnUnimplementedDirective;
2930
use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt as _;
3031
use rustc_trait_selection::traits::{self, ObligationCtxt};
3132

@@ -655,7 +656,7 @@ fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) {
655656

656657
pub(super) fn check_on_unimplemented(tcx: TyCtxt<'_>, item: &hir::Item<'_>) {
657658
// an error would be reported if this fails.
658-
let _ = traits::OnUnimplementedDirective::of_item(tcx, item.owner_id.to_def_id());
659+
let _ = OnUnimplementedDirective::of_item(tcx, item.owner_id.to_def_id());
659660
}
660661

661662
pub(super) fn check_specialization_validity<'tcx>(

compiler/rustc_hir_typeck/src/method/suggest.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ use rustc_middle::ty::{IsSuggestable, ToPolyTraitRef};
2323
use rustc_span::symbol::{kw, sym, Ident};
2424
use rustc_span::Symbol;
2525
use rustc_span::{lev_distance, source_map, ExpnKind, FileName, MacroKind, Span};
26+
use rustc_trait_selection::traits::error_reporting::on_unimplemented::OnUnimplementedNote;
2627
use rustc_trait_selection::traits::error_reporting::on_unimplemented::TypeErrCtxtExt as _;
2728
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
2829
use rustc_trait_selection::traits::{
29-
FulfillmentError, Obligation, ObligationCause, ObligationCauseCode, OnUnimplementedNote,
30+
FulfillmentError, Obligation, ObligationCause, ObligationCauseCode,
3031
};
3132

3233
use std::cmp::Ordering;

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ pub mod suggestions;
33

44
use super::{
55
FulfillmentContext, FulfillmentError, FulfillmentErrorCode, MismatchedProjectionTypes,
6-
Obligation, ObligationCause, ObligationCauseCode, OnUnimplementedDirective,
7-
OnUnimplementedNote, OutputTypeParameterMismatch, Overflow, PredicateObligation,
8-
SelectionContext, SelectionError, TraitNotObjectSafe,
6+
Obligation, ObligationCause, ObligationCauseCode, OutputTypeParameterMismatch, Overflow,
7+
PredicateObligation, SelectionContext, SelectionError, TraitNotObjectSafe,
98
};
10-
119
use crate::infer::error_reporting::{TyCategory, TypeAnnotationNeeded as ErrorCode};
1210
use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
1311
use crate::infer::{self, InferCtxt, TyCtxtInferExt};
12+
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
13+
use crate::traits::query::normalize::AtExt as _;
14+
use crate::traits::specialize::to_pretty_impl_header;
15+
use on_unimplemented::OnUnimplementedNote;
16+
use on_unimplemented::TypeErrCtxtExt as _;
1417
use rustc_data_structures::fx::FxHashMap;
1518
use rustc_errors::{
1619
pluralize, struct_span_err, Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed,
@@ -40,11 +43,6 @@ use rustc_span::{ExpnKind, Span, DUMMY_SP};
4043
use std::fmt;
4144
use std::iter;
4245
use std::ops::ControlFlow;
43-
44-
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
45-
use crate::traits::query::normalize::AtExt as _;
46-
use crate::traits::specialize::to_pretty_impl_header;
47-
use on_unimplemented::TypeErrCtxtExt as _;
4846
use suggestions::TypeErrCtxtExt as _;
4947

5048
pub use rustc_infer::traits::error_reporting::*;

0 commit comments

Comments
 (0)