Reformat use
declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
This commit is contained in:
parent
118f9350c5
commit
84ac80f192
1865 changed files with 8367 additions and 9199 deletions
|
@ -60,12 +60,11 @@ use rustc_hir::{self as hir};
|
|||
use rustc_macros::extension;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::dep_graph::DepContext;
|
||||
use rustc_middle::ty::error::ExpectedFound;
|
||||
use rustc_middle::ty::error::TypeErrorToStringExt;
|
||||
use rustc_middle::ty::error::{ExpectedFound, TypeError, TypeErrorToStringExt};
|
||||
use rustc_middle::ty::print::{with_forced_trimmed_paths, PrintError, PrintTraitRefExt as _};
|
||||
use rustc_middle::ty::{
|
||||
self, error::TypeError, List, Region, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable,
|
||||
TypeVisitable, TypeVisitableExt,
|
||||
self, List, Region, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeVisitable,
|
||||
TypeVisitableExt,
|
||||
};
|
||||
use rustc_span::{sym, BytePos, DesugaringKind, Pos, Span};
|
||||
use rustc_target::spec::abi;
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::errors::{
|
||||
AmbiguousImpl, AmbiguousReturn, AnnotationRequired, InferenceBadError,
|
||||
SourceKindMultiSuggestion, SourceKindSubdiag,
|
||||
};
|
||||
use crate::infer::InferCtxt;
|
||||
use rustc_errors::{codes::*, Diag, IntoDiagArg};
|
||||
use std::borrow::Cow;
|
||||
use std::iter;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{Diag, IntoDiagArg};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::def::{CtorOf, DefKind, Namespace};
|
||||
use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::{Body, Closure, Expr, ExprKind, FnRetTy, HirId, LetStmt, LocalSource};
|
||||
|
@ -21,9 +19,13 @@ use rustc_middle::ty::{
|
|||
};
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
use rustc_span::{BytePos, Span, DUMMY_SP};
|
||||
use std::borrow::Cow;
|
||||
use std::iter;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::errors::{
|
||||
AmbiguousImpl, AmbiguousReturn, AnnotationRequired, InferenceBadError,
|
||||
SourceKindMultiSuggestion, SourceKindSubdiag,
|
||||
};
|
||||
use crate::infer::InferCtxt;
|
||||
|
||||
pub enum TypeAnnotationNeeded {
|
||||
/// ```compile_fail,E0282
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
//! Error Reporting for Anonymous Region Lifetime Errors
|
||||
//! where both the regions are anonymous.
|
||||
|
||||
use rustc_errors::{Diag, ErrorGuaranteed, Subdiagnostic};
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::Ty;
|
||||
use rustc_middle::ty::{Region, TyCtxt};
|
||||
|
||||
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::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::AddLifetimeParamsSuggestion;
|
||||
use crate::errors::LifetimeMismatch;
|
||||
use crate::errors::LifetimeMismatchLabels;
|
||||
use crate::infer::RegionResolutionError;
|
||||
use crate::infer::SubregionOrigin;
|
||||
|
||||
use rustc_errors::Subdiagnostic;
|
||||
use rustc_errors::{Diag, ErrorGuaranteed};
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::Ty;
|
||||
use rustc_middle::ty::{Region, TyCtxt};
|
||||
use crate::errors::{AddLifetimeParamsSuggestion, LifetimeMismatch, LifetimeMismatchLabels};
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin};
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
/// Print the error message for lifetime errors when both the concerned regions are anonymous.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use core::ops::ControlFlow;
|
||||
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
//! Error Reporting for when the lifetime for a type doesn't match the `impl` selected for a predicate
|
||||
//! to hold.
|
||||
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::{note_and_explain, IntroducesStaticBecauseUnmetLifetimeReq};
|
||||
use crate::errors::{
|
||||
DoesNotOutliveStaticFromImpl, ImplicitStaticLifetimeSubdiag, MismatchedStaticLifetime,
|
||||
};
|
||||
use crate::infer::RegionResolutionError;
|
||||
use crate::infer::{SubregionOrigin, TypeTrace};
|
||||
use crate::traits::ObligationCauseCode;
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::{ErrorGuaranteed, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
|
@ -16,6 +8,14 @@ use rustc_hir::intravisit::Visitor;
|
|||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::TypeVisitor;
|
||||
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::{
|
||||
note_and_explain, DoesNotOutliveStaticFromImpl, ImplicitStaticLifetimeSubdiag,
|
||||
IntroducesStaticBecauseUnmetLifetimeReq, MismatchedStaticLifetime,
|
||||
};
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin, TypeTrace};
|
||||
use crate::traits::ObligationCauseCode;
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
pub(super) fn try_report_mismatched_static_lifetime(&self) -> Option<ErrorGuaranteed> {
|
||||
let error = self.error.as_ref()?;
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::infer::RegionResolutionError;
|
||||
use crate::infer::RegionResolutionError::*;
|
||||
use rustc_errors::{Diag, ErrorGuaranteed};
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::infer::RegionResolutionError;
|
||||
use crate::infer::RegionResolutionError::*;
|
||||
|
||||
mod different_lifetimes;
|
||||
pub mod find_anon_type;
|
||||
mod mismatched_static_lifetime;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
//! Error Reporting for Anonymous Region Lifetime Errors
|
||||
//! where one region is named and the other is anonymous.
|
||||
|
||||
use rustc_errors::Diag;
|
||||
use rustc_middle::ty;
|
||||
use rustc_span::symbol::kw;
|
||||
|
||||
use crate::error_reporting::infer::nice_region_error::find_anon_type::find_anon_type;
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::ExplicitLifetimeRequired;
|
||||
use rustc_errors::Diag;
|
||||
use rustc_middle::ty;
|
||||
use rustc_span::symbol::kw;
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
/// When given a `ConcreteFailure` for a function with parameters containing a named region and
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::{
|
||||
ActualImplExpectedKind, ActualImplExpectedLifetimeKind, ActualImplExplNotes,
|
||||
TraitPlaceholderMismatch, TyOrSig,
|
||||
};
|
||||
use crate::infer::RegionResolutionError;
|
||||
use crate::infer::ValuePairs;
|
||||
use crate::infer::{SubregionOrigin, TypeTrace};
|
||||
use crate::traits::{ObligationCause, ObligationCauseCode};
|
||||
use std::fmt;
|
||||
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_errors::{Diag, IntoDiagArg};
|
||||
use rustc_hir::def::Namespace;
|
||||
|
@ -14,10 +7,15 @@ use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
|
|||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::error::ExpectedFound;
|
||||
use rustc_middle::ty::print::{FmtPrinter, Print, PrintTraitRefExt as _, RegionHighlightMode};
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
use rustc_middle::ty::{self, RePlaceholder, Region, TyCtxt};
|
||||
use rustc_middle::ty::{self, GenericArgsRef, RePlaceholder, Region, TyCtxt};
|
||||
|
||||
use std::fmt;
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::{
|
||||
ActualImplExpectedKind, ActualImplExpectedLifetimeKind, ActualImplExplNotes,
|
||||
TraitPlaceholderMismatch, TyOrSig,
|
||||
};
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin, TypeTrace, ValuePairs};
|
||||
use crate::traits::{ObligationCause, ObligationCauseCode};
|
||||
|
||||
// HACK(eddyb) maybe move this in a more central location.
|
||||
#[derive(Copy, Clone)]
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::PlaceholderRelationLfNotSatisfied;
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin};
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_errors::Diag;
|
||||
use rustc_middle::ty::{self, RePlaceholder, Region};
|
||||
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::PlaceholderRelationLfNotSatisfied;
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin};
|
||||
|
||||
impl<'tcx> NiceRegionError<'_, 'tcx> {
|
||||
/// Emitted wwhen given a `ConcreteFailure` when relating two placeholders.
|
||||
pub(super) fn try_report_placeholder_relation(&self) -> Option<Diag<'tcx>> {
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
//! Error Reporting for static impl Traits.
|
||||
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::{
|
||||
ButCallingIntroduces, ButNeedsToSatisfy, DynTraitConstraintSuggestion, MoreTargeted,
|
||||
ReqIntroducedLocations,
|
||||
};
|
||||
use crate::infer::RegionResolutionError;
|
||||
use crate::infer::{SubregionOrigin, TypeTrace};
|
||||
use crate::traits::{ObligationCauseCode, UnifyReceiverContext};
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, Subdiagnostic};
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
@ -19,10 +11,17 @@ use rustc_hir::{
|
|||
use rustc_middle::ty::{
|
||||
self, AssocItemContainer, StaticLifetimeVisitor, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor,
|
||||
};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::Span;
|
||||
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::{
|
||||
ButCallingIntroduces, ButNeedsToSatisfy, DynTraitConstraintSuggestion, MoreTargeted,
|
||||
ReqIntroducedLocations,
|
||||
};
|
||||
use crate::infer::{RegionResolutionError, SubregionOrigin, TypeTrace};
|
||||
use crate::traits::{ObligationCauseCode, UnifyReceiverContext};
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
/// Print the error message for lifetime errors when the return type is a static `impl Trait`,
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
//! Error Reporting for `impl` items that do not match the obligations from their `trait`.
|
||||
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::{ConsiderBorrowingParamHelp, RelationshipHelp, TraitImplDiff};
|
||||
use crate::infer::RegionResolutionError;
|
||||
use crate::infer::{Subtype, ValuePairs};
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::Res;
|
||||
|
@ -16,6 +12,10 @@ use rustc_middle::ty::print::RegionHighlightMode;
|
|||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitor};
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::error_reporting::infer::nice_region_error::NiceRegionError;
|
||||
use crate::errors::{ConsiderBorrowingParamHelp, RelationshipHelp, TraitImplDiff};
|
||||
use crate::infer::{RegionResolutionError, Subtype, ValuePairs};
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
/// Print the error message for lifetime errors when the `impl` doesn't conform to the `trait`.
|
||||
pub(super) fn try_report_impl_not_conforming_to_trait(&self) -> Option<ErrorGuaranteed> {
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
use crate::error_reporting::infer::{note_and_explain_region, TypeErrCtxt};
|
||||
use crate::errors::{
|
||||
note_and_explain, FulfillReqLifetime, LfBoundNotSatisfied, OutlivesBound, OutlivesContent,
|
||||
RefLongerThanData, RegionOriginNote, WhereClauseSuggestions,
|
||||
};
|
||||
use crate::fluent_generated as fluent;
|
||||
use crate::infer::{self, SubregionOrigin};
|
||||
use rustc_errors::{Diag, Subdiagnostic};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::traits::ObligationCauseCode;
|
||||
|
@ -13,6 +6,13 @@ use rustc_middle::ty::{self, IsSuggestable, Region, Ty};
|
|||
use rustc_span::symbol::kw;
|
||||
|
||||
use super::ObligationCauseAsDiagArg;
|
||||
use crate::error_reporting::infer::{note_and_explain_region, TypeErrCtxt};
|
||||
use crate::errors::{
|
||||
note_and_explain, FulfillReqLifetime, LfBoundNotSatisfied, OutlivesBound, OutlivesContent,
|
||||
RefLongerThanData, RegionOriginNote, WhereClauseSuggestions,
|
||||
};
|
||||
use crate::fluent_generated as fluent;
|
||||
use crate::infer::{self, SubregionOrigin};
|
||||
|
||||
impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
pub(super) fn note_region_origin(&self, err: &mut Diag<'_>, origin: &SubregionOrigin<'tcx>) {
|
||||
|
|
|
@ -2,14 +2,12 @@ use rustc_errors::Applicability::{MachineApplicable, MaybeIncorrect};
|
|||
use rustc_errors::{pluralize, Diag, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_middle::traits::ObligationCauseCode;
|
||||
use rustc_middle::ty::error::ExpectedFound;
|
||||
use rustc_middle::ty::print::Printer;
|
||||
use rustc_middle::{
|
||||
traits::ObligationCause,
|
||||
ty::{self, error::TypeError, print::FmtPrinter, suggest_constraining_type_param, Ty},
|
||||
};
|
||||
use rustc_span::{def_id::DefId, sym, BytePos, Span, Symbol};
|
||||
use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
|
||||
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
||||
use rustc_middle::ty::print::{FmtPrinter, Printer};
|
||||
use rustc_middle::ty::{self, suggest_constraining_type_param, Ty};
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::{sym, BytePos, Span, Symbol};
|
||||
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::infer::InferCtxtExt;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::error_reporting::infer::hir::Path;
|
||||
use core::ops::ControlFlow;
|
||||
|
||||
use hir::def::CtorKind;
|
||||
use hir::intravisit::{walk_expr, walk_stmt, Visitor};
|
||||
use hir::{LetStmt, QPath};
|
||||
|
@ -7,8 +7,7 @@ use rustc_data_structures::fx::FxIndexSet;
|
|||
use rustc_errors::{Applicability, Diag};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::Res;
|
||||
use rustc_hir::MatchSource;
|
||||
use rustc_hir::Node;
|
||||
use rustc_hir::{MatchSource, Node};
|
||||
use rustc_middle::traits::{
|
||||
IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
|
||||
StatementAsExpression,
|
||||
|
@ -17,6 +16,7 @@ use rustc_middle::ty::print::with_no_trimmed_paths;
|
|||
use rustc_middle::ty::{self as ty, GenericArgKind, IsSuggestable, Ty, TypeVisitableExt};
|
||||
use rustc_span::{sym, Span};
|
||||
|
||||
use crate::error_reporting::infer::hir::Path;
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::errors::{
|
||||
ConsiderAddingAwait, FnConsiderCasting, FnItemsAreDistinct, FnUniqTypes,
|
||||
|
|
|
@ -1,31 +1,16 @@
|
|||
use super::on_unimplemented::{AppendConstMessage, OnUnimplementedNote};
|
||||
use super::suggestions::get_explanation_based_on_obligation;
|
||||
use crate::error_reporting::infer::TyCategory;
|
||||
use crate::error_reporting::traits::report_object_safety_error;
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::errors::{
|
||||
AsyncClosureNotFn, ClosureFnMutLabel, ClosureFnOnceLabel, ClosureKindMismatch,
|
||||
};
|
||||
use crate::infer::InferCtxtExt as _;
|
||||
use crate::infer::{self, InferCtxt};
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use crate::traits::NormalizeExt;
|
||||
use crate::traits::{
|
||||
elaborate, MismatchedProjectionTypes, Obligation, ObligationCause, ObligationCauseCode,
|
||||
ObligationCtxt, Overflow, PredicateObligation, SelectionError, SignatureMismatch,
|
||||
TraitNotObjectSafe,
|
||||
};
|
||||
use core::ops::ControlFlow;
|
||||
use std::borrow::Cow;
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{pluralize, struct_span_code_err, Applicability, StringPart};
|
||||
use rustc_errors::{Diag, ErrorGuaranteed, StashKey};
|
||||
use rustc_errors::{
|
||||
pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, StashKey, StringPart,
|
||||
};
|
||||
use rustc_hir::def::Namespace;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_hir::Node;
|
||||
use rustc_hir::{self as hir, LangItem};
|
||||
use rustc_hir::{self as hir, LangItem, Node};
|
||||
use rustc_infer::infer::{InferOk, TypeTrace};
|
||||
use rustc_middle::traits::select::OverflowError;
|
||||
use rustc_middle::traits::SignatureMismatchData;
|
||||
|
@ -42,11 +27,25 @@ use rustc_middle::ty::{
|
|||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{BytePos, Span, Symbol, DUMMY_SP};
|
||||
use std::borrow::Cow;
|
||||
|
||||
use super::on_unimplemented::{AppendConstMessage, OnUnimplementedNote};
|
||||
use super::suggestions::get_explanation_based_on_obligation;
|
||||
use super::{
|
||||
ArgKind, CandidateSimilarity, GetSafeTransmuteErrorAndReason, ImplCandidate, UnsatisfiedConst,
|
||||
};
|
||||
use crate::error_reporting::infer::TyCategory;
|
||||
use crate::error_reporting::traits::report_object_safety_error;
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::errors::{
|
||||
AsyncClosureNotFn, ClosureFnMutLabel, ClosureFnOnceLabel, ClosureKindMismatch,
|
||||
};
|
||||
use crate::infer::{self, InferCtxt, InferCtxtExt as _};
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use crate::traits::{
|
||||
elaborate, MismatchedProjectionTypes, NormalizeExt, Obligation, ObligationCause,
|
||||
ObligationCauseCode, ObligationCtxt, Overflow, PredicateObligation, SelectionError,
|
||||
SignatureMismatch, TraitNotObjectSafe,
|
||||
};
|
||||
|
||||
impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
/// The `root_obligation` parameter should be the `root_obligation` field
|
||||
|
|
|
@ -19,11 +19,10 @@ use rustc_middle::ty::print::{with_no_trimmed_paths, PrintTraitRefExt as _};
|
|||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_span::{ErrorGuaranteed, ExpnKind, Span};
|
||||
|
||||
pub use self::overflow::*;
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::traits::{FulfillmentError, FulfillmentErrorCode};
|
||||
|
||||
pub use self::overflow::*;
|
||||
|
||||
// When outputting impl candidates, prefer showing those that are more similar.
|
||||
//
|
||||
// We also compare candidates after skipping lifetimes, which has a lower
|
||||
|
|
|
@ -1,29 +1,27 @@
|
|||
use std::iter;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use rustc_ast::{AttrArgs, AttrArgsEq, AttrKind, Attribute, MetaItem, NestedMetaItem};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{struct_span_code_err, ErrorGuaranteed};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_macros::LintDiagnostic;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::print::PrintTraitRefExt as _;
|
||||
use rustc_middle::ty::{self, GenericArgsRef, GenericParamDefKind, TyCtxt};
|
||||
use rustc_parse_format::{ParseMode, Parser, Piece, Position};
|
||||
use rustc_session::lint::builtin::UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
use {rustc_attr as attr, rustc_hir as hir};
|
||||
|
||||
use super::{ObligationCauseCode, PredicateObligation};
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::errors::{
|
||||
EmptyOnClauseInOnUnimplemented, InvalidOnClauseInOnUnimplemented, NoValueInOnUnimplemented,
|
||||
};
|
||||
use crate::infer::InferCtxtExt;
|
||||
use rustc_ast::AttrArgs;
|
||||
use rustc_ast::AttrArgsEq;
|
||||
use rustc_ast::AttrKind;
|
||||
use rustc_ast::{Attribute, MetaItem, NestedMetaItem};
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_macros::LintDiagnostic;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::print::PrintTraitRefExt as _;
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
use rustc_middle::ty::{self, GenericParamDefKind, TyCtxt};
|
||||
use rustc_parse_format::{ParseMode, Parser, Piece, Position};
|
||||
use rustc_session::lint::builtin::UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES;
|
||||
use rustc_span::symbol::{kw, sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
use std::iter;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// The symbols which are always allowed in a format string
|
||||
static ALLOWED_FORMAT_SYMBOLS: &[Symbol] = &[
|
||||
|
|
|
@ -1,34 +1,33 @@
|
|||
// ignore-tidy-filelength
|
||||
|
||||
use super::{
|
||||
DefIdOrName, FindExprBySpan, ImplCandidate, Obligation, ObligationCause, ObligationCauseCode,
|
||||
PredicateObligation,
|
||||
};
|
||||
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::errors;
|
||||
use crate::traits::{ImplDerivedCause, NormalizeExt, ObligationCtxt};
|
||||
use std::assert_matches::debug_assert_matches;
|
||||
use std::borrow::Cow;
|
||||
use std::iter;
|
||||
|
||||
use itertools::{EitherOrBoth, Itertools};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{
|
||||
codes::*, pluralize, struct_span_code_err, Applicability, Diag, EmissionGuarantee, MultiSpan,
|
||||
Style, SuggestionStyle,
|
||||
pluralize, struct_span_code_err, Applicability, Diag, EmissionGuarantee, MultiSpan, Style,
|
||||
SuggestionStyle,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::CtorOf;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def::{CtorOf, DefKind, Res};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_hir::is_range_literal;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_hir::{CoroutineDesugaring, CoroutineKind, CoroutineSource, Expr, HirId, Node};
|
||||
use rustc_infer::infer::InferCtxt;
|
||||
use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferOk};
|
||||
use rustc_hir::{
|
||||
is_range_literal, CoroutineDesugaring, CoroutineKind, CoroutineSource, Expr, HirId, Node,
|
||||
};
|
||||
use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferCtxt, InferOk};
|
||||
use rustc_middle::hir::map;
|
||||
use rustc_middle::traits::IsConstable;
|
||||
use rustc_middle::ty::error::TypeError;
|
||||
use rustc_middle::ty::print::PrintPolyTraitRefExt;
|
||||
use rustc_middle::ty::print::{
|
||||
with_forced_trimmed_paths, with_no_trimmed_paths, PrintPolyTraitPredicateExt as _,
|
||||
PrintPolyTraitRefExt, PrintTraitPredicateExt as _,
|
||||
};
|
||||
use rustc_middle::ty::{
|
||||
self, suggest_arbitrary_trait_bound, suggest_constraining_type_param, AdtKind, GenericArgs,
|
||||
InferTy, IsSuggestable, ToPolyTraitRef, Ty, TyCtxt, TypeFoldable, TypeFolder,
|
||||
|
@ -39,19 +38,16 @@ use rustc_span::def_id::LocalDefId;
|
|||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{BytePos, DesugaringKind, ExpnKind, MacroKind, Span, DUMMY_SP};
|
||||
use rustc_target::spec::abi;
|
||||
use std::assert_matches::debug_assert_matches;
|
||||
use std::borrow::Cow;
|
||||
use std::iter;
|
||||
|
||||
use super::{
|
||||
DefIdOrName, FindExprBySpan, ImplCandidate, Obligation, ObligationCause, ObligationCauseCode,
|
||||
PredicateObligation,
|
||||
};
|
||||
use crate::error_reporting::TypeErrCtxt;
|
||||
use crate::errors;
|
||||
use crate::infer::InferCtxtExt as _;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use rustc_middle::ty::print::{
|
||||
with_forced_trimmed_paths, with_no_trimmed_paths, PrintPolyTraitPredicateExt as _,
|
||||
PrintTraitPredicateExt as _,
|
||||
};
|
||||
|
||||
use itertools::EitherOrBoth;
|
||||
use itertools::Itertools;
|
||||
use crate::traits::{ImplDerivedCause, NormalizeExt, ObligationCtxt};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum CoroutineInteriorOrUpvar {
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{
|
||||
codes::*, Applicability, Diag, DiagCtxtHandle, DiagMessage, DiagStyledString, Diagnostic,
|
||||
Applicability, Diag, DiagCtxtHandle, DiagMessage, DiagStyledString, Diagnostic,
|
||||
EmissionGuarantee, IntoDiagArg, Level, MultiSpan, SubdiagMessageOp, Subdiagnostic,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::intravisit::{walk_ty, Visitor};
|
||||
use rustc_hir::FnRetTy;
|
||||
use rustc_hir::GenericParamKind;
|
||||
use rustc_hir::{FnRetTy, GenericParamKind};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::print::TraitRefPrintOnlyTraitPath;
|
||||
use rustc_middle::ty::{
|
||||
self, print::PrintTraitRefExt as _, Binder, ClosureKind, FnSig, PolyTraitRef, Region, Ty,
|
||||
TyCtxt,
|
||||
};
|
||||
use rustc_middle::ty::print::{PrintTraitRefExt as _, TraitRefPrintOnlyTraitPath};
|
||||
use rustc_middle::ty::{self, Binder, ClosureKind, FnSig, PolyTraitRef, Region, Ty, TyCtxt};
|
||||
use rustc_span::symbol::{kw, Ident, Symbol};
|
||||
use rustc_span::{BytePos, Span};
|
||||
|
||||
|
@ -22,8 +21,6 @@ use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlig
|
|||
use crate::error_reporting::infer::ObligationCauseAsDiagArg;
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub mod note_and_explain;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
use crate::error_reporting::infer::nice_region_error::find_anon_type;
|
||||
use crate::fluent_generated as fluent;
|
||||
use rustc_errors::{Diag, EmissionGuarantee, IntoDiagArg, SubdiagMessageOp, Subdiagnostic};
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_span::{symbol::kw, Span};
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::error_reporting::infer::nice_region_error::find_anon_type;
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
struct DescriptionCtx<'a> {
|
||||
span: Option<Span>,
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
use crate::infer::at::ToTrace;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use crate::traits::{self, Obligation, ObligationCause, ObligationCtxt, SelectionContext};
|
||||
use std::fmt::Debug;
|
||||
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
pub use rustc_infer::infer::*;
|
||||
use rustc_macros::extension;
|
||||
use rustc_middle::arena::ArenaAllocatable;
|
||||
use rustc_middle::infer::canonical::{Canonical, CanonicalQueryResponse, QueryResponse};
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
|
||||
use rustc_middle::ty::{GenericArg, Upcast};
|
||||
use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, Upcast};
|
||||
use rustc_span::DUMMY_SP;
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
pub use rustc_infer::infer::*;
|
||||
use crate::infer::at::ToTrace;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use crate::traits::{self, Obligation, ObligationCause, ObligationCtxt, SelectionContext};
|
||||
|
||||
#[extension(pub trait InferCtxtExt<'tcx>)]
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
use crate::traits::ScrubbedTraitError;
|
||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
||||
use rustc_infer::infer::{InferCtxt, RegionResolutionError};
|
||||
use rustc_macros::extension;
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::traits::ObligationCause;
|
||||
|
||||
use crate::traits::ScrubbedTraitError;
|
||||
|
||||
#[extension(pub trait InferCtxtRegionExt<'tcx>)]
|
||||
impl<'tcx> InferCtxt<'tcx> {
|
||||
/// Resolve regions, using the deep normalizer to normalize any type-outlives
|
||||
|
|
|
@ -15,11 +15,10 @@ use rustc_middle::ty::{self, TyCtxt};
|
|||
use rustc_next_trait_solver::solve::{GenerateProofTree, SolverDelegateEvalExt as _};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
use crate::traits::{FulfillmentError, FulfillmentErrorCode, ScrubbedTraitError};
|
||||
|
||||
use super::delegate::SolverDelegate;
|
||||
use super::inspect::{self, ProofTreeInferCtxtExt, ProofTreeVisitor};
|
||||
use super::Certainty;
|
||||
use crate::traits::{FulfillmentError, FulfillmentErrorCode, ScrubbedTraitError};
|
||||
|
||||
/// A trait engine using the new trait solver.
|
||||
///
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
use std::fmt::Debug;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::error_reporting::traits::OverflowCause;
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt;
|
||||
use crate::traits::{BoundVarReplacer, PlaceholderReplacer, ScrubbedTraitError};
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_infer::infer::at::At;
|
||||
use rustc_infer::infer::InferCtxt;
|
||||
use rustc_infer::traits::{FromSolverError, Obligation, TraitEngine};
|
||||
use rustc_middle::traits::ObligationCause;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, UniverseIndex};
|
||||
use rustc_middle::ty::{FallibleTypeFolder, TypeFolder, TypeSuperFoldable};
|
||||
use rustc_middle::ty::{TypeFoldable, TypeVisitableExt};
|
||||
use rustc_middle::ty::{
|
||||
self, FallibleTypeFolder, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
|
||||
TypeVisitableExt, UniverseIndex,
|
||||
};
|
||||
|
||||
use super::{FulfillmentCtxt, NextSolverError};
|
||||
use crate::error_reporting::traits::OverflowCause;
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt;
|
||||
use crate::traits::{BoundVarReplacer, PlaceholderReplacer, ScrubbedTraitError};
|
||||
|
||||
/// Deeply normalize all aliases in `value`. This does not handle inference and expects
|
||||
/// its input to be already fully resolved.
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
//! Support code for rustdoc and external tools.
|
||||
//! You really don't want to be using this unless you need to.
|
||||
|
||||
use super::*;
|
||||
|
||||
use crate::errors::UnableToConstructConstantValue;
|
||||
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
|
||||
use crate::traits::project::ProjectAndUnifyResult;
|
||||
use std::collections::VecDeque;
|
||||
use std::iter;
|
||||
|
||||
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet, IndexEntry};
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
|
@ -13,8 +10,10 @@ use rustc_infer::infer::DefineOpaqueTypes;
|
|||
use rustc_middle::mir::interpret::ErrorHandled;
|
||||
use rustc_middle::ty::{Region, RegionVid};
|
||||
|
||||
use std::collections::VecDeque;
|
||||
use std::iter;
|
||||
use super::*;
|
||||
use crate::errors::UnableToConstructConstantValue;
|
||||
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
|
||||
use crate::traits::project::ProjectAndUnifyResult;
|
||||
|
||||
// FIXME(twk): this is obviously not nice to duplicate like that
|
||||
#[derive(Eq, PartialEq, Hash, Copy, Clone, Debug)]
|
||||
|
|
|
@ -4,15 +4,8 @@
|
|||
//! [trait-resolution]: https://rustc-dev-guide.rust-lang.org/traits/resolution.html
|
||||
//! [trait-specialization]: https://rustc-dev-guide.rust-lang.org/traits/specialization.html
|
||||
|
||||
use crate::infer::outlives::env::OutlivesEnvironment;
|
||||
use crate::infer::InferOk;
|
||||
use crate::solve::inspect::{InspectGoal, ProofTreeInferCtxtExt, ProofTreeVisitor};
|
||||
use crate::solve::{deeply_normalize_for_diagnostics, inspect};
|
||||
use crate::traits::select::IntercrateAmbiguityCause;
|
||||
use crate::traits::NormalizeExt;
|
||||
use crate::traits::SkipLeakCheck;
|
||||
use crate::traits::{util, FulfillmentErrorCode};
|
||||
use crate::traits::{Obligation, ObligationCause, PredicateObligation, SelectionContext};
|
||||
use std::fmt::Debug;
|
||||
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::{Diag, EmissionGuarantee};
|
||||
use rustc_hir::def::DefKind;
|
||||
|
@ -28,10 +21,18 @@ use rustc_middle::ty::{self, Ty, TyCtxt};
|
|||
pub use rustc_next_trait_solver::coherence::*;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use std::fmt::Debug;
|
||||
|
||||
use super::ObligationCtxt;
|
||||
use crate::error_reporting::traits::suggest_new_overflow_limit;
|
||||
use crate::infer::outlives::env::OutlivesEnvironment;
|
||||
use crate::infer::InferOk;
|
||||
use crate::solve::inspect::{InspectGoal, ProofTreeInferCtxtExt, ProofTreeVisitor};
|
||||
use crate::solve::{deeply_normalize_for_diagnostics, inspect};
|
||||
use crate::traits::select::IntercrateAmbiguityCause;
|
||||
use crate::traits::{
|
||||
util, FulfillmentErrorCode, NormalizeExt, Obligation, ObligationCause, PredicateObligation,
|
||||
SelectionContext, SkipLeakCheck,
|
||||
};
|
||||
|
||||
pub struct OverlapResult<'tcx> {
|
||||
pub impl_header: ty::ImplHeader<'tcx>,
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
use std::cell::RefCell;
|
||||
use std::fmt::Debug;
|
||||
|
||||
use super::{FromSolverError, TraitEngine};
|
||||
use super::{FulfillmentContext, ScrubbedTraitError};
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::regions::InferCtxtRegionExt;
|
||||
use crate::solve::FulfillmentCtxt as NextFulfillmentCtxt;
|
||||
use crate::solve::NextSolverError;
|
||||
use crate::traits::fulfill::OldSolverError;
|
||||
use crate::traits::NormalizeExt;
|
||||
use crate::traits::StructurallyNormalizeExt;
|
||||
use crate::traits::{FulfillmentError, Obligation, ObligationCause, PredicateObligation};
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
|
@ -19,16 +9,22 @@ use rustc_infer::infer::canonical::{
|
|||
Canonical, CanonicalQueryResponse, CanonicalVarValues, QueryResponse,
|
||||
};
|
||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
||||
use rustc_infer::infer::RegionResolutionError;
|
||||
use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, InferOk};
|
||||
use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, InferOk, RegionResolutionError};
|
||||
use rustc_macros::extension;
|
||||
use rustc_middle::arena::ArenaAllocatable;
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::ty::error::TypeError;
|
||||
use rustc_middle::ty::TypeFoldable;
|
||||
use rustc_middle::ty::Upcast;
|
||||
use rustc_middle::ty::Variance;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, Upcast, Variance};
|
||||
|
||||
use super::{FromSolverError, FulfillmentContext, ScrubbedTraitError, TraitEngine};
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::regions::InferCtxtRegionExt;
|
||||
use crate::solve::{FulfillmentCtxt as NextFulfillmentCtxt, NextSolverError};
|
||||
use crate::traits::fulfill::OldSolverError;
|
||||
use crate::traits::{
|
||||
FulfillmentError, NormalizeExt, Obligation, ObligationCause, PredicateObligation,
|
||||
StructurallyNormalizeExt,
|
||||
};
|
||||
|
||||
#[extension(pub trait TraitEngineExt<'tcx, E>)]
|
||||
impl<'tcx, E> dyn TraitEngine<'tcx, E>
|
||||
|
|
|
@ -1,32 +1,29 @@
|
|||
use crate::infer::{InferCtxt, TyOrConstInferVar};
|
||||
use crate::traits::normalize::normalize_with_depth_to;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::obligation_forest::ProcessResult;
|
||||
use rustc_data_structures::obligation_forest::{Error, ForestObligation, Outcome};
|
||||
use rustc_data_structures::obligation_forest::{ObligationForest, ObligationProcessor};
|
||||
use rustc_data_structures::obligation_forest::{
|
||||
Error, ForestObligation, ObligationForest, ObligationProcessor, Outcome, ProcessResult,
|
||||
};
|
||||
use rustc_infer::infer::DefineOpaqueTypes;
|
||||
use rustc_infer::traits::{FromSolverError, ProjectionCacheKey};
|
||||
use rustc_infer::traits::{PolyTraitObligation, SelectionError, TraitEngine};
|
||||
use rustc_infer::traits::{
|
||||
FromSolverError, PolyTraitObligation, ProjectionCacheKey, SelectionError, TraitEngine,
|
||||
};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::mir::interpret::ErrorHandled;
|
||||
use rustc_middle::ty::abstract_const::NotConstEvaluatable;
|
||||
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
use rustc_middle::ty::{self, Binder, Const, TypeVisitableExt};
|
||||
use std::marker::PhantomData;
|
||||
use rustc_middle::ty::{self, Binder, Const, GenericArgsRef, TypeVisitableExt};
|
||||
|
||||
use super::project::{self, ProjectAndUnifyResult};
|
||||
use super::select::SelectionContext;
|
||||
use super::wf;
|
||||
use super::EvaluationResult;
|
||||
use super::PredicateObligation;
|
||||
use super::Unimplemented;
|
||||
use super::{const_evaluatable, ScrubbedTraitError};
|
||||
use super::{FulfillmentError, FulfillmentErrorCode};
|
||||
|
||||
use super::{
|
||||
const_evaluatable, wf, EvaluationResult, FulfillmentError, FulfillmentErrorCode,
|
||||
PredicateObligation, ScrubbedTraitError, Unimplemented,
|
||||
};
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::traits::project::PolyProjectionObligation;
|
||||
use crate::traits::project::ProjectionCacheKeyExt as _;
|
||||
use crate::infer::{InferCtxt, TyOrConstInferVar};
|
||||
use crate::traits::normalize::normalize_with_depth_to;
|
||||
use crate::traits::project::{PolyProjectionObligation, ProjectionCacheKeyExt as _};
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt;
|
||||
|
||||
impl<'tcx> ForestObligation for PendingPredicateObligation<'tcx> {
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
//! Miscellaneous type-system utilities that are too small to deserve their own modules.
|
||||
|
||||
use crate::regions::InferCtxtRegionExt;
|
||||
use crate::traits::{self, FulfillmentError, ObligationCause};
|
||||
|
||||
use hir::LangItem;
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
|
@ -12,6 +9,8 @@ use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt};
|
|||
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt, TypeVisitableExt};
|
||||
|
||||
use super::outlives_bounds::InferCtxtExt;
|
||||
use crate::regions::InferCtxtRegionExt;
|
||||
use crate::traits::{self, FulfillmentError, ObligationCause};
|
||||
|
||||
pub enum CopyImplementationError<'tcx> {
|
||||
InfringingFields(Vec<(&'tcx ty::FieldDef, Ty<'tcx>, InfringingFieldsReason<'tcx>)>),
|
||||
|
|
|
@ -22,51 +22,55 @@ mod util;
|
|||
pub mod vtable;
|
||||
pub mod wf;
|
||||
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::infer::outlives::env::OutlivesEnvironment;
|
||||
use crate::infer::{InferCtxt, TyCtxtInferExt};
|
||||
use crate::regions::InferCtxtRegionExt;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use std::fmt::Debug;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
pub use rustc_infer::traits::*;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
||||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::visit::{TypeVisitable, TypeVisitableExt};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFolder, TypeSuperVisitable, Upcast};
|
||||
use rustc_middle::ty::{GenericArgs, GenericArgsRef};
|
||||
use rustc_middle::ty::{
|
||||
self, GenericArgs, GenericArgsRef, Ty, TyCtxt, TypeFolder, TypeSuperVisitable, Upcast,
|
||||
};
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
pub use self::coherence::{add_placeholder_note, orphan_check_trait_ref, overlapping_impls};
|
||||
pub use self::coherence::{InCrate, IsFirstInputType, UncoveredTyParams};
|
||||
pub use self::coherence::{OrphanCheckErr, OrphanCheckMode, OverlapResult};
|
||||
pub use self::coherence::{
|
||||
add_placeholder_note, orphan_check_trait_ref, overlapping_impls, InCrate, IsFirstInputType,
|
||||
OrphanCheckErr, OrphanCheckMode, OverlapResult, UncoveredTyParams,
|
||||
};
|
||||
pub use self::engine::{ObligationCtxt, TraitEngineExt};
|
||||
pub use self::fulfill::{FulfillmentContext, OldSolverError, PendingPredicateObligation};
|
||||
pub use self::normalize::NormalizeExt;
|
||||
pub use self::object_safety::hir_ty_lowering_object_safety_violations;
|
||||
pub use self::object_safety::is_vtable_safe_method;
|
||||
pub use self::object_safety::object_safety_violations_for_assoc_item;
|
||||
pub use self::object_safety::ObjectSafetyViolation;
|
||||
pub use self::object_safety::{
|
||||
hir_ty_lowering_object_safety_violations, is_vtable_safe_method,
|
||||
object_safety_violations_for_assoc_item, ObjectSafetyViolation,
|
||||
};
|
||||
pub use self::project::{normalize_inherent_projection, normalize_projection_ty};
|
||||
pub use self::select::{EvaluationCache, SelectionCache, SelectionContext};
|
||||
pub use self::select::{EvaluationResult, IntercrateAmbiguityCause, OverflowError};
|
||||
pub use self::specialize::specialization_graph::FutureCompatOverlapError;
|
||||
pub use self::specialize::specialization_graph::FutureCompatOverlapErrorKind;
|
||||
pub use self::select::{
|
||||
EvaluationCache, EvaluationResult, IntercrateAmbiguityCause, OverflowError, SelectionCache,
|
||||
SelectionContext,
|
||||
};
|
||||
pub use self::specialize::specialization_graph::{
|
||||
FutureCompatOverlapError, FutureCompatOverlapErrorKind,
|
||||
};
|
||||
pub use self::specialize::{
|
||||
specialization_graph, translate_args, translate_args_with_cause, OverlapError,
|
||||
};
|
||||
pub use self::structural_normalize::StructurallyNormalizeExt;
|
||||
pub use self::util::elaborate;
|
||||
pub use self::util::{expand_trait_aliases, TraitAliasExpander, TraitAliasExpansionInfo};
|
||||
pub use self::util::{impl_item_is_final, upcast_choices};
|
||||
pub use self::util::{supertraits, transitive_bounds, transitive_bounds_that_define_assoc_item};
|
||||
pub use self::util::{with_replaced_escaping_bound_vars, BoundVarReplacer, PlaceholderReplacer};
|
||||
|
||||
pub use rustc_infer::traits::*;
|
||||
pub use self::util::{
|
||||
elaborate, expand_trait_aliases, impl_item_is_final, supertraits, transitive_bounds,
|
||||
transitive_bounds_that_define_assoc_item, upcast_choices, with_replaced_escaping_bound_vars,
|
||||
BoundVarReplacer, PlaceholderReplacer, TraitAliasExpander, TraitAliasExpansionInfo,
|
||||
};
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::infer::outlives::env::OutlivesEnvironment;
|
||||
use crate::infer::{InferCtxt, TyCtxtInferExt};
|
||||
use crate::regions::InferCtxtRegionExt;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
|
||||
pub struct FulfillmentError<'tcx> {
|
||||
pub obligation: PredicateObligation<'tcx>,
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
//! Deeply normalize types using the old trait solver.
|
||||
|
||||
use super::SelectionContext;
|
||||
use super::{project, with_replaced_escaping_bound_vars, BoundVarReplacer, PlaceholderReplacer};
|
||||
use crate::error_reporting::traits::OverflowCause;
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::solve::NextSolverError;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_infer::infer::at::At;
|
||||
use rustc_infer::infer::InferOk;
|
||||
use rustc_infer::traits::FromSolverError;
|
||||
use rustc_infer::traits::PredicateObligation;
|
||||
use rustc_infer::traits::{Normalized, Obligation, TraitEngine};
|
||||
use rustc_infer::traits::{
|
||||
FromSolverError, Normalized, Obligation, PredicateObligation, TraitEngine,
|
||||
};
|
||||
use rustc_macros::extension;
|
||||
use rustc_middle::traits::{ObligationCause, ObligationCauseCode, Reveal};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFolder};
|
||||
use rustc_middle::ty::{TypeFoldable, TypeSuperFoldable, TypeVisitable, TypeVisitableExt};
|
||||
use rustc_middle::ty::{
|
||||
self, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, TypeVisitable, TypeVisitableExt,
|
||||
};
|
||||
|
||||
use super::{
|
||||
project, with_replaced_escaping_bound_vars, BoundVarReplacer, PlaceholderReplacer,
|
||||
SelectionContext,
|
||||
};
|
||||
use crate::error_reporting::traits::OverflowCause;
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::solve::NextSolverError;
|
||||
|
||||
#[extension(pub trait NormalizeExt<'tcx>)]
|
||||
impl<'tcx> At<'_, 'tcx> {
|
||||
|
|
|
@ -8,11 +8,9 @@
|
|||
//! - not reference the erased type `Self` except for in this receiver;
|
||||
//! - not have generic type parameters.
|
||||
|
||||
use super::elaborate;
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use crate::infer::TyCtxtInferExt;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt;
|
||||
use crate::traits::{util, Obligation, ObligationCause};
|
||||
use rustc_errors::FatalError;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
|
@ -27,9 +25,10 @@ use rustc_span::Span;
|
|||
use rustc_target::abi::Abi;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use super::elaborate;
|
||||
use crate::infer::TyCtxtInferExt;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt;
|
||||
use crate::traits::{util, Obligation, ObligationCause};
|
||||
pub use crate::traits::{MethodViolationCode, ObjectSafetyViolation};
|
||||
|
||||
/// Returns the object safety violations that affect HIR ty lowering.
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
use crate::infer::InferCtxt;
|
||||
use crate::traits::{ObligationCause, ObligationCtxt};
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_infer::infer::resolve::OpportunisticRegionResolver;
|
||||
use rustc_infer::infer::InferOk;
|
||||
use rustc_macros::extension;
|
||||
use rustc_middle::infer::canonical::{OriginalQueryValues, QueryRegionConstraints};
|
||||
use rustc_middle::span_bug;
|
||||
pub use rustc_middle::traits::query::OutlivesBound;
|
||||
use rustc_middle::ty::{self, ParamEnv, Ty, TypeFolder, TypeVisitableExt};
|
||||
use rustc_span::def_id::LocalDefId;
|
||||
|
||||
pub use rustc_middle::traits::query::OutlivesBound;
|
||||
use crate::infer::InferCtxt;
|
||||
use crate::traits::{ObligationCause, ObligationCtxt};
|
||||
|
||||
pub type BoundsCompat<'a, 'tcx: 'a> = impl Iterator<Item = OutlivesBound<'tcx>> + 'a;
|
||||
pub type Bounds<'a, 'tcx: 'a> = impl Iterator<Item = OutlivesBound<'tcx>> + 'a;
|
||||
|
|
|
@ -2,29 +2,6 @@
|
|||
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use super::specialization_graph;
|
||||
use super::translate_args;
|
||||
use super::util;
|
||||
use super::MismatchedProjectionTypes;
|
||||
use super::Obligation;
|
||||
use super::ObligationCause;
|
||||
use super::PredicateObligation;
|
||||
use super::Selection;
|
||||
use super::SelectionContext;
|
||||
use super::SelectionError;
|
||||
use super::{Normalized, NormalizedTerm, ProjectionCacheEntry, ProjectionCacheKey};
|
||||
use rustc_infer::traits::ObligationCauseCode;
|
||||
use rustc_middle::traits::BuiltinImplSource;
|
||||
use rustc_middle::traits::ImplSource;
|
||||
use rustc_middle::traits::ImplSourceUserDefinedData;
|
||||
use rustc_middle::{bug, span_bug};
|
||||
|
||||
use crate::errors::InherentProjectionNormalizationOverflow;
|
||||
use crate::infer::{BoundRegionConversionTime, InferOk};
|
||||
use crate::traits::normalize::normalize_with_depth;
|
||||
use crate::traits::normalize::normalize_with_depth_to;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use crate::traits::select::ProjectionMatchesProjection;
|
||||
use rustc_data_structures::sso::SsoHashSet;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
|
@ -32,13 +9,26 @@ use rustc_hir::def::DefKind;
|
|||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_infer::infer::resolve::OpportunisticRegionResolver;
|
||||
use rustc_infer::infer::DefineOpaqueTypes;
|
||||
use rustc_infer::traits::ObligationCauseCode;
|
||||
use rustc_middle::traits::select::OverflowError;
|
||||
pub use rustc_middle::traits::Reveal;
|
||||
use rustc_middle::traits::{BuiltinImplSource, ImplSource, ImplSourceUserDefinedData};
|
||||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::visit::{MaxUniverse, TypeVisitable, TypeVisitableExt};
|
||||
use rustc_middle::ty::{self, Term, Ty, TyCtxt, Upcast};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
pub use rustc_middle::traits::Reveal;
|
||||
use super::{
|
||||
specialization_graph, translate_args, util, MismatchedProjectionTypes, Normalized,
|
||||
NormalizedTerm, Obligation, ObligationCause, PredicateObligation, ProjectionCacheEntry,
|
||||
ProjectionCacheKey, Selection, SelectionContext, SelectionError,
|
||||
};
|
||||
use crate::errors::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 _;
|
||||
use crate::traits::select::ProjectionMatchesProjection;
|
||||
|
||||
pub type PolyProjectionObligation<'tcx> = Obligation<'tcx, ty::PolyProjectionPredicate<'tcx>>;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use crate::traits::query::normalize::QueryNormalizeExt;
|
||||
use crate::traits::query::NoSolution;
|
||||
use crate::traits::{Normalized, ObligationCause, ObligationCtxt};
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_middle::traits::query::{DropckConstraint, DropckOutlivesResult};
|
||||
use rustc_middle::ty::{self, EarlyBinder, ParamEnvAnd, Ty, TyCtxt};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use crate::traits::query::normalize::QueryNormalizeExt;
|
||||
use crate::traits::query::NoSolution;
|
||||
use crate::traits::{Normalized, ObligationCause, ObligationCtxt};
|
||||
|
||||
/// This returns true if the type `ty` is "trivial" for
|
||||
/// dropck-outlives -- that is, if it doesn't require any types to
|
||||
/// outlive. This is similar but not *quite* the same as the
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
//! which folds deeply, invoking the underlying
|
||||
//! `normalize_canonicalized_projection_ty` query when it encounters projections.
|
||||
|
||||
use crate::error_reporting::traits::OverflowCause;
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::infer::at::At;
|
||||
use crate::infer::canonical::OriginalQueryValues;
|
||||
use crate::infer::{InferCtxt, InferOk};
|
||||
use crate::traits::normalize::needs_normalization;
|
||||
use crate::traits::Normalized;
|
||||
use crate::traits::{BoundVarReplacer, PlaceholderReplacer, ScrubbedTraitError};
|
||||
use crate::traits::{ObligationCause, PredicateObligation, Reveal};
|
||||
use rustc_data_structures::sso::SsoHashMap;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_macros::extension;
|
||||
pub use rustc_middle::traits::query::NormalizationResult;
|
||||
use rustc_middle::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeSuperFoldable};
|
||||
use rustc_middle::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitor};
|
||||
use rustc_span::DUMMY_SP;
|
||||
|
||||
use super::NoSolution;
|
||||
|
||||
pub use rustc_middle::traits::query::NormalizationResult;
|
||||
use crate::error_reporting::traits::OverflowCause;
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::infer::at::At;
|
||||
use crate::infer::canonical::OriginalQueryValues;
|
||||
use crate::infer::{InferCtxt, InferOk};
|
||||
use crate::traits::normalize::needs_normalization;
|
||||
use crate::traits::{
|
||||
BoundVarReplacer, Normalized, ObligationCause, PlaceholderReplacer, PredicateObligation,
|
||||
Reveal, ScrubbedTraitError,
|
||||
};
|
||||
|
||||
#[extension(pub trait QueryNormalizeExt<'tcx>)]
|
||||
impl<'cx, 'tcx> At<'cx, 'tcx> {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::ObligationCtxt;
|
||||
use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
|
||||
use rustc_infer::traits::Obligation;
|
||||
pub use rustc_middle::traits::query::type_op::AscribeUserType;
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
|
||||
use rustc_middle::ty::{self, ParamEnvAnd, Ty, TyCtxt, UserArgs, UserSelfTy, UserType};
|
||||
|
||||
pub use rustc_middle::traits::query::type_op::AscribeUserType;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::ObligationCtxt;
|
||||
|
||||
impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> {
|
||||
type QueryResponse = ();
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
use crate::infer::canonical::query_response;
|
||||
use crate::infer::InferCtxt;
|
||||
use crate::traits::query::type_op::TypeOpOutput;
|
||||
use crate::traits::ObligationCtxt;
|
||||
use std::fmt;
|
||||
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_infer::infer::region_constraints::RegionConstraintData;
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::ty::{TyCtxt, TypeFoldable};
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::fmt;
|
||||
use crate::infer::canonical::query_response;
|
||||
use crate::infer::InferCtxt;
|
||||
use crate::traits::query::type_op::TypeOpOutput;
|
||||
use crate::traits::ObligationCtxt;
|
||||
|
||||
pub struct CustomTypeOp<F> {
|
||||
closure: F,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::ObligationCtxt;
|
||||
pub use rustc_middle::traits::query::type_op::Eq;
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::traits::ObligationCause;
|
||||
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
|
||||
|
||||
pub use rustc_middle::traits::query::type_op::Eq;
|
||||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::ObligationCtxt;
|
||||
|
||||
impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
|
||||
type QueryResponse = ();
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
use crate::traits::query::NoSolution;
|
||||
use crate::traits::wf;
|
||||
use crate::traits::ObligationCtxt;
|
||||
|
||||
use rustc_infer::infer::canonical::Canonical;
|
||||
use rustc_infer::infer::resolve::OpportunisticRegionResolver;
|
||||
use rustc_infer::traits::query::OutlivesBound;
|
||||
|
@ -14,6 +10,9 @@ use rustc_span::DUMMY_SP;
|
|||
use rustc_type_ir::outlives::{push_outlives_components, Component};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
use crate::traits::query::NoSolution;
|
||||
use crate::traits::{wf, ObligationCtxt};
|
||||
|
||||
#[derive(Copy, Clone, Debug, HashStable, TypeFoldable, TypeVisitable)]
|
||||
pub struct ImpliedOutlivesBounds<'tcx> {
|
||||
pub ty: Ty<'tcx>,
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
use crate::infer::canonical::{
|
||||
Canonical, CanonicalQueryResponse, OriginalQueryValues, QueryRegionConstraints,
|
||||
};
|
||||
use crate::infer::{InferCtxt, InferOk};
|
||||
use crate::traits::{ObligationCause, ObligationCtxt};
|
||||
use std::fmt;
|
||||
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_infer::infer::canonical::Certainty;
|
||||
use rustc_infer::traits::PredicateObligation;
|
||||
|
@ -10,7 +7,12 @@ use rustc_middle::traits::query::NoSolution;
|
|||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
|
||||
use rustc_span::Span;
|
||||
use std::fmt;
|
||||
|
||||
use crate::infer::canonical::{
|
||||
Canonical, CanonicalQueryResponse, OriginalQueryValues, QueryRegionConstraints,
|
||||
};
|
||||
use crate::infer::{InferCtxt, InferOk};
|
||||
use crate::traits::{ObligationCause, ObligationCtxt};
|
||||
|
||||
pub mod ascribe_user_type;
|
||||
pub mod custom;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::ObligationCtxt;
|
||||
use std::fmt;
|
||||
|
||||
pub use rustc_middle::traits::query::type_op::Normalize;
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::traits::ObligationCause;
|
||||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::{self, Lift, ParamEnvAnd, Ty, TyCtxt, TypeVisitableExt};
|
||||
use std::fmt;
|
||||
|
||||
pub use rustc_middle::traits::query::type_op::Normalize;
|
||||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::ObligationCtxt;
|
||||
|
||||
impl<'tcx, T> super::QueryTypeOp<'tcx> for Normalize<T>
|
||||
where
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
use rustc_macros::{HashStable, TypeFoldable, TypeVisitable};
|
||||
use rustc_middle::traits::query::{DropckOutlivesResult, NoSolution};
|
||||
use rustc_middle::ty::{ParamEnvAnd, Ty, TyCtxt};
|
||||
|
||||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::query::dropck_outlives::{
|
||||
compute_dropck_outlives_inner, trivial_dropck_outlives,
|
||||
};
|
||||
use crate::traits::ObligationCtxt;
|
||||
use rustc_macros::{HashStable, TypeFoldable, TypeVisitable};
|
||||
use rustc_middle::traits::query::{DropckOutlivesResult, NoSolution};
|
||||
use rustc_middle::ty::{ParamEnvAnd, Ty, TyCtxt};
|
||||
|
||||
#[derive(Copy, Clone, Debug, HashStable, TypeFoldable, TypeVisitable)]
|
||||
pub struct DropckOutlives<'tcx> {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::ObligationCtxt;
|
||||
use rustc_infer::traits::Obligation;
|
||||
pub use rustc_middle::traits::query::type_op::ProvePredicate;
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::traits::ObligationCause;
|
||||
use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt};
|
||||
|
||||
pub use rustc_middle::traits::query::type_op::ProvePredicate;
|
||||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::ObligationCtxt;
|
||||
|
||||
impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
|
||||
type QueryResponse = ();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::ObligationCtxt;
|
||||
pub use rustc_middle::traits::query::type_op::Subtype;
|
||||
use rustc_middle::traits::query::NoSolution;
|
||||
use rustc_middle::traits::ObligationCause;
|
||||
use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
|
||||
|
||||
pub use rustc_middle::traits::query::type_op::Subtype;
|
||||
use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
|
||||
use crate::traits::ObligationCtxt;
|
||||
|
||||
impl<'tcx> super::QueryTypeOp<'tcx> for Subtype<'tcx> {
|
||||
type QueryResponse = ();
|
||||
|
|
|
@ -12,20 +12,17 @@ use hir::def_id::DefId;
|
|||
use hir::LangItem;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
|
||||
use rustc_hir as hir;
|
||||
use rustc_infer::traits::ObligationCause;
|
||||
use rustc_infer::traits::{Obligation, PolyTraitObligation, SelectionError};
|
||||
use rustc_infer::traits::{Obligation, ObligationCause, PolyTraitObligation, SelectionError};
|
||||
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
|
||||
use rustc_middle::ty::{self, ToPolyTraitRef, Ty, TypeVisitableExt};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
|
||||
use super::SelectionCandidate::*;
|
||||
use super::{BuiltinImplConditions, SelectionCandidateSet, SelectionContext, TraitObligationStack};
|
||||
use crate::traits;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt;
|
||||
use crate::traits::util;
|
||||
|
||||
use super::BuiltinImplConditions;
|
||||
use super::SelectionCandidate::*;
|
||||
use super::{SelectionCandidateSet, SelectionContext, TraitObligationStack};
|
||||
|
||||
impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
#[instrument(skip(self, stack), level = "debug")]
|
||||
pub(super) fn assemble_candidates<'o>(
|
||||
|
|
|
@ -7,11 +7,13 @@
|
|||
//! [rustc dev guide]:
|
||||
//! https://rustc-dev-guide.rust-lang.org/traits/resolution.html#confirmation
|
||||
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_ast::Mutability;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_infer::infer::HigherRankedType;
|
||||
use rustc_infer::infer::{DefineOpaqueTypes, InferOk};
|
||||
use rustc_infer::infer::{DefineOpaqueTypes, HigherRankedType, InferOk};
|
||||
use rustc_infer::traits::ObligationCauseCode;
|
||||
use rustc_middle::traits::{BuiltinImplSource, SignatureMismatchData};
|
||||
use rustc_middle::ty::{
|
||||
|
@ -21,6 +23,8 @@ use rustc_middle::ty::{
|
|||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::def_id::DefId;
|
||||
|
||||
use super::SelectionCandidate::{self, *};
|
||||
use super::{BuiltinImplConditions, SelectionContext};
|
||||
use crate::traits::normalize::{normalize_with_depth, normalize_with_depth_to};
|
||||
use crate::traits::util::{self, closure_trait_ref_and_return_type};
|
||||
use crate::traits::{
|
||||
|
@ -29,13 +33,6 @@ use crate::traits::{
|
|||
SignatureMismatch, TraitNotObjectSafe, TraitObligation, Unimplemented,
|
||||
};
|
||||
|
||||
use super::BuiltinImplConditions;
|
||||
use super::SelectionCandidate::{self, *};
|
||||
use super::SelectionContext;
|
||||
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
pub(super) fn confirm_candidate(
|
||||
|
|
|
@ -2,31 +2,11 @@
|
|||
//!
|
||||
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/resolution.html#selection
|
||||
|
||||
use self::EvaluationResult::*;
|
||||
use self::SelectionCandidate::*;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::{self, Display};
|
||||
use std::ops::ControlFlow;
|
||||
use std::{cmp, iter};
|
||||
|
||||
use super::coherence::{self, Conflict};
|
||||
use super::const_evaluatable;
|
||||
use super::project;
|
||||
use super::project::ProjectionTermObligation;
|
||||
use super::util;
|
||||
use super::util::closure_trait_ref_and_return_type;
|
||||
use super::wf;
|
||||
use super::{
|
||||
ImplDerivedCause, Normalized, Obligation, ObligationCause, ObligationCauseCode, Overflow,
|
||||
PolyTraitObligation, PredicateObligation, Selection, SelectionError, SelectionResult,
|
||||
TraitQueryMode,
|
||||
};
|
||||
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::infer::{InferCtxt, InferCtxtExt, InferOk, TypeFreshener};
|
||||
use crate::solve::InferCtxtSelectExt as _;
|
||||
use crate::traits::normalize::normalize_with_depth;
|
||||
use crate::traits::normalize::normalize_with_depth_to;
|
||||
use crate::traits::project::ProjectAndUnifyResult;
|
||||
use crate::traits::project::ProjectionCacheKeyExt;
|
||||
use crate::traits::ProjectionCacheKey;
|
||||
use crate::traits::Unimplemented;
|
||||
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::{Diag, EmissionGuarantee};
|
||||
|
@ -34,31 +14,39 @@ use rustc_hir as hir;
|
|||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::LangItem;
|
||||
use rustc_infer::infer::relate::TypeRelation;
|
||||
use rustc_infer::infer::BoundRegionConversionTime;
|
||||
use rustc_infer::infer::BoundRegionConversionTime::HigherRankedType;
|
||||
use rustc_infer::infer::DefineOpaqueTypes;
|
||||
use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes};
|
||||
use rustc_infer::traits::TraitObligation;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::dep_graph::dep_kinds;
|
||||
use rustc_middle::dep_graph::DepNodeIndex;
|
||||
use rustc_middle::dep_graph::{dep_kinds, DepNodeIndex};
|
||||
use rustc_middle::mir::interpret::ErrorHandled;
|
||||
pub use rustc_middle::traits::select::*;
|
||||
use rustc_middle::ty::abstract_const::NotConstEvaluatable;
|
||||
use rustc_middle::ty::error::TypeErrorToStringExt;
|
||||
use rustc_middle::ty::print::PrintTraitRefExt as _;
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
use rustc_middle::ty::{self, PolyProjectionPredicate, Upcast};
|
||||
use rustc_middle::ty::{Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
|
||||
use rustc_middle::ty::print::{with_no_trimmed_paths, PrintTraitRefExt as _};
|
||||
use rustc_middle::ty::{
|
||||
self, GenericArgsRef, PolyProjectionPredicate, Ty, TyCtxt, TypeFoldable, TypeVisitableExt,
|
||||
Upcast,
|
||||
};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::Symbol;
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::cmp;
|
||||
use std::fmt::{self, Display};
|
||||
use std::iter;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
pub use rustc_middle::traits::select::*;
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use self::EvaluationResult::*;
|
||||
use self::SelectionCandidate::*;
|
||||
use super::coherence::{self, Conflict};
|
||||
use super::project::ProjectionTermObligation;
|
||||
use super::util::closure_trait_ref_and_return_type;
|
||||
use super::{
|
||||
const_evaluatable, project, util, wf, ImplDerivedCause, Normalized, Obligation,
|
||||
ObligationCause, ObligationCauseCode, Overflow, PolyTraitObligation, PredicateObligation,
|
||||
Selection, SelectionError, SelectionResult, TraitQueryMode,
|
||||
};
|
||||
use crate::error_reporting::InferCtxtErrorExt;
|
||||
use crate::infer::{InferCtxt, InferCtxtExt, InferOk, TypeFreshener};
|
||||
use crate::solve::InferCtxtSelectExt as _;
|
||||
use crate::traits::normalize::{normalize_with_depth, normalize_with_depth_to};
|
||||
use crate::traits::project::{ProjectAndUnifyResult, ProjectionCacheKeyExt};
|
||||
use crate::traits::{ProjectionCacheKey, Unimplemented};
|
||||
|
||||
mod _match;
|
||||
mod candidate_assembly;
|
||||
|
|
|
@ -10,28 +10,25 @@
|
|||
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/traits/specialization.html
|
||||
|
||||
pub mod specialization_graph;
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::codes::*;
|
||||
use rustc_errors::{Diag, EmissionGuarantee};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_infer::infer::DefineOpaqueTypes;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::query::LocalCrate;
|
||||
use rustc_middle::ty::print::PrintTraitRefExt as _;
|
||||
use rustc_middle::ty::{self, GenericArgsRef, ImplSubject, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_session::lint::builtin::{COHERENCE_LEAK_CHECK, ORDER_DEPENDENT_TRAIT_OBJECTS};
|
||||
use rustc_span::{sym, ErrorGuaranteed, Span, DUMMY_SP};
|
||||
use specialization_graph::GraphExt;
|
||||
|
||||
use super::{util, SelectionContext};
|
||||
use crate::error_reporting::traits::to_pretty_impl_header;
|
||||
use crate::errors::NegativePositiveConflict;
|
||||
use crate::infer::{InferCtxt, InferOk, TyCtxtInferExt};
|
||||
use crate::traits::select::IntercrateAmbiguityCause;
|
||||
use crate::traits::{coherence, FutureCompatOverlapErrorKind, ObligationCause, ObligationCtxt};
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::{codes::*, Diag, EmissionGuarantee};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::query::LocalCrate;
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
use rustc_middle::ty::{self, ImplSubject, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_session::lint::builtin::COHERENCE_LEAK_CHECK;
|
||||
use rustc_session::lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS;
|
||||
use rustc_span::{sym, ErrorGuaranteed, Span, DUMMY_SP};
|
||||
|
||||
use super::util;
|
||||
use super::SelectionContext;
|
||||
|
||||
/// Information pertinent to an overlapping impl error.
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
use super::OverlapError;
|
||||
|
||||
use crate::traits;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_macros::extension;
|
||||
use rustc_middle::bug;
|
||||
pub use rustc_middle::traits::specialization_graph::*;
|
||||
use rustc_middle::ty::fast_reject::{self, SimplifiedType, TreatParams};
|
||||
use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
|
||||
|
||||
pub use rustc_middle::traits::specialization_graph::*;
|
||||
use super::OverlapError;
|
||||
use crate::traits;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum FutureCompatOverlapErrorKind {
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
use super::NormalizeExt;
|
||||
use super::{ObligationCause, PredicateObligation, SelectionContext};
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_errors::Diag;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_infer::infer::{InferCtxt, InferOk};
|
||||
pub use rustc_infer::traits::util::*;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::GenericArgsRef;
|
||||
use rustc_middle::ty::{self, ImplSubject, Ty, TyCtxt, TypeVisitableExt, Upcast};
|
||||
use rustc_middle::ty::{TypeFoldable, TypeFolder, TypeSuperFoldable};
|
||||
use rustc_middle::ty::{
|
||||
self, GenericArgsRef, ImplSubject, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
|
||||
TypeVisitableExt, Upcast,
|
||||
};
|
||||
use rustc_span::Span;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
pub use rustc_infer::traits::util::*;
|
||||
use super::{NormalizeExt, ObligationCause, PredicateObligation, SelectionContext};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// `TraitAliasExpander` iterator
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
use crate::errors::DumpVTableEntries;
|
||||
use crate::traits::{impossible_predicates, is_vtable_safe_method};
|
||||
use std::fmt::Debug;
|
||||
use std::ops::ControlFlow;
|
||||
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_infer::traits::util::PredicateSet;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{self, GenericParamDefKind, Ty, TyCtxt, Upcast, VtblEntry};
|
||||
use rustc_middle::ty::{GenericArgs, TypeVisitableExt};
|
||||
use rustc_middle::ty::{
|
||||
self, GenericArgs, GenericParamDefKind, Ty, TyCtxt, TypeVisitableExt, Upcast, VtblEntry,
|
||||
};
|
||||
use rustc_span::{sym, Span, DUMMY_SP};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::ops::ControlFlow;
|
||||
use crate::errors::DumpVTableEntries;
|
||||
use crate::traits::{impossible_predicates, is_vtable_safe_method};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum VtblSegment<'tcx> {
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
use crate::infer::InferCtxt;
|
||||
use crate::traits;
|
||||
use std::iter;
|
||||
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_infer::traits::ObligationCauseCode;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::{
|
||||
self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
|
||||
self, GenericArg, GenericArgKind, GenericArgsRef, Ty, TyCtxt, TypeSuperVisitable,
|
||||
TypeVisitable, TypeVisitableExt, TypeVisitor,
|
||||
};
|
||||
use rustc_middle::ty::{GenericArg, GenericArgKind, GenericArgsRef};
|
||||
use rustc_span::def_id::{DefId, LocalDefId, CRATE_DEF_ID};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
||||
use std::iter;
|
||||
use crate::infer::InferCtxt;
|
||||
use crate::traits;
|
||||
/// Returns the set of obligations needed to make `arg` well-formed.
|
||||
/// If `arg` contains unresolved inference variables, this may include
|
||||
/// further WF obligations. However, if `arg` IS an unresolved
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue