Skip to content

Commit f722b24

Browse files
committed
Auto merge of #108159 - matthiaskrgr:rollup-5k2j7cx, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #107592 (Default `repr(C)` enums to `c_int` size) - #107956 (Copy `bin/*` and `lib/*.dylib` files to `stage0-sysroot`) - #108126 (fix a line, and do a consistency fix) - #108144 (Add compiler-errors to a few more triagebot groups) - #108149 (typo) - #108154 (`BasicBlock::new(0)` -> `START_BLOCK` [no functional changes]) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents f4f5fc3 + ae5473c commit f722b24

File tree

24 files changed

+167
-42
lines changed

24 files changed

+167
-42
lines changed

compiler/rustc_abi/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ pub struct TargetDataLayout {
171171

172172
pub instruction_address_space: AddressSpace,
173173

174-
/// Minimum size of #[repr(C)] enums (default I32 bits)
174+
/// Minimum size of #[repr(C)] enums (default c_int::BITS, usually 32)
175+
/// Note: This isn't in LLVM's data layout string, it is `short_enum`
176+
/// so the only valid spec for LLVM is c_int::BITS or 8
175177
pub c_enum_min_size: Integer,
176178
}
177179

compiler/rustc_codegen_llvm/src/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> {
521521

522522
// The semantics of #[used] in Rust only require the symbol to make it into the
523523
// object file. It is explicitly allowed for the linker to strip the symbol if it
524-
// is dead, which means we are allowed use `llvm.compiler.used` instead of
524+
// is dead, which means we are allowed to use `llvm.compiler.used` instead of
525525
// `llvm.used` here.
526526
//
527527
// Additionally, https://reviews.llvm.org/D97448 in LLVM 13 started emitting unique
@@ -532,7 +532,7 @@ impl<'ll> StaticMethods for CodegenCx<'ll, '_> {
532532
// That said, we only ever emit these when compiling for ELF targets, unless
533533
// `#[used(compiler)]` is explicitly requested. This is to avoid similar breakage
534534
// on other targets, in particular MachO targets have *their* static constructor
535-
// lists broken if `llvm.compiler.used` is emitted rather than llvm.used. However,
535+
// lists broken if `llvm.compiler.used` is emitted rather than `llvm.used`. However,
536536
// that check happens when assigning the `CodegenFnAttrFlags` in `rustc_hir_analysis`,
537537
// so we don't need to take care of it here.
538538
self.add_compiler_used_global(g);

compiler/rustc_codegen_ssa/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
//! This crate contains codegen code that is used by all codegen backends (LLVM and others).
1515
//! The backend-agnostic functions of this crate use functions defined in various traits that
16-
//! have to be implemented by each backends.
16+
//! have to be implemented by each backend.
1717
1818
#[macro_use]
1919
extern crate rustc_macros;

compiler/rustc_const_eval/src/transform/promote_consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
898898
assert_eq!(self.new_block(), START_BLOCK);
899899
self.visit_rvalue(
900900
&mut rvalue,
901-
Location { block: BasicBlock::new(0), statement_index: usize::MAX },
901+
Location { block: START_BLOCK, statement_index: usize::MAX },
902902
);
903903

904904
let span = self.promoted.span;

compiler/rustc_middle/src/middle/codegen_fn_attrs.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ bitflags! {
9191
/// the MIR `InstrumentCoverage` pass and not added to the coverage map
9292
/// during codegen.
9393
const NO_COVERAGE = 1 << 15;
94-
/// `#[used(linker)]`: indicates that LLVM nor the linker can eliminate this function.
94+
/// `#[used(linker)]`:
95+
/// indicates that neither LLVM nor the linker will eliminate this function.
9596
const USED_LINKER = 1 << 16;
9697
/// `#[rustc_deallocator]`: a hint to LLVM that the function only deallocates memory.
9798
const DEALLOCATOR = 1 << 17;

compiler/rustc_middle/src/mir/visit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ macro_rules! make_mir_visitor {
323323
self.visit_source_scope($(& $mutability)? *parent_scope);
324324
}
325325
if let Some((callee, callsite_span)) = inlined {
326-
let location = START_BLOCK.start_location();
326+
let location = Location::START;
327327

328328
self.visit_span($(& $mutability)? *callsite_span);
329329

@@ -837,7 +837,7 @@ macro_rules! make_mir_visitor {
837837
} = var_debug_info;
838838

839839
self.visit_source_info(source_info);
840-
let location = START_BLOCK.start_location();
840+
let location = Location::START;
841841
match value {
842842
VarDebugInfoContents::Const(c) => self.visit_constant(c, location),
843843
VarDebugInfoContents::Place(place) =>
@@ -1026,7 +1026,7 @@ macro_rules! super_body {
10261026
$self.visit_span($(& $mutability)? $body.span);
10271027

10281028
for const_ in &$($mutability)? $body.required_consts {
1029-
let location = START_BLOCK.start_location();
1029+
let location = Location::START;
10301030
$self.visit_constant(const_, location);
10311031
}
10321032
}

compiler/rustc_mir_transform/src/dest_prop.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ use rustc_index::bit_set::BitSet;
136136
use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};
137137
use rustc_middle::mir::{dump_mir, PassWhere};
138138
use rustc_middle::mir::{
139-
traversal, BasicBlock, Body, InlineAsmOperand, Local, LocalKind, Location, Operand, Place,
140-
Rvalue, Statement, StatementKind, TerminatorKind,
139+
traversal, Body, InlineAsmOperand, Local, LocalKind, Location, Operand, Place, Rvalue,
140+
Statement, StatementKind, TerminatorKind,
141141
};
142142
use rustc_middle::ty::TyCtxt;
143143
use rustc_mir_dataflow::impls::MaybeLiveLocals;
@@ -468,7 +468,7 @@ impl<'a, 'body, 'alloc, 'tcx> FilterInformation<'a, 'body, 'alloc, 'tcx> {
468468
// to reuse the allocation.
469469
write_info: write_info_alloc,
470470
// Doesn't matter what we put here, will be overwritten before being used
471-
at: Location { block: BasicBlock::from_u32(0), statement_index: 0 },
471+
at: Location::START,
472472
};
473473
this.internal_filter_liveness();
474474
}

compiler/rustc_mir_transform/src/generator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ fn transform_async_context<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
487487

488488
let get_context_def_id = tcx.require_lang_item(LangItem::GetContext, None);
489489

490-
for bb in BasicBlock::new(0)..body.basic_blocks.next_index() {
490+
for bb in START_BLOCK..body.basic_blocks.next_index() {
491491
let bb_data = &body[bb];
492492
if bb_data.is_cleanup {
493493
continue;
@@ -1255,7 +1255,7 @@ fn create_generator_resume_function<'tcx>(
12551255
use rustc_middle::mir::AssertKind::{ResumedAfterPanic, ResumedAfterReturn};
12561256

12571257
// Jump to the entry point on the unresumed
1258-
cases.insert(0, (UNRESUMED, BasicBlock::new(0)));
1258+
cases.insert(0, (UNRESUMED, START_BLOCK));
12591259

12601260
// Panic when resumed on the returned or poisoned state
12611261
let generator_kind = body.generator_kind().unwrap();
@@ -1481,7 +1481,7 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
14811481

14821482
// When first entering the generator, move the resume argument into its new local.
14831483
let source_info = SourceInfo::outermost(body.span);
1484-
let stmts = &mut body.basic_blocks_mut()[BasicBlock::new(0)].statements;
1484+
let stmts = &mut body.basic_blocks_mut()[START_BLOCK].statements;
14851485
stmts.insert(
14861486
0,
14871487
Statement {

compiler/rustc_mir_transform/src/inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn inline<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) -> bool {
9696
history: Vec::new(),
9797
changed: false,
9898
};
99-
let blocks = BasicBlock::new(0)..body.basic_blocks.next_index();
99+
let blocks = START_BLOCK..body.basic_blocks.next_index();
100100
this.process_blocks(body, blocks);
101101
this.changed
102102
}

compiler/rustc_mir_transform/src/simplify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ impl UsedLocals {
496496
self.increment = false;
497497

498498
// The location of the statement is irrelevant.
499-
let location = Location { block: START_BLOCK, statement_index: 0 };
499+
let location = Location::START;
500500
self.visit_statement(statement, location);
501501
}
502502

0 commit comments

Comments
 (0)