From a47fee50bd2740caa91b6d658fa6e808466de5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 28 Dec 2024 18:20:44 +0000 Subject: [PATCH 1/8] Structured suggestion for "missing `feature` in unstable fn call" When encountering a call corresponding to an item marked as unstable behind a feature flag, provide a structured suggestion pointing at where in the crate the `#![feature(..)]` needs to be written. ``` error: `foobar` is not yet stable as a const fn --> $DIR/const-stability-attribute-implies-no-feature.rs:12:5 | LL | foobar(); | ^^^^^^^^ | help: add `#![feature(const_foobar)]` to the crate attributes to enable | LL + #![feature(const_foobar)] | ``` Fix #81370. --- .../rustc_const_eval/src/check_consts/check.rs | 9 ++++++++- compiler/rustc_const_eval/src/check_consts/ops.rs | 15 +++++++++++++-- ...-stability-attribute-implies-no-feature.stderr | 5 ++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index 6c940124193c7..94fb039512a63 100644 --- a/compiler/rustc_const_eval/src/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/check_consts/check.rs @@ -911,16 +911,23 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { // regular stability. feature == sym::rustc_private && issue == NonZero::new(27812) - && self.tcx.sess.opts.unstable_opts.force_unstable_if_unmarked + && tcx.sess.opts.unstable_opts.force_unstable_if_unmarked }; // Even if the feature is enabled, we still need check_op to double-check // this if the callee is not safe to expose on stable. if !feature_enabled || !callee_safe_to_expose_on_stable { + let suggestion_span = + tcx.hir_crate_items(()).definitions().next().and_then(|id| { + tcx.crate_level_attribute_injection_span( + tcx.local_def_id_to_hir_id(id), + ) + }); self.check_op(ops::FnCallUnstable { def_id: callee, feature, feature_enabled, safe_to_expose_on_stable: callee_safe_to_expose_on_stable, + suggestion_span, }); } } diff --git a/compiler/rustc_const_eval/src/check_consts/ops.rs b/compiler/rustc_const_eval/src/check_consts/ops.rs index 7d103055a7c43..6a7da13b30396 100644 --- a/compiler/rustc_const_eval/src/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/check_consts/ops.rs @@ -1,8 +1,8 @@ //! Concrete error types for all operations which may be invalid in a certain const context. use hir::{ConstContext, LangItem}; -use rustc_errors::Diag; use rustc_errors::codes::*; +use rustc_errors::{Applicability, Diag}; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_infer::infer::TyCtxtInferExt; @@ -388,6 +388,7 @@ pub(crate) struct FnCallUnstable { /// expose on stable. pub feature_enabled: bool, pub safe_to_expose_on_stable: bool, + pub suggestion_span: Option, } impl<'tcx> NonConstOp<'tcx> for FnCallUnstable { @@ -407,8 +408,18 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable { def_path: ccx.tcx.def_path_str(self.def_id), }); // FIXME: make this translatable + let msg = format!("add `#![feature({})]` to the crate attributes to enable", self.feature); #[allow(rustc::untranslatable_diagnostic)] - err.help(format!("add `#![feature({})]` to the crate attributes to enable", self.feature)); + if let Some(span) = self.suggestion_span { + err.span_suggestion_verbose( + span, + msg, + format!("#![feature({})]\n", self.feature), + Applicability::MachineApplicable, + ); + } else { + err.help(msg); + } err } diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.stderr index 0a5f58288fa33..0f2006e932b34 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-no-feature.stderr @@ -4,7 +4,10 @@ error: `foobar` is not yet stable as a const fn LL | foobar(); | ^^^^^^^^ | - = help: add `#![feature(const_foobar)]` to the crate attributes to enable +help: add `#![feature(const_foobar)]` to the crate attributes to enable + | +LL + #![feature(const_foobar)] + | error: aborting due to 1 previous error From 7175da59d3ce56ededb142385dbbf95a2f6ad1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 28 Dec 2024 18:37:16 +0000 Subject: [PATCH 2/8] Structured suggestion for "missing `feature` intrinsic" ``` error: `size_of_val` is not yet stable as a const intrinsic --> $DIR/const-unstable-intrinsic.rs:17:9 | LL | unstable_intrinsic::size_of_val(&x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(unstable)]` to the crate attributes to enable help: add `#![feature(unstable)]` to the crate attributes to enable | LL + #![feature("unstable")] | ``` --- compiler/rustc_const_eval/messages.ftl | 2 +- compiler/rustc_const_eval/src/check_consts/check.rs | 7 +++++++ compiler/rustc_const_eval/src/check_consts/ops.rs | 3 +++ compiler/rustc_const_eval/src/errors.rs | 9 ++++++++- tests/ui/consts/const-unstable-intrinsic.stderr | 10 ++++++++-- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl index 4861b7a4430f0..d4bfb781320de 100644 --- a/compiler/rustc_const_eval/messages.ftl +++ b/compiler/rustc_const_eval/messages.ftl @@ -424,7 +424,7 @@ const_eval_unstable_in_stable_exposed = .bypass_sugg = otherwise, as a last resort `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks (this requires team approval) const_eval_unstable_intrinsic = `{$name}` is not yet stable as a const intrinsic - .help = add `#![feature({$feature})]` to the crate attributes to enable +const_eval_unstable_intrinsic_suggestion = add `#![feature({$feature})]` to the crate attributes to enable const_eval_unterminated_c_string = reading a null-terminated string starting at {$pointer} with no null found before end of allocation diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index 94fb039512a63..844dc2aa59339 100644 --- a/compiler/rustc_const_eval/src/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/check_consts/check.rs @@ -819,10 +819,17 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { feature, .. }) => { + let suggestion = + tcx.hir_crate_items(()).definitions().next().and_then(|id| { + tcx.crate_level_attribute_injection_span( + tcx.local_def_id_to_hir_id(id), + ) + }); self.check_op(ops::IntrinsicUnstable { name: intrinsic.name, feature, const_stable_indirect: is_const_stable, + suggestion, }); } Some(ConstStability { level: StabilityLevel::Stable { .. }, .. }) => { diff --git a/compiler/rustc_const_eval/src/check_consts/ops.rs b/compiler/rustc_const_eval/src/check_consts/ops.rs index 6a7da13b30396..3c83a7b92cdc6 100644 --- a/compiler/rustc_const_eval/src/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/check_consts/ops.rs @@ -447,6 +447,7 @@ pub(crate) struct IntrinsicUnstable { pub name: Symbol, pub feature: Symbol, pub const_stable_indirect: bool, + pub suggestion: Option, } impl<'tcx> NonConstOp<'tcx> for IntrinsicUnstable { @@ -466,6 +467,8 @@ impl<'tcx> NonConstOp<'tcx> for IntrinsicUnstable { span, name: self.name, feature: self.feature, + suggestion: self.suggestion, + help: self.suggestion.is_none(), }) } } diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs index 3fe78171cd944..1ee9214c4b2a0 100644 --- a/compiler/rustc_const_eval/src/errors.rs +++ b/compiler/rustc_const_eval/src/errors.rs @@ -123,12 +123,19 @@ pub(crate) struct UnstableConstFn { #[derive(Diagnostic)] #[diag(const_eval_unstable_intrinsic)] -#[help] pub(crate) struct UnstableIntrinsic { #[primary_span] pub span: Span, pub name: Symbol, pub feature: Symbol, + #[suggestion( + const_eval_unstable_intrinsic_suggestion, + code = "#![feature({feature})]\n", + applicability = "machine-applicable" + )] + pub suggestion: Option, + #[help(const_eval_unstable_intrinsic_suggestion)] + pub help: bool, } #[derive(Diagnostic)] diff --git a/tests/ui/consts/const-unstable-intrinsic.stderr b/tests/ui/consts/const-unstable-intrinsic.stderr index 601c8647eeef7..308b02386f5c9 100644 --- a/tests/ui/consts/const-unstable-intrinsic.stderr +++ b/tests/ui/consts/const-unstable-intrinsic.stderr @@ -24,7 +24,10 @@ error: `size_of_val` is not yet stable as a const intrinsic LL | unstable_intrinsic::size_of_val(&x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: add `#![feature(unstable)]` to the crate attributes to enable +help: add `#![feature(unstable)]` to the crate attributes to enable + | +LL + #![feature(unstable)] + | error: `min_align_of_val` is not yet stable as a const intrinsic --> $DIR/const-unstable-intrinsic.rs:20:9 @@ -32,7 +35,10 @@ error: `min_align_of_val` is not yet stable as a const intrinsic LL | unstable_intrinsic::min_align_of_val(&x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = help: add `#![feature(unstable)]` to the crate attributes to enable +help: add `#![feature(unstable)]` to the crate attributes to enable + | +LL + #![feature(unstable)] + | error: const function that might be (indirectly) exposed to stable cannot use `#[feature(local)]` --> $DIR/const-unstable-intrinsic.rs:24:9 From e7ac2eabd0b51f7beec909794e76db3e991aa08d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 28 Dec 2024 18:50:18 +0000 Subject: [PATCH 3/8] Deduplicate logic --- .../src/check_consts/check.rs | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index 844dc2aa59339..1496e71bae015 100644 --- a/compiler/rustc_const_eval/src/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/check_consts/check.rs @@ -464,6 +464,12 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> { err_span, ); } + + fn crate_inject_span(&self) -> Option { + self.tcx.hir_crate_items(()).definitions().next().and_then(|id| { + self.tcx.crate_level_attribute_injection_span(self.tcx.local_def_id_to_hir_id(id)) + }) + } } impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { @@ -819,17 +825,11 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { feature, .. }) => { - let suggestion = - tcx.hir_crate_items(()).definitions().next().and_then(|id| { - tcx.crate_level_attribute_injection_span( - tcx.local_def_id_to_hir_id(id), - ) - }); self.check_op(ops::IntrinsicUnstable { name: intrinsic.name, feature, const_stable_indirect: is_const_stable, - suggestion, + suggestion: self.crate_inject_span(), }); } Some(ConstStability { level: StabilityLevel::Stable { .. }, .. }) => { @@ -923,18 +923,12 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { // Even if the feature is enabled, we still need check_op to double-check // this if the callee is not safe to expose on stable. if !feature_enabled || !callee_safe_to_expose_on_stable { - let suggestion_span = - tcx.hir_crate_items(()).definitions().next().and_then(|id| { - tcx.crate_level_attribute_injection_span( - tcx.local_def_id_to_hir_id(id), - ) - }); self.check_op(ops::FnCallUnstable { def_id: callee, feature, feature_enabled, safe_to_expose_on_stable: callee_safe_to_expose_on_stable, - suggestion_span, + suggestion_span: self.crate_inject_span(), }); } } From e68a8ce0350892d97ff24323bf98771d65d0ed52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sat, 28 Dec 2024 18:53:22 +0000 Subject: [PATCH 4/8] Provide suggestion for `#![feature(default_field_values)]` ``` error[E0797]: base expression required after `..` --> $DIR/feature-gate-default-field-values.rs:62:21 | LL | let x = Foo { .. }; | ^ | help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields | LL + #![feature(default_field_values)] | help: add a base expression here | LL | let x = Foo { ../* expr */ }; | ++++++++++ ``` --- compiler/rustc_hir_typeck/src/errors.rs | 9 +++- compiler/rustc_hir_typeck/src/expr.rs | 13 ++++- .../feature-gate-default-field-values.stderr | 50 +++++++++++++++---- 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index 4eed2bc12388d..052adaa69b2b9 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -19,8 +19,15 @@ use crate::fluent_generated as fluent; pub(crate) struct BaseExpressionDoubleDot { #[primary_span] pub span: Span, + #[suggestion( + hir_typeck_base_expression_double_dot_enable_default_field_values, + code = "#![feature(default_field_values)]\n", + applicability = "machine-applicable", + style = "verbose" + )] + pub default_field_values_suggestion: Option, #[subdiagnostic] - pub default_field_values: Option, + pub default_field_values_help: Option, #[subdiagnostic] pub add_expr: Option, #[subdiagnostic] diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 3bb518e7f9711..329eb90a1d59a 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -2138,13 +2138,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } if !self.tcx.features().default_field_values() { + let sugg = self.tcx.crate_level_attribute_injection_span(expr.hir_id); self.dcx().emit_err(BaseExpressionDoubleDot { span: span.shrink_to_hi(), // We only mention enabling the feature if this is a nightly rustc *and* the // expression would make sense with the feature enabled. - default_field_values: if self.tcx.sess.is_nightly_build() + default_field_values_suggestion: if self.tcx.sess.is_nightly_build() && missing_mandatory_fields.is_empty() && !missing_optional_fields.is_empty() + && sugg.is_some() + { + sugg + } else { + None + }, + default_field_values_help: if self.tcx.sess.is_nightly_build() + && missing_mandatory_fields.is_empty() + && !missing_optional_fields.is_empty() + && sugg.is_none() { Some(BaseExpressionDoubleDotEnableDefaultFieldValues) } else { diff --git a/tests/ui/feature-gates/feature-gate-default-field-values.stderr b/tests/ui/feature-gates/feature-gate-default-field-values.stderr index d882c322c8eda..104d72a39861d 100644 --- a/tests/ui/feature-gates/feature-gate-default-field-values.stderr +++ b/tests/ui/feature-gates/feature-gate-default-field-values.stderr @@ -130,7 +130,10 @@ error[E0797]: base expression required after `..` LL | let x = Foo { .. }; | ^ | - = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields + | +LL + #![feature(default_field_values)] + | help: add a base expression here | LL | let x = Foo { ../* expr */ }; @@ -142,7 +145,10 @@ error[E0797]: base expression required after `..` LL | let z = Foo { baz: 1, .. }; | ^ | - = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields + | +LL + #![feature(default_field_values)] + | help: add a base expression here | LL | let z = Foo { baz: 1, ../* expr */ }; @@ -154,7 +160,10 @@ error[E0797]: base expression required after `..` LL | let x = Bar::Foo { .. }; | ^ | - = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields + | +LL + #![feature(default_field_values)] + | help: add a base expression here | LL | let x = Bar::Foo { ../* expr */ }; @@ -166,7 +175,10 @@ error[E0797]: base expression required after `..` LL | let z = Bar::Foo { baz: 1, .. }; | ^ | - = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields + | +LL + #![feature(default_field_values)] + | help: add a base expression here | LL | let z = Bar::Foo { baz: 1, ../* expr */ }; @@ -178,7 +190,10 @@ error[E0797]: base expression required after `..` LL | let x = Qux:: { .. }; | ^ | - = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields + | +LL + #![feature(default_field_values)] + | help: add a base expression here | LL | let x = Qux:: { ../* expr */ }; @@ -190,7 +205,10 @@ error[E0797]: base expression required after `..` LL | assert!(matches!(Qux:: { bar: S, baz: 42, bat: 2, bay: 4, .. }, x)); | ^ | - = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields + | +LL + #![feature(default_field_values)] + | help: add a base expression here | LL | assert!(matches!(Qux:: { bar: S, baz: 42, bat: 2, bay: 4, ../* expr */ }, x)); @@ -202,7 +220,10 @@ error[E0797]: base expression required after `..` LL | let y = Opt { mandatory: None, .. }; | ^ | - = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields + | +LL + #![feature(default_field_values)] + | help: add a base expression here | LL | let y = Opt { mandatory: None, ../* expr */ }; @@ -214,7 +235,10 @@ error[E0797]: base expression required after `..` LL | assert!(matches!(Opt { mandatory: None, .. }, z)); | ^ | - = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields + | +LL + #![feature(default_field_values)] + | help: add a base expression here | LL | assert!(matches!(Opt { mandatory: None, ../* expr */ }, z)); @@ -260,7 +284,10 @@ error[E0797]: base expression required after `..` LL | let y = OptEnum::Variant { mandatory: None, .. }; | ^ | - = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields + | +LL + #![feature(default_field_values)] + | help: add a base expression here | LL | let y = OptEnum::Variant { mandatory: None, ../* expr */ }; @@ -272,7 +299,10 @@ error[E0797]: base expression required after `..` LL | assert!(matches!(OptEnum::Variant { mandatory: None, .. }, z)); | ^ | - = help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields +help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields + | +LL + #![feature(default_field_values)] + | help: add a base expression here | LL | assert!(matches!(OptEnum::Variant { mandatory: None, ../* expr */ }, z)); From 93f69b23006d180e2f6cf2d6f7efeab17b2c2cf2 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sun, 19 Jan 2025 13:12:07 +1100 Subject: [PATCH 5/8] Don't skip argument parsing when running `rustc` with no arguments Setting up the argument parser to parse no arguments is a tiny bit of wasted work, but avoids an otherwise-unnecessary special case. In particular, this lets us avoid having to deal with multiple different APIs to determine whether the compiler is nightly or not. --- compiler/rustc_driver_impl/src/lib.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 0413e5e86348b..f7e7aa6461421 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -1191,15 +1191,6 @@ fn print_flag_list(cmdline_opt: &str, flag_list: &[OptionDesc]) { /// be public when using rustc as a library, see /// pub fn handle_options(early_dcx: &EarlyDiagCtxt, args: &[String]) -> Option { - if args.is_empty() { - // user did not write `-v` nor `-Z unstable-options`, so do not - // include that extra information. - let nightly_build = - rustc_feature::UnstableFeatures::from_environment(None).is_nightly_build(); - usage(false, false, nightly_build); - return None; - } - // Parse with *all* options defined in the compiler, we don't worry about // option stability here we just want to parse as much as possible. let mut options = getopts::Options::new(); @@ -1245,7 +1236,7 @@ pub fn handle_options(early_dcx: &EarlyDiagCtxt, args: &[String]) -> Option Date: Sun, 19 Jan 2025 12:02:27 +0300 Subject: [PATCH 6/8] create an issue template for bootstrap Signed-off-by: onur-ozkan --- .github/ISSUE_TEMPLATE/bootstrap.md | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bootstrap.md diff --git a/.github/ISSUE_TEMPLATE/bootstrap.md b/.github/ISSUE_TEMPLATE/bootstrap.md new file mode 100644 index 0000000000000..8d72eae85931f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bootstrap.md @@ -0,0 +1,70 @@ +--- +name: Bootstrap (Rust Build System) Report +about: Issues encountered on bootstrap build system +labels: C-bug, T-bootstrap +--- + + + +### Summary + + + +### Command used + +```sh + +``` + +### Expected behaviour + + + +### Actual behaviour + + + +### Bootstrap configuration (config.toml) +```toml + +``` + +### Operating system + + + +### HEAD + + + +### Additional context + + + + +
Build Log +

+ +```txt + +``` + +

+
From f1b83fe5d93ed24eb3d0a8f846fd56cf7884f1cb Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Sun, 19 Jan 2025 11:36:41 +0100 Subject: [PATCH 7/8] Fix dev guide docs for error-pattern I know it would have made more sense to make this PR to the dev guide repo but I had already made the fix before I realized that. --- src/doc/rustc-dev-guide/src/tests/directives.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index 69f4c864186cf..e80857b7afac9 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -94,7 +94,8 @@ for more details. | Directive | Explanation | Supported test suites | Possible values | |-----------------------------------|--------------------------------------------------------------------------------------------------------------------------|----------------------------------------------|-----------------------------------------------------------------------------------------| | `check-run-results` | Check run test binary `run-{pass,fail}` output snapshot | `ui`, `crashes`, `incremental` if `run-pass` | N/A | -| `error-pattern` | Check that output contains a regex pattern | `ui`, `crashes`, `incremental` if `run-pass` | Regex | +| `error-pattern` | Check that output contains a specific string | `ui`, `crashes`, `incremental` if `run-pass` | String | +| `regex-error-pattern` | Check that output contains a regex pattern | `ui`, `crashes`, `incremental` if `run-pass` | Regex | | `check-stdout` | Check `stdout` against `error-pattern`s from running test binary[^check_stdout] | `ui`, `crashes`, `incremental` | N/A | | `normalize-stderr-32bit` | Normalize actual stderr (for 32-bit platforms) with a rule `"" -> ""` before comparing against snapshot | `ui`, `incremental` | `"" -> ""`, ``/`` is regex capture and replace syntax | | `normalize-stderr-64bit` | Normalize actual stderr (for 64-bit platforms) with a rule `"" -> ""` before comparing against snapshot | `ui`, `incremental` | `"" -> ""`, ``/`` is regex capture and replace syntax | From 20443dbe1b2facfc845affe9c0a0703c92f2bb30 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 18 Jan 2025 15:48:14 +0100 Subject: [PATCH 8/8] Remove unused `item-row` CSS class --- src/librustdoc/html/static/css/rustdoc.css | 2 +- tests/rustdoc/multiple-mods-w-same-name-doc-inline-83375.rs | 2 +- .../multiple-mods-w-same-name-doc-inline-last-item-83375.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 4cb05b05be5da..b994a43868cb1 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -2473,7 +2473,7 @@ in src-script.js and main.js } /* Display an alternating layout on tablets and phones */ - .item-row, .search-results > a, .search-results > a > div { + .search-results > a, .search-results > a > div { display: block; } diff --git a/tests/rustdoc/multiple-mods-w-same-name-doc-inline-83375.rs b/tests/rustdoc/multiple-mods-w-same-name-doc-inline-83375.rs index 6d255ed600407..be32fcc7e4a42 100644 --- a/tests/rustdoc/multiple-mods-w-same-name-doc-inline-83375.rs +++ b/tests/rustdoc/multiple-mods-w-same-name-doc-inline-83375.rs @@ -10,7 +10,7 @@ pub mod sub { } //@ count foo/index.html '//a[@class="mod"][@title="mod foo::prelude"]' 1 -//@ count foo/prelude/index.html '//div[@class="item-row"]' 0 +//@ count foo/prelude/index.html '//ul[@class="item-table"]' 0 pub mod prelude {} #[doc(inline)] diff --git a/tests/rustdoc/multiple-mods-w-same-name-doc-inline-last-item-83375.rs b/tests/rustdoc/multiple-mods-w-same-name-doc-inline-last-item-83375.rs index a59b48232a347..4b3b467382b55 100644 --- a/tests/rustdoc/multiple-mods-w-same-name-doc-inline-last-item-83375.rs +++ b/tests/rustdoc/multiple-mods-w-same-name-doc-inline-last-item-83375.rs @@ -13,5 +13,5 @@ pub mod sub { pub use sub::*; //@ count foo/index.html '//a[@class="mod"][@title="mod foo::prelude"]' 1 -//@ count foo/prelude/index.html '//div[@class="item-row"]' 0 +//@ count foo/prelude/index.html '//ul[@class="item-table"]' 0 pub mod prelude {}