Skip to content

Commit 79734f1

Browse files
committed
Auto merge of rust-lang#124629 - matthiaskrgr:rollup-gttvzrg, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#124138 (Ignore LLVM ABI in dlltool tests since those targets don't use dlltool) - rust-lang#124414 (remove extraneous note on `UnableToRunDsymutil` diagnostic) - rust-lang#124579 (Align: add bytes_usize and bits_usize) - rust-lang#124622 (Cleanup: Rid the `rmake` test runners of `extern crate run_make_support;`) - rust-lang#124623 (shallow resolve in orphan check) - rust-lang#124624 (Use `tcx.types.unit` instead of `Ty::new_unit(tcx)`) - rust-lang#124627 (interpret: hide some reexports in rustdoc) r? `@ghost` `@rustbot` modify labels: rollup
2 parents a8773d5 + a248411 commit 79734f1

File tree

65 files changed

+135
-203
lines changed

Some content is hidden

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

65 files changed

+135
-203
lines changed

compiler/rustc_abi/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,11 +742,21 @@ impl Align {
742742
1 << self.pow2
743743
}
744744

745+
#[inline]
746+
pub fn bytes_usize(self) -> usize {
747+
self.bytes().try_into().unwrap()
748+
}
749+
745750
#[inline]
746751
pub fn bits(self) -> u64 {
747752
self.bytes() * 8
748753
}
749754

755+
#[inline]
756+
pub fn bits_usize(self) -> usize {
757+
self.bits().try_into().unwrap()
758+
}
759+
750760
/// Computes the best alignment possible for the given offset
751761
/// (the largest power of two that the offset is a multiple of).
752762
///

compiler/rustc_codegen_gcc/src/intrinsic/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ fn get_rust_try_fn<'a, 'gcc, 'tcx>(
12231223
tcx,
12241224
ty::Binder::dummy(tcx.mk_fn_sig(
12251225
iter::once(i8p),
1226-
Ty::new_unit(tcx),
1226+
tcx.types.unit,
12271227
false,
12281228
rustc_hir::Unsafety::Unsafe,
12291229
Abi::Rust,
@@ -1234,7 +1234,7 @@ fn get_rust_try_fn<'a, 'gcc, 'tcx>(
12341234
tcx,
12351235
ty::Binder::dummy(tcx.mk_fn_sig(
12361236
[i8p, i8p].iter().cloned(),
1237-
Ty::new_unit(tcx),
1237+
tcx.types.unit,
12381238
false,
12391239
rustc_hir::Unsafety::Unsafe,
12401240
Abi::Rust,

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
984984
tcx,
985985
ty::Binder::dummy(tcx.mk_fn_sig(
986986
[i8p],
987-
Ty::new_unit(tcx),
987+
tcx.types.unit,
988988
false,
989989
hir::Unsafety::Unsafe,
990990
Abi::Rust,
@@ -995,7 +995,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
995995
tcx,
996996
ty::Binder::dummy(tcx.mk_fn_sig(
997997
[i8p, i8p],
998-
Ty::new_unit(tcx),
998+
tcx.types.unit,
999999
false,
10001000
hir::Unsafety::Unsafe,
10011001
Abi::Rust,

compiler/rustc_codegen_ssa/src/errors.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ pub struct ProcessingDymutilFailed {
431431

432432
#[derive(Diagnostic)]
433433
#[diag(codegen_ssa_unable_to_run_dsymutil)]
434-
#[note]
435434
pub struct UnableToRunDsymutil {
436435
pub error: Error,
437436
}

compiler/rustc_const_eval/src/interpret/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ mod util;
1818
mod validity;
1919
mod visitor;
2020

21+
#[doc(no_inline)]
2122
pub use rustc_middle::mir::interpret::*; // have all the `interpret` symbols in one place: here
2223

2324
pub use self::eval_context::{format_interp_error, Frame, FrameInfo, InterpCx, StackPopCleanup};

compiler/rustc_hir_analysis/src/check/intrinsic.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ pub fn check_intrinsic_type(
208208
Ty::new_tup(tcx, &[param(0), tcx.types.bool]),
209209
),
210210
"load" => (1, vec![Ty::new_imm_ptr(tcx, param(0))], param(0)),
211-
"store" => (1, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], Ty::new_unit(tcx)),
211+
"store" => (1, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit),
212212

213213
"xchg" | "xadd" | "xsub" | "and" | "nand" | "or" | "xor" | "max" | "min" | "umax"
214214
| "umin" => (1, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], param(0)),
215-
"fence" | "singlethreadfence" => (0, Vec::new(), Ty::new_unit(tcx)),
215+
"fence" | "singlethreadfence" => (0, Vec::new(), tcx.types.unit),
216216
op => {
217217
tcx.dcx().emit_err(UnrecognizedAtomicOperation { span, op });
218218
return;
@@ -224,7 +224,7 @@ pub fn check_intrinsic_type(
224224
let (n_tps, n_cts, inputs, output) = match intrinsic_name {
225225
sym::abort => (0, 0, vec![], tcx.types.never),
226226
sym::unreachable => (0, 0, vec![], tcx.types.never),
227-
sym::breakpoint => (0, 0, vec![], Ty::new_unit(tcx)),
227+
sym::breakpoint => (0, 0, vec![], tcx.types.unit),
228228
sym::size_of | sym::pref_align_of | sym::min_align_of | sym::variant_count => {
229229
(1, 0, vec![], tcx.types.usize)
230230
}
@@ -235,14 +235,14 @@ pub fn check_intrinsic_type(
235235
sym::caller_location => (0, 0, vec![], tcx.caller_location_ty()),
236236
sym::assert_inhabited
237237
| sym::assert_zero_valid
238-
| sym::assert_mem_uninitialized_valid => (1, 0, vec![], Ty::new_unit(tcx)),
239-
sym::forget => (1, 0, vec![param(0)], Ty::new_unit(tcx)),
238+
| sym::assert_mem_uninitialized_valid => (1, 0, vec![], tcx.types.unit),
239+
sym::forget => (1, 0, vec![param(0)], tcx.types.unit),
240240
sym::transmute | sym::transmute_unchecked => (2, 0, vec![param(0)], param(1)),
241241
sym::prefetch_read_data
242242
| sym::prefetch_write_data
243243
| sym::prefetch_read_instruction
244244
| sym::prefetch_write_instruction => {
245-
(1, 0, vec![Ty::new_imm_ptr(tcx, param(0)), tcx.types.i32], Ty::new_unit(tcx))
245+
(1, 0, vec![Ty::new_imm_ptr(tcx, param(0)), tcx.types.i32], tcx.types.unit)
246246
}
247247
sym::needs_drop => (1, 0, vec![], tcx.types.bool),
248248

@@ -270,7 +270,7 @@ pub fn check_intrinsic_type(
270270
Ty::new_mut_ptr(tcx, param(0)),
271271
tcx.types.usize,
272272
],
273-
Ty::new_unit(tcx),
273+
tcx.types.unit,
274274
),
275275
sym::volatile_copy_memory | sym::volatile_copy_nonoverlapping_memory => (
276276
1,
@@ -280,7 +280,7 @@ pub fn check_intrinsic_type(
280280
Ty::new_imm_ptr(tcx, param(0)),
281281
tcx.types.usize,
282282
],
283-
Ty::new_unit(tcx),
283+
tcx.types.unit,
284284
),
285285
sym::compare_bytes => {
286286
let byte_ptr = Ty::new_imm_ptr(tcx, tcx.types.u8);
@@ -290,7 +290,7 @@ pub fn check_intrinsic_type(
290290
1,
291291
0,
292292
vec![Ty::new_mut_ptr(tcx, param(0)), tcx.types.u8, tcx.types.usize],
293-
Ty::new_unit(tcx),
293+
tcx.types.unit,
294294
),
295295

296296
sym::sqrtf16 => (0, 0, vec![tcx.types.f16], tcx.types.f16),
@@ -409,7 +409,7 @@ pub fn check_intrinsic_type(
409409
(1, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(0))
410410
}
411411
sym::volatile_store | sym::unaligned_volatile_store => {
412-
(1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], Ty::new_unit(tcx))
412+
(1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit)
413413
}
414414

415415
sym::ctpop | sym::ctlz | sym::ctlz_nonzero | sym::cttz | sym::cttz_nonzero => {
@@ -440,7 +440,7 @@ pub fn check_intrinsic_type(
440440
0,
441441
1,
442442
vec![Ty::new_mut_ptr(tcx, tcx.types.u8), tcx.types.usize, tcx.types.usize],
443-
Ty::new_unit(tcx),
443+
tcx.types.unit,
444444
),
445445

446446
sym::ptr_offset_from => (
@@ -477,16 +477,16 @@ pub fn check_intrinsic_type(
477477
| sym::frem_algebraic => (1, 0, vec![param(0), param(0)], param(0)),
478478
sym::float_to_int_unchecked => (2, 0, vec![param(0)], param(1)),
479479

480-
sym::assume => (0, 1, vec![tcx.types.bool], Ty::new_unit(tcx)),
480+
sym::assume => (0, 1, vec![tcx.types.bool], tcx.types.unit),
481481
sym::likely => (0, 1, vec![tcx.types.bool], tcx.types.bool),
482482
sym::unlikely => (0, 1, vec![tcx.types.bool], tcx.types.bool),
483483

484484
sym::read_via_copy => (1, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(0)),
485485
sym::write_via_move => {
486-
(1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], Ty::new_unit(tcx))
486+
(1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit)
487487
}
488488

489-
sym::typed_swap => (1, 1, vec![Ty::new_mut_ptr(tcx, param(0)); 2], Ty::new_unit(tcx)),
489+
sym::typed_swap => (1, 1, vec![Ty::new_mut_ptr(tcx, param(0)); 2], tcx.types.unit),
490490

491491
sym::discriminant_value => {
492492
let assoc_items = tcx.associated_item_def_ids(
@@ -511,14 +511,14 @@ pub fn check_intrinsic_type(
511511
let mut_u8 = Ty::new_mut_ptr(tcx, tcx.types.u8);
512512
let try_fn_ty = ty::Binder::dummy(tcx.mk_fn_sig(
513513
[mut_u8],
514-
Ty::new_unit(tcx),
514+
tcx.types.unit,
515515
false,
516516
hir::Unsafety::Normal,
517517
Abi::Rust,
518518
));
519519
let catch_fn_ty = ty::Binder::dummy(tcx.mk_fn_sig(
520520
[mut_u8, mut_u8],
521-
Ty::new_unit(tcx),
521+
tcx.types.unit,
522522
false,
523523
hir::Unsafety::Normal,
524524
Abi::Rust,
@@ -532,14 +532,14 @@ pub fn check_intrinsic_type(
532532
}
533533

534534
sym::va_start | sym::va_end => match mk_va_list_ty(hir::Mutability::Mut) {
535-
Some((va_list_ref_ty, _)) => (0, 0, vec![va_list_ref_ty], Ty::new_unit(tcx)),
535+
Some((va_list_ref_ty, _)) => (0, 0, vec![va_list_ref_ty], tcx.types.unit),
536536
None => bug!("`va_list` lang item needed for C-variadic intrinsics"),
537537
},
538538

539539
sym::va_copy => match mk_va_list_ty(hir::Mutability::Not) {
540540
Some((va_list_ref_ty, va_list_ty)) => {
541541
let va_list_ptr_ty = Ty::new_mut_ptr(tcx, va_list_ty);
542-
(0, 0, vec![va_list_ptr_ty, va_list_ref_ty], Ty::new_unit(tcx))
542+
(0, 0, vec![va_list_ptr_ty, va_list_ref_ty], tcx.types.unit)
543543
}
544544
None => bug!("`va_list` lang item needed for C-variadic intrinsics"),
545545
},
@@ -550,7 +550,7 @@ pub fn check_intrinsic_type(
550550
},
551551

552552
sym::nontemporal_store => {
553-
(1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], Ty::new_unit(tcx))
553+
(1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit)
554554
}
555555

556556
sym::raw_eq => {
@@ -570,7 +570,7 @@ pub fn check_intrinsic_type(
570570
sym::const_eval_select => (4, 1, vec![param(0), param(1), param(2)], param(3)),
571571

572572
sym::vtable_size | sym::vtable_align => {
573-
(0, 0, vec![Ty::new_imm_ptr(tcx, Ty::new_unit(tcx))], tcx.types.usize)
573+
(0, 0, vec![Ty::new_imm_ptr(tcx, tcx.types.unit)], tcx.types.usize)
574574
}
575575

576576
// This type check is not particularly useful, but the `where` bounds
@@ -623,8 +623,8 @@ pub fn check_intrinsic_type(
623623
sym::simd_fma => (1, 0, vec![param(0), param(0), param(0)], param(0)),
624624
sym::simd_gather => (3, 0, vec![param(0), param(1), param(2)], param(0)),
625625
sym::simd_masked_load => (3, 0, vec![param(0), param(1), param(2)], param(2)),
626-
sym::simd_masked_store => (3, 0, vec![param(0), param(1), param(2)], Ty::new_unit(tcx)),
627-
sym::simd_scatter => (3, 0, vec![param(0), param(1), param(2)], Ty::new_unit(tcx)),
626+
sym::simd_masked_store => (3, 0, vec![param(0), param(1), param(2)], tcx.types.unit),
627+
sym::simd_scatter => (3, 0, vec![param(0), param(1), param(2)], tcx.types.unit),
628628
sym::simd_insert => (2, 0, vec![param(0), tcx.types.u32, param(1)], param(0)),
629629
sym::simd_extract => (2, 0, vec![param(0), tcx.types.u32], param(1)),
630630
sym::simd_cast

compiler/rustc_hir_analysis/src/coherence/orphan.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ fn orphan_check<'tcx>(
330330
};
331331

332332
let Ok(result) = traits::orphan_check_trait_ref::<!>(
333+
&infcx,
333334
trait_ref,
334335
traits::InCrate::Local { mode },
335336
lazily_normalize_ty,

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2370,7 +2370,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
23702370
self.lower_ty(output)
23712371
}
23722372
}
2373-
hir::FnRetTy::DefaultReturn(..) => Ty::new_unit(tcx),
2373+
hir::FnRetTy::DefaultReturn(..) => tcx.types.unit,
23742374
};
23752375

23762376
debug!(?output_ty);

compiler/rustc_hir_typeck/src/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
6666
// us to give better error messages (pointing to a usually better
6767
// arm for inconsistent arms or to the whole match when a `()` type
6868
// is required).
69-
Expectation::ExpectHasType(ety) if ety != Ty::new_unit(self.tcx) => ety,
69+
Expectation::ExpectHasType(ety) if ety != tcx.types.unit => ety,
7070
_ => self.next_ty_var(TypeVariableOrigin { param_def_id: None, span: expr.span }),
7171
};
7272
CoerceMany::with_coercion_sites(coerce_first, arms)

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> {
14621462
fcx,
14631463
cause,
14641464
None,
1465-
Ty::new_unit(fcx.tcx),
1465+
fcx.tcx.types.unit,
14661466
augment_error,
14671467
label_unit_as_expected,
14681468
)

0 commit comments

Comments
 (0)