mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Add warn(unreachable_pub)
to rustc_hir_analysis
.
This commit is contained in:
parent
bffa2244ed
commit
5acf4e7b4b
@ -26,13 +26,13 @@ use rustc_span::Span;
|
||||
/// 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
|
||||
#[derive(Default, PartialEq, Eq, Clone, Debug)]
|
||||
pub struct Bounds<'tcx> {
|
||||
pub(crate) struct Bounds<'tcx> {
|
||||
clauses: Vec<(ty::Clause<'tcx>, Span)>,
|
||||
effects_min_tys: FxIndexMap<Ty<'tcx>, Span>,
|
||||
}
|
||||
|
||||
impl<'tcx> Bounds<'tcx> {
|
||||
pub fn push_region_bound(
|
||||
pub(crate) fn push_region_bound(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'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));
|
||||
}
|
||||
|
||||
pub fn push_trait_bound(
|
||||
pub(crate) fn push_trait_bound(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
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));
|
||||
}
|
||||
|
||||
pub fn push_projection_bound(
|
||||
pub(crate) fn push_projection_bound(
|
||||
&mut self,
|
||||
tcx: TyCtxt<'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 trait_ref = ty::TraitRef::new(tcx, sized_def_id, [ty]);
|
||||
// Preferable to put this obligation first, since we report better errors for sized ambiguity.
|
||||
self.clauses.insert(0, (trait_ref.upcast(tcx), span));
|
||||
}
|
||||
|
||||
pub fn clauses(
|
||||
pub(crate) fn clauses(
|
||||
&self,
|
||||
// FIXME(effects): remove tcx
|
||||
_tcx: TyCtxt<'tcx>,
|
||||
@ -181,7 +181,7 @@ impl<'tcx> Bounds<'tcx> {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
if let ty::Adt(def, args) = t.kind()
|
||||
&& def.is_struct()
|
||||
|
@ -6,7 +6,7 @@ use rustc_span::Span;
|
||||
use crate::errors;
|
||||
|
||||
/// 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 hir_id = expr.hir_id;
|
||||
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
|
||||
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
|
||||
&& let hir::PatKind::Binding(ba, _, _, _) = loc.pat.kind
|
||||
&& let hir::ByRef::Yes(rmutbl) = ba.0
|
||||
|
@ -22,7 +22,7 @@ use rustc_span::source_map;
|
||||
use super::errs::{maybe_expr_static_mut, maybe_stmt_static_mut};
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct Context {
|
||||
struct Context {
|
||||
/// The scope that contains any new variables declared, plus its depth in
|
||||
/// the scope tree.
|
||||
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
|
||||
/// type checker even when the HIR hasn't changed, and in those cases
|
||||
/// 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);
|
||||
if typeck_root_def_id != def_id {
|
||||
return tcx.region_scope_tree(typeck_root_def_id);
|
||||
|
@ -5,7 +5,7 @@ use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::lint;
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { check_unused_traits, ..*providers };
|
||||
}
|
||||
|
||||
|
@ -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>,
|
||||
impl_did: LocalDefId,
|
||||
) -> Result<CoerceUnsizedInfo, ErrorGuaranteed> {
|
||||
|
@ -19,7 +19,7 @@ use rustc_span::ErrorGuaranteed;
|
||||
use crate::errors;
|
||||
|
||||
/// 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<'_>,
|
||||
(): (),
|
||||
) -> Result<&'_ CrateInherentImpls, ErrorGuaranteed> {
|
||||
@ -32,7 +32,7 @@ pub fn crate_inherent_impls(
|
||||
Ok(tcx.arena.alloc(collect.impls_map))
|
||||
}
|
||||
|
||||
pub fn crate_incoherent_impls(
|
||||
pub(crate) fn crate_incoherent_impls(
|
||||
tcx: TyCtxt<'_>,
|
||||
simp: SimplifiedType,
|
||||
) -> 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.
|
||||
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(())?;
|
||||
Ok(match crate_map.inherent_impls.get(&ty_def_id) {
|
||||
Some(v) => &v[..],
|
||||
|
@ -11,7 +11,10 @@ use rustc_span::{ErrorGuaranteed, Symbol};
|
||||
use rustc_trait_selection::traits::{self, SkipLeakCheck};
|
||||
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 res = Ok(());
|
||||
for id in tcx.hir().items() {
|
||||
|
@ -123,7 +123,7 @@ fn enforce_empty_impls_for_marker_traits(
|
||||
.emit())
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
use self::builtin::coerce_unsized_info;
|
||||
use self::inherent_impls::{crate_incoherent_impls, crate_inherent_impls, inherent_impls};
|
||||
use self::inherent_impls_overlap::crate_inherent_impls_overlap_check;
|
||||
|
@ -2071,7 +2071,7 @@ fn is_late_bound_map(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn deny_non_region_late_bound(
|
||||
fn deny_non_region_late_bound(
|
||||
tcx: TyCtxt<'_>,
|
||||
bound_vars: &mut FxIndexMap<LocalDefId, ResolvedArg>,
|
||||
where_: &str,
|
||||
|
@ -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;
|
||||
if tcx.features().lazy_type_alias {
|
||||
return true;
|
||||
|
@ -6,7 +6,7 @@ use rustc_span::Span;
|
||||
use rustc_type_ir::fold::TypeFoldable;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
|
||||
pub struct Parameter(pub u32);
|
||||
pub(crate) struct Parameter(pub u32);
|
||||
|
||||
impl From<ty::ParamTy> for Parameter {
|
||||
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.
|
||||
pub fn parameters_for_impl<'tcx>(
|
||||
pub(crate) fn parameters_for_impl<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
impl_self_ty: Ty<'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
|
||||
/// of parameters whose values are needed in order to constrain `value` - these
|
||||
/// 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>,
|
||||
value: impl TypeFoldable<TyCtxt<'tcx>>,
|
||||
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>,
|
||||
predicates: ty::GenericPredicates<'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
|
||||
/// by 0. I should probably pick a less tangled example, but I can't
|
||||
/// think of any.
|
||||
pub fn setup_constraining_predicates<'tcx>(
|
||||
pub(crate) fn setup_constraining_predicates<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
predicates: &mut [(ty::Clause<'tcx>, Span)],
|
||||
impl_trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
|
@ -11,15 +11,15 @@ use rustc_span::{Span, Symbol};
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
mod pattern_types;
|
||||
pub use pattern_types::*;
|
||||
pub mod wrong_number_of_generic_args;
|
||||
pub(crate) use pattern_types::*;
|
||||
pub(crate) mod wrong_number_of_generic_args;
|
||||
|
||||
mod precise_captures;
|
||||
pub(crate) use precise_captures::*;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_ambiguous_assoc_item)]
|
||||
pub struct AmbiguousAssocItem<'a> {
|
||||
pub(crate) struct AmbiguousAssocItem<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -30,7 +30,7 @@ pub struct AmbiguousAssocItem<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_assoc_kind_mismatch)]
|
||||
pub struct AssocKindMismatch {
|
||||
pub(crate) struct AssocKindMismatch {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -52,7 +52,7 @@ pub struct AssocKindMismatch {
|
||||
hir_analysis_assoc_kind_mismatch_wrap_in_braces_sugg,
|
||||
applicability = "maybe-incorrect"
|
||||
)]
|
||||
pub struct AssocKindMismatchWrapInBracesSugg {
|
||||
pub(crate) struct AssocKindMismatchWrapInBracesSugg {
|
||||
#[suggestion_part(code = "{{ ")]
|
||||
pub lo: Span,
|
||||
#[suggestion_part(code = " }}")]
|
||||
@ -61,7 +61,7 @@ pub struct AssocKindMismatchWrapInBracesSugg {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_assoc_item_is_private, code = E0624)]
|
||||
pub struct AssocItemIsPrivate {
|
||||
pub(crate) struct AssocItemIsPrivate {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -73,7 +73,7 @@ pub struct AssocItemIsPrivate {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_assoc_item_not_found, code = E0220)]
|
||||
pub struct AssocItemNotFound<'a> {
|
||||
pub(crate) struct AssocItemNotFound<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub assoc_name: Ident,
|
||||
@ -86,7 +86,7 @@ pub struct AssocItemNotFound<'a> {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub enum AssocItemNotFoundLabel<'a> {
|
||||
pub(crate) enum AssocItemNotFoundLabel<'a> {
|
||||
#[label(hir_analysis_assoc_item_not_found_label)]
|
||||
NotFound {
|
||||
#[primary_span]
|
||||
@ -105,7 +105,7 @@ pub enum AssocItemNotFoundLabel<'a> {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
|
||||
pub enum AssocItemNotFoundSugg<'a> {
|
||||
pub(crate) enum AssocItemNotFoundSugg<'a> {
|
||||
#[suggestion(
|
||||
hir_analysis_assoc_item_not_found_similar_sugg,
|
||||
code = "{suggested_name}",
|
||||
@ -162,7 +162,7 @@ pub enum AssocItemNotFoundSugg<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_unrecognized_atomic_operation, code = E0092)]
|
||||
pub struct UnrecognizedAtomicOperation<'a> {
|
||||
pub(crate) struct UnrecognizedAtomicOperation<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -171,7 +171,7 @@ pub struct UnrecognizedAtomicOperation<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_wrong_number_of_generic_arguments_to_intrinsic, code = E0094)]
|
||||
pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
|
||||
pub(crate) struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -183,7 +183,7 @@ pub struct WrongNumberOfGenericArgumentsToIntrinsic<'a> {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_unrecognized_intrinsic_function, code = E0093)]
|
||||
#[help]
|
||||
pub struct UnrecognizedIntrinsicFunction {
|
||||
pub(crate) struct UnrecognizedIntrinsicFunction {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -192,7 +192,7 @@ pub struct UnrecognizedIntrinsicFunction {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_lifetimes_or_bounds_mismatch_on_trait, code = E0195)]
|
||||
pub struct LifetimesOrBoundsMismatchOnTrait {
|
||||
pub(crate) struct LifetimesOrBoundsMismatchOnTrait {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -208,14 +208,14 @@ pub struct LifetimesOrBoundsMismatchOnTrait {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_drop_impl_on_wrong_item, code = E0120)]
|
||||
pub struct DropImplOnWrongItem {
|
||||
pub(crate) struct DropImplOnWrongItem {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub enum FieldAlreadyDeclared {
|
||||
pub(crate) enum FieldAlreadyDeclared {
|
||||
#[diag(hir_analysis_field_already_declared, code = E0124)]
|
||||
NotNested {
|
||||
field_name: Symbol,
|
||||
@ -272,14 +272,14 @@ pub enum FieldAlreadyDeclared {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[help(hir_analysis_field_already_declared_nested_help)]
|
||||
pub struct FieldAlreadyDeclaredNestedHelp {
|
||||
pub(crate) struct FieldAlreadyDeclaredNestedHelp {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_copy_impl_on_type_with_dtor, code = E0184)]
|
||||
pub struct CopyImplOnTypeWithDtor {
|
||||
pub(crate) struct CopyImplOnTypeWithDtor {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -287,14 +287,14 @@ pub struct CopyImplOnTypeWithDtor {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_multiple_relaxed_default_bounds, code = E0203)]
|
||||
pub struct MultipleRelaxedDefaultBounds {
|
||||
pub(crate) struct MultipleRelaxedDefaultBounds {
|
||||
#[primary_span]
|
||||
pub spans: Vec<Span>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_copy_impl_on_non_adt, code = E0206)]
|
||||
pub struct CopyImplOnNonAdt {
|
||||
pub(crate) struct CopyImplOnNonAdt {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -302,7 +302,7 @@ pub struct CopyImplOnNonAdt {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_const_param_ty_impl_on_unsized)]
|
||||
pub struct ConstParamTyImplOnUnsized {
|
||||
pub(crate) struct ConstParamTyImplOnUnsized {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -310,7 +310,7 @@ pub struct ConstParamTyImplOnUnsized {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_const_param_ty_impl_on_non_adt)]
|
||||
pub struct ConstParamTyImplOnNonAdt {
|
||||
pub(crate) struct ConstParamTyImplOnNonAdt {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -318,7 +318,7 @@ pub struct ConstParamTyImplOnNonAdt {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_trait_object_declared_with_no_traits, code = E0224)]
|
||||
pub struct TraitObjectDeclaredWithNoTraits {
|
||||
pub(crate) struct TraitObjectDeclaredWithNoTraits {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[label(hir_analysis_alias_span)]
|
||||
@ -327,14 +327,14 @@ pub struct TraitObjectDeclaredWithNoTraits {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_ambiguous_lifetime_bound, code = E0227)]
|
||||
pub struct AmbiguousLifetimeBound {
|
||||
pub(crate) struct AmbiguousLifetimeBound {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_assoc_item_constraints_not_allowed_here, code = E0229)]
|
||||
pub struct AssocItemConstraintsNotAllowedHere {
|
||||
pub(crate) struct AssocItemConstraintsNotAllowedHere {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -383,7 +383,7 @@ pub(crate) struct EscapingBoundVarInTyOfAssocConstBinding<'tcx> {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[help(hir_analysis_parenthesized_fn_trait_expansion)]
|
||||
pub struct ParenthesizedFnTraitExpansion {
|
||||
pub(crate) struct ParenthesizedFnTraitExpansion {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
||||
@ -392,7 +392,7 @@ pub struct ParenthesizedFnTraitExpansion {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_typeof_reserved_keyword_used, code = E0516)]
|
||||
pub struct TypeofReservedKeywordUsed<'tcx> {
|
||||
pub(crate) struct TypeofReservedKeywordUsed<'tcx> {
|
||||
pub ty: Ty<'tcx>,
|
||||
#[primary_span]
|
||||
#[label]
|
||||
@ -403,7 +403,7 @@ pub struct TypeofReservedKeywordUsed<'tcx> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_value_of_associated_struct_already_specified, code = E0719)]
|
||||
pub struct ValueOfAssociatedStructAlreadySpecified {
|
||||
pub(crate) struct ValueOfAssociatedStructAlreadySpecified {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -416,7 +416,7 @@ pub struct ValueOfAssociatedStructAlreadySpecified {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_unconstrained_opaque_type)]
|
||||
#[note]
|
||||
pub struct UnconstrainedOpaqueType {
|
||||
pub(crate) struct UnconstrainedOpaqueType {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: Symbol,
|
||||
@ -426,7 +426,7 @@ pub struct UnconstrainedOpaqueType {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_tait_forward_compat)]
|
||||
#[note]
|
||||
pub struct TaitForwardCompat {
|
||||
pub(crate) struct TaitForwardCompat {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[note]
|
||||
@ -436,7 +436,7 @@ pub struct TaitForwardCompat {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_tait_forward_compat2)]
|
||||
#[note]
|
||||
pub struct TaitForwardCompat2 {
|
||||
pub(crate) struct TaitForwardCompat2 {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[note(hir_analysis_opaque)]
|
||||
@ -444,7 +444,7 @@ pub struct TaitForwardCompat2 {
|
||||
pub opaque_type: String,
|
||||
}
|
||||
|
||||
pub struct MissingTypeParams {
|
||||
pub(crate) struct MissingTypeParams {
|
||||
pub span: Span,
|
||||
pub def_span: Span,
|
||||
pub span_snippet: Option<String>,
|
||||
@ -512,7 +512,7 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for MissingTypeParams {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_manual_implementation, code = E0183)]
|
||||
#[help]
|
||||
pub struct ManualImplementation {
|
||||
pub(crate) struct ManualImplementation {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -521,14 +521,14 @@ pub struct ManualImplementation {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_generic_args_on_overridden_impl)]
|
||||
pub struct GenericArgsOnOverriddenImpl {
|
||||
pub(crate) struct GenericArgsOnOverriddenImpl {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_const_impl_for_non_const_trait)]
|
||||
pub struct ConstImplForNonConstTrait {
|
||||
pub(crate) struct ConstImplForNonConstTrait {
|
||||
#[primary_span]
|
||||
pub trait_ref_span: Span,
|
||||
pub trait_name: String,
|
||||
@ -542,7 +542,7 @@ pub struct ConstImplForNonConstTrait {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_const_bound_for_non_const_trait)]
|
||||
pub struct ConstBoundForNonConstTrait {
|
||||
pub(crate) struct ConstBoundForNonConstTrait {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub modifier: &'static str,
|
||||
@ -550,7 +550,7 @@ pub struct ConstBoundForNonConstTrait {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_self_in_impl_self)]
|
||||
pub struct SelfInImplSelf {
|
||||
pub(crate) struct SelfInImplSelf {
|
||||
#[primary_span]
|
||||
pub span: MultiSpan,
|
||||
#[note]
|
||||
@ -567,7 +567,7 @@ pub(crate) struct LinkageType {
|
||||
#[derive(Diagnostic)]
|
||||
#[help]
|
||||
#[diag(hir_analysis_auto_deref_reached_recursion_limit, code = E0055)]
|
||||
pub struct AutoDerefReachedRecursionLimit<'a> {
|
||||
pub(crate) struct AutoDerefReachedRecursionLimit<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -736,7 +736,7 @@ pub(crate) struct InvalidUnionField {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_invalid_unnamed_field_ty)]
|
||||
pub struct InvalidUnnamedFieldTy {
|
||||
pub(crate) struct InvalidUnnamedFieldTy {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
@ -894,7 +894,7 @@ pub(crate) struct SIMDFFIHighlyExperimental {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub enum ImplNotMarkedDefault {
|
||||
pub(crate) enum ImplNotMarkedDefault {
|
||||
#[diag(hir_analysis_impl_not_marked_default, code = E0520)]
|
||||
#[note]
|
||||
Ok {
|
||||
@ -1137,7 +1137,7 @@ pub(crate) enum LateBoundInApit {
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(hir_analysis_unused_associated_type_bounds)]
|
||||
#[note]
|
||||
pub struct UnusedAssociatedTypeBounds {
|
||||
pub(crate) struct UnusedAssociatedTypeBounds {
|
||||
#[suggestion(code = "")]
|
||||
pub span: Span,
|
||||
}
|
||||
@ -1162,7 +1162,7 @@ pub(crate) struct ReturnPositionImplTraitInTraitRefined<'tcx> {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_ty_outside, code = E0390)]
|
||||
#[help]
|
||||
pub struct InherentTyOutside {
|
||||
pub(crate) struct InherentTyOutside {
|
||||
#[primary_span]
|
||||
#[help(hir_analysis_span_help)]
|
||||
pub span: Span,
|
||||
@ -1170,7 +1170,7 @@ pub struct InherentTyOutside {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0378)]
|
||||
pub struct DispatchFromDynCoercion<'a> {
|
||||
pub(crate) struct DispatchFromDynCoercion<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub trait_name: &'a str,
|
||||
@ -1182,7 +1182,7 @@ pub struct DispatchFromDynCoercion<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_dispatch_from_dyn_repr, code = E0378)]
|
||||
pub struct DispatchFromDynRepr {
|
||||
pub(crate) struct DispatchFromDynRepr {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
@ -1190,7 +1190,7 @@ pub struct DispatchFromDynRepr {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_ty_outside_relevant, code = E0390)]
|
||||
#[help]
|
||||
pub struct InherentTyOutsideRelevant {
|
||||
pub(crate) struct InherentTyOutsideRelevant {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[help(hir_analysis_span_help)]
|
||||
@ -1200,7 +1200,7 @@ pub struct InherentTyOutsideRelevant {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_ty_outside_new, code = E0116)]
|
||||
#[note]
|
||||
pub struct InherentTyOutsideNew {
|
||||
pub(crate) struct InherentTyOutsideNew {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1209,7 +1209,7 @@ pub struct InherentTyOutsideNew {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_ty_outside_primitive, code = E0390)]
|
||||
#[help]
|
||||
pub struct InherentTyOutsidePrimitive {
|
||||
pub(crate) struct InherentTyOutsidePrimitive {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[help(hir_analysis_span_help)]
|
||||
@ -1219,7 +1219,7 @@ pub struct InherentTyOutsidePrimitive {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_primitive_ty, code = E0390)]
|
||||
#[help]
|
||||
pub struct InherentPrimitiveTy<'a> {
|
||||
pub(crate) struct InherentPrimitiveTy<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[subdiagnostic]
|
||||
@ -1228,14 +1228,14 @@ pub struct InherentPrimitiveTy<'a> {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(hir_analysis_inherent_primitive_ty_note)]
|
||||
pub struct InherentPrimitiveTyNote<'a> {
|
||||
pub(crate) struct InherentPrimitiveTyNote<'a> {
|
||||
pub subty: Ty<'a>,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_dyn, code = E0785)]
|
||||
#[note]
|
||||
pub struct InherentDyn {
|
||||
pub(crate) struct InherentDyn {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1244,7 +1244,7 @@ pub struct InherentDyn {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_inherent_nominal, code = E0118)]
|
||||
#[note]
|
||||
pub struct InherentNominal {
|
||||
pub(crate) struct InherentNominal {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1253,7 +1253,7 @@ pub struct InherentNominal {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_dispatch_from_dyn_zst, code = E0378)]
|
||||
#[note]
|
||||
pub struct DispatchFromDynZST<'a> {
|
||||
pub(crate) struct DispatchFromDynZST<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: Symbol,
|
||||
@ -1262,7 +1262,7 @@ pub struct DispatchFromDynZST<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0378)]
|
||||
pub struct DispatchFromDynSingle<'a> {
|
||||
pub(crate) struct DispatchFromDynSingle<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub trait_name: &'a str,
|
||||
@ -1273,7 +1273,7 @@ pub struct DispatchFromDynSingle<'a> {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_dispatch_from_dyn_multi, code = E0378)]
|
||||
#[note]
|
||||
pub struct DispatchFromDynMulti {
|
||||
pub(crate) struct DispatchFromDynMulti {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[note(hir_analysis_coercions_note)]
|
||||
@ -1284,7 +1284,7 @@ pub struct DispatchFromDynMulti {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0376)]
|
||||
pub struct DispatchFromDynStruct<'a> {
|
||||
pub(crate) struct DispatchFromDynStruct<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub trait_name: &'a str,
|
||||
@ -1292,7 +1292,7 @@ pub struct DispatchFromDynStruct<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0377)]
|
||||
pub struct DispatchFromDynSame<'a> {
|
||||
pub(crate) struct DispatchFromDynSame<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub trait_name: &'a str,
|
||||
@ -1304,7 +1304,7 @@ pub struct DispatchFromDynSame<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0374)]
|
||||
pub struct CoerceUnsizedOneField<'a> {
|
||||
pub(crate) struct CoerceUnsizedOneField<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub trait_name: &'a str,
|
||||
@ -1315,7 +1315,7 @@ pub struct CoerceUnsizedOneField<'a> {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_multi, code = E0375)]
|
||||
#[note]
|
||||
pub struct CoerceUnsizedMulti {
|
||||
pub(crate) struct CoerceUnsizedMulti {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1327,7 +1327,7 @@ pub struct CoerceUnsizedMulti {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_coerce_unsized_may, code = E0378)]
|
||||
pub struct CoerceUnsizedMay<'a> {
|
||||
pub(crate) struct CoerceUnsizedMay<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub trait_name: &'a str,
|
||||
@ -1335,7 +1335,7 @@ pub struct CoerceUnsizedMay<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_trait_cannot_impl_for_ty, code = E0204)]
|
||||
pub struct TraitCannotImplForTy {
|
||||
pub(crate) struct TraitCannotImplForTy {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub trait_name: String,
|
||||
@ -1347,7 +1347,7 @@ pub struct TraitCannotImplForTy {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(hir_analysis_requires_note)]
|
||||
pub struct ImplForTyRequires {
|
||||
pub(crate) struct ImplForTyRequires {
|
||||
#[primary_span]
|
||||
pub span: MultiSpan,
|
||||
pub error_predicate: String,
|
||||
@ -1358,7 +1358,7 @@ pub struct ImplForTyRequires {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_traits_with_defualt_impl, code = E0321)]
|
||||
#[note]
|
||||
pub struct TraitsWithDefaultImpl<'a> {
|
||||
pub(crate) struct TraitsWithDefaultImpl<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub traits: String,
|
||||
@ -1368,7 +1368,7 @@ pub struct TraitsWithDefaultImpl<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_cross_crate_traits, code = E0321)]
|
||||
pub struct CrossCrateTraits<'a> {
|
||||
pub(crate) struct CrossCrateTraits<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1378,7 +1378,7 @@ pub struct CrossCrateTraits<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_cross_crate_traits_defined, code = E0321)]
|
||||
pub struct CrossCrateTraitsDefined {
|
||||
pub(crate) struct CrossCrateTraitsDefined {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1390,7 +1390,7 @@ pub struct CrossCrateTraitsDefined {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_ty_param_first_local, code = E0210)]
|
||||
#[note]
|
||||
pub struct TyParamFirstLocal<'tcx> {
|
||||
pub(crate) struct TyParamFirstLocal<'tcx> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1403,7 +1403,7 @@ pub struct TyParamFirstLocal<'tcx> {
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(hir_analysis_ty_param_first_local, code = E0210)]
|
||||
#[note]
|
||||
pub struct TyParamFirstLocalLint<'tcx> {
|
||||
pub(crate) struct TyParamFirstLocalLint<'tcx> {
|
||||
#[label]
|
||||
pub span: Span,
|
||||
#[note(hir_analysis_case_note)]
|
||||
@ -1415,7 +1415,7 @@ pub struct TyParamFirstLocalLint<'tcx> {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_ty_param_some, code = E0210)]
|
||||
#[note]
|
||||
pub struct TyParamSome {
|
||||
pub(crate) struct TyParamSome {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1427,7 +1427,7 @@ pub struct TyParamSome {
|
||||
#[derive(LintDiagnostic)]
|
||||
#[diag(hir_analysis_ty_param_some, code = E0210)]
|
||||
#[note]
|
||||
pub struct TyParamSomeLint {
|
||||
pub(crate) struct TyParamSomeLint {
|
||||
#[label]
|
||||
pub span: Span,
|
||||
#[note(hir_analysis_only_note)]
|
||||
@ -1436,7 +1436,7 @@ pub struct TyParamSomeLint {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub enum OnlyCurrentTraits {
|
||||
pub(crate) enum OnlyCurrentTraits {
|
||||
#[diag(hir_analysis_only_current_traits_outside, code = E0117)]
|
||||
Outside {
|
||||
#[primary_span]
|
||||
@ -1465,20 +1465,20 @@ pub enum OnlyCurrentTraits {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(hir_analysis_only_current_traits_opaque)]
|
||||
pub struct OnlyCurrentTraitsOpaque {
|
||||
pub(crate) struct OnlyCurrentTraitsOpaque {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(hir_analysis_only_current_traits_foreign)]
|
||||
pub struct OnlyCurrentTraitsForeign {
|
||||
pub(crate) struct OnlyCurrentTraitsForeign {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(hir_analysis_only_current_traits_name)]
|
||||
pub struct OnlyCurrentTraitsName<'a> {
|
||||
pub(crate) struct OnlyCurrentTraitsName<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: &'a str,
|
||||
@ -1486,7 +1486,7 @@ pub struct OnlyCurrentTraitsName<'a> {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(hir_analysis_only_current_traits_pointer)]
|
||||
pub struct OnlyCurrentTraitsPointer<'a> {
|
||||
pub(crate) struct OnlyCurrentTraitsPointer<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub pointer: Ty<'a>,
|
||||
@ -1494,7 +1494,7 @@ pub struct OnlyCurrentTraitsPointer<'a> {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(hir_analysis_only_current_traits_ty)]
|
||||
pub struct OnlyCurrentTraitsTy<'a> {
|
||||
pub(crate) struct OnlyCurrentTraitsTy<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub ty: Ty<'a>,
|
||||
@ -1502,7 +1502,7 @@ pub struct OnlyCurrentTraitsTy<'a> {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[label(hir_analysis_only_current_traits_adt)]
|
||||
pub struct OnlyCurrentTraitsAdt {
|
||||
pub(crate) struct OnlyCurrentTraitsAdt {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub name: String,
|
||||
@ -1513,11 +1513,11 @@ pub struct OnlyCurrentTraitsAdt {
|
||||
hir_analysis_only_current_traits_pointer_sugg,
|
||||
applicability = "maybe-incorrect"
|
||||
)]
|
||||
pub struct OnlyCurrentTraitsPointerSugg<'a> {
|
||||
pub(crate) struct OnlyCurrentTraitsPointerSugg<'a> {
|
||||
#[suggestion_part(code = "WrapperType")]
|
||||
pub wrapper_span: Span,
|
||||
#[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 ptr_ty: Ty<'a>,
|
||||
}
|
||||
@ -1525,7 +1525,7 @@ pub struct OnlyCurrentTraitsPointerSugg<'a> {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_static_mut_ref, code = E0796)]
|
||||
#[note]
|
||||
pub struct StaticMutRef<'a> {
|
||||
pub(crate) struct StaticMutRef<'a> {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1535,7 +1535,7 @@ pub struct StaticMutRef<'a> {
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub enum MutRefSugg {
|
||||
pub(crate) enum MutRefSugg {
|
||||
#[multipart_suggestion(
|
||||
hir_analysis_suggestion,
|
||||
style = "verbose",
|
||||
@ -1565,7 +1565,7 @@ pub enum MutRefSugg {
|
||||
#[diag(hir_analysis_static_mut_refs_lint)]
|
||||
#[note]
|
||||
#[note(hir_analysis_why_note)]
|
||||
pub struct RefOfMutStatic<'a> {
|
||||
pub(crate) struct RefOfMutStatic<'a> {
|
||||
#[label]
|
||||
pub span: Span,
|
||||
#[subdiagnostic]
|
||||
@ -1575,7 +1575,7 @@ pub struct RefOfMutStatic<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_not_supported_delegation)]
|
||||
pub struct UnsupportedDelegation<'a> {
|
||||
pub(crate) struct UnsupportedDelegation<'a> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub descr: &'a str,
|
||||
@ -1585,7 +1585,7 @@ pub struct UnsupportedDelegation<'a> {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_method_should_return_future)]
|
||||
pub struct MethodShouldReturnFuture {
|
||||
pub(crate) struct MethodShouldReturnFuture {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub method_name: Symbol,
|
||||
@ -1649,7 +1649,7 @@ pub(crate) struct UnconstrainedGenericParameter {
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub enum UnnamedFieldsRepr<'a> {
|
||||
pub(crate) enum UnnamedFieldsRepr<'a> {
|
||||
#[diag(hir_analysis_unnamed_fields_repr_missing_repr_c)]
|
||||
MissingReprC {
|
||||
#[primary_span]
|
||||
@ -1678,14 +1678,14 @@ pub enum UnnamedFieldsRepr<'a> {
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[note(hir_analysis_unnamed_fields_repr_field_defined)]
|
||||
pub struct UnnamedFieldsReprFieldDefined {
|
||||
pub(crate) struct UnnamedFieldsReprFieldDefined {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_opaque_captures_higher_ranked_lifetime, code = E0657)]
|
||||
pub struct OpaqueCapturesHigherRankedLifetime {
|
||||
pub(crate) struct OpaqueCapturesHigherRankedLifetime {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[label]
|
||||
@ -1697,7 +1697,7 @@ pub struct OpaqueCapturesHigherRankedLifetime {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_pattern_type_non_const_range)]
|
||||
pub struct NonConstRange {
|
||||
pub(crate) struct NonConstRange {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
@ -1706,7 +1706,7 @@ pub struct NonConstRange {
|
||||
#[diag(hir_analysis_invalid_receiver_ty, code = E0307)]
|
||||
#[note]
|
||||
#[help(hir_analysis_invalid_receiver_ty_help)]
|
||||
pub struct InvalidReceiverTy<'tcx> {
|
||||
pub(crate) struct InvalidReceiverTy<'tcx> {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub receiver_ty: Ty<'tcx>,
|
||||
@ -1716,12 +1716,12 @@ pub struct InvalidReceiverTy<'tcx> {
|
||||
#[diag(hir_analysis_effects_without_next_solver)]
|
||||
#[note]
|
||||
#[help]
|
||||
pub struct EffectsWithoutNextSolver;
|
||||
pub(crate) struct EffectsWithoutNextSolver;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_cmse_call_inputs_stack_spill, code = E0798)]
|
||||
#[note]
|
||||
pub struct CmseCallInputsStackSpill {
|
||||
pub(crate) struct CmseCallInputsStackSpill {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1732,7 +1732,7 @@ pub struct CmseCallInputsStackSpill {
|
||||
#[diag(hir_analysis_cmse_call_output_stack_spill, code = E0798)]
|
||||
#[note(hir_analysis_note1)]
|
||||
#[note(hir_analysis_note2)]
|
||||
pub struct CmseCallOutputStackSpill {
|
||||
pub(crate) struct CmseCallOutputStackSpill {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
@ -1740,7 +1740,7 @@ pub struct CmseCallOutputStackSpill {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_cmse_call_generic, code = E0798)]
|
||||
pub struct CmseCallGeneric {
|
||||
pub(crate) struct CmseCallGeneric {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use rustc_span::Span;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_pattern_type_wild_pat)]
|
||||
pub struct WildPatTy {
|
||||
pub(crate) struct WildPatTy {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ use rustc_span::{Span, Symbol};
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_param_not_captured)]
|
||||
#[note]
|
||||
pub struct ParamNotCaptured {
|
||||
pub(crate) struct ParamNotCaptured {
|
||||
#[primary_span]
|
||||
pub opaque_span: Span,
|
||||
#[label]
|
||||
@ -15,7 +15,7 @@ pub struct ParamNotCaptured {
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_self_ty_not_captured)]
|
||||
#[note]
|
||||
pub struct SelfTyNotCaptured {
|
||||
pub(crate) struct SelfTyNotCaptured {
|
||||
#[primary_span]
|
||||
pub opaque_span: Span,
|
||||
#[label]
|
||||
@ -24,7 +24,7 @@ pub struct SelfTyNotCaptured {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_lifetime_not_captured)]
|
||||
pub struct LifetimeNotCaptured {
|
||||
pub(crate) struct LifetimeNotCaptured {
|
||||
#[primary_span]
|
||||
pub use_span: Span,
|
||||
#[label(hir_analysis_param_label)]
|
||||
@ -35,7 +35,7 @@ pub struct LifetimeNotCaptured {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_bad_precise_capture)]
|
||||
pub struct BadPreciseCapture {
|
||||
pub(crate) struct BadPreciseCapture {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
pub kind: &'static str,
|
||||
@ -44,7 +44,7 @@ pub struct BadPreciseCapture {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_precise_capture_self_alias)]
|
||||
pub struct PreciseCaptureSelfAlias {
|
||||
pub(crate) struct PreciseCaptureSelfAlias {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[label]
|
||||
@ -54,7 +54,7 @@ pub struct PreciseCaptureSelfAlias {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_duplicate_precise_capture)]
|
||||
pub struct DuplicatePreciseCapture {
|
||||
pub(crate) struct DuplicatePreciseCapture {
|
||||
#[primary_span]
|
||||
pub first_span: Span,
|
||||
pub name: Symbol,
|
||||
@ -64,7 +64,7 @@ pub struct DuplicatePreciseCapture {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_lifetime_must_be_first)]
|
||||
pub struct LifetimesMustBeFirst {
|
||||
pub(crate) struct LifetimesMustBeFirst {
|
||||
#[primary_span]
|
||||
pub lifetime_span: Span,
|
||||
pub name: Symbol,
|
||||
|
@ -8,7 +8,7 @@ use rustc_span::def_id::DefId;
|
||||
use GenericArgsInfo::*;
|
||||
|
||||
/// 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) angle_brackets: AngleBrackets,
|
||||
@ -49,7 +49,7 @@ pub(crate) enum AngleBrackets {
|
||||
|
||||
// Information about the kind of arguments that are either missing or are unexpected
|
||||
#[derive(Debug)]
|
||||
pub enum GenericArgsInfo {
|
||||
pub(crate) enum GenericArgsInfo {
|
||||
MissingLifetimes {
|
||||
num_missing_args: usize,
|
||||
},
|
||||
@ -87,7 +87,7 @@ pub enum GenericArgsInfo {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
||||
pub fn new(
|
||||
pub(crate) fn new(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
gen_args_info: GenericArgsInfo,
|
||||
path_segment: &'a hir::PathSegment<'_>,
|
||||
|
@ -11,7 +11,7 @@ use crate::errors;
|
||||
/// 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
|
||||
/// 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>,
|
||||
dcx: DiagCtxtHandle<'_>,
|
||||
hir_id: HirId,
|
||||
|
@ -11,7 +11,7 @@ use rustc_trait_selection::traits::{self, ObligationCtxt};
|
||||
|
||||
use crate::collect::ItemCtxt;
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { diagnostic_hir_wf_check, ..*providers };
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,10 @@ mod min_specialization;
|
||||
/// impl<'a> Trait<Foo> for Bar { type X = &'a i32; }
|
||||
/// // ^ '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 mut res = Ok(());
|
||||
debug_assert_matches!(tcx.def_kind(impl_def_id), DefKind::Impl { .. });
|
||||
|
@ -72,6 +72,7 @@ This API is completely unstable and subject to change.
|
||||
#![feature(slice_partition_dedup)]
|
||||
#![feature(try_blocks)]
|
||||
#![feature(unwrap_infallible)]
|
||||
#![warn(unreachable_pub)]
|
||||
// tidy-alphabetical-end
|
||||
|
||||
#[macro_use]
|
||||
|
@ -5,12 +5,12 @@ use rustc_middle::ty::{self, OutlivesPredicate, TyCtxt};
|
||||
use super::utils::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ExplicitPredicatesMap<'tcx> {
|
||||
pub(crate) struct ExplicitPredicatesMap<'tcx> {
|
||||
map: FxIndexMap<DefId, ty::EarlyBinder<'tcx, RequiredPredicates<'tcx>>>,
|
||||
}
|
||||
|
||||
impl<'tcx> ExplicitPredicatesMap<'tcx> {
|
||||
pub fn new() -> ExplicitPredicatesMap<'tcx> {
|
||||
pub(crate) fn new() -> ExplicitPredicatesMap<'tcx> {
|
||||
ExplicitPredicatesMap { map: FxIndexMap::default() }
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ mod explicit;
|
||||
mod implicit_infer;
|
||||
mod utils;
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { inferred_outlives_of, inferred_outlives_crate, ..*providers };
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ use rustc_middle::{bug, span_bug};
|
||||
use super::terms::VarianceTerm::*;
|
||||
use super::terms::*;
|
||||
|
||||
pub struct ConstraintContext<'a, 'tcx> {
|
||||
pub(crate) struct ConstraintContext<'a, 'tcx> {
|
||||
pub terms_cx: TermsContext<'a, 'tcx>,
|
||||
|
||||
// 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
|
||||
/// variance `variance`.
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Constraint<'a> {
|
||||
pub(crate) struct Constraint<'a> {
|
||||
pub inferred: InferredIndex,
|
||||
pub variance: &'a VarianceTerm<'a>,
|
||||
}
|
||||
@ -41,11 +41,11 @@ pub struct Constraint<'a> {
|
||||
/// ```
|
||||
/// then while we are visiting `Bar<T>`, the `CurrentItem` would have
|
||||
/// the `DefId` and the start of `Foo`'s inferreds.
|
||||
pub struct CurrentItem {
|
||||
struct CurrentItem {
|
||||
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>,
|
||||
) -> ConstraintContext<'a, 'tcx> {
|
||||
let tcx = terms_cx.tcx;
|
||||
|
@ -28,7 +28,7 @@ pub(crate) mod dump;
|
||||
/// Code for transforming variances.
|
||||
mod xform;
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
*providers = Providers { variances_of, crate_variances, ..*providers };
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ struct SolveContext<'a, 'tcx> {
|
||||
solutions: Vec<ty::Variance>,
|
||||
}
|
||||
|
||||
pub fn solve_constraints<'tcx>(
|
||||
pub(crate) fn solve_constraints<'tcx>(
|
||||
constraints_cx: ConstraintContext<'_, 'tcx>,
|
||||
) -> ty::CrateVariancesMap<'tcx> {
|
||||
let ConstraintContext { terms_cx, constraints, .. } = constraints_cx;
|
||||
|
@ -18,13 +18,13 @@ use rustc_middle::ty::{self, TyCtxt};
|
||||
|
||||
use self::VarianceTerm::*;
|
||||
|
||||
pub type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
|
||||
pub(crate) type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct InferredIndex(pub usize);
|
||||
pub(crate) struct InferredIndex(pub usize);
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum VarianceTerm<'a> {
|
||||
pub(crate) enum VarianceTerm<'a> {
|
||||
ConstantTerm(ty::Variance),
|
||||
TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>),
|
||||
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.
|
||||
|
||||
pub struct TermsContext<'a, 'tcx> {
|
||||
pub(crate) struct TermsContext<'a, 'tcx> {
|
||||
pub tcx: TyCtxt<'tcx>,
|
||||
pub arena: &'a DroplessArena,
|
||||
|
||||
@ -62,7 +62,7 @@ pub struct TermsContext<'a, 'tcx> {
|
||||
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>,
|
||||
arena: &'a DroplessArena,
|
||||
) -> TermsContext<'a, 'tcx> {
|
||||
|
@ -1,6 +1,6 @@
|
||||
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
|
||||
// defined in The Paper:
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user