diff options
Diffstat (limited to 'compiler/rustc_mir_build/src/build/expr')
9 files changed, 27 insertions, 27 deletions
diff --git a/compiler/rustc_mir_build/src/build/expr/as_constant.rs b/compiler/rustc_mir_build/src/build/expr/as_constant.rs index 25ba5d570b8..035e94eecee 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_constant.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_constant.rs @@ -11,7 +11,7 @@ use rustc_middle::ty::{self, CanonicalUserTypeAnnotation, Ty, TyCtxt}; impl<'a, 'tcx> Builder<'a, 'tcx> { /// Compile `expr`, yielding a compile-time constant. Assumes that /// `expr` is a valid compile-time constant! - crate fn as_constant(&mut self, expr: &Expr<'tcx>) -> Constant<'tcx> { + pub(crate) fn as_constant(&mut self, expr: &Expr<'tcx>) -> Constant<'tcx> { let create_uneval_from_def_id = |tcx: TyCtxt<'tcx>, def_id: DefId, ty: Ty<'tcx>, substs: SubstsRef<'tcx>| { let uneval = ty::Unevaluated::new(ty::WithOptConstParam::unknown(def_id), substs); diff --git a/compiler/rustc_mir_build/src/build/expr/as_operand.rs b/compiler/rustc_mir_build/src/build/expr/as_operand.rs index 7eca49454ba..e707c373f0d 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_operand.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_operand.rs @@ -14,7 +14,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// after the current enclosing `ExprKind::Scope` has ended, so /// please do *not* return it from functions to avoid bad /// miscompiles. - crate fn as_local_operand( + pub(crate) fn as_local_operand( &mut self, block: BasicBlock, expr: &Expr<'tcx>, @@ -73,7 +73,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// value to the stack. /// /// See #68034 for more details. - crate fn as_local_call_operand( + pub(crate) fn as_local_call_operand( &mut self, block: BasicBlock, expr: &Expr<'tcx>, @@ -97,7 +97,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// Like `as_local_call_operand`, except that the argument will /// not be valid once `scope` ends. #[instrument(level = "debug", skip(self, scope))] - crate fn as_operand( + pub(crate) fn as_operand( &mut self, mut block: BasicBlock, scope: Option<region::Scope>, @@ -132,7 +132,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } - crate fn as_call_operand( + pub(crate) fn as_call_operand( &mut self, mut block: BasicBlock, scope: Option<region::Scope>, diff --git a/compiler/rustc_mir_build/src/build/expr/as_place.rs b/compiler/rustc_mir_build/src/build/expr/as_place.rs index fa1bb0622bd..045d6eb1c30 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_place.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_place.rs @@ -21,7 +21,7 @@ use std::iter; /// The "outermost" place that holds this value. #[derive(Copy, Clone, Debug, PartialEq)] -crate enum PlaceBase { +pub(crate) enum PlaceBase { /// Denotes the start of a `Place`. Local(Local), @@ -71,7 +71,7 @@ crate enum PlaceBase { /// This is used internally when building a place for an expression like `a.b.c`. The fields `b` /// and `c` can be progressively pushed onto the place builder that is created when converting `a`. #[derive(Clone, Debug, PartialEq)] -crate struct PlaceBuilder<'tcx> { +pub(crate) struct PlaceBuilder<'tcx> { base: PlaceBase, projection: Vec<PlaceElem<'tcx>>, } @@ -283,7 +283,7 @@ fn to_upvars_resolved_place_builder<'a, 'tcx>( } impl<'tcx> PlaceBuilder<'tcx> { - crate fn into_place<'a>( + pub(crate) fn into_place<'a>( self, tcx: TyCtxt<'tcx>, typeck_results: &'a ty::TypeckResults<'tcx>, @@ -314,7 +314,7 @@ impl<'tcx> PlaceBuilder<'tcx> { /// not captured. This can happen because the final mir that will be /// generated doesn't require a read for this place. Failures will only /// happen inside closures. - crate fn try_upvars_resolved<'a>( + pub(crate) fn try_upvars_resolved<'a>( self, tcx: TyCtxt<'tcx>, typeck_results: &'a ty::TypeckResults<'tcx>, @@ -322,19 +322,19 @@ impl<'tcx> PlaceBuilder<'tcx> { to_upvars_resolved_place_builder(self, tcx, typeck_results) } - crate fn base(&self) -> PlaceBase { + pub(crate) fn base(&self) -> PlaceBase { self.base } - crate fn field(self, f: Field, ty: Ty<'tcx>) -> Self { + pub(crate) fn field(self, f: Field, ty: Ty<'tcx>) -> Self { self.project(PlaceElem::Field(f, ty)) } - crate fn deref(self) -> Self { + pub(crate) fn deref(self) -> Self { self.project(PlaceElem::Deref) } - crate fn downcast(self, adt_def: AdtDef<'tcx>, variant_index: VariantIdx) -> Self { + pub(crate) fn downcast(self, adt_def: AdtDef<'tcx>, variant_index: VariantIdx) -> Self { self.project(PlaceElem::Downcast(Some(adt_def.variant(variant_index).name), variant_index)) } @@ -342,7 +342,7 @@ impl<'tcx> PlaceBuilder<'tcx> { self.project(PlaceElem::Index(index)) } - crate fn project(mut self, elem: PlaceElem<'tcx>) -> Self { + pub(crate) fn project(mut self, elem: PlaceElem<'tcx>) -> Self { self.projection.push(elem); self } @@ -373,7 +373,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// Extra care is needed if any user code is allowed to run between calling /// this method and using it, as is the case for `match` and index /// expressions. - crate fn as_place( + pub(crate) fn as_place( &mut self, mut block: BasicBlock, expr: &Expr<'tcx>, @@ -384,7 +384,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// This is used when constructing a compound `Place`, so that we can avoid creating /// intermediate `Place` values until we know the full set of projections. - crate fn as_place_builder( + pub(crate) fn as_place_builder( &mut self, block: BasicBlock, expr: &Expr<'tcx>, @@ -397,7 +397,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// place. The place itself may or may not be mutable: /// * If this expr is a place expr like a.b, then we will return that place. /// * Otherwise, a temporary is created: in that event, it will be an immutable temporary. - crate fn as_read_only_place( + pub(crate) fn as_read_only_place( &mut self, mut block: BasicBlock, expr: &Expr<'tcx>, diff --git a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs index d807500f1fb..0fd67f15b75 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs @@ -21,7 +21,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// The operand returned from this function will *not be valid* after /// an ExprKind::Scope is passed, so please do *not* return it from /// functions to avoid bad miscompiles. - crate fn as_local_rvalue( + pub(crate) fn as_local_rvalue( &mut self, block: BasicBlock, expr: &Expr<'tcx>, @@ -31,7 +31,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } /// Compile `expr`, yielding an rvalue. - crate fn as_rvalue( + pub(crate) fn as_rvalue( &mut self, mut block: BasicBlock, scope: Option<region::Scope>, @@ -416,7 +416,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } - crate fn build_binary_op( + pub(crate) fn build_binary_op( &mut self, mut block: BasicBlock, op: BinOp, diff --git a/compiler/rustc_mir_build/src/build/expr/as_temp.rs b/compiler/rustc_mir_build/src/build/expr/as_temp.rs index 6067da2f69b..724b72f8769 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_temp.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_temp.rs @@ -10,7 +10,7 @@ use rustc_middle::thir::*; impl<'a, 'tcx> Builder<'a, 'tcx> { /// Compile `expr` into a fresh temporary. This is used when building /// up rvalues so as to freeze the value that will be consumed. - crate fn as_temp( + pub(crate) fn as_temp( &mut self, block: BasicBlock, temp_lifetime: Option<region::Scope>, diff --git a/compiler/rustc_mir_build/src/build/expr/category.rs b/compiler/rustc_mir_build/src/build/expr/category.rs index bcece39c620..b1a70643934 100644 --- a/compiler/rustc_mir_build/src/build/expr/category.rs +++ b/compiler/rustc_mir_build/src/build/expr/category.rs @@ -1,7 +1,7 @@ use rustc_middle::thir::*; #[derive(Debug, PartialEq)] -crate enum Category { +pub(crate) enum Category { // An assignable memory location like `x`, `x.f`, `foo()[3]`, that // sort of thing. Something that could appear on the LHS of an `=` // sign. @@ -19,7 +19,7 @@ crate enum Category { // Rvalues fall into different "styles" that will determine which fn // is best suited to generate them. #[derive(Debug, PartialEq)] -crate enum RvalueFunc { +pub(crate) enum RvalueFunc { // Best generated by `into`. This is generally exprs that // cause branching, like `match`, but also includes calls. Into, @@ -31,7 +31,7 @@ crate enum RvalueFunc { /// Determines the category for a given expression. Note that scope /// and paren expressions have no category. impl Category { - crate fn of(ek: &ExprKind<'_>) -> Option<Category> { + pub(crate) fn of(ek: &ExprKind<'_>) -> Option<Category> { match *ek { ExprKind::Scope { .. } => None, diff --git a/compiler/rustc_mir_build/src/build/expr/into.rs b/compiler/rustc_mir_build/src/build/expr/into.rs index 4399fdf8520..e912501d55f 100644 --- a/compiler/rustc_mir_build/src/build/expr/into.rs +++ b/compiler/rustc_mir_build/src/build/expr/into.rs @@ -15,7 +15,7 @@ use std::iter; impl<'a, 'tcx> Builder<'a, 'tcx> { /// Compile `expr`, storing the result into `destination`, which /// is assumed to be uninitialized. - crate fn expr_into_dest( + pub(crate) fn expr_into_dest( &mut self, destination: Place<'tcx>, mut block: BasicBlock, diff --git a/compiler/rustc_mir_build/src/build/expr/mod.rs b/compiler/rustc_mir_build/src/build/expr/mod.rs index 7be435cda7d..f5ae060d603 100644 --- a/compiler/rustc_mir_build/src/build/expr/mod.rs +++ b/compiler/rustc_mir_build/src/build/expr/mod.rs @@ -60,7 +60,7 @@ //! basically the point where the "by value" operations are bridged //! over to the "by reference" mode (`as_place`). -crate mod as_constant; +pub(crate) mod as_constant; mod as_operand; pub mod as_place; mod as_rvalue; diff --git a/compiler/rustc_mir_build/src/build/expr/stmt.rs b/compiler/rustc_mir_build/src/build/expr/stmt.rs index 46c616ff362..a7e1331aabc 100644 --- a/compiler/rustc_mir_build/src/build/expr/stmt.rs +++ b/compiler/rustc_mir_build/src/build/expr/stmt.rs @@ -10,7 +10,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { /// (e.g., `some().code(&here());`) then `opt_stmt_span` is the /// span of that statement (including its semicolon, if any). /// The scope is used if a statement temporary must be dropped. - crate fn stmt_expr( + pub(crate) fn stmt_expr( &mut self, mut block: BasicBlock, expr: &Expr<'tcx>, |
