1
Fork 0

Remove crate visibility usage in compiler

This commit is contained in:
Jacob Pratt 2022-05-20 19:51:09 -04:00
parent 536020c5f9
commit 49c82f31a8
No known key found for this signature in database
GPG key ID: B80E19E4662B5AA4
186 changed files with 865 additions and 800 deletions

View file

@ -44,7 +44,7 @@ use std::collections::btree_map::{BTreeMap, Entry};
use std::ops::ControlFlow;
/// Essentially an `Into` with a `&RustInterner` parameter
crate trait LowerInto<'tcx, T> {
pub(crate) trait LowerInto<'tcx, T> {
/// Lower a rustc construct (e.g., `ty::TraitPredicate`) to a chalk type, consuming `self`.
fn lower_into(self, interner: RustInterner<'tcx>) -> T;
}
@ -836,7 +836,7 @@ impl<'tcx> LowerInto<'tcx, chalk_solve::rust_ir::AliasEqBound<RustInterner<'tcx>
/// It's important to note that because of prior substitution, we may have
/// late-bound regions, even outside of fn contexts, since this is the best way
/// to prep types for chalk lowering.
crate fn collect_bound_vars<'tcx, T: TypeFoldable<'tcx>>(
pub(crate) fn collect_bound_vars<'tcx, T: TypeFoldable<'tcx>>(
interner: RustInterner<'tcx>,
tcx: TyCtxt<'tcx>,
ty: Binder<'tcx, T>,
@ -870,14 +870,14 @@ crate fn collect_bound_vars<'tcx, T: TypeFoldable<'tcx>>(
(new_ty, binders, named_parameters)
}
crate struct BoundVarsCollector<'tcx> {
pub(crate) struct BoundVarsCollector<'tcx> {
binder_index: ty::DebruijnIndex,
crate parameters: BTreeMap<u32, chalk_ir::VariableKind<RustInterner<'tcx>>>,
crate named_parameters: Vec<DefId>,
pub(crate) parameters: BTreeMap<u32, chalk_ir::VariableKind<RustInterner<'tcx>>>,
pub(crate) named_parameters: Vec<DefId>,
}
impl<'tcx> BoundVarsCollector<'tcx> {
crate fn new() -> Self {
pub(crate) fn new() -> Self {
BoundVarsCollector {
binder_index: ty::INNERMOST,
parameters: BTreeMap::new(),
@ -1001,17 +1001,17 @@ impl<'a, 'tcx> TypeFolder<'tcx> for NamedBoundVarSubstitutor<'a, 'tcx> {
/// Used to substitute `Param`s with placeholders. We do this since Chalk
/// have a notion of `Param`s.
crate struct ParamsSubstitutor<'tcx> {
pub(crate) struct ParamsSubstitutor<'tcx> {
tcx: TyCtxt<'tcx>,
binder_index: ty::DebruijnIndex,
list: Vec<rustc_middle::ty::ParamTy>,
next_ty_placeholder: usize,
crate params: rustc_data_structures::fx::FxHashMap<usize, rustc_middle::ty::ParamTy>,
crate named_regions: BTreeMap<DefId, u32>,
pub(crate) params: rustc_data_structures::fx::FxHashMap<usize, rustc_middle::ty::ParamTy>,
pub(crate) named_regions: BTreeMap<DefId, u32>,
}
impl<'tcx> ParamsSubstitutor<'tcx> {
crate fn new(tcx: TyCtxt<'tcx>, next_ty_placeholder: usize) -> Self {
pub(crate) fn new(tcx: TyCtxt<'tcx>, next_ty_placeholder: usize) -> Self {
ParamsSubstitutor {
tcx,
binder_index: ty::INNERMOST,
@ -1083,13 +1083,13 @@ impl<'tcx> TypeFolder<'tcx> for ParamsSubstitutor<'tcx> {
}
}
crate struct ReverseParamsSubstitutor<'tcx> {
pub(crate) struct ReverseParamsSubstitutor<'tcx> {
tcx: TyCtxt<'tcx>,
params: rustc_data_structures::fx::FxHashMap<usize, rustc_middle::ty::ParamTy>,
}
impl<'tcx> ReverseParamsSubstitutor<'tcx> {
crate fn new(
pub(crate) fn new(
tcx: TyCtxt<'tcx>,
params: rustc_data_structures::fx::FxHashMap<usize, rustc_middle::ty::ParamTy>,
) -> Self {
@ -1117,14 +1117,14 @@ impl<'tcx> TypeFolder<'tcx> for ReverseParamsSubstitutor<'tcx> {
}
/// Used to collect `Placeholder`s.
crate struct PlaceholdersCollector {
pub(crate) struct PlaceholdersCollector {
universe_index: ty::UniverseIndex,
crate next_ty_placeholder: usize,
crate next_anon_region_placeholder: u32,
pub(crate) next_ty_placeholder: usize,
pub(crate) next_anon_region_placeholder: u32,
}
impl PlaceholdersCollector {
crate fn new() -> Self {
pub(crate) fn new() -> Self {
PlaceholdersCollector {
universe_index: ty::UniverseIndex::ROOT,
next_ty_placeholder: 0,

View file

@ -3,8 +3,8 @@
//! In order to call `chalk-solve`, this file must convert a `CanonicalChalkEnvironmentAndGoal` into
//! a Chalk uncanonical goal. It then calls Chalk, and converts the answer back into rustc solution.
crate mod db;
crate mod lowering;
pub(crate) mod db;
pub(crate) mod lowering;
use rustc_data_structures::fx::FxHashMap;
@ -27,11 +27,11 @@ use crate::chalk::lowering::{ParamsSubstitutor, PlaceholdersCollector, ReversePa
use chalk_solve::Solution;
crate fn provide(p: &mut Providers) {
pub(crate) fn provide(p: &mut Providers) {
*p = Providers { evaluate_goal, ..*p };
}
crate fn evaluate_goal<'tcx>(
pub(crate) fn evaluate_goal<'tcx>(
tcx: TyCtxt<'tcx>,
obligation: CanonicalChalkEnvironmentAndGoal<'tcx>,
) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, traits::query::NoSolution> {

View file

@ -17,7 +17,7 @@ use rustc_trait_selection::traits::{
Normalized, ObligationCause, TraitEngine, TraitEngineExt as _,
};
crate fn provide(p: &mut Providers) {
pub(crate) fn provide(p: &mut Providers) {
*p = Providers { dropck_outlives, adt_dtorck_constraint, ..*p };
}
@ -304,7 +304,7 @@ fn dtorck_constraint_for_ty<'tcx>(
}
/// Calculates the dtorck constraint for a type.
crate fn adt_dtorck_constraint(
pub(crate) fn adt_dtorck_constraint(
tcx: TyCtxt<'_>,
def_id: DefId,
) -> Result<&DropckConstraint<'_>, NoSolution> {

View file

@ -7,7 +7,7 @@ use rustc_trait_selection::traits::{
EvaluationResult, Obligation, ObligationCause, OverflowError, SelectionContext, TraitQueryMode,
};
crate fn provide(p: &mut Providers) {
pub(crate) fn provide(p: &mut Providers) {
*p = Providers { evaluate_obligation, ..*p };
}

View file

@ -18,7 +18,7 @@ use rustc_trait_selection::traits::FulfillmentContext;
use rustc_trait_selection::traits::TraitEngine;
use smallvec::{smallvec, SmallVec};
crate fn provide(p: &mut Providers) {
pub(crate) fn provide(p: &mut Providers) {
*p = Providers { implied_outlives_bounds, ..*p };
}

View file

@ -1,7 +1,6 @@
//! New recursive solver modeled on Chalk's recursive solver. Most of
//! the guts are broken up into modules; see the comments in those modules.
#![feature(crate_visibility_modifier)]
#![feature(let_else)]
#![feature(nll)]
#![recursion_limit = "256"]

View file

@ -6,7 +6,7 @@ use rustc_trait_selection::traits::query::normalize::AtExt;
use rustc_trait_selection::traits::{Normalized, ObligationCause};
use std::sync::atomic::Ordering;
crate fn provide(p: &mut Providers) {
pub(crate) fn provide(p: &mut Providers) {
*p = Providers {
try_normalize_generic_arg_after_erasing_regions: |tcx, goal| {
debug!("try_normalize_generic_arg_after_erasing_regions(goal={:#?}", goal);

View file

@ -10,7 +10,7 @@ use rustc_trait_selection::traits::query::{
use rustc_trait_selection::traits::{self, ObligationCause, SelectionContext};
use std::sync::atomic::Ordering;
crate fn provide(p: &mut Providers) {
pub(crate) fn provide(p: &mut Providers) {
*p = Providers { normalize_projection_ty, ..*p };
}

View file

@ -23,7 +23,7 @@ use rustc_trait_selection::traits::query::{Fallible, NoSolution};
use rustc_trait_selection::traits::{Normalized, Obligation, ObligationCause, TraitEngine};
use std::fmt;
crate fn provide(p: &mut Providers) {
pub(crate) fn provide(p: &mut Providers) {
*p = Providers {
type_op_ascribe_user_type,
type_op_eq,