From b7121355756cc97bf1273a01d0206585d951699b Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Mon, 2 May 2022 20:23:56 +0200 Subject: [PATCH 01/18] rustdoc-json-types: Improve docs for HRTB fields --- src/rustdoc-json-types/lib.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 17b3859a77b64..c045db9b231f6 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -408,7 +408,13 @@ pub enum GenericBound { TraitBound { #[serde(rename = "trait")] trait_: Type, - /// Used for HRTBs + /// Used for Higher-Rank Trait Bounds (HRTBs) + /// ```plain + /// where F: for<'a, 'b> Fn(&'a u8, &'b u8) + /// ^^^^^^^^^^^ + /// | + /// this part + /// ``` generic_params: Vec, modifier: TraitBoundModifier, }, @@ -487,6 +493,13 @@ pub enum Type { #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] pub struct FunctionPointer { pub decl: FnDecl, + /// Used for Higher-Rank Trait Bounds (HRTBs) + /// ```plain + /// for<'c> fn(val: &'c i32) -> i32 + /// ^^^^^^^ + /// | + /// this part + /// ``` pub generic_params: Vec, pub header: Header, } From 1f15ce5f9748d523f3c1835da12b05b15648aa68 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Mon, 2 May 2022 20:34:12 +0200 Subject: [PATCH 02/18] rustdoc-json: Fix HRTBs for WherePredicate::BoundPredicate --- src/librustdoc/json/conversions.rs | 10 ++++++++-- src/rustdoc-json-types/lib.rs | 10 +++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 56b02cd848041..412387313dc17 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -350,10 +350,16 @@ impl FromWithTcx 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(), diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index c045db9b231f6..eb2c8e5bae1c4 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -9,7 +9,7 @@ use std::path::PathBuf; use serde::{Deserialize, Serialize}; /// rustdoc format-version. -pub const FORMAT_VERSION: u32 = 14; +pub const FORMAT_VERSION: u32 = 15; /// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information /// about the language items in the local crate, as well as info about external items to allow @@ -391,6 +391,14 @@ pub enum WherePredicate { #[serde(rename = "type")] type_: Type, bounds: Vec, + /// Used for Higher-Rank Trait Bounds (HRTBs) + /// ```plain + /// where for<'a> &'a T: Iterator," + /// ^^^^^^^ + /// | + /// this part + /// ``` + generic_params: Vec, }, RegionPredicate { lifetime: String, From 774b525f6f5c7a8712349e67f53cfd75056fe079 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Wed, 4 May 2022 20:49:05 +0200 Subject: [PATCH 03/18] rustdoc-json: Add tests for all three HRTB fields --- src/test/rustdoc-json/fn_pointer/generics.rs | 14 +++++++++ src/test/rustdoc-json/fns/generic_args.rs | 32 +++++++++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 src/test/rustdoc-json/fn_pointer/generics.rs diff --git a/src/test/rustdoc-json/fn_pointer/generics.rs b/src/test/rustdoc-json/fn_pointer/generics.rs new file mode 100644 index 0000000000000..646f720e66396 --- /dev/null +++ b/src/test/rustdoc-json/fn_pointer/generics.rs @@ -0,0 +1,14 @@ +// ignore-tidy-linelength + +#![feature(no_core)] +#![no_core] + +// @count generics.json "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[*]" 1 +// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][0]" '"val"' +// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][1].kind" '"borrowed_ref"' +// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.inputs[0][1].inner.lifetime" \"\'c\" +// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.decl.output" '{ "kind": "primitive", "inner": "i32" }' +// @count - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[*]" 1 +// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[0].name" \"\'c\" +// @is - "$.index[*][?(@.name=='WithHigherRankTraitBounds')].inner.type.inner.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }' +pub type WithHigherRankTraitBounds = for<'c> fn(val: &'c i32) -> i32; diff --git a/src/test/rustdoc-json/fns/generic_args.rs b/src/test/rustdoc-json/fns/generic_args.rs index 3b03724b040ae..69150443c29dc 100644 --- a/src/test/rustdoc-json/fns/generic_args.rs +++ b/src/test/rustdoc-json/fns/generic_args.rs @@ -6,6 +6,9 @@ // @set foo = generic_args.json "$.index[*][?(@.name=='Foo')].id" pub trait Foo {} +// @set generic_foo = generic_args.json "$.index[*][?(@.name=='GenericFoo')].id" +pub trait GenericFoo<'a> {} + // @is - "$.index[*][?(@.name=='generics')].inner.generics.where_predicates" "[]" // @count - "$.index[*][?(@.name=='generics')].inner.generics.params[*]" 1 // @is - "$.index[*][?(@.name=='generics')].inner.generics.params[0].name" '"F"' @@ -29,19 +32,40 @@ pub fn generics(f: F) {} // @is - "$.index[*][?(@.name=='impl_trait')].inner.decl.inputs[0][1].inner[0].trait_bound.trait.inner.id" $foo pub fn impl_trait(f: impl Foo) {} -// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.params[*]" 1 +// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.params[*]" 3 // @is - "$.index[*][?(@.name=='where_clase')].inner.generics.params[0].name" '"F"' // @is - "$.index[*][?(@.name=='where_clase')].inner.generics.params[0].kind" '{"type": {"bounds": [], "default": null, "synthetic": false}}' -// @count - "$.index[*][?(@.name=='where_clase')].inner.decl.inputs[*]" 1 +// @count - "$.index[*][?(@.name=='where_clase')].inner.decl.inputs[*]" 3 // @is - "$.index[*][?(@.name=='where_clase')].inner.decl.inputs[0][0]" '"f"' // @is - "$.index[*][?(@.name=='where_clase')].inner.decl.inputs[0][1].kind" '"generic"' // @is - "$.index[*][?(@.name=='where_clase')].inner.decl.inputs[0][1].inner" '"F"' -// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[*]" 1 +// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[*]" 3 + // @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[0].bound_predicate.type" '{"inner": "F", "kind": "generic"}' // @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[0].bound_predicate.bounds[*]" 1 // @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[0].bound_predicate.bounds[0].trait_bound.trait.inner.id" $foo -pub fn where_clase(f: F) + +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.type" '{"inner": "G", "kind": "generic"}' +// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.bounds[*]" 1 +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.trait.inner.id" $generic_foo +// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[*]" 1 +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].name" \"\'a\" +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.bounds[0].trait_bound.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }' +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[1].bound_predicate.generic_params" "[]" + +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.type.kind" '"borrowed_ref"' +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.type.inner.lifetime" \"\'b\" +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.type.inner.type" '{"inner": "H", "kind": "generic"}' +// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.bounds[*]" 1 +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.trait.inner.id" $foo +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.bounds[0].trait_bound.generic_params" "[]" +// @count - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.generic_params[*]" 1 +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.generic_params[0].name" \"\'b\" +// @is - "$.index[*][?(@.name=='where_clase')].inner.generics.where_predicates[2].bound_predicate.generic_params[0].kind" '{ "lifetime": { "outlives": [] } }' +pub fn where_clase(f: F, g: G, h: H) where F: Foo, + G: for<'a> GenericFoo<'a>, + for<'b> &'b H: Foo, { } From 7f1174977f39087b9d00ca0c185876876d202579 Mon Sep 17 00:00:00 2001 From: klensy Date: Fri, 6 May 2022 07:56:53 +0300 Subject: [PATCH 04/18] rustdoc: don't build `rayon` for non-windows targets --- src/librustdoc/Cargo.toml | 4 +++- src/librustdoc/docfs.rs | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index 21efd040663b8..0495cd97dc229 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -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" @@ -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" diff --git a/src/librustdoc/docfs.rs b/src/librustdoc/docfs.rs index d59273db08b4f..8dd8eb23df270 100644 --- a/src/librustdoc/docfs.rs +++ b/src/librustdoc/docfs.rs @@ -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"); @@ -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(()) } } From 03007dee7994ebb874614c33ecc2c0aab22f07b0 Mon Sep 17 00:00:00 2001 From: Ken Matsui <26405363+ken-matsui@users.noreply.github.com> Date: Tue, 3 May 2022 06:46:25 +0900 Subject: [PATCH 05/18] Omit unnecessary help to add `#[cfg(test)]` when already annotated --- compiler/rustc_resolve/src/check_unused.rs | 35 +++-- .../ui/imports/unused-imports-in-test-mode.rs | 84 ++++++++++++ .../unused-imports-in-test-mode.stderr | 122 ++++++++++++++++++ 3 files changed, 227 insertions(+), 14 deletions(-) create mode 100644 src/test/ui/imports/unused-imports-in-test-mode.rs create mode 100644 src/test/ui/imports/unused-imports-in-test-mode.stderr diff --git a/compiler/rustc_resolve/src/check_unused.rs b/compiler/rustc_resolve/src/check_unused.rs index 6503b97a1d31f..ec3b14ace4df2 100644 --- a/compiler/rustc_resolve/src/check_unused.rs +++ b/compiler/rustc_resolve/src/check_unused.rs @@ -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( diff --git a/src/test/ui/imports/unused-imports-in-test-mode.rs b/src/test/ui/imports/unused-imports-in-test-mode.rs new file mode 100644 index 0000000000000..ed0bb65b3aa91 --- /dev/null +++ b/src/test/ui/imports/unused-imports-in-test-mode.rs @@ -0,0 +1,84 @@ +// compile-flags: --test + +#![deny(unused_imports)] + +use std::io::BufRead; //~ ERROR unused import: `std::io::BufRead` + +fn a() {} +fn b() {} + +mod test { + use super::a; //~ ERROR unused import: `super::a` + + fn foo() { + use crate::b; //~ ERROR unused import: `crate::b` + } +} + +mod tests { + use super::a; //~ ERROR unused import: `super::a` + + fn foo() { + use crate::b; //~ ERROR unused import: `crate::b` + } +} + +mod test_a { + use super::a; //~ ERROR unused import: `super::a` + + fn foo() { + use crate::b; //~ ERROR unused import: `crate::b` + } +} + +mod a_test { + use super::a; //~ ERROR unused import: `super::a` + + fn foo() { + use crate::b; //~ ERROR unused import: `crate::b` + } +} + +mod tests_a { + use super::a; //~ ERROR unused import: `super::a` + + fn foo() { + use crate::b; //~ ERROR unused import: `crate::b` + } +} + +mod a_tests { + use super::a; //~ ERROR unused import: `super::a` + + fn foo() { + use crate::b; //~ ERROR unused import: `crate::b` + } +} + +mod fastest_search { + use super::a; //~ ERROR unused import: `super::a` + + fn foo() { + use crate::b; //~ ERROR unused import: `crate::b` + } +} + +#[cfg(test)] +mod test_has_attr { + use super::a; //~ ERROR unused import: `super::a` + + fn foo() { + use crate::b; //~ ERROR unused import: `crate::b` + } +} + +mod test_has_no_attr { + #[cfg(test)] + use super::a; //~ ERROR unused import: `super::a` + + fn foo() { + use crate::b; //~ ERROR unused import: `crate::b` + } +} + +fn main() {} diff --git a/src/test/ui/imports/unused-imports-in-test-mode.stderr b/src/test/ui/imports/unused-imports-in-test-mode.stderr new file mode 100644 index 0000000000000..1847abd64b4f2 --- /dev/null +++ b/src/test/ui/imports/unused-imports-in-test-mode.stderr @@ -0,0 +1,122 @@ +error: unused import: `std::io::BufRead` + --> $DIR/unused-imports-in-test-mode.rs:5:5 + | +LL | use std::io::BufRead; + | ^^^^^^^^^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/unused-imports-in-test-mode.rs:3:9 + | +LL | #![deny(unused_imports)] + | ^^^^^^^^^^^^^^ + +error: unused import: `super::a` + --> $DIR/unused-imports-in-test-mode.rs:11:9 + | +LL | use super::a; + | ^^^^^^^^ + +error: unused import: `crate::b` + --> $DIR/unused-imports-in-test-mode.rs:14:13 + | +LL | use crate::b; + | ^^^^^^^^ + +error: unused import: `super::a` + --> $DIR/unused-imports-in-test-mode.rs:19:9 + | +LL | use super::a; + | ^^^^^^^^ + +error: unused import: `crate::b` + --> $DIR/unused-imports-in-test-mode.rs:22:13 + | +LL | use crate::b; + | ^^^^^^^^ + +error: unused import: `super::a` + --> $DIR/unused-imports-in-test-mode.rs:27:9 + | +LL | use super::a; + | ^^^^^^^^ + +error: unused import: `crate::b` + --> $DIR/unused-imports-in-test-mode.rs:30:13 + | +LL | use crate::b; + | ^^^^^^^^ + +error: unused import: `super::a` + --> $DIR/unused-imports-in-test-mode.rs:35:9 + | +LL | use super::a; + | ^^^^^^^^ + +error: unused import: `crate::b` + --> $DIR/unused-imports-in-test-mode.rs:38:13 + | +LL | use crate::b; + | ^^^^^^^^ + +error: unused import: `super::a` + --> $DIR/unused-imports-in-test-mode.rs:43:9 + | +LL | use super::a; + | ^^^^^^^^ + +error: unused import: `crate::b` + --> $DIR/unused-imports-in-test-mode.rs:46:13 + | +LL | use crate::b; + | ^^^^^^^^ + +error: unused import: `super::a` + --> $DIR/unused-imports-in-test-mode.rs:51:9 + | +LL | use super::a; + | ^^^^^^^^ + +error: unused import: `crate::b` + --> $DIR/unused-imports-in-test-mode.rs:54:13 + | +LL | use crate::b; + | ^^^^^^^^ + +error: unused import: `super::a` + --> $DIR/unused-imports-in-test-mode.rs:59:9 + | +LL | use super::a; + | ^^^^^^^^ + +error: unused import: `crate::b` + --> $DIR/unused-imports-in-test-mode.rs:62:13 + | +LL | use crate::b; + | ^^^^^^^^ + +error: unused import: `super::a` + --> $DIR/unused-imports-in-test-mode.rs:68:9 + | +LL | use super::a; + | ^^^^^^^^ + +error: unused import: `crate::b` + --> $DIR/unused-imports-in-test-mode.rs:71:13 + | +LL | use crate::b; + | ^^^^^^^^ + +error: unused import: `super::a` + --> $DIR/unused-imports-in-test-mode.rs:77:9 + | +LL | use super::a; + | ^^^^^^^^ + +error: unused import: `crate::b` + --> $DIR/unused-imports-in-test-mode.rs:80:13 + | +LL | use crate::b; + | ^^^^^^^^ + +error: aborting due to 19 previous errors + From 17f289345516662166a93a388b6225b862d1f238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Tue, 17 May 2022 00:00:00 +0000 Subject: [PATCH 06/18] Types with reachable constructors are reachable --- compiler/rustc_privacy/src/lib.rs | 16 ++++++++++++++- src/test/ui/privacy/auxiliary/ctor_aux.rs | 25 +++++++++++++++++++++++ src/test/ui/privacy/ctor.rs | 16 +++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/test/ui/privacy/auxiliary/ctor_aux.rs create mode 100644 src/test/ui/privacy/ctor.rs diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index ee459d9c129d3..86244aa8985e8 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -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(); + } } } } @@ -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(); + } + } } } diff --git a/src/test/ui/privacy/auxiliary/ctor_aux.rs b/src/test/ui/privacy/auxiliary/ctor_aux.rs new file mode 100644 index 0000000000000..9c99cca9ae6ed --- /dev/null +++ b/src/test/ui/privacy/auxiliary/ctor_aux.rs @@ -0,0 +1,25 @@ +// edition:2021 +//! Missing docs lint warns about undocumented exported items. +//! Use the lint to additionally verify that items are reachable +//! but not exported. +#![allow(non_camel_case_types)] +#![deny(missing_docs)] + +mod hidden { + pub struct s; + pub enum e { x, y, z } + pub use e::*; + impl s { + pub fn f(&self) {} + } + impl e { + pub fn g(&self) {} + } +} +// Hide all type definitions while reexporting their constructors: +mod e {} +mod x {} +mod y {} +mod z {} +mod s {} +pub use hidden::*; diff --git a/src/test/ui/privacy/ctor.rs b/src/test/ui/privacy/ctor.rs new file mode 100644 index 0000000000000..0ec15d68ed39e --- /dev/null +++ b/src/test/ui/privacy/ctor.rs @@ -0,0 +1,16 @@ +// Verify that a type is considered reachable when its constructor is +// reachable. The auxiliary library is constructed so that all types are +// shadowed and cannot be named directly, while their constructors are +// reexported. Regression test for issue #96934. +// +// aux-build:ctor_aux.rs +// edition:2021 +// build-pass + +extern crate ctor_aux; + +fn main() { + ctor_aux::s.f(); + ctor_aux::x.g(); + ctor_aux::y.g(); +} From 658be0d1cff1e84473f20f7301bf89d6d1249787 Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Mon, 16 May 2022 20:15:06 -0400 Subject: [PATCH 07/18] Add tmm_reg clobbers --- compiler/rustc_codegen_llvm/src/asm.rs | 9 ++++++--- compiler/rustc_span/src/symbol.rs | 1 + compiler/rustc_target/src/asm/x86.rs | 13 +++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/asm.rs b/compiler/rustc_codegen_llvm/src/asm.rs index e994001f96fd9..a53946995ee1c 100644 --- a/compiler/rustc_codegen_llvm/src/asm.rs +++ b/compiler/rustc_codegen_llvm/src/asm.rs @@ -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", @@ -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") } @@ -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") } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 2cc6eb0358567..5c9c16350e469 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1408,6 +1408,7 @@ symbols! { thread_local_macro, thumb2, thumb_mode: "thumb-mode", + tmm_reg, todo_macro, tool_attributes, tool_lints, diff --git a/compiler/rustc_target/src/asm/x86.rs b/compiler/rustc_target/src/asm/x86.rs index 854674c7f2fa7..e35035fd25af6 100644 --- a/compiler/rustc_target/src/asm/x86.rs +++ b/compiler/rustc_target/src/asm/x86.rs @@ -17,6 +17,7 @@ def_reg_class! { kreg0, mmx_reg, x87_reg, + tmm_reg, } } @@ -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 => &[], } } @@ -80,6 +82,7 @@ impl X86InlineAsmRegClass { }, Self::kreg | Self::kreg0 => None, Self::mmx_reg | Self::x87_reg => None, + Self::tmm_reg => None, } } @@ -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, } } @@ -135,6 +139,7 @@ impl X86InlineAsmRegClass { }, Self::kreg0 => &[], Self::mmx_reg | Self::x87_reg => &[], + Self::tmm_reg => &[], } } } @@ -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"] => From 50ce367880a8b426d59fdfe9c9e064ed399c4e6f Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Mon, 16 May 2022 20:40:19 -0400 Subject: [PATCH 08/18] add clobbers --- src/test/codegen/asm-target-clobbers.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/codegen/asm-target-clobbers.rs b/src/test/codegen/asm-target-clobbers.rs index 8845cfbe76792..1a1272ace3cae 100644 --- a/src/test/codegen/asm-target-clobbers.rs +++ b/src/test/codegen/asm-target-clobbers.rs @@ -6,6 +6,13 @@ use std::arch::asm; +// CHECK-LABEL: @avx512_clobber +// base: call void asm sideeffect inteldialect "", "~{tmm0}"() +#[no_mangle] +pub unsafe fn amx_clobber() { + asm!("", out("tmm0") _, options(nostack, nomem, preserves_flags)); +} + // CHECK-LABEL: @avx512_clobber // base: call void asm sideeffect inteldialect "", "~{xmm31}"() // avx512: call float asm sideeffect inteldialect "", "=&{xmm31}"() From 89ab77b3cbed9fbc2f54adcf68ddf31e91ad5272 Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Tue, 17 May 2022 06:34:58 -0400 Subject: [PATCH 09/18] Handle tmm_reg in rustc_codegen_gcc --- compiler/rustc_codegen_gcc/src/asm.rs | 5 +++-- src/test/codegen/asm-target-clobbers.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_codegen_gcc/src/asm.rs b/compiler/rustc_codegen_gcc/src/asm.rs index 2e8cd934eb298..20d91b80e8c52 100644 --- a/compiler/rustc_codegen_gcc/src/asm.rs +++ b/compiler/rustc_codegen_gcc/src/asm.rs @@ -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") @@ -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") @@ -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!(), diff --git a/src/test/codegen/asm-target-clobbers.rs b/src/test/codegen/asm-target-clobbers.rs index 1a1272ace3cae..ac30e18ec5234 100644 --- a/src/test/codegen/asm-target-clobbers.rs +++ b/src/test/codegen/asm-target-clobbers.rs @@ -6,7 +6,7 @@ use std::arch::asm; -// CHECK-LABEL: @avx512_clobber +// CHECK-LABEL: @amx_clobber // base: call void asm sideeffect inteldialect "", "~{tmm0}"() #[no_mangle] pub unsafe fn amx_clobber() { From 6354bfc152bda60d737c10e331bf796b10950cfb Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Tue, 17 May 2022 06:48:03 -0400 Subject: [PATCH 10/18] Add ABI clobbers --- compiler/rustc_target/src/asm/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/rustc_target/src/asm/mod.rs b/compiler/rustc_target/src/asm/mod.rs index 6bc807c7c4421..df8ccc42a77a3 100644 --- a/compiler/rustc_target/src/asm/mod.rs +++ b/compiler/rustc_target/src/asm/mod.rs @@ -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! { @@ -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! { From eabe851a5ca2130576500674baa3304666c6fd4f Mon Sep 17 00:00:00 2001 From: Connor Horman Date: Tue, 17 May 2022 07:11:29 -0400 Subject: [PATCH 11/18] fix clobber_abi tests --- src/test/codegen/asm-clobber_abi.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/codegen/asm-clobber_abi.rs b/src/test/codegen/asm-clobber_abi.rs index a87152e0321b9..f70caea2fb9e2 100644 --- a/src/test/codegen/asm-clobber_abi.rs +++ b/src/test/codegen/asm-clobber_abi.rs @@ -6,21 +6,21 @@ use std::arch::asm; // CHECK-LABEL: @clobber_sysv64 -// CHECK: ={ax},={cx},={dx},={si},={di},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{dirflag},~{fpsr},~{flags},~{memory} +// CHECK: ={ax},={cx},={dx},={si},={di},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{tmm0},~{tmm1},~{tmm2},~{tmm3},~{tmm4},~{tmm5},~{tmm6},~{tmm7},~{dirflag},~{fpsr},~{flags},~{memory} #[no_mangle] pub unsafe fn clobber_sysv64() { asm!("", clobber_abi("sysv64")); } // CHECK-LABEL: @clobber_win64 -// CHECK: ={ax},={cx},={dx},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{dirflag},~{fpsr},~{flags},~{memory} +// CHECK: ={ax},={cx},={dx},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{tmm0},~{tmm1},~{tmm2},~{tmm3},~{tmm4},~{tmm5},~{tmm6},~{tmm7},~{dirflag},~{fpsr},~{flags},~{memory} #[no_mangle] pub unsafe fn clobber_win64() { asm!("", clobber_abi("win64")); } // CHECK-LABEL: @clobber_sysv64 -// CHECK: =&{dx},={ax},={cx},={si},={di},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{dirflag},~{fpsr},~{flags},~{memory} +// CHECK: =&{dx},={ax},={cx},={si},={di},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{tmm0},~{tmm1},~{tmm2},~{tmm3},~{tmm4},~{tmm5},~{tmm6},~{tmm7},~{dirflag},~{fpsr},~{flags},~{memory} #[no_mangle] pub unsafe fn clobber_sysv64_edx() { let foo: i32; @@ -28,7 +28,7 @@ pub unsafe fn clobber_sysv64_edx() { } // CHECK-LABEL: @clobber_win64 -// CHECK: =&{dx},={ax},={cx},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{dirflag},~{fpsr},~{flags},~{memory} +// CHECK: =&{dx},={ax},={cx},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{tmm0},~{tmm1},~{tmm2},~{tmm3},~{tmm4},~{tmm5},~{tmm6},~{tmm7},~{dirflag},~{fpsr},~{flags},~{memory} #[no_mangle] pub unsafe fn clobber_win64_edx() { let foo: i32; From e170d8789750d6a27f41a3cfc2d124209c08f382 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 16 May 2022 21:15:19 +0200 Subject: [PATCH 12/18] Update browser-ui-test version to 0.9.2 --- .../docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version index f514a2f0bd053..f76f9131742ee 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version @@ -1 +1 @@ -0.9.1 \ No newline at end of file +0.9.2 \ No newline at end of file From d765b73a01870b45e2179e8a55ce1a406d8de248 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 17 May 2022 13:15:49 +0200 Subject: [PATCH 13/18] Fix duplicated "in" in the search result text --- src/librustdoc/html/static/js/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 0be70d77d06e4..40042f06a347b 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -1740,7 +1740,7 @@ window.initSearch = rawSearchIndex => { let output = "
" + `

Results for ${escape(results.query.userQuery)}` + - `${typeFilter}

in ${crates}
`; + `${typeFilter}${crates}`; if (results.query.error !== null) { output += `

Query parser error: "${results.query.error}".

`; output += "
" + From 56010449035eef9d80b8f76ee77b20b0a9d92e33 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 17 May 2022 13:28:22 +0200 Subject: [PATCH 14/18] Add GUI test for search result "title" --- src/test/rustdoc-gui/search-filter.goml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/rustdoc-gui/search-filter.goml b/src/test/rustdoc-gui/search-filter.goml index aca8390dfb3d5..63fb860d77a83 100644 --- a/src/test/rustdoc-gui/search-filter.goml +++ b/src/test/rustdoc-gui/search-filter.goml @@ -45,3 +45,6 @@ goto: file://|DOC_PATH|/test_docs/index.html?search=test&filter-crate=lib2 wait-for: "#crate-search" assert-property: ("#crate-search", {"value": "lib2"}) assert-false: "#results .externcrate" + +// Checking that the text for the "title" is correct (the "All" comes from the "`... */ + border-color: #424c57 !important; } .search-input { diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 1525163f50281..4957f25bcf358 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -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 ``... */ + border-color: #e0e0e0 !important; } .search-input:focus { From 440bbce36d649a973a323ed5fd431e36f124fb59 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 17 May 2022 14:45:23 +0200 Subject: [PATCH 16/18] Add GUI test for search crate filter select CSS properties --- src/test/rustdoc-gui/search-filter.goml | 31 +++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/test/rustdoc-gui/search-filter.goml b/src/test/rustdoc-gui/search-filter.goml index 63fb860d77a83..d0b3175114cce 100644 --- a/src/test/rustdoc-gui/search-filter.goml +++ b/src/test/rustdoc-gui/search-filter.goml @@ -48,3 +48,34 @@ assert-false: "#results .externcrate" // Checking that the text for the "title" is correct (the "All" comes from the "