Skip to content

Commit 77972d2

Browse files
committed
Auto merge of #97126 - JohnTitor:rollup-7gdt2aw, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #96647 (rustdoc-json: Fix HRTBs for WherePredicate::BoundPredicate) - #96651 (Omit unnecessary help to add `#[cfg(test)]` when already annotated) - #96761 (rustdoc: don't build `rayon` for non-windows targets) - #97096 (Types with reachable constructors are reachable) - #97097 (Add tmm_reg clobbers) - #97113 (Search GUI fixes) - #97116 (interpret/validity: reject references to uninhabited types) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4c5f6e6 + 248890c commit 77972d2

File tree

31 files changed

+459
-53
lines changed

31 files changed

+459
-53
lines changed

compiler/rustc_codegen_gcc/src/asm.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ fn reg_to_gcc(reg: InlineAsmRegOrRegClass) -> ConstraintOrRegister {
592592
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg0) => unimplemented!(),
593593
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => unimplemented!(),
594594
InlineAsmRegClass::X86(
595-
X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg,
595+
X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg | X86InlineAsmRegClass::tmm_reg,
596596
) => unreachable!("clobber-only"),
597597
InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
598598
bug!("GCC backend does not support SPIR-V")
@@ -656,6 +656,7 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
656656
InlineAsmRegClass::X86(X86InlineAsmRegClass::x87_reg) => unimplemented!(),
657657
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg) => cx.type_i16(),
658658
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg0) => cx.type_i16(),
659+
InlineAsmRegClass::X86(X86InlineAsmRegClass::tmm_reg) => unimplemented!(),
659660
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => cx.type_i32(),
660661
InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
661662
bug!("LLVM backend does not support SPIR-V")
@@ -787,7 +788,7 @@ fn modifier_to_gcc(arch: InlineAsmArch, reg: InlineAsmRegClass, modifier: Option
787788
},
788789
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg) => None,
789790
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg0) => None,
790-
InlineAsmRegClass::X86(X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg) => {
791+
InlineAsmRegClass::X86(X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg | X86InlineAsmRegClass::tmm_reg) => {
791792
unreachable!("clobber-only")
792793
}
793794
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => unimplemented!(),

compiler/rustc_codegen_llvm/src/asm.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,8 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) ->
604604
InlineAsmRegClass::X86(
605605
X86InlineAsmRegClass::x87_reg
606606
| X86InlineAsmRegClass::mmx_reg
607-
| X86InlineAsmRegClass::kreg0,
607+
| X86InlineAsmRegClass::kreg0
608+
| X86InlineAsmRegClass::tmm_reg,
608609
) => unreachable!("clobber-only"),
609610
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => "r",
610611
InlineAsmRegClass::Bpf(BpfInlineAsmRegClass::reg) => "r",
@@ -692,7 +693,8 @@ fn modifier_to_llvm(
692693
InlineAsmRegClass::X86(
693694
X86InlineAsmRegClass::x87_reg
694695
| X86InlineAsmRegClass::mmx_reg
695-
| X86InlineAsmRegClass::kreg0,
696+
| X86InlineAsmRegClass::kreg0
697+
| X86InlineAsmRegClass::tmm_reg,
696698
) => {
697699
unreachable!("clobber-only")
698700
}
@@ -766,7 +768,8 @@ fn dummy_output_type<'ll>(cx: &CodegenCx<'ll, '_>, reg: InlineAsmRegClass) -> &'
766768
InlineAsmRegClass::X86(
767769
X86InlineAsmRegClass::x87_reg
768770
| X86InlineAsmRegClass::mmx_reg
769-
| X86InlineAsmRegClass::kreg0,
771+
| X86InlineAsmRegClass::kreg0
772+
| X86InlineAsmRegClass::tmm_reg,
770773
) => {
771774
unreachable!("clobber-only")
772775
}

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,22 +412,27 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
412412
self.path,
413413
err_ub!(AlignmentCheckFailed { required, has }) =>
414414
{
415-
"an unaligned {} (required {} byte alignment but found {})",
416-
kind,
415+
"an unaligned {kind} (required {} byte alignment but found {})",
417416
required.bytes(),
418417
has.bytes()
419418
},
420419
err_ub!(DanglingIntPointer(0, _)) =>
421-
{ "a null {}", kind },
420+
{ "a null {kind}" },
422421
err_ub!(DanglingIntPointer(i, _)) =>
423-
{ "a dangling {} (address 0x{:x} is unallocated)", kind, i },
422+
{ "a dangling {kind} (address 0x{i:x} is unallocated)" },
424423
err_ub!(PointerOutOfBounds { .. }) =>
425-
{ "a dangling {} (going beyond the bounds of its allocation)", kind },
424+
{ "a dangling {kind} (going beyond the bounds of its allocation)" },
426425
// This cannot happen during const-eval (because interning already detects
427426
// dangling pointers), but it can happen in Miri.
428427
err_ub!(PointerUseAfterFree(..)) =>
429-
{ "a dangling {} (use-after-free)", kind },
428+
{ "a dangling {kind} (use-after-free)" },
430429
);
430+
// Do not allow pointers to uninhabited types.
431+
if place.layout.abi.is_uninhabited() {
432+
throw_validation_failure!(self.path,
433+
{ "a {kind} pointing to uninhabited type {}", place.layout.ty }
434+
)
435+
}
431436
// Recursive checking
432437
if let Some(ref mut ref_tracking) = self.ref_tracking {
433438
// Proceed recursively even for ZST, no reason to skip them!

compiler/rustc_privacy/src/lib.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,14 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
775775
}
776776
// Corner case: if the variant is reachable, but its
777777
// enum is not, make the enum reachable as well.
778-
self.update(item.def_id, variant_level);
778+
self.reach(item.def_id, variant_level).ty();
779+
}
780+
if let Some(hir_id) = variant.data.ctor_hir_id() {
781+
let ctor_def_id = self.tcx.hir().local_def_id(hir_id);
782+
let ctor_level = self.get(ctor_def_id);
783+
if ctor_level.is_some() {
784+
self.reach(item.def_id, ctor_level).ty();
785+
}
779786
}
780787
}
781788
}
@@ -803,6 +810,13 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
803810
}
804811
}
805812
}
813+
if let Some(hir_id) = struct_def.ctor_hir_id() {
814+
let ctor_def_id = self.tcx.hir().local_def_id(hir_id);
815+
let ctor_level = self.get(ctor_def_id);
816+
if ctor_level.is_some() {
817+
self.reach(item.def_id, ctor_level).ty();
818+
}
819+
}
806820
}
807821
}
808822

compiler/rustc_resolve/src/check_unused.rs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -315,21 +315,28 @@ impl Resolver<'_> {
315315
"remove the unused import"
316316
};
317317

318-
let parent_module = visitor.r.get_nearest_non_block_module(
319-
visitor.r.local_def_id(unused.use_tree_id).to_def_id(),
320-
);
321-
let test_module_span = match module_to_string(parent_module) {
322-
Some(module)
323-
if module == "test"
324-
|| module == "tests"
325-
|| module.starts_with("test_")
326-
|| module.starts_with("tests_")
327-
|| module.ends_with("_test")
328-
|| module.ends_with("_tests") =>
329-
{
330-
Some(parent_module.span)
318+
// If we are in the `--test` mode, suppress a help that adds the `#[cfg(test)]`
319+
// attribute; however, if not, suggest adding the attribute. There is no way to
320+
// retrieve attributes here because we do not have a `TyCtxt` yet.
321+
let test_module_span = if visitor.r.session.opts.test {
322+
None
323+
} else {
324+
let parent_module = visitor.r.get_nearest_non_block_module(
325+
visitor.r.local_def_id(unused.use_tree_id).to_def_id(),
326+
);
327+
match module_to_string(parent_module) {
328+
Some(module)
329+
if module == "test"
330+
|| module == "tests"
331+
|| module.starts_with("test_")
332+
|| module.starts_with("tests_")
333+
|| module.ends_with("_test")
334+
|| module.ends_with("_tests") =>
335+
{
336+
Some(parent_module.span)
337+
}
338+
_ => None,
331339
}
332-
_ => None,
333340
};
334341

335342
visitor.r.lint_buffer.buffer_lint_with_diagnostic(

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,6 +1408,7 @@ symbols! {
14081408
thread_local_macro,
14091409
thumb2,
14101410
thumb_mode: "thumb-mode",
1411+
tmm_reg,
14111412
todo_macro,
14121413
tool_attributes,
14131414
tool_lints,

compiler/rustc_target/src/asm/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,7 @@ impl InlineAsmClobberAbi {
912912

913913
mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7,
914914
st0, st1, st2, st3, st4, st5, st6, st7,
915+
tmm0, tmm1, tmm2, tmm3, tmm4, tmm5, tmm6, tmm7,
915916
}
916917
},
917918
InlineAsmClobberAbi::X86_64Win => clobbered_regs! {
@@ -931,6 +932,7 @@ impl InlineAsmClobberAbi {
931932

932933
mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7,
933934
st0, st1, st2, st3, st4, st5, st6, st7,
935+
tmm0, tmm1, tmm2, tmm3, tmm4, tmm5, tmm6, tmm7,
934936
}
935937
},
936938
InlineAsmClobberAbi::AArch64 => clobbered_regs! {

compiler/rustc_target/src/asm/x86.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def_reg_class! {
1717
kreg0,
1818
mmx_reg,
1919
x87_reg,
20+
tmm_reg,
2021
}
2122
}
2223

@@ -41,6 +42,7 @@ impl X86InlineAsmRegClass {
4142
Self::xmm_reg | Self::ymm_reg | Self::zmm_reg => &['x', 'y', 'z'],
4243
Self::kreg | Self::kreg0 => &[],
4344
Self::mmx_reg | Self::x87_reg => &[],
45+
Self::tmm_reg => &[],
4446
}
4547
}
4648

@@ -80,6 +82,7 @@ impl X86InlineAsmRegClass {
8082
},
8183
Self::kreg | Self::kreg0 => None,
8284
Self::mmx_reg | Self::x87_reg => None,
85+
Self::tmm_reg => None,
8386
}
8487
}
8588

@@ -98,6 +101,7 @@ impl X86InlineAsmRegClass {
98101
Self::zmm_reg => Some(('z', "zmm0")),
99102
Self::kreg | Self::kreg0 => None,
100103
Self::mmx_reg | Self::x87_reg => None,
104+
Self::tmm_reg => None,
101105
}
102106
}
103107

@@ -135,6 +139,7 @@ impl X86InlineAsmRegClass {
135139
},
136140
Self::kreg0 => &[],
137141
Self::mmx_reg | Self::x87_reg => &[],
142+
Self::tmm_reg => &[],
138143
}
139144
}
140145
}
@@ -320,6 +325,14 @@ def_regs! {
320325
st5: x87_reg = ["st(5)"],
321326
st6: x87_reg = ["st(6)"],
322327
st7: x87_reg = ["st(7)"],
328+
tmm0: tmm_reg = ["tmm0"] % x86_64_only,
329+
tmm1: tmm_reg = ["tmm1"] % x86_64_only,
330+
tmm2: tmm_reg = ["tmm2"] % x86_64_only,
331+
tmm3: tmm_reg = ["tmm3"] % x86_64_only,
332+
tmm4: tmm_reg = ["tmm4"] % x86_64_only,
333+
tmm5: tmm_reg = ["tmm5"] % x86_64_only,
334+
tmm6: tmm_reg = ["tmm6"] % x86_64_only,
335+
tmm7: tmm_reg = ["tmm7"] % x86_64_only,
323336
#error = ["bp", "bpl", "ebp", "rbp"] =>
324337
"the frame pointer cannot be used as an operand for inline asm",
325338
#error = ["sp", "spl", "esp", "rsp"] =>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.1
1+
0.9.2

src/librustdoc/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ askama = { version = "0.11", default-features = false, features = ["config"] }
1212
atty = "0.2"
1313
pulldown-cmark = { version = "0.9", default-features = false }
1414
minifier = "0.0.43"
15-
rayon = "1.5.1"
1615
serde = { version = "1.0", features = ["derive"] }
1716
serde_json = "1.0"
1817
smallvec = "1.6.1"
@@ -29,6 +28,9 @@ version = "0.3.3"
2928
default-features = false
3029
features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"]
3130

31+
[target.'cfg(windows)'.dependencies]
32+
rayon = "1.5.1"
33+
3234
[dev-dependencies]
3335
expect-test = "1.0"
3436

0 commit comments

Comments
 (0)