1
Fork 0

Add warn(unreachable_pub) to rustc_hir_analysis.

This commit is contained in:
Nicholas Nethercote 2024-08-27 13:14:50 +10:00
parent bffa2244ed
commit 5acf4e7b4b
27 changed files with 155 additions and 145 deletions

View file

@ -26,13 +26,13 @@ use rustc_span::Span;
/// Our representation is a bit mixed here -- in some cases, we /// Our representation is a bit mixed here -- in some cases, we
/// include the self type (e.g., `trait_bounds`) but in others we do not /// include the self type (e.g., `trait_bounds`) but in others we do not
#[derive(Default, PartialEq, Eq, Clone, Debug)] #[derive(Default, PartialEq, Eq, Clone, Debug)]
pub struct Bounds<'tcx> { pub(crate) struct Bounds<'tcx> {
clauses: Vec<(ty::Clause<'tcx>, Span)>, clauses: Vec<(ty::Clause<'tcx>, Span)>,
effects_min_tys: FxIndexMap<Ty<'tcx>, Span>, effects_min_tys: FxIndexMap<Ty<'tcx>, Span>,
} }
impl<'tcx> Bounds<'tcx> { impl<'tcx> Bounds<'tcx> {
pub fn push_region_bound( pub(crate) fn push_region_bound(
&mut self, &mut self,
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
region: ty::PolyTypeOutlivesPredicate<'tcx>, region: ty::PolyTypeOutlivesPredicate<'tcx>,
@ -42,7 +42,7 @@ impl<'tcx> Bounds<'tcx> {
.push((region.map_bound(|p| ty::ClauseKind::TypeOutlives(p)).upcast(tcx), span)); .push((region.map_bound(|p| ty::ClauseKind::TypeOutlives(p)).upcast(tcx), span));
} }
pub fn push_trait_bound( pub(crate) fn push_trait_bound(
&mut self, &mut self,
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
defining_def_id: DefId, defining_def_id: DefId,
@ -154,7 +154,7 @@ impl<'tcx> Bounds<'tcx> {
self.clauses.push((bound_trait_ref.rebind(new_trait_ref).upcast(tcx), span)); self.clauses.push((bound_trait_ref.rebind(new_trait_ref).upcast(tcx), span));
} }
pub fn push_projection_bound( pub(crate) fn push_projection_bound(
&mut self, &mut self,
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
projection: ty::PolyProjectionPredicate<'tcx>, projection: ty::PolyProjectionPredicate<'tcx>,
@ -166,14 +166,14 @@ impl<'tcx> Bounds<'tcx> {
)); ));
} }
pub fn push_sized(&mut self, tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, span: Span) { pub(crate) fn push_sized(&mut self, tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, span: Span) {
let sized_def_id = tcx.require_lang_item(LangItem::Sized, Some(span)); let sized_def_id = tcx.require_lang_item(LangItem::Sized, Some(span));
let trait_ref = ty::TraitRef::new(tcx, sized_def_id, [ty]); let trait_ref = ty::TraitRef::new(tcx, sized_def_id, [ty]);
// Preferable to put this obligation first, since we report better errors for sized ambiguity. // Preferable to put this obligation first, since we report better errors for sized ambiguity.
self.clauses.insert(0, (trait_ref.upcast(tcx), span)); self.clauses.insert(0, (trait_ref.upcast(tcx), span));
} }
pub fn clauses( pub(crate) fn clauses(
&self, &self,
// FIXME(effects): remove tcx // FIXME(effects): remove tcx
_tcx: TyCtxt<'tcx>, _tcx: TyCtxt<'tcx>,
@ -181,7 +181,7 @@ impl<'tcx> Bounds<'tcx> {
self.clauses.iter().cloned() self.clauses.iter().cloned()
} }
pub fn effects_min_tys(&self) -> impl Iterator<Item = Ty<'tcx>> + '_ { pub(crate) fn effects_min_tys(&self) -> impl Iterator<Item = Ty<'tcx>> + '_ {
self.effects_min_tys.keys().copied() self.effects_min_tys.keys().copied()
} }
} }

View file

@ -1053,7 +1053,7 @@ fn check_impl_items_against_trait<'tcx>(
} }
} }
pub fn check_simd(tcx: TyCtxt<'_>, sp: Span, def_id: LocalDefId) { fn check_simd(tcx: TyCtxt<'_>, sp: Span, def_id: LocalDefId) {
let t = tcx.type_of(def_id).instantiate_identity(); let t = tcx.type_of(def_id).instantiate_identity();
if let ty::Adt(def, args) = t.kind() if let ty::Adt(def, args) = t.kind()
&& def.is_struct() && def.is_struct()

View file

@ -6,7 +6,7 @@ use rustc_span::Span;
use crate::errors; use crate::errors;
/// Check for shared or mutable references of `static mut` inside expression /// Check for shared or mutable references of `static mut` inside expression
pub fn maybe_expr_static_mut(tcx: TyCtxt<'_>, expr: hir::Expr<'_>) { pub(crate) fn maybe_expr_static_mut(tcx: TyCtxt<'_>, expr: hir::Expr<'_>) {
let span = expr.span; let span = expr.span;
let hir_id = expr.hir_id; let hir_id = expr.hir_id;
if let hir::ExprKind::AddrOf(borrow_kind, m, expr) = expr.kind if let hir::ExprKind::AddrOf(borrow_kind, m, expr) = expr.kind
@ -26,7 +26,7 @@ pub fn maybe_expr_static_mut(tcx: TyCtxt<'_>, expr: hir::Expr<'_>) {
} }
/// Check for shared or mutable references of `static mut` inside statement /// Check for shared or mutable references of `static mut` inside statement
pub fn maybe_stmt_static_mut(tcx: TyCtxt<'_>, stmt: hir::Stmt<'_>) { pub(crate) fn maybe_stmt_static_mut(tcx: TyCtxt<'_>, stmt: hir::Stmt<'_>) {
if let hir::StmtKind::Let(loc) = stmt.kind if let hir::StmtKind::Let(loc) = stmt.kind
&& let hir::PatKind::Binding(ba, _, _, _) = loc.pat.kind && let hir::PatKind::Binding(ba, _, _, _) = loc.pat.kind
&& let hir::ByRef::Yes(rmutbl) = ba.0 && let hir::ByRef::Yes(rmutbl) = ba.0

View file

@ -22,7 +22,7 @@ use rustc_span::source_map;
use super::errs::{maybe_expr_static_mut, maybe_stmt_static_mut}; use super::errs::{maybe_expr_static_mut, maybe_stmt_static_mut};
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
pub struct Context { struct Context {
/// The scope that contains any new variables declared, plus its depth in /// The scope that contains any new variables declared, plus its depth in
/// the scope tree. /// the scope tree.
var_parent: Option<(Scope, ScopeDepth)>, var_parent: Option<(Scope, ScopeDepth)>,
@ -893,7 +893,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> {
/// re-use in incremental scenarios. We may sometimes need to rerun the /// re-use in incremental scenarios. We may sometimes need to rerun the
/// type checker even when the HIR hasn't changed, and in those cases /// type checker even when the HIR hasn't changed, and in those cases
/// we can avoid reconstructing the region scope tree. /// we can avoid reconstructing the region scope tree.
pub fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree { pub(crate) fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree {
let typeck_root_def_id = tcx.typeck_root_def_id(def_id); let typeck_root_def_id = tcx.typeck_root_def_id(def_id);
if typeck_root_def_id != def_id { if typeck_root_def_id != def_id {
return tcx.region_scope_tree(typeck_root_def_id); return tcx.region_scope_tree(typeck_root_def_id);

View file

@ -5,7 +5,7 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::TyCtxt; use rustc_middle::ty::TyCtxt;
use rustc_session::lint; use rustc_session::lint;
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { check_unused_traits, ..*providers }; *providers = Providers { check_unused_traits, ..*providers };
} }

View file

@ -332,7 +332,7 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<()
} }
} }
pub fn coerce_unsized_info<'tcx>( pub(crate) fn coerce_unsized_info<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
impl_did: LocalDefId, impl_did: LocalDefId,
) -> Result<CoerceUnsizedInfo, ErrorGuaranteed> { ) -> Result<CoerceUnsizedInfo, ErrorGuaranteed> {

View file

@ -19,7 +19,7 @@ use rustc_span::ErrorGuaranteed;
use crate::errors; use crate::errors;
/// On-demand query: yields a map containing all types mapped to their inherent impls. /// On-demand query: yields a map containing all types mapped to their inherent impls.
pub fn crate_inherent_impls( pub(crate) fn crate_inherent_impls(
tcx: TyCtxt<'_>, tcx: TyCtxt<'_>,
(): (), (): (),
) -> Result<&'_ CrateInherentImpls, ErrorGuaranteed> { ) -> Result<&'_ CrateInherentImpls, ErrorGuaranteed> {
@ -32,7 +32,7 @@ pub fn crate_inherent_impls(
Ok(tcx.arena.alloc(collect.impls_map)) Ok(tcx.arena.alloc(collect.impls_map))
} }
pub fn crate_incoherent_impls( pub(crate) fn crate_incoherent_impls(
tcx: TyCtxt<'_>, tcx: TyCtxt<'_>,
simp: SimplifiedType, simp: SimplifiedType,
) -> Result<&[DefId], ErrorGuaranteed> { ) -> Result<&[DefId], ErrorGuaranteed> {
@ -43,7 +43,10 @@ pub fn crate_incoherent_impls(
} }
/// On-demand query: yields a vector of the inherent impls for a specific type. /// On-demand query: yields a vector of the inherent impls for a specific type.
pub fn inherent_impls(tcx: TyCtxt<'_>, ty_def_id: LocalDefId) -> Result<&[DefId], ErrorGuaranteed> { pub(crate) fn inherent_impls(
tcx: TyCtxt<'_>,
ty_def_id: LocalDefId,
) -> Result<&[DefId], ErrorGuaranteed> {
let crate_map = tcx.crate_inherent_impls(())?; let crate_map = tcx.crate_inherent_impls(())?;
Ok(match crate_map.inherent_impls.get(&ty_def_id) { Ok(match crate_map.inherent_impls.get(&ty_def_id) {
Some(v) => &v[..], Some(v) => &v[..],

View file

@ -11,7 +11,10 @@ use rustc_span::{ErrorGuaranteed, Symbol};
use rustc_trait_selection::traits::{self, SkipLeakCheck}; use rustc_trait_selection::traits::{self, SkipLeakCheck};
use smallvec::SmallVec; use smallvec::SmallVec;
pub fn crate_inherent_impls_overlap_check(tcx: TyCtxt<'_>, (): ()) -> Result<(), ErrorGuaranteed> { pub(crate) fn crate_inherent_impls_overlap_check(
tcx: TyCtxt<'_>,
(): (),
) -> Result<(), ErrorGuaranteed> {
let mut inherent_overlap_checker = InherentOverlapChecker { tcx }; let mut inherent_overlap_checker = InherentOverlapChecker { tcx };
let mut res = Ok(()); let mut res = Ok(());
for id in tcx.hir().items() { for id in tcx.hir().items() {

View file

@ -123,7 +123,7 @@ fn enforce_empty_impls_for_marker_traits(
.emit()) .emit())
} }
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
use self::builtin::coerce_unsized_info; use self::builtin::coerce_unsized_info;
use self::inherent_impls::{crate_incoherent_impls, crate_inherent_impls, inherent_impls}; use self::inherent_impls::{crate_incoherent_impls, crate_inherent_impls, inherent_impls};
use self::inherent_impls_overlap::crate_inherent_impls_overlap_check; use self::inherent_impls_overlap::crate_inherent_impls_overlap_check;

View file

@ -2071,7 +2071,7 @@ fn is_late_bound_map(
} }
} }
pub fn deny_non_region_late_bound( fn deny_non_region_late_bound(
tcx: TyCtxt<'_>, tcx: TyCtxt<'_>,
bound_vars: &mut FxIndexMap<LocalDefId, ResolvedArg>, bound_vars: &mut FxIndexMap<LocalDefId, ResolvedArg>,
where_: &str, where_: &str,

View file

@ -725,7 +725,7 @@ fn check_feature_inherent_assoc_ty(tcx: TyCtxt<'_>, span: Span) {
} }
} }
pub fn type_alias_is_lazy<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> bool { pub(crate) fn type_alias_is_lazy<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> bool {
use hir::intravisit::Visitor; use hir::intravisit::Visitor;
if tcx.features().lazy_type_alias { if tcx.features().lazy_type_alias {
return true; return true;

View file

@ -6,7 +6,7 @@ use rustc_span::Span;
use rustc_type_ir::fold::TypeFoldable; use rustc_type_ir::fold::TypeFoldable;
#[derive(Clone, PartialEq, Eq, Hash, Debug)] #[derive(Clone, PartialEq, Eq, Hash, Debug)]
pub struct Parameter(pub u32); pub(crate) struct Parameter(pub u32);
impl From<ty::ParamTy> for Parameter { impl From<ty::ParamTy> for Parameter {
fn from(param: ty::ParamTy) -> Self { fn from(param: ty::ParamTy) -> Self {
@ -27,7 +27,7 @@ impl From<ty::ParamConst> for Parameter {
} }
/// Returns the set of parameters constrained by the impl header. /// Returns the set of parameters constrained by the impl header.
pub fn parameters_for_impl<'tcx>( pub(crate) fn parameters_for_impl<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
impl_self_ty: Ty<'tcx>, impl_self_ty: Ty<'tcx>,
impl_trait_ref: Option<ty::TraitRef<'tcx>>, impl_trait_ref: Option<ty::TraitRef<'tcx>>,
@ -44,7 +44,7 @@ pub fn parameters_for_impl<'tcx>(
/// uniquely determined by `value` (see RFC 447). If it is true, return the list /// uniquely determined by `value` (see RFC 447). If it is true, return the list
/// of parameters whose values are needed in order to constrain `value` - these /// of parameters whose values are needed in order to constrain `value` - these
/// differ, with the latter being a superset, in the presence of projections. /// differ, with the latter being a superset, in the presence of projections.
pub fn parameters_for<'tcx>( pub(crate) fn parameters_for<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
value: impl TypeFoldable<TyCtxt<'tcx>>, value: impl TypeFoldable<TyCtxt<'tcx>>,
include_nonconstraining: bool, include_nonconstraining: bool,
@ -102,7 +102,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ParameterCollector {
} }
} }
pub fn identify_constrained_generic_params<'tcx>( pub(crate) fn identify_constrained_generic_params<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
predicates: ty::GenericPredicates<'tcx>, predicates: ty::GenericPredicates<'tcx>,
impl_trait_ref: Option<ty::TraitRef<'tcx>>, impl_trait_ref: Option<ty::TraitRef<'tcx>>,
@ -156,7 +156,7 @@ pub fn identify_constrained_generic_params<'tcx>(
/// which is determined by 1, which requires `U`, that is determined /// which is determined by 1, which requires `U`, that is determined
/// by 0. I should probably pick a less tangled example, but I can't /// by 0. I should probably pick a less tangled example, but I can't
/// think of any. /// think of any.
pub fn setup_constraining_predicates<'tcx>( pub(crate) fn setup_constraining_predicates<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
predicates: &mut [(ty::Clause<'tcx>, Span)], predicates: &mut [(ty::Clause<'tcx>, Span)],
impl_trait_ref: Option<ty::TraitRef<'tcx>>, impl_trait_ref: Option<ty::TraitRef<'tcx>>,

View file

@ -11,15 +11,15 @@ use rustc_span::{Span, Symbol};
use crate::fluent_generated as fluent; use crate::fluent_generated as fluent;
mod pattern_types; mod pattern_types;
pub use pattern_types::*; pub(crate) use pattern_types::*;
pub mod wrong_number_of_generic_args; pub(crate) mod wrong_number_of_generic_args;
mod precise_captures; mod precise_captures;
pub(crate) use precise_captures::*; pub(crate) use precise_captures::*;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_ambiguous_assoc_item)] #[diag(hir_analysis_ambiguous_assoc_item)]
pub struct AmbiguousAssocItem<'a> { pub(crate) struct AmbiguousAssocItem<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -30,7 +30,7 @@ pub struct AmbiguousAssocItem<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_assoc_kind_mismatch)] #[diag(hir_analysis_assoc_kind_mismatch)]
pub struct AssocKindMismatch { pub(crate) struct AssocKindMismatch {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -52,7 +52,7 @@ pub struct AssocKindMismatch {
hir_analysis_assoc_kind_mismatch_wrap_in_braces_sugg, hir_analysis_assoc_kind_mismatch_wrap_in_braces_sugg,
applicability = "maybe-incorrect" applicability = "maybe-incorrect"
)] )]
pub struct AssocKindMismatchWrapInBracesSugg { pub(crate) struct AssocKindMismatchWrapInBracesSugg {
#[suggestion_part(code = "{{ ")] #[suggestion_part(code = "{{ ")]
pub lo: Span, pub lo: Span,
#[suggestion_part(code = " }}")] #[suggestion_part(code = " }}")]
@ -61,7 +61,7 @@ pub struct AssocKindMismatchWrapInBracesSugg {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_assoc_item_is_private, code = E0624)] #[diag(hir_analysis_assoc_item_is_private, code = E0624)]
pub struct AssocItemIsPrivate { pub(crate) struct AssocItemIsPrivate {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -73,7 +73,7 @@ pub struct AssocItemIsPrivate {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_assoc_item_not_found, code = E0220)] #[diag(hir_analysis_assoc_item_not_found, code = E0220)]
pub struct AssocItemNotFound<'a> { pub(crate) struct AssocItemNotFound<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub assoc_name: Ident, pub assoc_name: Ident,
@ -86,7 +86,7 @@ pub struct AssocItemNotFound<'a> {
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum AssocItemNotFoundLabel<'a> { pub(crate) enum AssocItemNotFoundLabel<'a> {
#[label(hir_analysis_assoc_item_not_found_label)] #[label(hir_analysis_assoc_item_not_found_label)]
NotFound { NotFound {
#[primary_span] #[primary_span]
@ -105,7 +105,7 @@ pub enum AssocItemNotFoundLabel<'a> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum AssocItemNotFoundSugg<'a> { pub(crate) enum AssocItemNotFoundSugg<'a> {
#[suggestion( #[suggestion(
hir_analysis_assoc_item_not_found_similar_sugg, hir_analysis_assoc_item_not_found_similar_sugg,
code = "{suggested_name}", code = "{suggested_name}",
@ -162,7 +162,7 @@ pub enum AssocItemNotFoundSugg<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_unrecognized_atomic_operation, code = E0092)] #[diag(hir_analysis_unrecognized_atomic_operation, code = E0092)]
pub struct UnrecognizedAtomicOperation<'a> { pub(crate) struct UnrecognizedAtomicOperation<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -171,7 +171,7 @@ pub struct UnrecognizedAtomicOperation<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_wrong_number_of_generic_arguments_to_intrinsic, code = E0094)] #[diag(hir_analysis_wrong_number_of_generic_arguments_to_intrinsic, code = E0094)]
pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> { pub(crate) struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -183,7 +183,7 @@ pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_unrecognized_intrinsic_function, code = E0093)] #[diag(hir_analysis_unrecognized_intrinsic_function, code = E0093)]
#[help] #[help]
pub struct UnrecognizedIntrinsicFunction { pub(crate) struct UnrecognizedIntrinsicFunction {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -192,7 +192,7 @@ pub struct UnrecognizedIntrinsicFunction {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_lifetimes_or_bounds_mismatch_on_trait, code = E0195)] #[diag(hir_analysis_lifetimes_or_bounds_mismatch_on_trait, code = E0195)]
pub struct LifetimesOrBoundsMismatchOnTrait { pub(crate) struct LifetimesOrBoundsMismatchOnTrait {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -208,14 +208,14 @@ pub struct LifetimesOrBoundsMismatchOnTrait {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_drop_impl_on_wrong_item, code = E0120)] #[diag(hir_analysis_drop_impl_on_wrong_item, code = E0120)]
pub struct DropImplOnWrongItem { pub(crate) struct DropImplOnWrongItem {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
pub enum FieldAlreadyDeclared { pub(crate) enum FieldAlreadyDeclared {
#[diag(hir_analysis_field_already_declared, code = E0124)] #[diag(hir_analysis_field_already_declared, code = E0124)]
NotNested { NotNested {
field_name: Symbol, field_name: Symbol,
@ -272,14 +272,14 @@ pub enum FieldAlreadyDeclared {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[help(hir_analysis_field_already_declared_nested_help)] #[help(hir_analysis_field_already_declared_nested_help)]
pub struct FieldAlreadyDeclaredNestedHelp { pub(crate) struct FieldAlreadyDeclaredNestedHelp {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_copy_impl_on_type_with_dtor, code = E0184)] #[diag(hir_analysis_copy_impl_on_type_with_dtor, code = E0184)]
pub struct CopyImplOnTypeWithDtor { pub(crate) struct CopyImplOnTypeWithDtor {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -287,14 +287,14 @@ pub struct CopyImplOnTypeWithDtor {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_multiple_relaxed_default_bounds, code = E0203)] #[diag(hir_analysis_multiple_relaxed_default_bounds, code = E0203)]
pub struct MultipleRelaxedDefaultBounds { pub(crate) struct MultipleRelaxedDefaultBounds {
#[primary_span] #[primary_span]
pub spans: Vec<Span>, pub spans: Vec<Span>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_copy_impl_on_non_adt, code = E0206)] #[diag(hir_analysis_copy_impl_on_non_adt, code = E0206)]
pub struct CopyImplOnNonAdt { pub(crate) struct CopyImplOnNonAdt {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -302,7 +302,7 @@ pub struct CopyImplOnNonAdt {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_const_param_ty_impl_on_unsized)] #[diag(hir_analysis_const_param_ty_impl_on_unsized)]
pub struct ConstParamTyImplOnUnsized { pub(crate) struct ConstParamTyImplOnUnsized {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -310,7 +310,7 @@ pub struct ConstParamTyImplOnUnsized {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_const_param_ty_impl_on_non_adt)] #[diag(hir_analysis_const_param_ty_impl_on_non_adt)]
pub struct ConstParamTyImplOnNonAdt { pub(crate) struct ConstParamTyImplOnNonAdt {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -318,7 +318,7 @@ pub struct ConstParamTyImplOnNonAdt {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_trait_object_declared_with_no_traits, code = E0224)] #[diag(hir_analysis_trait_object_declared_with_no_traits, code = E0224)]
pub struct TraitObjectDeclaredWithNoTraits { pub(crate) struct TraitObjectDeclaredWithNoTraits {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label(hir_analysis_alias_span)] #[label(hir_analysis_alias_span)]
@ -327,14 +327,14 @@ pub struct TraitObjectDeclaredWithNoTraits {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_ambiguous_lifetime_bound, code = E0227)] #[diag(hir_analysis_ambiguous_lifetime_bound, code = E0227)]
pub struct AmbiguousLifetimeBound { pub(crate) struct AmbiguousLifetimeBound {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_assoc_item_constraints_not_allowed_here, code = E0229)] #[diag(hir_analysis_assoc_item_constraints_not_allowed_here, code = E0229)]
pub struct AssocItemConstraintsNotAllowedHere { pub(crate) struct AssocItemConstraintsNotAllowedHere {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -383,7 +383,7 @@ pub(crate) struct EscapingBoundVarInTyOfAssocConstBinding<'tcx> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[help(hir_analysis_parenthesized_fn_trait_expansion)] #[help(hir_analysis_parenthesized_fn_trait_expansion)]
pub struct ParenthesizedFnTraitExpansion { pub(crate) struct ParenthesizedFnTraitExpansion {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
@ -392,7 +392,7 @@ pub struct ParenthesizedFnTraitExpansion {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_typeof_reserved_keyword_used, code = E0516)] #[diag(hir_analysis_typeof_reserved_keyword_used, code = E0516)]
pub struct TypeofReservedKeywordUsed<'tcx> { pub(crate) struct TypeofReservedKeywordUsed<'tcx> {
pub ty: Ty<'tcx>, pub ty: Ty<'tcx>,
#[primary_span] #[primary_span]
#[label] #[label]
@ -403,7 +403,7 @@ pub struct TypeofReservedKeywordUsed<'tcx> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_value_of_associated_struct_already_specified, code = E0719)] #[diag(hir_analysis_value_of_associated_struct_already_specified, code = E0719)]
pub struct ValueOfAssociatedStructAlreadySpecified { pub(crate) struct ValueOfAssociatedStructAlreadySpecified {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -416,7 +416,7 @@ pub struct ValueOfAssociatedStructAlreadySpecified {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_unconstrained_opaque_type)] #[diag(hir_analysis_unconstrained_opaque_type)]
#[note] #[note]
pub struct UnconstrainedOpaqueType { pub(crate) struct UnconstrainedOpaqueType {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub name: Symbol, pub name: Symbol,
@ -426,7 +426,7 @@ pub struct UnconstrainedOpaqueType {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_tait_forward_compat)] #[diag(hir_analysis_tait_forward_compat)]
#[note] #[note]
pub struct TaitForwardCompat { pub(crate) struct TaitForwardCompat {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[note] #[note]
@ -436,7 +436,7 @@ pub struct TaitForwardCompat {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_tait_forward_compat2)] #[diag(hir_analysis_tait_forward_compat2)]
#[note] #[note]
pub struct TaitForwardCompat2 { pub(crate) struct TaitForwardCompat2 {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[note(hir_analysis_opaque)] #[note(hir_analysis_opaque)]
@ -444,7 +444,7 @@ pub struct TaitForwardCompat2 {
pub opaque_type: String, pub opaque_type: String,
} }
pub struct MissingTypeParams { pub(crate) struct MissingTypeParams {
pub span: Span, pub span: Span,
pub def_span: Span, pub def_span: Span,
pub span_snippet: Option<String>, pub span_snippet: Option<String>,
@ -512,7 +512,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for MissingTypeParams {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_manual_implementation, code = E0183)] #[diag(hir_analysis_manual_implementation, code = E0183)]
#[help] #[help]
pub struct ManualImplementation { pub(crate) struct ManualImplementation {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -521,14 +521,14 @@ pub struct ManualImplementation {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_generic_args_on_overridden_impl)] #[diag(hir_analysis_generic_args_on_overridden_impl)]
pub struct GenericArgsOnOverriddenImpl { pub(crate) struct GenericArgsOnOverriddenImpl {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_const_impl_for_non_const_trait)] #[diag(hir_analysis_const_impl_for_non_const_trait)]
pub struct ConstImplForNonConstTrait { pub(crate) struct ConstImplForNonConstTrait {
#[primary_span] #[primary_span]
pub trait_ref_span: Span, pub trait_ref_span: Span,
pub trait_name: String, pub trait_name: String,
@ -542,7 +542,7 @@ pub struct ConstImplForNonConstTrait {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_const_bound_for_non_const_trait)] #[diag(hir_analysis_const_bound_for_non_const_trait)]
pub struct ConstBoundForNonConstTrait { pub(crate) struct ConstBoundForNonConstTrait {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub modifier: &'static str, pub modifier: &'static str,
@ -550,7 +550,7 @@ pub struct ConstBoundForNonConstTrait {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_self_in_impl_self)] #[diag(hir_analysis_self_in_impl_self)]
pub struct SelfInImplSelf { pub(crate) struct SelfInImplSelf {
#[primary_span] #[primary_span]
pub span: MultiSpan, pub span: MultiSpan,
#[note] #[note]
@ -567,7 +567,7 @@ pub(crate) struct LinkageType {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[help] #[help]
#[diag(hir_analysis_auto_deref_reached_recursion_limit, code = E0055)] #[diag(hir_analysis_auto_deref_reached_recursion_limit, code = E0055)]
pub struct AutoDerefReachedRecursionLimit<'a> { pub(crate) struct AutoDerefReachedRecursionLimit<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -736,7 +736,7 @@ pub(crate) struct InvalidUnionField {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_invalid_unnamed_field_ty)] #[diag(hir_analysis_invalid_unnamed_field_ty)]
pub struct InvalidUnnamedFieldTy { pub(crate) struct InvalidUnnamedFieldTy {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
@ -894,7 +894,7 @@ pub(crate) struct SIMDFFIHighlyExperimental {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
pub enum ImplNotMarkedDefault { pub(crate) enum ImplNotMarkedDefault {
#[diag(hir_analysis_impl_not_marked_default, code = E0520)] #[diag(hir_analysis_impl_not_marked_default, code = E0520)]
#[note] #[note]
Ok { Ok {
@ -1137,7 +1137,7 @@ pub(crate) enum LateBoundInApit {
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(hir_analysis_unused_associated_type_bounds)] #[diag(hir_analysis_unused_associated_type_bounds)]
#[note] #[note]
pub struct UnusedAssociatedTypeBounds { pub(crate) struct UnusedAssociatedTypeBounds {
#[suggestion(code = "")] #[suggestion(code = "")]
pub span: Span, pub span: Span,
} }
@ -1162,7 +1162,7 @@ pub(crate) struct ReturnPositionImplTraitInTraitRefined<'tcx> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_inherent_ty_outside, code = E0390)] #[diag(hir_analysis_inherent_ty_outside, code = E0390)]
#[help] #[help]
pub struct InherentTyOutside { pub(crate) struct InherentTyOutside {
#[primary_span] #[primary_span]
#[help(hir_analysis_span_help)] #[help(hir_analysis_span_help)]
pub span: Span, pub span: Span,
@ -1170,7 +1170,7 @@ pub struct InherentTyOutside {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_coerce_unsized_may, code = E0378)] #[diag(hir_analysis_coerce_unsized_may, code = E0378)]
pub struct DispatchFromDynCoercion<'a> { pub(crate) struct DispatchFromDynCoercion<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub trait_name: &'a str, pub trait_name: &'a str,
@ -1182,7 +1182,7 @@ pub struct DispatchFromDynCoercion<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_dispatch_from_dyn_repr, code = E0378)] #[diag(hir_analysis_dispatch_from_dyn_repr, code = E0378)]
pub struct DispatchFromDynRepr { pub(crate) struct DispatchFromDynRepr {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
@ -1190,7 +1190,7 @@ pub struct DispatchFromDynRepr {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_inherent_ty_outside_relevant, code = E0390)] #[diag(hir_analysis_inherent_ty_outside_relevant, code = E0390)]
#[help] #[help]
pub struct InherentTyOutsideRelevant { pub(crate) struct InherentTyOutsideRelevant {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[help(hir_analysis_span_help)] #[help(hir_analysis_span_help)]
@ -1200,7 +1200,7 @@ pub struct InherentTyOutsideRelevant {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_inherent_ty_outside_new, code = E0116)] #[diag(hir_analysis_inherent_ty_outside_new, code = E0116)]
#[note] #[note]
pub struct InherentTyOutsideNew { pub(crate) struct InherentTyOutsideNew {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1209,7 +1209,7 @@ pub struct InherentTyOutsideNew {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_inherent_ty_outside_primitive, code = E0390)] #[diag(hir_analysis_inherent_ty_outside_primitive, code = E0390)]
#[help] #[help]
pub struct InherentTyOutsidePrimitive { pub(crate) struct InherentTyOutsidePrimitive {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[help(hir_analysis_span_help)] #[help(hir_analysis_span_help)]
@ -1219,7 +1219,7 @@ pub struct InherentTyOutsidePrimitive {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_inherent_primitive_ty, code = E0390)] #[diag(hir_analysis_inherent_primitive_ty, code = E0390)]
#[help] #[help]
pub struct InherentPrimitiveTy<'a> { pub(crate) struct InherentPrimitiveTy<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[subdiagnostic] #[subdiagnostic]
@ -1228,14 +1228,14 @@ pub struct InherentPrimitiveTy<'a> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[note(hir_analysis_inherent_primitive_ty_note)] #[note(hir_analysis_inherent_primitive_ty_note)]
pub struct InherentPrimitiveTyNote<'a> { pub(crate) struct InherentPrimitiveTyNote<'a> {
pub subty: Ty<'a>, pub subty: Ty<'a>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_inherent_dyn, code = E0785)] #[diag(hir_analysis_inherent_dyn, code = E0785)]
#[note] #[note]
pub struct InherentDyn { pub(crate) struct InherentDyn {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1244,7 +1244,7 @@ pub struct InherentDyn {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_inherent_nominal, code = E0118)] #[diag(hir_analysis_inherent_nominal, code = E0118)]
#[note] #[note]
pub struct InherentNominal { pub(crate) struct InherentNominal {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1253,7 +1253,7 @@ pub struct InherentNominal {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_dispatch_from_dyn_zst, code = E0378)] #[diag(hir_analysis_dispatch_from_dyn_zst, code = E0378)]
#[note] #[note]
pub struct DispatchFromDynZST<'a> { pub(crate) struct DispatchFromDynZST<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub name: Symbol, pub name: Symbol,
@ -1262,7 +1262,7 @@ pub struct DispatchFromDynZST<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_coerce_unsized_may, code = E0378)] #[diag(hir_analysis_coerce_unsized_may, code = E0378)]
pub struct DispatchFromDynSingle<'a> { pub(crate) struct DispatchFromDynSingle<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub trait_name: &'a str, pub trait_name: &'a str,
@ -1273,7 +1273,7 @@ pub struct DispatchFromDynSingle<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_dispatch_from_dyn_multi, code = E0378)] #[diag(hir_analysis_dispatch_from_dyn_multi, code = E0378)]
#[note] #[note]
pub struct DispatchFromDynMulti { pub(crate) struct DispatchFromDynMulti {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[note(hir_analysis_coercions_note)] #[note(hir_analysis_coercions_note)]
@ -1284,7 +1284,7 @@ pub struct DispatchFromDynMulti {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_coerce_unsized_may, code = E0376)] #[diag(hir_analysis_coerce_unsized_may, code = E0376)]
pub struct DispatchFromDynStruct<'a> { pub(crate) struct DispatchFromDynStruct<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub trait_name: &'a str, pub trait_name: &'a str,
@ -1292,7 +1292,7 @@ pub struct DispatchFromDynStruct<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_coerce_unsized_may, code = E0377)] #[diag(hir_analysis_coerce_unsized_may, code = E0377)]
pub struct DispatchFromDynSame<'a> { pub(crate) struct DispatchFromDynSame<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub trait_name: &'a str, pub trait_name: &'a str,
@ -1304,7 +1304,7 @@ pub struct DispatchFromDynSame<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_coerce_unsized_may, code = E0374)] #[diag(hir_analysis_coerce_unsized_may, code = E0374)]
pub struct CoerceUnsizedOneField<'a> { pub(crate) struct CoerceUnsizedOneField<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub trait_name: &'a str, pub trait_name: &'a str,
@ -1315,7 +1315,7 @@ pub struct CoerceUnsizedOneField<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_coerce_unsized_multi, code = E0375)] #[diag(hir_analysis_coerce_unsized_multi, code = E0375)]
#[note] #[note]
pub struct CoerceUnsizedMulti { pub(crate) struct CoerceUnsizedMulti {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1327,7 +1327,7 @@ pub struct CoerceUnsizedMulti {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_coerce_unsized_may, code = E0378)] #[diag(hir_analysis_coerce_unsized_may, code = E0378)]
pub struct CoerceUnsizedMay<'a> { pub(crate) struct CoerceUnsizedMay<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub trait_name: &'a str, pub trait_name: &'a str,
@ -1335,7 +1335,7 @@ pub struct CoerceUnsizedMay<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_trait_cannot_impl_for_ty, code = E0204)] #[diag(hir_analysis_trait_cannot_impl_for_ty, code = E0204)]
pub struct TraitCannotImplForTy { pub(crate) struct TraitCannotImplForTy {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub trait_name: String, pub trait_name: String,
@ -1347,7 +1347,7 @@ pub struct TraitCannotImplForTy {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[note(hir_analysis_requires_note)] #[note(hir_analysis_requires_note)]
pub struct ImplForTyRequires { pub(crate) struct ImplForTyRequires {
#[primary_span] #[primary_span]
pub span: MultiSpan, pub span: MultiSpan,
pub error_predicate: String, pub error_predicate: String,
@ -1358,7 +1358,7 @@ pub struct ImplForTyRequires {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_traits_with_defualt_impl, code = E0321)] #[diag(hir_analysis_traits_with_defualt_impl, code = E0321)]
#[note] #[note]
pub struct TraitsWithDefaultImpl<'a> { pub(crate) struct TraitsWithDefaultImpl<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub traits: String, pub traits: String,
@ -1368,7 +1368,7 @@ pub struct TraitsWithDefaultImpl<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_cross_crate_traits, code = E0321)] #[diag(hir_analysis_cross_crate_traits, code = E0321)]
pub struct CrossCrateTraits<'a> { pub(crate) struct CrossCrateTraits<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1378,7 +1378,7 @@ pub struct CrossCrateTraits<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_cross_crate_traits_defined, code = E0321)] #[diag(hir_analysis_cross_crate_traits_defined, code = E0321)]
pub struct CrossCrateTraitsDefined { pub(crate) struct CrossCrateTraitsDefined {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1390,7 +1390,7 @@ pub struct CrossCrateTraitsDefined {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_ty_param_first_local, code = E0210)] #[diag(hir_analysis_ty_param_first_local, code = E0210)]
#[note] #[note]
pub struct TyParamFirstLocal<'tcx> { pub(crate) struct TyParamFirstLocal<'tcx> {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1403,7 +1403,7 @@ pub struct TyParamFirstLocal<'tcx> {
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(hir_analysis_ty_param_first_local, code = E0210)] #[diag(hir_analysis_ty_param_first_local, code = E0210)]
#[note] #[note]
pub struct TyParamFirstLocalLint<'tcx> { pub(crate) struct TyParamFirstLocalLint<'tcx> {
#[label] #[label]
pub span: Span, pub span: Span,
#[note(hir_analysis_case_note)] #[note(hir_analysis_case_note)]
@ -1415,7 +1415,7 @@ pub struct TyParamFirstLocalLint<'tcx> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_ty_param_some, code = E0210)] #[diag(hir_analysis_ty_param_some, code = E0210)]
#[note] #[note]
pub struct TyParamSome { pub(crate) struct TyParamSome {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1427,7 +1427,7 @@ pub struct TyParamSome {
#[derive(LintDiagnostic)] #[derive(LintDiagnostic)]
#[diag(hir_analysis_ty_param_some, code = E0210)] #[diag(hir_analysis_ty_param_some, code = E0210)]
#[note] #[note]
pub struct TyParamSomeLint { pub(crate) struct TyParamSomeLint {
#[label] #[label]
pub span: Span, pub span: Span,
#[note(hir_analysis_only_note)] #[note(hir_analysis_only_note)]
@ -1436,7 +1436,7 @@ pub struct TyParamSomeLint {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
pub enum OnlyCurrentTraits { pub(crate) enum OnlyCurrentTraits {
#[diag(hir_analysis_only_current_traits_outside, code = E0117)] #[diag(hir_analysis_only_current_traits_outside, code = E0117)]
Outside { Outside {
#[primary_span] #[primary_span]
@ -1465,20 +1465,20 @@ pub enum OnlyCurrentTraits {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[label(hir_analysis_only_current_traits_opaque)] #[label(hir_analysis_only_current_traits_opaque)]
pub struct OnlyCurrentTraitsOpaque { pub(crate) struct OnlyCurrentTraitsOpaque {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[label(hir_analysis_only_current_traits_foreign)] #[label(hir_analysis_only_current_traits_foreign)]
pub struct OnlyCurrentTraitsForeign { pub(crate) struct OnlyCurrentTraitsForeign {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[label(hir_analysis_only_current_traits_name)] #[label(hir_analysis_only_current_traits_name)]
pub struct OnlyCurrentTraitsName<'a> { pub(crate) struct OnlyCurrentTraitsName<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub name: &'a str, pub name: &'a str,
@ -1486,7 +1486,7 @@ pub struct OnlyCurrentTraitsName<'a> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[label(hir_analysis_only_current_traits_pointer)] #[label(hir_analysis_only_current_traits_pointer)]
pub struct OnlyCurrentTraitsPointer<'a> { pub(crate) struct OnlyCurrentTraitsPointer<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub pointer: Ty<'a>, pub pointer: Ty<'a>,
@ -1494,7 +1494,7 @@ pub struct OnlyCurrentTraitsPointer<'a> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[label(hir_analysis_only_current_traits_ty)] #[label(hir_analysis_only_current_traits_ty)]
pub struct OnlyCurrentTraitsTy<'a> { pub(crate) struct OnlyCurrentTraitsTy<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub ty: Ty<'a>, pub ty: Ty<'a>,
@ -1502,7 +1502,7 @@ pub struct OnlyCurrentTraitsTy<'a> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[label(hir_analysis_only_current_traits_adt)] #[label(hir_analysis_only_current_traits_adt)]
pub struct OnlyCurrentTraitsAdt { pub(crate) struct OnlyCurrentTraitsAdt {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub name: String, pub name: String,
@ -1513,11 +1513,11 @@ pub struct OnlyCurrentTraitsAdt {
hir_analysis_only_current_traits_pointer_sugg, hir_analysis_only_current_traits_pointer_sugg,
applicability = "maybe-incorrect" applicability = "maybe-incorrect"
)] )]
pub struct OnlyCurrentTraitsPointerSugg<'a> { pub(crate) struct OnlyCurrentTraitsPointerSugg<'a> {
#[suggestion_part(code = "WrapperType")] #[suggestion_part(code = "WrapperType")]
pub wrapper_span: Span, pub wrapper_span: Span,
#[suggestion_part(code = "struct WrapperType(*{mut_key}{ptr_ty});\n\n")] #[suggestion_part(code = "struct WrapperType(*{mut_key}{ptr_ty});\n\n")]
pub struct_span: Span, pub(crate) struct_span: Span,
pub mut_key: &'a str, pub mut_key: &'a str,
pub ptr_ty: Ty<'a>, pub ptr_ty: Ty<'a>,
} }
@ -1525,7 +1525,7 @@ pub struct OnlyCurrentTraitsPointerSugg<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_static_mut_ref, code = E0796)] #[diag(hir_analysis_static_mut_ref, code = E0796)]
#[note] #[note]
pub struct StaticMutRef<'a> { pub(crate) struct StaticMutRef<'a> {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1535,7 +1535,7 @@ pub struct StaticMutRef<'a> {
} }
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
pub enum MutRefSugg { pub(crate) enum MutRefSugg {
#[multipart_suggestion( #[multipart_suggestion(
hir_analysis_suggestion, hir_analysis_suggestion,
style = "verbose", style = "verbose",
@ -1565,7 +1565,7 @@ pub enum MutRefSugg {
#[diag(hir_analysis_static_mut_refs_lint)] #[diag(hir_analysis_static_mut_refs_lint)]
#[note] #[note]
#[note(hir_analysis_why_note)] #[note(hir_analysis_why_note)]
pub struct RefOfMutStatic<'a> { pub(crate) struct RefOfMutStatic<'a> {
#[label] #[label]
pub span: Span, pub span: Span,
#[subdiagnostic] #[subdiagnostic]
@ -1575,7 +1575,7 @@ pub struct RefOfMutStatic<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_not_supported_delegation)] #[diag(hir_analysis_not_supported_delegation)]
pub struct UnsupportedDelegation<'a> { pub(crate) struct UnsupportedDelegation<'a> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub descr: &'a str, pub descr: &'a str,
@ -1585,7 +1585,7 @@ pub struct UnsupportedDelegation<'a> {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_method_should_return_future)] #[diag(hir_analysis_method_should_return_future)]
pub struct MethodShouldReturnFuture { pub(crate) struct MethodShouldReturnFuture {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub method_name: Symbol, pub method_name: Symbol,
@ -1649,7 +1649,7 @@ pub(crate) struct UnconstrainedGenericParameter {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
pub enum UnnamedFieldsRepr<'a> { pub(crate) enum UnnamedFieldsRepr<'a> {
#[diag(hir_analysis_unnamed_fields_repr_missing_repr_c)] #[diag(hir_analysis_unnamed_fields_repr_missing_repr_c)]
MissingReprC { MissingReprC {
#[primary_span] #[primary_span]
@ -1678,14 +1678,14 @@ pub enum UnnamedFieldsRepr<'a> {
#[derive(Subdiagnostic)] #[derive(Subdiagnostic)]
#[note(hir_analysis_unnamed_fields_repr_field_defined)] #[note(hir_analysis_unnamed_fields_repr_field_defined)]
pub struct UnnamedFieldsReprFieldDefined { pub(crate) struct UnnamedFieldsReprFieldDefined {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_opaque_captures_higher_ranked_lifetime, code = E0657)] #[diag(hir_analysis_opaque_captures_higher_ranked_lifetime, code = E0657)]
pub struct OpaqueCapturesHigherRankedLifetime { pub(crate) struct OpaqueCapturesHigherRankedLifetime {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label] #[label]
@ -1697,7 +1697,7 @@ pub struct OpaqueCapturesHigherRankedLifetime {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_pattern_type_non_const_range)] #[diag(hir_analysis_pattern_type_non_const_range)]
pub struct NonConstRange { pub(crate) struct NonConstRange {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }
@ -1706,7 +1706,7 @@ pub struct NonConstRange {
#[diag(hir_analysis_invalid_receiver_ty, code = E0307)] #[diag(hir_analysis_invalid_receiver_ty, code = E0307)]
#[note] #[note]
#[help(hir_analysis_invalid_receiver_ty_help)] #[help(hir_analysis_invalid_receiver_ty_help)]
pub struct InvalidReceiverTy<'tcx> { pub(crate) struct InvalidReceiverTy<'tcx> {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub receiver_ty: Ty<'tcx>, pub receiver_ty: Ty<'tcx>,
@ -1716,12 +1716,12 @@ pub struct InvalidReceiverTy<'tcx> {
#[diag(hir_analysis_effects_without_next_solver)] #[diag(hir_analysis_effects_without_next_solver)]
#[note] #[note]
#[help] #[help]
pub struct EffectsWithoutNextSolver; pub(crate) struct EffectsWithoutNextSolver;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_cmse_call_inputs_stack_spill, code = E0798)] #[diag(hir_analysis_cmse_call_inputs_stack_spill, code = E0798)]
#[note] #[note]
pub struct CmseCallInputsStackSpill { pub(crate) struct CmseCallInputsStackSpill {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1732,7 +1732,7 @@ pub struct CmseCallInputsStackSpill {
#[diag(hir_analysis_cmse_call_output_stack_spill, code = E0798)] #[diag(hir_analysis_cmse_call_output_stack_spill, code = E0798)]
#[note(hir_analysis_note1)] #[note(hir_analysis_note1)]
#[note(hir_analysis_note2)] #[note(hir_analysis_note2)]
pub struct CmseCallOutputStackSpill { pub(crate) struct CmseCallOutputStackSpill {
#[primary_span] #[primary_span]
#[label] #[label]
pub span: Span, pub span: Span,
@ -1740,7 +1740,7 @@ pub struct CmseCallOutputStackSpill {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_cmse_call_generic, code = E0798)] #[diag(hir_analysis_cmse_call_generic, code = E0798)]
pub struct CmseCallGeneric { pub(crate) struct CmseCallGeneric {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }

View file

@ -3,7 +3,7 @@ use rustc_span::Span;
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_pattern_type_wild_pat)] #[diag(hir_analysis_pattern_type_wild_pat)]
pub struct WildPatTy { pub(crate) struct WildPatTy {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
} }

View file

@ -4,7 +4,7 @@ use rustc_span::{Span, Symbol};
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_param_not_captured)] #[diag(hir_analysis_param_not_captured)]
#[note] #[note]
pub struct ParamNotCaptured { pub(crate) struct ParamNotCaptured {
#[primary_span] #[primary_span]
pub opaque_span: Span, pub opaque_span: Span,
#[label] #[label]
@ -15,7 +15,7 @@ pub struct ParamNotCaptured {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_self_ty_not_captured)] #[diag(hir_analysis_self_ty_not_captured)]
#[note] #[note]
pub struct SelfTyNotCaptured { pub(crate) struct SelfTyNotCaptured {
#[primary_span] #[primary_span]
pub opaque_span: Span, pub opaque_span: Span,
#[label] #[label]
@ -24,7 +24,7 @@ pub struct SelfTyNotCaptured {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_lifetime_not_captured)] #[diag(hir_analysis_lifetime_not_captured)]
pub struct LifetimeNotCaptured { pub(crate) struct LifetimeNotCaptured {
#[primary_span] #[primary_span]
pub use_span: Span, pub use_span: Span,
#[label(hir_analysis_param_label)] #[label(hir_analysis_param_label)]
@ -35,7 +35,7 @@ pub struct LifetimeNotCaptured {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_bad_precise_capture)] #[diag(hir_analysis_bad_precise_capture)]
pub struct BadPreciseCapture { pub(crate) struct BadPreciseCapture {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
pub kind: &'static str, pub kind: &'static str,
@ -44,7 +44,7 @@ pub struct BadPreciseCapture {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_precise_capture_self_alias)] #[diag(hir_analysis_precise_capture_self_alias)]
pub struct PreciseCaptureSelfAlias { pub(crate) struct PreciseCaptureSelfAlias {
#[primary_span] #[primary_span]
pub span: Span, pub span: Span,
#[label] #[label]
@ -54,7 +54,7 @@ pub struct PreciseCaptureSelfAlias {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_duplicate_precise_capture)] #[diag(hir_analysis_duplicate_precise_capture)]
pub struct DuplicatePreciseCapture { pub(crate) struct DuplicatePreciseCapture {
#[primary_span] #[primary_span]
pub first_span: Span, pub first_span: Span,
pub name: Symbol, pub name: Symbol,
@ -64,7 +64,7 @@ pub struct DuplicatePreciseCapture {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(hir_analysis_lifetime_must_be_first)] #[diag(hir_analysis_lifetime_must_be_first)]
pub struct LifetimesMustBeFirst { pub(crate) struct LifetimesMustBeFirst {
#[primary_span] #[primary_span]
pub lifetime_span: Span, pub lifetime_span: Span,
pub name: Symbol, pub name: Symbol,

View file

@ -8,7 +8,7 @@ use rustc_span::def_id::DefId;
use GenericArgsInfo::*; use GenericArgsInfo::*;
/// Handles the `wrong number of type / lifetime / ... arguments` family of error messages. /// Handles the `wrong number of type / lifetime / ... arguments` family of error messages.
pub struct WrongNumberOfGenericArgs<'a, 'tcx> { pub(crate) struct WrongNumberOfGenericArgs<'a, 'tcx> {
pub(crate) tcx: TyCtxt<'tcx>, pub(crate) tcx: TyCtxt<'tcx>,
pub(crate) angle_brackets: AngleBrackets, pub(crate) angle_brackets: AngleBrackets,
@ -49,7 +49,7 @@ pub(crate) enum AngleBrackets {
// Information about the kind of arguments that are either missing or are unexpected // Information about the kind of arguments that are either missing or are unexpected
#[derive(Debug)] #[derive(Debug)]
pub enum GenericArgsInfo { pub(crate) enum GenericArgsInfo {
MissingLifetimes { MissingLifetimes {
num_missing_args: usize, num_missing_args: usize,
}, },
@ -87,7 +87,7 @@ pub enum GenericArgsInfo {
} }
impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
pub fn new( pub(crate) fn new(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
gen_args_info: GenericArgsInfo, gen_args_info: GenericArgsInfo,
path_segment: &'a hir::PathSegment<'_>, path_segment: &'a hir::PathSegment<'_>,

View file

@ -11,7 +11,7 @@ use crate::errors;
/// Check conditions on inputs and outputs that the cmse ABIs impose: arguments and results MUST be /// Check conditions on inputs and outputs that the cmse ABIs impose: arguments and results MUST be
/// returned via registers (i.e. MUST NOT spill to the stack). LLVM will also validate these /// returned via registers (i.e. MUST NOT spill to the stack). LLVM will also validate these
/// conditions, but by checking them here rustc can emit nicer error messages. /// conditions, but by checking them here rustc can emit nicer error messages.
pub fn validate_cmse_abi<'tcx>( pub(crate) fn validate_cmse_abi<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
dcx: DiagCtxtHandle<'_>, dcx: DiagCtxtHandle<'_>,
hir_id: HirId, hir_id: HirId,

View file

@ -11,7 +11,7 @@ use rustc_trait_selection::traits::{self, ObligationCtxt};
use crate::collect::ItemCtxt; use crate::collect::ItemCtxt;
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { diagnostic_hir_wf_check, ..*providers }; *providers = Providers { diagnostic_hir_wf_check, ..*providers };
} }

View file

@ -53,7 +53,10 @@ mod min_specialization;
/// impl<'a> Trait<Foo> for Bar { type X = &'a i32; } /// impl<'a> Trait<Foo> for Bar { type X = &'a i32; }
/// // ^ 'a is unused and appears in assoc type, error /// // ^ 'a is unused and appears in assoc type, error
/// ``` /// ```
pub fn check_impl_wf(tcx: TyCtxt<'_>, impl_def_id: LocalDefId) -> Result<(), ErrorGuaranteed> { pub(crate) fn check_impl_wf(
tcx: TyCtxt<'_>,
impl_def_id: LocalDefId,
) -> Result<(), ErrorGuaranteed> {
let min_specialization = tcx.features().min_specialization; let min_specialization = tcx.features().min_specialization;
let mut res = Ok(()); let mut res = Ok(());
debug_assert_matches!(tcx.def_kind(impl_def_id), DefKind::Impl { .. }); debug_assert_matches!(tcx.def_kind(impl_def_id), DefKind::Impl { .. });

View file

@ -72,6 +72,7 @@ This API is completely unstable and subject to change.
#![feature(slice_partition_dedup)] #![feature(slice_partition_dedup)]
#![feature(try_blocks)] #![feature(try_blocks)]
#![feature(unwrap_infallible)] #![feature(unwrap_infallible)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end // tidy-alphabetical-end
#[macro_use] #[macro_use]

View file

@ -5,12 +5,12 @@ use rustc_middle::ty::{self, OutlivesPredicate, TyCtxt};
use super::utils::*; use super::utils::*;
#[derive(Debug)] #[derive(Debug)]
pub struct ExplicitPredicatesMap<'tcx> { pub(crate) struct ExplicitPredicatesMap<'tcx> {
map: FxIndexMap<DefId, ty::EarlyBinder<'tcx, RequiredPredicates<'tcx>>>, map: FxIndexMap<DefId, ty::EarlyBinder<'tcx, RequiredPredicates<'tcx>>>,
} }
impl<'tcx> ExplicitPredicatesMap<'tcx> { impl<'tcx> ExplicitPredicatesMap<'tcx> {
pub fn new() -> ExplicitPredicatesMap<'tcx> { pub(crate) fn new() -> ExplicitPredicatesMap<'tcx> {
ExplicitPredicatesMap { map: FxIndexMap::default() } ExplicitPredicatesMap { map: FxIndexMap::default() }
} }

View file

@ -9,7 +9,7 @@ mod explicit;
mod implicit_infer; mod implicit_infer;
mod utils; mod utils;
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { inferred_outlives_of, inferred_outlives_crate, ..*providers }; *providers = Providers { inferred_outlives_of, inferred_outlives_crate, ..*providers };
} }

View file

@ -12,7 +12,7 @@ use rustc_middle::{bug, span_bug};
use super::terms::VarianceTerm::*; use super::terms::VarianceTerm::*;
use super::terms::*; use super::terms::*;
pub struct ConstraintContext<'a, 'tcx> { pub(crate) struct ConstraintContext<'a, 'tcx> {
pub terms_cx: TermsContext<'a, 'tcx>, pub terms_cx: TermsContext<'a, 'tcx>,
// These are pointers to common `ConstantTerm` instances // These are pointers to common `ConstantTerm` instances
@ -27,7 +27,7 @@ pub struct ConstraintContext<'a, 'tcx> {
/// Declares that the variable `decl_id` appears in a location with /// Declares that the variable `decl_id` appears in a location with
/// variance `variance`. /// variance `variance`.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub struct Constraint<'a> { pub(crate) struct Constraint<'a> {
pub inferred: InferredIndex, pub inferred: InferredIndex,
pub variance: &'a VarianceTerm<'a>, pub variance: &'a VarianceTerm<'a>,
} }
@ -41,11 +41,11 @@ pub struct Constraint<'a> {
/// ``` /// ```
/// then while we are visiting `Bar<T>`, the `CurrentItem` would have /// then while we are visiting `Bar<T>`, the `CurrentItem` would have
/// the `DefId` and the start of `Foo`'s inferreds. /// the `DefId` and the start of `Foo`'s inferreds.
pub struct CurrentItem { struct CurrentItem {
inferred_start: InferredIndex, inferred_start: InferredIndex,
} }
pub fn add_constraints_from_crate<'a, 'tcx>( pub(crate) fn add_constraints_from_crate<'a, 'tcx>(
terms_cx: TermsContext<'a, 'tcx>, terms_cx: TermsContext<'a, 'tcx>,
) -> ConstraintContext<'a, 'tcx> { ) -> ConstraintContext<'a, 'tcx> {
let tcx = terms_cx.tcx; let tcx = terms_cx.tcx;

View file

@ -28,7 +28,7 @@ pub(crate) mod dump;
/// Code for transforming variances. /// Code for transforming variances.
mod xform; mod xform;
pub fn provide(providers: &mut Providers) { pub(crate) fn provide(providers: &mut Providers) {
*providers = Providers { variances_of, crate_variances, ..*providers }; *providers = Providers { variances_of, crate_variances, ..*providers };
} }

View file

@ -21,7 +21,7 @@ struct SolveContext<'a, 'tcx> {
solutions: Vec<ty::Variance>, solutions: Vec<ty::Variance>,
} }
pub fn solve_constraints<'tcx>( pub(crate) fn solve_constraints<'tcx>(
constraints_cx: ConstraintContext<'_, 'tcx>, constraints_cx: ConstraintContext<'_, 'tcx>,
) -> ty::CrateVariancesMap<'tcx> { ) -> ty::CrateVariancesMap<'tcx> {
let ConstraintContext { terms_cx, constraints, .. } = constraints_cx; let ConstraintContext { terms_cx, constraints, .. } = constraints_cx;

View file

@ -18,13 +18,13 @@ use rustc_middle::ty::{self, TyCtxt};
use self::VarianceTerm::*; use self::VarianceTerm::*;
pub type VarianceTermPtr<'a> = &'a VarianceTerm<'a>; pub(crate) type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
pub struct InferredIndex(pub usize); pub(crate) struct InferredIndex(pub usize);
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub enum VarianceTerm<'a> { pub(crate) enum VarianceTerm<'a> {
ConstantTerm(ty::Variance), ConstantTerm(ty::Variance),
TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>), TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>),
InferredTerm(InferredIndex), InferredTerm(InferredIndex),
@ -45,7 +45,7 @@ impl<'a> fmt::Debug for VarianceTerm<'a> {
/// The first pass over the crate simply builds up the set of inferreds. /// The first pass over the crate simply builds up the set of inferreds.
pub struct TermsContext<'a, 'tcx> { pub(crate) struct TermsContext<'a, 'tcx> {
pub tcx: TyCtxt<'tcx>, pub tcx: TyCtxt<'tcx>,
pub arena: &'a DroplessArena, pub arena: &'a DroplessArena,
@ -62,7 +62,7 @@ pub struct TermsContext<'a, 'tcx> {
pub inferred_terms: Vec<VarianceTermPtr<'a>>, pub inferred_terms: Vec<VarianceTermPtr<'a>>,
} }
pub fn determine_parameters_to_be_inferred<'a, 'tcx>( pub(crate) fn determine_parameters_to_be_inferred<'a, 'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
arena: &'a DroplessArena, arena: &'a DroplessArena,
) -> TermsContext<'a, 'tcx> { ) -> TermsContext<'a, 'tcx> {

View file

@ -1,6 +1,6 @@
use rustc_middle::ty; use rustc_middle::ty;
pub fn glb(v1: ty::Variance, v2: ty::Variance) -> ty::Variance { pub(crate) fn glb(v1: ty::Variance, v2: ty::Variance) -> ty::Variance {
// Greatest lower bound of the variance lattice as // Greatest lower bound of the variance lattice as
// defined in The Paper: // defined in The Paper:
// //