Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #97126

Merged
merged 25 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b712135
rustdoc-json-types: Improve docs for HRTB fields
Enselic May 2, 2022
1f15ce5
rustdoc-json: Fix HRTBs for WherePredicate::BoundPredicate
Enselic May 2, 2022
774b525
rustdoc-json: Add tests for all three HRTB fields
Enselic May 4, 2022
7f11749
rustdoc: don't build `rayon` for non-windows targets
klensy May 6, 2022
03007de
Omit unnecessary help to add `#[cfg(test)]` when already annotated
ken-matsui May 2, 2022
17f2893
Types with reachable constructors are reachable
tmiasko May 17, 2022
658be0d
Add tmm_reg clobbers
chorman0773 May 17, 2022
50ce367
add clobbers
chorman0773 May 17, 2022
89ab77b
Handle tmm_reg in rustc_codegen_gcc
chorman0773 May 17, 2022
6354bfc
Add ABI clobbers
chorman0773 May 17, 2022
eabe851
fix clobber_abi tests
chorman0773 May 17, 2022
e170d87
Update browser-ui-test version to 0.9.2
GuillaumeGomez May 16, 2022
d765b73
Fix duplicated "in" in the search result text
GuillaumeGomez May 17, 2022
5601044
Add GUI test for search result "title"
GuillaumeGomez May 17, 2022
0f8b3f4
Fix display of search crate filter select
GuillaumeGomez May 17, 2022
440bbce
Add GUI test for search crate filter select CSS properties
GuillaumeGomez May 17, 2022
501f5d0
interpret/validity: reject references to uninhabited types
RalfJung May 17, 2022
201750d
bless 32bit
RalfJung May 17, 2022
ce49ce2
Rollup merge of #96647 - Enselic:fix-hrtb-for-wherepredicate, r=Craft…
JohnTitor May 17, 2022
78c709c
Rollup merge of #96651 - ken-matsui:omit-unnecessary-help-to-add-cfg-…
JohnTitor May 17, 2022
e9f3733
Rollup merge of #96761 - klensy:no-rayon-here, r=CraftSpider
JohnTitor May 17, 2022
f597846
Rollup merge of #97096 - tmiasko:reachable-constructor, r=petrochenkov
JohnTitor May 17, 2022
7361b22
Rollup merge of #97097 - chorman0773:add_tmm_clobers, r=joshtriplett
JohnTitor May 17, 2022
b8dd270
Rollup merge of #97113 - GuillaumeGomez:search-ui-fixes, r=notriddle
JohnTitor May 17, 2022
248890c
Rollup merge of #97116 - RalfJung:ref-validity, r=oli-obk
JohnTitor May 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions compiler/rustc_codegen_gcc/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ fn reg_to_gcc(reg: InlineAsmRegOrRegClass) -> ConstraintOrRegister {
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg0) => unimplemented!(),
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => unimplemented!(),
InlineAsmRegClass::X86(
X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg,
X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg | X86InlineAsmRegClass::tmm_reg,
) => unreachable!("clobber-only"),
InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
bug!("GCC backend does not support SPIR-V")
Expand Down Expand Up @@ -656,6 +656,7 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
InlineAsmRegClass::X86(X86InlineAsmRegClass::x87_reg) => unimplemented!(),
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg) => cx.type_i16(),
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg0) => cx.type_i16(),
InlineAsmRegClass::X86(X86InlineAsmRegClass::tmm_reg) => unimplemented!(),
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => cx.type_i32(),
InlineAsmRegClass::SpirV(SpirVInlineAsmRegClass::reg) => {
bug!("LLVM backend does not support SPIR-V")
Expand Down Expand Up @@ -787,7 +788,7 @@ fn modifier_to_gcc(arch: InlineAsmArch, reg: InlineAsmRegClass, modifier: Option
},
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg) => None,
InlineAsmRegClass::X86(X86InlineAsmRegClass::kreg0) => None,
InlineAsmRegClass::X86(X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg) => {
InlineAsmRegClass::X86(X86InlineAsmRegClass::x87_reg | X86InlineAsmRegClass::mmx_reg | X86InlineAsmRegClass::tmm_reg) => {
unreachable!("clobber-only")
}
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => unimplemented!(),
Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_codegen_llvm/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,8 @@ fn reg_to_llvm(reg: InlineAsmRegOrRegClass, layout: Option<&TyAndLayout<'_>>) ->
InlineAsmRegClass::X86(
X86InlineAsmRegClass::x87_reg
| X86InlineAsmRegClass::mmx_reg
| X86InlineAsmRegClass::kreg0,
| X86InlineAsmRegClass::kreg0
| X86InlineAsmRegClass::tmm_reg,
) => unreachable!("clobber-only"),
InlineAsmRegClass::Wasm(WasmInlineAsmRegClass::local) => "r",
InlineAsmRegClass::Bpf(BpfInlineAsmRegClass::reg) => "r",
Expand Down Expand Up @@ -692,7 +693,8 @@ fn modifier_to_llvm(
InlineAsmRegClass::X86(
X86InlineAsmRegClass::x87_reg
| X86InlineAsmRegClass::mmx_reg
| X86InlineAsmRegClass::kreg0,
| X86InlineAsmRegClass::kreg0
| X86InlineAsmRegClass::tmm_reg,
) => {
unreachable!("clobber-only")
}
Expand Down Expand Up @@ -766,7 +768,8 @@ fn dummy_output_type<'ll>(cx: &CodegenCx<'ll, '_>, reg: InlineAsmRegClass) -> &'
InlineAsmRegClass::X86(
X86InlineAsmRegClass::x87_reg
| X86InlineAsmRegClass::mmx_reg
| X86InlineAsmRegClass::kreg0,
| X86InlineAsmRegClass::kreg0
| X86InlineAsmRegClass::tmm_reg,
) => {
unreachable!("clobber-only")
}
Expand Down
17 changes: 11 additions & 6 deletions compiler/rustc_const_eval/src/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,22 +412,27 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
self.path,
err_ub!(AlignmentCheckFailed { required, has }) =>
{
"an unaligned {} (required {} byte alignment but found {})",
kind,
"an unaligned {kind} (required {} byte alignment but found {})",
required.bytes(),
has.bytes()
},
err_ub!(DanglingIntPointer(0, _)) =>
{ "a null {}", kind },
{ "a null {kind}" },
err_ub!(DanglingIntPointer(i, _)) =>
{ "a dangling {} (address 0x{:x} is unallocated)", kind, i },
{ "a dangling {kind} (address 0x{i:x} is unallocated)" },
err_ub!(PointerOutOfBounds { .. }) =>
{ "a dangling {} (going beyond the bounds of its allocation)", kind },
{ "a dangling {kind} (going beyond the bounds of its allocation)" },
// This cannot happen during const-eval (because interning already detects
// dangling pointers), but it can happen in Miri.
err_ub!(PointerUseAfterFree(..)) =>
{ "a dangling {} (use-after-free)", kind },
{ "a dangling {kind} (use-after-free)" },
);
// Do not allow pointers to uninhabited types.
if place.layout.abi.is_uninhabited() {
throw_validation_failure!(self.path,
{ "a {kind} pointing to uninhabited type {}", place.layout.ty }
)
}
// Recursive checking
if let Some(ref mut ref_tracking) = self.ref_tracking {
// Proceed recursively even for ZST, no reason to skip them!
Expand Down
16 changes: 15 additions & 1 deletion compiler/rustc_privacy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,14 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
}
// Corner case: if the variant is reachable, but its
// enum is not, make the enum reachable as well.
self.update(item.def_id, variant_level);
self.reach(item.def_id, variant_level).ty();
}
if let Some(hir_id) = variant.data.ctor_hir_id() {
let ctor_def_id = self.tcx.hir().local_def_id(hir_id);
let ctor_level = self.get(ctor_def_id);
if ctor_level.is_some() {
self.reach(item.def_id, ctor_level).ty();
}
}
}
}
Expand Down Expand Up @@ -803,6 +810,13 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
}
}
}
if let Some(hir_id) = struct_def.ctor_hir_id() {
let ctor_def_id = self.tcx.hir().local_def_id(hir_id);
let ctor_level = self.get(ctor_def_id);
if ctor_level.is_some() {
self.reach(item.def_id, ctor_level).ty();
}
}
}
}

Expand Down
35 changes: 21 additions & 14 deletions compiler/rustc_resolve/src/check_unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,21 +315,28 @@ impl Resolver<'_> {
"remove the unused import"
};

let parent_module = visitor.r.get_nearest_non_block_module(
visitor.r.local_def_id(unused.use_tree_id).to_def_id(),
);
let test_module_span = match module_to_string(parent_module) {
Some(module)
if module == "test"
|| module == "tests"
|| module.starts_with("test_")
|| module.starts_with("tests_")
|| module.ends_with("_test")
|| module.ends_with("_tests") =>
{
Some(parent_module.span)
// If we are in the `--test` mode, suppress a help that adds the `#[cfg(test)]`
// attribute; however, if not, suggest adding the attribute. There is no way to
// retrieve attributes here because we do not have a `TyCtxt` yet.
let test_module_span = if visitor.r.session.opts.test {
None
} else {
let parent_module = visitor.r.get_nearest_non_block_module(
visitor.r.local_def_id(unused.use_tree_id).to_def_id(),
);
match module_to_string(parent_module) {
Some(module)
if module == "test"
|| module == "tests"
|| module.starts_with("test_")
|| module.starts_with("tests_")
|| module.ends_with("_test")
|| module.ends_with("_tests") =>
{
Some(parent_module.span)
}
_ => None,
}
_ => None,
};

visitor.r.lint_buffer.buffer_lint_with_diagnostic(
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,7 @@ symbols! {
thread_local_macro,
thumb2,
thumb_mode: "thumb-mode",
tmm_reg,
todo_macro,
tool_attributes,
tool_lints,
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_target/src/asm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ impl InlineAsmClobberAbi {

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

mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7,
st0, st1, st2, st3, st4, st5, st6, st7,
tmm0, tmm1, tmm2, tmm3, tmm4, tmm5, tmm6, tmm7,
}
},
InlineAsmClobberAbi::AArch64 => clobbered_regs! {
Expand Down
13 changes: 13 additions & 0 deletions compiler/rustc_target/src/asm/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def_reg_class! {
kreg0,
mmx_reg,
x87_reg,
tmm_reg,
}
}

Expand All @@ -41,6 +42,7 @@ impl X86InlineAsmRegClass {
Self::xmm_reg | Self::ymm_reg | Self::zmm_reg => &['x', 'y', 'z'],
Self::kreg | Self::kreg0 => &[],
Self::mmx_reg | Self::x87_reg => &[],
Self::tmm_reg => &[],
}
}

Expand Down Expand Up @@ -80,6 +82,7 @@ impl X86InlineAsmRegClass {
},
Self::kreg | Self::kreg0 => None,
Self::mmx_reg | Self::x87_reg => None,
Self::tmm_reg => None,
}
}

Expand All @@ -98,6 +101,7 @@ impl X86InlineAsmRegClass {
Self::zmm_reg => Some(('z', "zmm0")),
Self::kreg | Self::kreg0 => None,
Self::mmx_reg | Self::x87_reg => None,
Self::tmm_reg => None,
}
}

Expand Down Expand Up @@ -135,6 +139,7 @@ impl X86InlineAsmRegClass {
},
Self::kreg0 => &[],
Self::mmx_reg | Self::x87_reg => &[],
Self::tmm_reg => &[],
}
}
}
Expand Down Expand Up @@ -320,6 +325,14 @@ def_regs! {
st5: x87_reg = ["st(5)"],
st6: x87_reg = ["st(6)"],
st7: x87_reg = ["st(7)"],
tmm0: tmm_reg = ["tmm0"] % x86_64_only,
tmm1: tmm_reg = ["tmm1"] % x86_64_only,
tmm2: tmm_reg = ["tmm2"] % x86_64_only,
tmm3: tmm_reg = ["tmm3"] % x86_64_only,
tmm4: tmm_reg = ["tmm4"] % x86_64_only,
tmm5: tmm_reg = ["tmm5"] % x86_64_only,
tmm6: tmm_reg = ["tmm6"] % x86_64_only,
tmm7: tmm_reg = ["tmm7"] % x86_64_only,
#error = ["bp", "bpl", "ebp", "rbp"] =>
"the frame pointer cannot be used as an operand for inline asm",
#error = ["sp", "spl", "esp", "rsp"] =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.1
0.9.2
4 changes: 3 additions & 1 deletion src/librustdoc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ askama = { version = "0.11", default-features = false, features = ["config"] }
atty = "0.2"
pulldown-cmark = { version = "0.9", default-features = false }
minifier = "0.0.43"
rayon = "1.5.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
smallvec = "1.6.1"
Expand All @@ -29,6 +28,9 @@ version = "0.3.3"
default-features = false
features = ["fmt", "env-filter", "smallvec", "parking_lot", "ansi"]

[target.'cfg(windows)'.dependencies]
rayon = "1.5.1"

[dev-dependencies]
expect-test = "1.0"

Expand Down
7 changes: 6 additions & 1 deletion src/librustdoc/docfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ impl DocFS {
where
E: PathError,
{
if !self.sync_only && cfg!(windows) {
#[cfg(windows)]
if !self.sync_only {
// A possible future enhancement after more detailed profiling would
// be to create the file sync so errors are reported eagerly.
let sender = self.errors.clone().expect("can't write after closing");
Expand All @@ -68,6 +69,10 @@ impl DocFS {
} else {
fs::write(&path, contents).map_err(|e| E::new(e, path))?;
}

#[cfg(not(windows))]
fs::write(&path, contents).map_err(|e| E::new(e, path))?;

Ok(())
}
}
3 changes: 1 addition & 2 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ table,
margin-left: 0.25em;
padding-left: 0.3125em;
padding-right: 23px;
border: 0;
border: 1px solid;
border-radius: 4px;
outline: none;
cursor: pointer;
Expand Down Expand Up @@ -2010,7 +2010,6 @@ details.rustdoc-toggle[open] > summary.hideme::after {

#crate-search {
border-radius: 4px;
border: 0;
}

.docblock {
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/css/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ details.undocumented > summary::before {

#crate-search, .search-input {
background-color: #141920;
border-color: #424c57;
color: #c5c5c5;
/* Without the `!important`, the border-color is ignored for `<select>`... */
border-color: #424c57 !important;
}

.search-input {
Expand Down
3 changes: 2 additions & 1 deletion src/librustdoc/html/static/css/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ details.undocumented > summary::before {
#crate-search, .search-input {
color: #111;
background-color: #f0f0f0;
border-color: #000;
/* Without the `!important`, the border-color is ignored for `<select>`... */
border-color: #f0f0f0 !important;
}

.search-input {
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/css/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ details.undocumented > summary::before {
}

#crate-search, .search-input {
color: #555;
background-color: white;
border-color: #e0e0e0;
/* Without the `!important`, the border-color is ignored for `<select>`... */
border-color: #e0e0e0 !important;
}

.search-input:focus {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1738,7 +1738,7 @@ function initSearch(rawSearchIndex) {

let output = "<div id=\"search-settings\">" +
`<h1 class="search-results-title">Results for ${escape(results.query.userQuery)}` +
`${typeFilter}</h1> in ${crates} </div>`;
`${typeFilter}</h1>${crates}</div>`;
if (results.query.error !== null) {
output += `<h3>Query parser error: "${results.query.error}".</h3>`;
output += "<div id=\"titles\">" +
Expand Down
10 changes: 8 additions & 2 deletions src/librustdoc/json/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,16 @@ impl FromWithTcx<clean::WherePredicate> for WherePredicate {
fn from_tcx(predicate: clean::WherePredicate, tcx: TyCtxt<'_>) -> Self {
use clean::WherePredicate::*;
match predicate {
BoundPredicate { ty, bounds, .. } => WherePredicate::BoundPredicate {
BoundPredicate { ty, bounds, bound_params } => WherePredicate::BoundPredicate {
type_: ty.into_tcx(tcx),
bounds: bounds.into_iter().map(|x| x.into_tcx(tcx)).collect(),
// FIXME: add `bound_params` to rustdoc-json-params?
generic_params: bound_params
.into_iter()
.map(|x| GenericParamDef {
name: x.0.to_string(),
kind: GenericParamDefKind::Lifetime { outlives: vec![] },
})
.collect(),
},
RegionPredicate { lifetime, bounds } => WherePredicate::RegionPredicate {
lifetime: lifetime.0.to_string(),
Expand Down
Loading