Skip to content

Commit c62d210

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 594a2fc + bbe9d27 commit c62d210

File tree

274 files changed

+2048
-819
lines changed

Some content is hidden

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

274 files changed

+2048
-819
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2068,7 +2068,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20682068
hir::GenericParam {
20692069
hir_id,
20702070
name,
2071-
span: self.lower_span(param.ident.span),
2071+
span: self.lower_span(param.span()),
20722072
pure_wrt_drop: self.sess.contains_name(&param.attrs, sym::may_dangle),
20732073
bounds: self.arena.alloc_from_iter(bounds),
20742074
kind,

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -772,14 +772,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
772772
Some((issued_span, span)),
773773
);
774774

775-
self.suggest_using_local_if_applicable(
776-
&mut err,
777-
location,
778-
(place, span),
779-
gen_borrow_kind,
780-
issued_borrow,
781-
explanation,
782-
);
775+
self.suggest_using_local_if_applicable(&mut err, location, issued_borrow, explanation);
783776

784777
err
785778
}
@@ -789,8 +782,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
789782
&self,
790783
err: &mut Diagnostic,
791784
location: Location,
792-
(place, span): (Place<'tcx>, Span),
793-
gen_borrow_kind: BorrowKind,
794785
issued_borrow: &BorrowData<'tcx>,
795786
explanation: BorrowExplanation,
796787
) {
@@ -822,7 +813,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
822813
return;
823814
};
824815
let inner_param_uses = find_all_local_uses::find(self.body, inner_param.local);
825-
let Some((inner_call_loc,inner_call_term)) = inner_param_uses.into_iter().find_map(|loc| {
816+
let Some((inner_call_loc, inner_call_term)) = inner_param_uses.into_iter().find_map(|loc| {
826817
let Either::Right(term) = self.body.stmt_at(loc) else {
827818
debug!("{:?} is a statement, so it can't be a call", loc);
828819
return None;
@@ -833,7 +824,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
833824
};
834825
debug!("checking call args for uses of inner_param: {:?}", args);
835826
if args.contains(&Operand::Move(inner_param)) {
836-
Some((loc,term))
827+
Some((loc, term))
837828
} else {
838829
None
839830
}

compiler/rustc_codegen_cranelift/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub(crate) fn pointer_ty(tcx: TyCtxt<'_>) -> types::Type {
2121
}
2222

2323
pub(crate) fn scalar_to_clif_type(tcx: TyCtxt<'_>, scalar: Scalar) -> Type {
24-
match scalar.value {
24+
match scalar.primitive() {
2525
Primitive::Int(int, _sign) => match int {
2626
Integer::I8 => types::I8,
2727
Integer::I16 => types::I16,

compiler/rustc_codegen_cranelift/src/discriminant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub(crate) fn codegen_get_discriminant<'tcx>(
105105
// Decode the discriminant (specifically if it's niche-encoded).
106106
match *tag_encoding {
107107
TagEncoding::Direct => {
108-
let signed = match tag_scalar.value {
108+
let signed = match tag_scalar.primitive() {
109109
Int(_, signed) => signed,
110110
_ => false,
111111
};

compiler/rustc_codegen_cranelift/src/value_and_place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn codegen_field<'tcx>(
5050
}
5151

5252
fn scalar_pair_calculate_b_offset(tcx: TyCtxt<'_>, a_scalar: Scalar, b_scalar: Scalar) -> Offset32 {
53-
let b_offset = a_scalar.value.size(&tcx).align_to(b_scalar.value.align(&tcx).abi);
53+
let b_offset = a_scalar.size(&tcx).align_to(b_scalar.align(&tcx).abi);
5454
Offset32::new(b_offset.bytes().try_into().unwrap())
5555
}
5656

compiler/rustc_codegen_gcc/src/builder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,11 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
694694
}
695695

696696
fn scalar_load_metadata<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>, load: RValue<'gcc>, scalar: &abi::Scalar) {
697-
let vr = scalar.valid_range.clone();
698-
match scalar.value {
697+
let vr = scalar.valid_range(bx);
698+
match scalar.primitive() {
699699
abi::Int(..) => {
700700
if !scalar.is_always_valid(bx) {
701-
bx.range_metadata(load, scalar.valid_range);
701+
bx.range_metadata(load, vr);
702702
}
703703
}
704704
abi::Pointer if vr.start < vr.end && !vr.contains(0) => {
@@ -720,7 +720,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
720720
OperandValue::Immediate(self.to_immediate(load, place.layout))
721721
}
722722
else if let abi::Abi::ScalarPair(ref a, ref b) = place.layout.abi {
723-
let b_offset = a.value.size(self).align_to(b.value.align(self).abi);
723+
let b_offset = a.size(self).align_to(b.align(self).abi);
724724
let pair_type = place.layout.gcc_type(self, false);
725725

726726
let mut load = |i, scalar: &abi::Scalar, align| {

compiler/rustc_codegen_gcc/src/common.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,14 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
158158
}
159159

160160
fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, ty: Type<'gcc>) -> RValue<'gcc> {
161-
let bitsize = if layout.is_bool() { 1 } else { layout.value.size(self).bits() };
161+
let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
162162
match cv {
163163
Scalar::Int(ScalarInt::ZST) => {
164-
assert_eq!(0, layout.value.size(self).bytes());
164+
assert_eq!(0, layout.size(self).bytes());
165165
self.const_undef(self.type_ix(0))
166166
}
167167
Scalar::Int(int) => {
168-
let data = int.assert_bits(layout.value.size(self));
168+
let data = int.assert_bits(layout.size(self));
169169

170170
// FIXME(antoyo): there's some issues with using the u128 code that follows, so hard-code
171171
// the paths for floating-point values.
@@ -209,7 +209,7 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
209209
let base_addr = self.const_bitcast(base_addr, self.usize_type);
210210
let offset = self.context.new_rvalue_from_long(self.usize_type, offset.bytes() as i64);
211211
let ptr = self.const_bitcast(base_addr + offset, ptr_type);
212-
if layout.value != Pointer {
212+
if layout.primitive() != Pointer {
213213
self.const_bitcast(ptr.dereference(None).to_rvalue(), ty)
214214
}
215215
else {

compiler/rustc_codegen_gcc/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ pub fn const_alloc_to_gcc<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, alloc: ConstAl
328328
interpret::Pointer::new(alloc_id, Size::from_bytes(ptr_offset)),
329329
&cx.tcx,
330330
),
331-
abi::Scalar { value: Primitive::Pointer, valid_range: WrappingRange { start: 0, end: !0 } },
331+
abi::Scalar::Initialized { value: Primitive::Pointer, valid_range: WrappingRange::full(dl.pointer_size) },
332332
cx.type_i8p(),
333333
));
334334
next_offset = offset + pointer_size;

compiler/rustc_codegen_gcc/src/type_of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
224224
}
225225

226226
fn scalar_gcc_type_at<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>, scalar: &abi::Scalar, offset: Size) -> Type<'gcc> {
227-
match scalar.value {
227+
match scalar.primitive() {
228228
Int(i, true) => cx.type_from_integer(i),
229229
Int(i, false) => cx.type_from_unsigned_integer(i),
230230
F32 => cx.type_f32(),
@@ -282,7 +282,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
282282
Size::ZERO
283283
}
284284
else {
285-
a.value.size(cx).align_to(b.value.align(cx).abi)
285+
a.size(cx).align_to(b.align(cx).abi)
286286
};
287287
self.scalar_gcc_type_at(cx, scalar, offset)
288288
}

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,9 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
510510
// If the value is a boolean, the range is 0..2 and that ultimately
511511
// become 0..0 when the type becomes i1, which would be rejected
512512
// by the LLVM verifier.
513-
if let Int(..) = scalar.value {
513+
if let Int(..) = scalar.primitive() {
514514
if !scalar.is_bool() && !scalar.is_always_valid(bx) {
515-
bx.range_metadata(callsite, scalar.valid_range);
515+
bx.range_metadata(callsite, scalar.valid_range(bx));
516516
}
517517
}
518518
}

0 commit comments

Comments
 (0)