Add warn(unreachable_pub)
to rustc_hir_analysis
.
This commit is contained in:
parent
bffa2244ed
commit
5acf4e7b4b
27 changed files with 155 additions and 145 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue