Auto merge of #135725 - GuillaumeGomez:rollup-dxn3use, r=GuillaumeGomez
Rollup of 5 pull requests Successful merges: - #134858 (Provide structured suggestion for `#![feature(..)]` in more cases) - #135679 (create an issue template for bootstrap) - #135685 (Remove unused `item-row` CSS class) - #135716 (Don't skip argument parsing when running `rustc` with no arguments) - #135723 (Fix dev guide docs for error-pattern) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
af952c1abe
15 changed files with 182 additions and 34 deletions
70
.github/ISSUE_TEMPLATE/bootstrap.md
vendored
Normal file
70
.github/ISSUE_TEMPLATE/bootstrap.md
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
---
|
||||
name: Bootstrap (Rust Build System) Report
|
||||
about: Issues encountered on bootstrap build system
|
||||
labels: C-bug, T-bootstrap
|
||||
---
|
||||
|
||||
<!--
|
||||
Thank you for submitting a bootstrap report! Please provide detailed information to help us reproduce and diagnose the issue.
|
||||
-->
|
||||
|
||||
### Summary
|
||||
|
||||
<!--
|
||||
Provide a brief description of the problem you are experiencing.
|
||||
-->
|
||||
|
||||
### Command used
|
||||
|
||||
```sh
|
||||
<command>
|
||||
```
|
||||
|
||||
### Expected behaviour
|
||||
|
||||
<!--
|
||||
Describe what you expected to happen.
|
||||
-->
|
||||
|
||||
### Actual behaviour
|
||||
|
||||
<!--
|
||||
Describe what actually happened.
|
||||
-->
|
||||
|
||||
### Bootstrap configuration (config.toml)
|
||||
```toml
|
||||
<config>
|
||||
```
|
||||
|
||||
### Operating system
|
||||
|
||||
<!--
|
||||
e.g., Ubuntu 22.04, macOS 12, Windows 10
|
||||
-->
|
||||
|
||||
### HEAD
|
||||
|
||||
<!--
|
||||
Output of `git rev-parse HEAD` command, or content of the `git-commit-hash` file if using a tarball source.
|
||||
-->
|
||||
|
||||
### Additional context
|
||||
<!--
|
||||
Include any other relevant information (e.g., if you have custom patches or modifications on the project).
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
Include the complete build log in the section below.
|
||||
Enable backtrace and verbose mode if possible for more detailed information e.g., with `RUST_BACKTRACE=1 ./x build -v`.
|
||||
-->
|
||||
<details><summary>Build Log</summary>
|
||||
<p>
|
||||
|
||||
```txt
|
||||
<log>
|
||||
```
|
||||
|
||||
</p>
|
||||
</details>
|
|
@ -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
|
||||
|
|
|
@ -464,6 +464,12 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
|
|||
err_span,
|
||||
);
|
||||
}
|
||||
|
||||
fn crate_inject_span(&self) -> Option<Span> {
|
||||
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> {
|
||||
|
@ -809,6 +815,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
|
|||
name: intrinsic.name,
|
||||
feature,
|
||||
const_stable_indirect: is_const_stable,
|
||||
suggestion: self.crate_inject_span(),
|
||||
});
|
||||
}
|
||||
Some(ConstStability { level: StabilityLevel::Stable { .. }, .. }) => {
|
||||
|
@ -897,7 +904,7 @@ 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.
|
||||
|
@ -907,6 +914,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
|
|||
feature,
|
||||
feature_enabled,
|
||||
safe_to_expose_on_stable: callee_safe_to_expose_on_stable,
|
||||
suggestion_span: self.crate_inject_span(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Span>,
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -436,6 +447,7 @@ pub(crate) struct IntrinsicUnstable {
|
|||
pub name: Symbol,
|
||||
pub feature: Symbol,
|
||||
pub const_stable_indirect: bool,
|
||||
pub suggestion: Option<Span>,
|
||||
}
|
||||
|
||||
impl<'tcx> NonConstOp<'tcx> for IntrinsicUnstable {
|
||||
|
@ -455,6 +467,8 @@ impl<'tcx> NonConstOp<'tcx> for IntrinsicUnstable {
|
|||
span,
|
||||
name: self.name,
|
||||
feature: self.feature,
|
||||
suggestion: self.suggestion,
|
||||
help: self.suggestion.is_none(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Span>,
|
||||
#[help(const_eval_unstable_intrinsic_suggestion)]
|
||||
pub help: bool,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
|
|
|
@ -1191,15 +1191,6 @@ fn print_flag_list<T>(cmdline_opt: &str, flag_list: &[OptionDesc<T>]) {
|
|||
/// be public when using rustc as a library, see
|
||||
/// <https://github.com/rust-lang/rust/commit/2b4c33817a5aaecabf4c6598d41e190080ec119e>
|
||||
pub fn handle_options(early_dcx: &EarlyDiagCtxt, args: &[String]) -> Option<getopts::Matches> {
|
||||
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<geto
|
|||
// (unstable option being used on stable)
|
||||
nightly_options::check_nightly_options(early_dcx, &matches, &config::rustc_optgroups());
|
||||
|
||||
if matches.opt_present("h") || matches.opt_present("help") {
|
||||
if args.is_empty() || matches.opt_present("h") || matches.opt_present("help") {
|
||||
// Only show unstable options in --help if we accept unstable options.
|
||||
let unstable_enabled = nightly_options::is_unstable_enabled(&matches);
|
||||
let nightly_build = nightly_options::match_is_nightly_build(&matches);
|
||||
|
|
|
@ -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<Span>,
|
||||
#[subdiagnostic]
|
||||
pub default_field_values: Option<BaseExpressionDoubleDotEnableDefaultFieldValues>,
|
||||
pub default_field_values_help: Option<BaseExpressionDoubleDotEnableDefaultFieldValues>,
|
||||
#[subdiagnostic]
|
||||
pub add_expr: Option<BaseExpressionDoubleDotAddExpr>,
|
||||
#[subdiagnostic]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 `"<raw>" -> "<normalized>"` before comparing against snapshot | `ui`, `incremental` | `"<RAW>" -> "<NORMALIZED>"`, `<RAW>`/`<NORMALIZED>` is regex capture and replace syntax |
|
||||
| `normalize-stderr-64bit` | Normalize actual stderr (for 64-bit platforms) with a rule `"<raw>" -> "<normalized>"` before comparing against snapshot | `ui`, `incremental` | `"<RAW>" -> "<NORMALIZED>"`, `<RAW>`/`<NORMALIZED>` is regex capture and replace syntax |
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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 {}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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::<i32, 4> { .. };
|
||||
| ^
|
||||
|
|
||||
= 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::<i32, 4> { ../* expr */ };
|
||||
|
@ -190,7 +205,10 @@ error[E0797]: base expression required after `..`
|
|||
LL | assert!(matches!(Qux::<i32, 4> { 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::<i32, 4> { 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));
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue