Skip to content

Commit a3fea24

Browse files
committed
Auto merge of rust-lang#3901 - RalfJung:rustup, r=RalfJung
Rustup This has a larger large "fmt" diff, probably there was a bug rustfmt update. For some reason the automatic `./miri fmt` on CI failed so this PR had to be created by hand -- it is unclear to me why this occurred.
2 parents 3d4d5e1 + 7d9a4a7 commit a3fea24

File tree

879 files changed

+15568
-8667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

879 files changed

+15568
-8667
lines changed

Cargo.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -4630,7 +4630,7 @@ dependencies = [
46304630

46314631
[[package]]
46324632
name = "rustfmt-nightly"
4633-
version = "1.7.1"
4633+
version = "1.8.0"
46344634
dependencies = [
46354635
"annotate-snippets 0.9.2",
46364636
"anyhow",

compiler/rustc_abi/src/layout.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,10 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
527527
let count =
528528
(niche_variants.end().index() as u128 - niche_variants.start().index() as u128) + 1;
529529

530-
// Find the field with the largest niche
531-
let (field_index, niche, (niche_start, niche_scalar)) = variants[largest_variant_index]
532-
.iter()
533-
.enumerate()
534-
.filter_map(|(j, field)| Some((j, field.largest_niche?)))
535-
.max_by_key(|(_, niche)| niche.available(dl))
536-
.and_then(|(j, niche)| Some((j, niche, niche.reserve(dl, count)?)))?;
537-
let niche_offset =
538-
niche.offset + variant_layouts[largest_variant_index].fields.offset(field_index);
530+
// Use the largest niche in the largest variant.
531+
let niche = variant_layouts[largest_variant_index].largest_niche?;
532+
let (niche_start, niche_scalar) = niche.reserve(dl, count)?;
533+
let niche_offset = niche.offset;
539534
let niche_size = niche.value.size(dl);
540535
let size = variant_layouts[largest_variant_index].size.align_to(align.abi);
541536

compiler/rustc_abi/src/lib.rs

+22
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,28 @@ pub enum Integer {
833833
}
834834

835835
impl Integer {
836+
pub fn int_ty_str(self) -> &'static str {
837+
use Integer::*;
838+
match self {
839+
I8 => "i8",
840+
I16 => "i16",
841+
I32 => "i32",
842+
I64 => "i64",
843+
I128 => "i128",
844+
}
845+
}
846+
847+
pub fn uint_ty_str(self) -> &'static str {
848+
use Integer::*;
849+
match self {
850+
I8 => "u8",
851+
I16 => "u16",
852+
I32 => "u32",
853+
I64 => "u64",
854+
I128 => "u128",
855+
}
856+
}
857+
836858
#[inline]
837859
pub fn size(self) -> Size {
838860
use Integer::*;

compiler/rustc_ast/src/ast.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ impl Expr {
12931293
ExprKind::Binary(op, ..) => ExprPrecedence::Binary(op.node),
12941294
ExprKind::Unary(..) => ExprPrecedence::Unary,
12951295
ExprKind::Lit(_) | ExprKind::IncludedBytes(..) => ExprPrecedence::Lit,
1296-
ExprKind::Type(..) | ExprKind::Cast(..) => ExprPrecedence::Cast,
1296+
ExprKind::Cast(..) => ExprPrecedence::Cast,
12971297
ExprKind::Let(..) => ExprPrecedence::Let,
12981298
ExprKind::If(..) => ExprPrecedence::If,
12991299
ExprKind::While(..) => ExprPrecedence::While,
@@ -1317,17 +1317,18 @@ impl Expr {
13171317
ExprKind::Break(..) => ExprPrecedence::Break,
13181318
ExprKind::Continue(..) => ExprPrecedence::Continue,
13191319
ExprKind::Ret(..) => ExprPrecedence::Ret,
1320-
ExprKind::InlineAsm(..) => ExprPrecedence::InlineAsm,
1321-
ExprKind::OffsetOf(..) => ExprPrecedence::OffsetOf,
1322-
ExprKind::MacCall(..) => ExprPrecedence::Mac,
13231320
ExprKind::Struct(..) => ExprPrecedence::Struct,
13241321
ExprKind::Repeat(..) => ExprPrecedence::Repeat,
13251322
ExprKind::Paren(..) => ExprPrecedence::Paren,
13261323
ExprKind::Try(..) => ExprPrecedence::Try,
13271324
ExprKind::Yield(..) => ExprPrecedence::Yield,
13281325
ExprKind::Yeet(..) => ExprPrecedence::Yeet,
1329-
ExprKind::FormatArgs(..) => ExprPrecedence::FormatArgs,
13301326
ExprKind::Become(..) => ExprPrecedence::Become,
1327+
ExprKind::InlineAsm(..)
1328+
| ExprKind::Type(..)
1329+
| ExprKind::OffsetOf(..)
1330+
| ExprKind::FormatArgs(..)
1331+
| ExprKind::MacCall(..) => ExprPrecedence::Mac,
13311332
ExprKind::Err(_) | ExprKind::Dummy => ExprPrecedence::Err,
13321333
}
13331334
}

compiler/rustc_ast/src/util/parser.rs

-6
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,7 @@ pub enum ExprPrecedence {
265265
Field,
266266
Index,
267267
Try,
268-
InlineAsm,
269-
OffsetOf,
270268
Mac,
271-
FormatArgs,
272269

273270
Array,
274271
Repeat,
@@ -333,17 +330,14 @@ impl ExprPrecedence {
333330
| ExprPrecedence::ConstBlock
334331
| ExprPrecedence::Field
335332
| ExprPrecedence::ForLoop
336-
| ExprPrecedence::FormatArgs
337333
| ExprPrecedence::Gen
338334
| ExprPrecedence::If
339335
| ExprPrecedence::Index
340-
| ExprPrecedence::InlineAsm
341336
| ExprPrecedence::Lit
342337
| ExprPrecedence::Loop
343338
| ExprPrecedence::Mac
344339
| ExprPrecedence::Match
345340
| ExprPrecedence::MethodCall
346-
| ExprPrecedence::OffsetOf
347341
| ExprPrecedence::Paren
348342
| ExprPrecedence::Path
349343
| ExprPrecedence::PostfixMatch

compiler/rustc_borrowck/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ borrowck_simd_intrinsic_arg_const =
207207
*[other] {$arg}th
208208
} argument of `{$intrinsic}` is required to be a `const` item
209209
210-
borrowck_suggest_create_freash_reborrow =
210+
borrowck_suggest_create_fresh_reborrow =
211211
consider reborrowing the `Pin` instead of moving it
212212
213213
borrowck_suggest_iterate_over_slice =

compiler/rustc_borrowck/src/session_diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ pub(crate) enum CaptureReasonSuggest<'tcx> {
415415
span: Span,
416416
},
417417
#[suggestion(
418-
borrowck_suggest_create_freash_reborrow,
418+
borrowck_suggest_create_fresh_reborrow,
419419
applicability = "maybe-incorrect",
420420
code = ".as_mut()",
421421
style = "verbose"

compiler/rustc_codegen_cranelift/src/base.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -785,8 +785,10 @@ fn codegen_stmt<'tcx>(
785785
}
786786
Rvalue::Repeat(ref operand, times) => {
787787
let operand = codegen_operand(fx, operand);
788-
let times =
789-
fx.monomorphize(times).eval_target_usize(fx.tcx, ParamEnv::reveal_all());
788+
let times = fx
789+
.monomorphize(times)
790+
.try_to_target_usize(fx.tcx)
791+
.expect("expected monomorphic const in codegen");
790792
if operand.layout().size.bytes() == 0 {
791793
// Do nothing for ZST's
792794
} else if fx.clif_type(operand.layout().ty) == Some(types::I8) {
@@ -944,7 +946,10 @@ fn codegen_stmt<'tcx>(
944946
fn codegen_array_len<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, place: CPlace<'tcx>) -> Value {
945947
match *place.layout().ty.kind() {
946948
ty::Array(_elem_ty, len) => {
947-
let len = fx.monomorphize(len).eval_target_usize(fx.tcx, ParamEnv::reveal_all()) as i64;
949+
let len = fx
950+
.monomorphize(len)
951+
.try_to_target_usize(fx.tcx)
952+
.expect("expected monomorphic const in codegen") as i64;
948953
fx.bcx.ins().iconst(fx.pointer_type, len)
949954
}
950955
ty::Slice(_elem_ty) => place.to_ptr_unsized().1,

compiler/rustc_codegen_cranelift/src/common.rs

-8
Original file line numberDiff line numberDiff line change
@@ -309,17 +309,13 @@ pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> {
309309
}
310310

311311
impl<'tcx> LayoutOfHelpers<'tcx> for FunctionCx<'_, '_, 'tcx> {
312-
type LayoutOfResult = TyAndLayout<'tcx>;
313-
314312
#[inline]
315313
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
316314
RevealAllLayoutCx(self.tcx).handle_layout_err(err, span, ty)
317315
}
318316
}
319317

320318
impl<'tcx> FnAbiOfHelpers<'tcx> for FunctionCx<'_, '_, 'tcx> {
321-
type FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>;
322-
323319
#[inline]
324320
fn handle_fn_abi_err(
325321
&self,
@@ -450,8 +446,6 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
450446
pub(crate) struct RevealAllLayoutCx<'tcx>(pub(crate) TyCtxt<'tcx>);
451447

452448
impl<'tcx> LayoutOfHelpers<'tcx> for RevealAllLayoutCx<'tcx> {
453-
type LayoutOfResult = TyAndLayout<'tcx>;
454-
455449
#[inline]
456450
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
457451
if let LayoutError::SizeOverflow(_) | LayoutError::ReferencesError(_) = err {
@@ -466,8 +460,6 @@ impl<'tcx> LayoutOfHelpers<'tcx> for RevealAllLayoutCx<'tcx> {
466460
}
467461

468462
impl<'tcx> FnAbiOfHelpers<'tcx> for RevealAllLayoutCx<'tcx> {
469-
type FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>;
470-
471463
#[inline]
472464
fn handle_fn_abi_err(
473465
&self,

compiler/rustc_codegen_cranelift/src/debuginfo/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl DebugContext {
4444
type_dbg,
4545
ty,
4646
*elem_ty,
47-
len.eval_target_usize(tcx, ty::ParamEnv::reveal_all()),
47+
len.try_to_target_usize(tcx).expect("expected monomorphic const in codegen"),
4848
),
4949
// ty::Slice(_) | ty::Str
5050
// ty::Dynamic

compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
131131

132132
let idx = generic_args[2]
133133
.expect_const()
134-
.eval(fx.tcx, ty::ParamEnv::reveal_all(), span)
135-
.unwrap()
136-
.1
134+
.try_to_valtree()
135+
.expect("expected monomorphic const in codegen")
137136
.unwrap_branch();
138137

139138
assert_eq!(x.layout(), y.layout());

compiler/rustc_codegen_cranelift/src/unsize.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ pub(crate) fn unsized_info<'tcx>(
2424
let (source, target) =
2525
fx.tcx.struct_lockstep_tails_for_codegen(source, target, ParamEnv::reveal_all());
2626
match (&source.kind(), &target.kind()) {
27-
(&ty::Array(_, len), &ty::Slice(_)) => fx
28-
.bcx
29-
.ins()
30-
.iconst(fx.pointer_type, len.eval_target_usize(fx.tcx, ParamEnv::reveal_all()) as i64),
27+
(&ty::Array(_, len), &ty::Slice(_)) => fx.bcx.ins().iconst(
28+
fx.pointer_type,
29+
len.try_to_target_usize(fx.tcx).expect("expected monomorphic const in codegen") as i64,
30+
),
3131
(&ty::Dynamic(data_a, _, src_dyn_kind), &ty::Dynamic(data_b, _, target_dyn_kind))
3232
if src_dyn_kind == target_dyn_kind =>
3333
{

compiler/rustc_codegen_gcc/src/abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[cfg(feature = "master")]
22
use gccjit::FnAttribute;
33
use gccjit::{ToLValue, ToRValue, Type};
4-
use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeMethods};
4+
use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods};
55
use rustc_data_structures::fx::FxHashSet;
66
use rustc_middle::bug;
77
use rustc_middle::ty::layout::LayoutOf;

compiler/rustc_codegen_gcc/src/asm.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece};
55
use rustc_codegen_ssa::mir::operand::OperandValue;
66
use rustc_codegen_ssa::mir::place::PlaceRef;
77
use rustc_codegen_ssa::traits::{
8-
AsmBuilderMethods, AsmMethods, BaseTypeMethods, BuilderMethods, GlobalAsmOperandRef,
9-
InlineAsmOperandRef,
8+
AsmBuilderMethods, AsmCodegenMethods, BaseTypeCodegenMethods, BuilderMethods,
9+
GlobalAsmOperandRef, InlineAsmOperandRef,
1010
};
1111
use rustc_middle::bug;
1212
use rustc_middle::ty::Instance;
@@ -770,7 +770,7 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
770770
}
771771
}
772772

773-
impl<'gcc, 'tcx> AsmMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
773+
impl<'gcc, 'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
774774
fn codegen_global_asm(
775775
&self,
776776
template: &[InlineAsmTemplatePiece],

compiler/rustc_codegen_gcc/src/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::time::Instant;
66
use gccjit::{CType, FunctionType, GlobalKind};
77
use rustc_codegen_ssa::base::maybe_create_entry_wrapper;
88
use rustc_codegen_ssa::mono_item::MonoItemExt;
9-
use rustc_codegen_ssa::traits::DebugInfoMethods;
9+
use rustc_codegen_ssa::traits::DebugInfoCodegenMethods;
1010
use rustc_codegen_ssa::{ModuleCodegen, ModuleKind};
1111
use rustc_middle::dep_graph;
1212
use rustc_middle::mir::mono::Linkage;

compiler/rustc_codegen_gcc/src/builder.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ use rustc_codegen_ssa::common::{
1414
use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
1515
use rustc_codegen_ssa::mir::place::PlaceRef;
1616
use rustc_codegen_ssa::traits::{
17-
BackendTypes, BaseTypeMethods, BuilderMethods, ConstMethods, HasCodegen, LayoutTypeMethods,
18-
OverflowOp, StaticBuilderMethods,
17+
BackendTypes, BaseTypeCodegenMethods, BuilderMethods, ConstCodegenMethods,
18+
LayoutTypeCodegenMethods, OverflowOp, StaticBuilderMethods,
1919
};
2020
use rustc_codegen_ssa::MemFlags;
2121
use rustc_data_structures::fx::FxHashSet;
2222
use rustc_middle::bug;
2323
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
2424
use rustc_middle::ty::layout::{
2525
FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasParamEnv, HasTyCtxt, LayoutError, LayoutOfHelpers,
26-
TyAndLayout,
2726
};
2827
use rustc_middle::ty::{Instance, ParamEnv, Ty, TyCtxt};
2928
use rustc_span::def_id::DefId;
@@ -460,10 +459,6 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
460459
}
461460
}
462461

463-
impl<'gcc, 'tcx> HasCodegen<'tcx> for Builder<'_, 'gcc, 'tcx> {
464-
type CodegenCx = CodegenCx<'gcc, 'tcx>;
465-
}
466-
467462
impl<'tcx> HasTyCtxt<'tcx> for Builder<'_, '_, 'tcx> {
468463
fn tcx(&self) -> TyCtxt<'tcx> {
469464
self.cx.tcx()
@@ -477,17 +472,13 @@ impl HasDataLayout for Builder<'_, '_, '_> {
477472
}
478473

479474
impl<'tcx> LayoutOfHelpers<'tcx> for Builder<'_, '_, 'tcx> {
480-
type LayoutOfResult = TyAndLayout<'tcx>;
481-
482475
#[inline]
483476
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
484477
self.cx.handle_layout_err(err, span, ty)
485478
}
486479
}
487480

488481
impl<'tcx> FnAbiOfHelpers<'tcx> for Builder<'_, '_, 'tcx> {
489-
type FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>;
490-
491482
#[inline]
492483
fn handle_fn_abi_err(
493484
&self,
@@ -531,6 +522,8 @@ fn set_rvalue_location<'a, 'gcc, 'tcx>(
531522
}
532523

533524
impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
525+
type CodegenCx = CodegenCx<'gcc, 'tcx>;
526+
534527
fn build(cx: &'a CodegenCx<'gcc, 'tcx>, block: Block<'gcc>) -> Builder<'a, 'gcc, 'tcx> {
535528
Builder::with_cx(cx, block)
536529
}

0 commit comments

Comments
 (0)