mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-03 09:32:42 +00:00
Rename rustc_trait_selection/src/errors.rs into rustc_trait_selection/src/diagnostics.rs
This commit is contained in:
@@ -12,8 +12,8 @@ use rustc_middle::ty::{
|
||||
Unnormalized,
|
||||
};
|
||||
use rustc_span::Span;
|
||||
use rustc_trait_selection::diagnostics::impl_trait_overcapture_suggestion;
|
||||
use rustc_trait_selection::error_reporting::infer::region::unexpected_hidden_region_diagnostic;
|
||||
use rustc_trait_selection::errors::impl_trait_overcapture_suggestion;
|
||||
|
||||
use crate::MirBorrowckCtxt;
|
||||
use crate::borrow_set::BorrowData;
|
||||
|
||||
@@ -23,7 +23,7 @@ use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::lint::fcw;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_trait_selection::errors::{
|
||||
use rustc_trait_selection::diagnostics::{
|
||||
AddPreciseCapturingForOvercapture, impl_trait_overcapture_suggestion,
|
||||
};
|
||||
use rustc_trait_selection::regions::OutlivesEnvironmentBuildExt;
|
||||
|
||||
@@ -70,11 +70,11 @@ use rustc_middle::ty::{
|
||||
use rustc_span::{BytePos, DUMMY_SP, DesugaringKind, Pos, Span, sym};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use crate::diagnostics::{ObligationCauseFailureCode, TypeErrorAdditionalDiags};
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::error_reporting::traits::ambiguity::{
|
||||
CandidateSource, compute_applicable_impls_for_diagnostics,
|
||||
};
|
||||
use crate::errors::{ObligationCauseFailureCode, TypeErrorAdditionalDiags};
|
||||
use crate::infer;
|
||||
use crate::infer::relate::{self, RelateResult, TypeRelation};
|
||||
use crate::infer::{InferCtxt, InferCtxtExt as _, TypeTrace, ValuePairs};
|
||||
|
||||
@@ -23,11 +23,11 @@ use rustc_span::{BytePos, DUMMY_SP, Ident, Span, sym};
|
||||
use tracing::{debug, instrument, warn};
|
||||
|
||||
use super::nice_region_error::placeholder_error::Highlighted;
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::errors::{
|
||||
use crate::diagnostics::{
|
||||
AmbiguousImpl, AmbiguousReturn, AnnotationRequired, InferenceBadError,
|
||||
SourceKindMultiSuggestion, SourceKindSubdiag,
|
||||
};
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::infer::{InferCtxt, TyOrConstInferVar};
|
||||
|
||||
pub enum TypeAnnotationNeeded {
|
||||
|
||||
@@ -7,10 +7,10 @@ use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_middle::ty::{Region, TyCtxt};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::diagnostics::{AddLifetimeParamsSuggestion, LifetimeMismatch, LifetimeMismatchLabels};
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::error_reporting::infer::nice_region_error::find_anon_type::find_anon_type;
|
||||
use crate::error_reporting::infer::nice_region_error::util::AnonymousParamInfo;
|
||||
use crate::errors::{AddLifetimeParamsSuggestion, LifetimeMismatch, LifetimeMismatchLabels};
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin};
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
|
||||
@@ -9,11 +9,11 @@ use rustc_middle::bug;
|
||||
use rustc_middle::ty::TypeVisitor;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::{
|
||||
use crate::diagnostics::{
|
||||
DoesNotOutliveStaticFromImpl, ImplicitStaticLifetimeSubdiag,
|
||||
IntroducesStaticBecauseUnmetLifetimeReq, MismatchedStaticLifetime, note_and_explain,
|
||||
};
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin, TypeTrace};
|
||||
use crate::traits::ObligationCauseCode;
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ use rustc_errors::Diag;
|
||||
use rustc_middle::ty;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::diagnostics::ExplicitLifetimeRequired;
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::error_reporting::infer::nice_region_error::find_anon_type::find_anon_type;
|
||||
use crate::errors::ExplicitLifetimeRequired;
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
/// When given a `ConcreteFailure` for a function with parameters containing a named region and
|
||||
|
||||
@@ -10,11 +10,11 @@ use rustc_middle::ty::print::{FmtPrinter, Print, PrintTraitRefExt as _, RegionHi
|
||||
use rustc_middle::ty::{self, GenericArgsRef, RePlaceholder, Region, TyCtxt};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::{
|
||||
use crate::diagnostics::{
|
||||
ActualImplExpectedKind, ActualImplExpectedLifetimeKind, ActualImplExplNotes,
|
||||
TraitPlaceholderMismatch, TyOrSig,
|
||||
};
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin, TypeTrace, ValuePairs};
|
||||
use crate::traits::{ObligationCause, ObligationCauseCode};
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ use rustc_errors::Diag;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::{self, RePlaceholder, Region};
|
||||
|
||||
use crate::diagnostics::PlaceholderRelationLfNotSatisfied;
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::PlaceholderRelationLfNotSatisfied;
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin};
|
||||
|
||||
impl<'tcx> NiceRegionError<'_, 'tcx> {
|
||||
|
||||
@@ -13,8 +13,8 @@ use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::{Ident, Span};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::diagnostics::ButNeedsToSatisfy;
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::ButNeedsToSatisfy;
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin};
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
|
||||
@@ -14,9 +14,9 @@ use rustc_middle::ty::{self, TyCtxt, TypeVisitable};
|
||||
use rustc_span::{Ident, Span};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::diagnostics::{ConsiderBorrowingParamHelp, TraitImplDiff};
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlighted;
|
||||
use crate::errors::{ConsiderBorrowingParamHelp, TraitImplDiff};
|
||||
use crate::infer::{RegionResolutionError, ValuePairs};
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
|
||||
@@ -19,12 +19,12 @@ use tracing::{debug, instrument};
|
||||
|
||||
use super::ObligationCauseAsDiagArg;
|
||||
use super::nice_region_error::find_anon_type;
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::error_reporting::infer::ObligationCauseExt;
|
||||
use crate::errors::{
|
||||
use crate::diagnostics::{
|
||||
self, FulfillReqLifetime, LfBoundNotSatisfied, OutlivesBound, OutlivesContent,
|
||||
RefLongerThanData, RegionOriginNote, WhereClauseSuggestions, note_and_explain,
|
||||
};
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::error_reporting::infer::ObligationCauseExt;
|
||||
use crate::infer::region_constraints::GenericKind;
|
||||
use crate::infer::{
|
||||
BoundRegionConversionTime, InferCtxt, RegionResolutionError, RegionVariableOrigin,
|
||||
@@ -1276,7 +1276,7 @@ pub fn unexpected_hidden_region_diagnostic<'a, 'tcx>(
|
||||
opaque_ty_key: ty::OpaqueTypeKey<'tcx>,
|
||||
) -> Diag<'a> {
|
||||
let tcx = infcx.tcx;
|
||||
let mut err = infcx.dcx().create_err(errors::OpaqueCapturesLifetime {
|
||||
let mut err = infcx.dcx().create_err(diagnostics::OpaqueCapturesLifetime {
|
||||
span,
|
||||
opaque_ty: Ty::new_opaque(tcx, opaque_ty_key.def_id.to_def_id(), opaque_ty_key.args),
|
||||
opaque_ty_span: tcx.def_span(opaque_ty_key.def_id),
|
||||
@@ -1389,7 +1389,12 @@ fn suggest_precise_capturing<'tcx>(
|
||||
(span.with_hi(span.hi() - BytePos(1)).shrink_to_hi(), "", "")
|
||||
};
|
||||
|
||||
diag.subdiagnostic(errors::AddPreciseCapturing::Existing { span, new_lifetime, pre, post });
|
||||
diag.subdiagnostic(diagnostics::AddPreciseCapturing::Existing {
|
||||
span,
|
||||
new_lifetime,
|
||||
pre,
|
||||
post,
|
||||
});
|
||||
} else {
|
||||
let mut captured_lifetimes = FxIndexSet::default();
|
||||
let mut captured_non_lifetimes = FxIndexSet::default();
|
||||
@@ -1437,7 +1442,7 @@ fn suggest_precise_capturing<'tcx>(
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
|
||||
diag.subdiagnostic(errors::AddPreciseCapturing::New {
|
||||
diag.subdiagnostic(diagnostics::AddPreciseCapturing::New {
|
||||
span: tcx.def_span(opaque_def_id).shrink_to_hi(),
|
||||
new_lifetime,
|
||||
concatenated_bounds,
|
||||
@@ -1504,7 +1509,7 @@ fn suggest_precise_capturing<'tcx>(
|
||||
format!(" + use<{concatenated_bounds}>"),
|
||||
));
|
||||
|
||||
diag.subdiagnostic(errors::AddPreciseCapturingAndParams {
|
||||
diag.subdiagnostic(diagnostics::AddPreciseCapturingAndParams {
|
||||
suggs,
|
||||
new_lifetime,
|
||||
apit_spans,
|
||||
|
||||
@@ -17,13 +17,13 @@ use rustc_middle::ty::{
|
||||
use rustc_span::{Span, sym};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::error_reporting::infer::hir::Path;
|
||||
use crate::errors::{
|
||||
use crate::diagnostics::{
|
||||
ConsiderAddingAwait, FnConsiderCasting, FnConsiderCastingBoth, FnItemsAreDistinct, FnUniqTypes,
|
||||
FunctionPointerSuggestion, SuggestAccessingField, SuggestRemoveSemiOrReturnBinding,
|
||||
SuggestTuplePatternMany, SuggestTuplePatternOne, TypeErrorAdditionalDiags,
|
||||
};
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::error_reporting::infer::hir::Path;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
enum StatementAsExpression {
|
||||
|
||||
@@ -39,10 +39,12 @@ use tracing::{debug, instrument};
|
||||
|
||||
use super::suggestions::get_explanation_based_on_obligation;
|
||||
use super::{ArgKind, CandidateSimilarity, GetSafeTransmuteErrorAndReason, ImplCandidate};
|
||||
use crate::diagnostics::{
|
||||
ClosureFnMutLabel, ClosureFnOnceLabel, ClosureKindMismatch, CoroClosureNotFn,
|
||||
};
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::error_reporting::infer::TyCategory;
|
||||
use crate::error_reporting::traits::report_dyn_incompatibility;
|
||||
use crate::errors::{ClosureFnMutLabel, ClosureFnOnceLabel, ClosureKindMismatch, CoroClosureNotFn};
|
||||
use crate::infer::{self, InferCtxt, InferCtxtExt as _};
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use crate::traits::{
|
||||
|
||||
@@ -48,8 +48,8 @@ use super::{
|
||||
DefIdOrName, FindExprBySpan, ImplCandidate, Obligation, ObligationCause, ObligationCauseCode,
|
||||
PredicateObligation,
|
||||
};
|
||||
use crate::diagnostics;
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::errors;
|
||||
use crate::infer::InferCtxtExt as _;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use crate::traits::{ImplDerivedCause, NormalizeExt, ObligationCtxt, SelectionContext};
|
||||
@@ -6119,11 +6119,11 @@ fn hint_missing_borrow<'tcx>(
|
||||
}
|
||||
|
||||
if !to_borrow.is_empty() {
|
||||
err.subdiagnostic(errors::AdjustSignatureBorrow::Borrow { to_borrow });
|
||||
err.subdiagnostic(diagnostics::AdjustSignatureBorrow::Borrow { to_borrow });
|
||||
}
|
||||
|
||||
if !remove_borrow.is_empty() {
|
||||
err.subdiagnostic(errors::AdjustSignatureBorrow::RemoveBorrow { remove_borrow });
|
||||
err.subdiagnostic(diagnostics::AdjustSignatureBorrow::RemoveBorrow { remove_borrow });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#![recursion_limit = "512"] // For rustdoc
|
||||
// tidy-alphabetical-end
|
||||
|
||||
pub mod diagnostics;
|
||||
pub mod error_reporting;
|
||||
pub mod errors;
|
||||
pub mod infer;
|
||||
pub mod opaque_types;
|
||||
pub mod regions;
|
||||
|
||||
@@ -9,7 +9,7 @@ use rustc_middle::ty::{
|
||||
};
|
||||
use rustc_span::{ErrorGuaranteed, Span};
|
||||
|
||||
use crate::errors::NonGenericOpaqueTypeParam;
|
||||
use crate::diagnostics::NonGenericOpaqueTypeParam;
|
||||
use crate::regions::OutlivesEnvironmentBuildExt;
|
||||
use crate::traits::ObligationCtxt;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ use rustc_span::DUMMY_SP;
|
||||
use tracing::debug;
|
||||
|
||||
use super::*;
|
||||
use crate::errors::UnableToConstructConstantValue;
|
||||
use crate::diagnostics::UnableToConstructConstantValue;
|
||||
use crate::infer::TypeFreshener;
|
||||
use crate::infer::region_constraints::{ConstraintKind, RegionConstraintData};
|
||||
use crate::regions::OutlivesEnvironmentBuildExt;
|
||||
|
||||
@@ -25,7 +25,7 @@ use super::{
|
||||
PredicateObligation, ProjectionCacheEntry, ProjectionCacheKey, Selection, SelectionContext,
|
||||
SelectionError, specialization_graph, translate_args, util,
|
||||
};
|
||||
use crate::errors::InherentProjectionNormalizationOverflow;
|
||||
use crate::diagnostics::InherentProjectionNormalizationOverflow;
|
||||
use crate::infer::{BoundRegionConversionTime, InferOk};
|
||||
use crate::traits::normalize::{normalize_with_depth, normalize_with_depth_to};
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
|
||||
@@ -28,8 +28,8 @@ use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, sym};
|
||||
use specialization_graph::GraphExt;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use crate::diagnostics::NegativePositiveConflict;
|
||||
use crate::error_reporting::traits::to_pretty_impl_header;
|
||||
use crate::errors::NegativePositiveConflict;
|
||||
use crate::infer::{InferCtxt, TyCtxtInferExt};
|
||||
use crate::traits::select::IntercrateAmbiguityCause;
|
||||
use crate::traits::{
|
||||
|
||||
Reference in New Issue
Block a user