Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit eb8cab0

Browse files
authored
Unrolled build for rust-lang#134365
Rollup merge of rust-lang#134365 - Zalathar:builder, r=nnethercote Rename `rustc_mir_build::build` to `builder` GitHub's “Go to file” feature silently ignores all files in this module, presumably because they are in a directory named `build`, which is mistaken for a build-output directory. That makes it meaningfully harder to view those files and their history via GitHub. This PR sidesteps that issue by renaming `build` to `builder`, which in context has basically the same meaning, but can't be mistaken for a build-output directory. --- Extracted from rust-lang#133404, after rust-lang#133592 changed the .gitignore rule from `build/` to `/build`. The problem of GitHub ignoring these files still exists even after that change, which suggests that GitHub's behaviour is a hard-coded heuristic that isn't influenced by the repository's git settings. Currently this PR doesn't include the tidy rule forbidding `build` as a module name, but that could be added if people think it's a good idea.
2 parents 604d669 + c58219b commit eb8cab0

27 files changed

+61
-53
lines changed

compiler/rustc_mir_build/src/build/block.rs renamed to compiler/rustc_mir_build/src/builder/block.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use rustc_middle::{span_bug, ty};
55
use rustc_span::Span;
66
use tracing::debug;
77

8-
use crate::build::ForGuard::OutsideGuard;
9-
use crate::build::matches::{DeclareLetBindings, EmitStorageLive, ScheduleDrops};
10-
use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
8+
use crate::builder::ForGuard::OutsideGuard;
9+
use crate::builder::matches::{DeclareLetBindings, EmitStorageLive, ScheduleDrops};
10+
use crate::builder::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
1111

1212
impl<'a, 'tcx> Builder<'a, 'tcx> {
1313
pub(crate) fn ast_block(

compiler/rustc_mir_build/src/build/cfg.rs renamed to compiler/rustc_mir_build/src/builder/cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_middle::mir::*;
44
use rustc_middle::ty::TyCtxt;
55
use tracing::debug;
66

7-
use crate::build::CFG;
7+
use crate::builder::CFG;
88

99
impl<'tcx> CFG<'tcx> {
1010
pub(crate) fn block_data(&self, blk: BasicBlock) -> &BasicBlockData<'tcx> {

compiler/rustc_mir_build/src/build/coverageinfo.rs renamed to compiler/rustc_mir_build/src/builder/coverageinfo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use rustc_middle::thir::{ExprId, ExprKind, Pat, Thir};
88
use rustc_middle::ty::TyCtxt;
99
use rustc_span::def_id::LocalDefId;
1010

11-
use crate::build::coverageinfo::mcdc::MCDCInfoBuilder;
12-
use crate::build::{Builder, CFG};
11+
use crate::builder::coverageinfo::mcdc::MCDCInfoBuilder;
12+
use crate::builder::{Builder, CFG};
1313

1414
mod mcdc;
1515

compiler/rustc_mir_build/src/build/coverageinfo/mcdc.rs renamed to compiler/rustc_mir_build/src/builder/coverageinfo/mcdc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::thir::LogicalOp;
99
use rustc_middle::ty::TyCtxt;
1010
use rustc_span::Span;
1111

12-
use crate::build::Builder;
12+
use crate::builder::Builder;
1313
use crate::errors::MCDCExceedsConditionLimit;
1414

1515
/// LLVM uses `i16` to represent condition id. Hence `i16::MAX` is the hard limit for number of

compiler/rustc_mir_build/src/build/custom/parse/instruction.rs renamed to compiler/rustc_mir_build/src/builder/custom/parse/instruction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use rustc_span::Span;
99
use rustc_span::source_map::Spanned;
1010

1111
use super::{PResult, ParseCtxt, parse_by_kind};
12-
use crate::build::custom::ParseError;
13-
use crate::build::expr::as_constant::as_constant_inner;
12+
use crate::builder::custom::ParseError;
13+
use crate::builder::expr::as_constant::as_constant_inner;
1414

1515
impl<'a, 'tcx> ParseCtxt<'a, 'tcx> {
1616
pub(crate) fn parse_statement(&self, expr_id: ExprId) -> PResult<StatementKind<'tcx>> {

compiler/rustc_mir_build/src/build/expr/as_constant.rs renamed to compiler/rustc_mir_build/src/builder/expr/as_constant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_middle::ty::{
1414
use rustc_middle::{bug, mir, span_bug};
1515
use tracing::{instrument, trace};
1616

17-
use crate::build::{Builder, parse_float_into_constval};
17+
use crate::builder::{Builder, parse_float_into_constval};
1818

1919
impl<'a, 'tcx> Builder<'a, 'tcx> {
2020
/// Compile `expr`, yielding a compile-time constant. Assumes that

compiler/rustc_mir_build/src/build/expr/as_operand.rs renamed to compiler/rustc_mir_build/src/builder/expr/as_operand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use rustc_middle::mir::*;
44
use rustc_middle::thir::*;
55
use tracing::{debug, instrument};
66

7-
use crate::build::expr::category::Category;
8-
use crate::build::{BlockAnd, BlockAndExtension, Builder, NeedsTemporary};
7+
use crate::builder::expr::category::Category;
8+
use crate::builder::{BlockAnd, BlockAndExtension, Builder, NeedsTemporary};
99

1010
impl<'a, 'tcx> Builder<'a, 'tcx> {
1111
/// Construct a temporary lifetime restricted to just the local scope

compiler/rustc_mir_build/src/build/expr/as_place.rs renamed to compiler/rustc_mir_build/src/builder/expr/as_place.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use rustc_middle::{bug, span_bug};
1414
use rustc_span::{DesugaringKind, Span};
1515
use tracing::{debug, instrument, trace};
1616

17-
use crate::build::ForGuard::{OutsideGuard, RefWithinGuard};
18-
use crate::build::expr::category::Category;
19-
use crate::build::{BlockAnd, BlockAndExtension, Builder, Capture, CaptureMap};
17+
use crate::builder::ForGuard::{OutsideGuard, RefWithinGuard};
18+
use crate::builder::expr::category::Category;
19+
use crate::builder::{BlockAnd, BlockAndExtension, Builder, Capture, CaptureMap};
2020

2121
/// The "outermost" place that holds this value.
2222
#[derive(Copy, Clone, Debug, PartialEq)]
@@ -68,7 +68,7 @@ pub(crate) enum PlaceBase {
6868
/// This is used internally when building a place for an expression like `a.b.c`. The fields `b`
6969
/// and `c` can be progressively pushed onto the place builder that is created when converting `a`.
7070
#[derive(Clone, Debug, PartialEq)]
71-
pub(in crate::build) struct PlaceBuilder<'tcx> {
71+
pub(in crate::builder) struct PlaceBuilder<'tcx> {
7272
base: PlaceBase,
7373
projection: Vec<PlaceElem<'tcx>>,
7474
}
@@ -249,7 +249,7 @@ fn strip_prefix<'a, 'tcx>(
249249
}
250250

251251
impl<'tcx> PlaceBuilder<'tcx> {
252-
pub(in crate::build) fn to_place(&self, cx: &Builder<'_, 'tcx>) -> Place<'tcx> {
252+
pub(in crate::builder) fn to_place(&self, cx: &Builder<'_, 'tcx>) -> Place<'tcx> {
253253
self.try_to_place(cx).unwrap_or_else(|| match self.base {
254254
PlaceBase::Local(local) => span_bug!(
255255
cx.local_decls[local].source_info.span,
@@ -265,7 +265,7 @@ impl<'tcx> PlaceBuilder<'tcx> {
265265
}
266266

267267
/// Creates a `Place` or returns `None` if an upvar cannot be resolved
268-
pub(in crate::build) fn try_to_place(&self, cx: &Builder<'_, 'tcx>) -> Option<Place<'tcx>> {
268+
pub(in crate::builder) fn try_to_place(&self, cx: &Builder<'_, 'tcx>) -> Option<Place<'tcx>> {
269269
let resolved = self.resolve_upvar(cx);
270270
let builder = resolved.as_ref().unwrap_or(self);
271271
let PlaceBase::Local(local) = builder.base else { return None };
@@ -283,7 +283,7 @@ impl<'tcx> PlaceBuilder<'tcx> {
283283
/// not captured. This can happen because the final mir that will be
284284
/// generated doesn't require a read for this place. Failures will only
285285
/// happen inside closures.
286-
pub(in crate::build) fn resolve_upvar(
286+
pub(in crate::builder) fn resolve_upvar(
287287
&self,
288288
cx: &Builder<'_, 'tcx>,
289289
) -> Option<PlaceBuilder<'tcx>> {

0 commit comments

Comments
 (0)