Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions compiler/rustc_mir_build/src/builder/expr/as_temp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,8 @@ use crate::builder::{BlockAnd, BlockAndExtension, Builder};
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.
pub(crate) fn as_temp(
&mut self,
block: BasicBlock,
temp_lifetime: TempLifetime,
expr_id: ExprId,
mutability: Mutability,
) -> BlockAnd<Local> {
// this is the only place in mir building that we need to truly need to worry about
// infinite recursion. Everything else does recurse, too, but it always gets broken up
// at some point by inserting an intermediate temporary
self.as_temp_inner(block, temp_lifetime, expr_id, mutability)
}

#[instrument(skip(self), level = "debug")]
fn as_temp_inner(
pub(crate) fn as_temp(
&mut self,
mut block: BasicBlock,
temp_lifetime: TempLifetime,
Expand Down
14 changes: 5 additions & 9 deletions compiler/rustc_mir_build/src/thir/cx/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ fn parsed_attrs(id: HirId, tcx: TyCtxt<'_>) -> ThinVec<AttributeKind> {
}

impl<'tcx> ThirBuildCx<'tcx> {
pub(crate) fn mirror_exprs(&mut self, exprs: &'tcx [hir::Expr<'tcx>]) -> Box<[ExprId]> {
exprs.iter().map(|expr| self.mirror_expr(expr)).collect()
}

/// Create a THIR expression for the given HIR expression. This expands all
/// adjustments and directly adds the type information from the
/// `typeck_results`. See the [dev-guide] for more details.
Expand All @@ -77,16 +81,8 @@ impl<'tcx> ThirBuildCx<'tcx> {
/// "reversed".)
///
/// [dev-guide]: https://rustc-dev-guide.rust-lang.org/thir.html
pub(crate) fn mirror_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) -> ExprId {
self.mirror_expr_inner(expr)
}

pub(crate) fn mirror_exprs(&mut self, exprs: &'tcx [hir::Expr<'tcx>]) -> Box<[ExprId]> {
exprs.iter().map(|expr| self.mirror_expr_inner(expr)).collect()
}

#[instrument(level = "trace", skip(self, hir_expr))]
pub(super) fn mirror_expr_inner(&mut self, hir_expr: &'tcx hir::Expr<'tcx>) -> ExprId {
pub(crate) fn mirror_expr(&mut self, hir_expr: &'tcx hir::Expr<'tcx>) -> ExprId {
let expr_scope =
region::Scope { local_id: hir_expr.hir_id.local_id, data: region::ScopeData::Node };

Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_parse/src/parser/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ impl<'a> Parser<'a> {
let kind = TyKind::Err(self.dcx().emit_err(InvalidCVariadicType { span }));
return Ok(self.mk_ty(span, kind));
}
// Make sure deeply nested types don't overflow the stack.
self.parse_ty_common(
AllowPlus::Yes,
AllowCVariadic::No,
Expand Down
Loading