Skip to content

Commit c80c4b8

Browse files
committed
Auto merge of #98545 - matthiaskrgr:rollup-njely29, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #97140 (std: use an event-flag-based thread parker on SOLID) - #97295 ([rustc_parse] Forbid `let`s in certain places) - #97743 (make const_err show up in future breakage reports) - #97908 (Stabilize NonZero* checked operations constness.) - #98297 (Transform help popup into a pocket menu) - #98428 (macros: use typed identifiers in diag and subdiag derive) - #98528 (Respect --color when building rustbuild itself) - #98535 (Add regression test for generic const in rustdoc) - #98538 (Add a ui test for issue #91883) - #98540 (Add regression test for #87558) - #98541 (Update `std::alloc::System` doc example code style) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 788dded + 935958e commit c80c4b8

File tree

119 files changed

+4911
-1084
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+4911
-1084
lines changed

compiler/rustc_builtin_macros/src/cfg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ pub fn expand_cfg(
3636
}
3737

3838
#[derive(SessionDiagnostic)]
39-
#[error(slug = "builtin-macros-requires-cfg-pattern")]
39+
#[error(builtin_macros::requires_cfg_pattern)]
4040
struct RequiresCfgPattern {
4141
#[primary_span]
4242
#[label]
4343
span: Span,
4444
}
4545

4646
#[derive(SessionDiagnostic)]
47-
#[error(slug = "builtin-macros-expected-one-cfg-pattern")]
47+
#[error(builtin_macros::expected_one_cfg_pattern)]
4848
struct OneCfgPattern {
4949
#[primary_span]
5050
span: Span,
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
builtin-macros-requires-cfg-pattern =
1+
builtin_macros-requires-cfg-pattern =
22
macro requires a cfg-pattern as an argument
33
.label = cfg-pattern required
44
5-
builtin-macros-expected-one-cfg-pattern = expected 1 cfg-pattern
5+
builtin_macros-expected-one-cfg-pattern = expected 1 cfg-pattern

compiler/rustc_error_messages/src/lib.rs

+21-17
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,6 @@ pub enum SubdiagnosticMessage {
258258
FluentAttr(FluentId),
259259
}
260260

261-
impl SubdiagnosticMessage {
262-
/// Create a `SubdiagnosticMessage` for the provided Fluent attribute.
263-
pub fn attr(id: impl Into<FluentId>) -> Self {
264-
SubdiagnosticMessage::FluentAttr(id.into())
265-
}
266-
267-
/// Create a `SubdiagnosticMessage` for the provided Fluent identifier.
268-
pub fn message(id: impl Into<FluentId>) -> Self {
269-
SubdiagnosticMessage::FluentIdentifier(id.into())
270-
}
271-
}
272-
273261
/// `From` impl that enables existing diagnostic calls to functions which now take
274262
/// `impl Into<SubdiagnosticMessage>` to continue to work as before.
275263
impl<S: Into<String>> From<S> for SubdiagnosticMessage {
@@ -332,11 +320,6 @@ impl DiagnosticMessage {
332320
_ => panic!("expected non-translatable diagnostic message"),
333321
}
334322
}
335-
336-
/// Create a `DiagnosticMessage` for the provided Fluent identifier.
337-
pub fn new(id: impl Into<FluentId>) -> Self {
338-
DiagnosticMessage::FluentIdentifier(id.into(), None)
339-
}
340323
}
341324

342325
/// `From` impl that enables existing diagnostic calls to functions which now take
@@ -347,6 +330,27 @@ impl<S: Into<String>> From<S> for DiagnosticMessage {
347330
}
348331
}
349332

333+
/// Translating *into* a subdiagnostic message from a diagnostic message is a little strange - but
334+
/// the subdiagnostic functions (e.g. `span_label`) take a `SubdiagnosticMessage` and the
335+
/// subdiagnostic derive refers to typed identifiers that are `DiagnosticMessage`s, so need to be
336+
/// able to convert between these, as much as they'll be converted back into `DiagnosticMessage`
337+
/// using `with_subdiagnostic_message` eventually. Don't use this other than for the derive.
338+
impl Into<SubdiagnosticMessage> for DiagnosticMessage {
339+
fn into(self) -> SubdiagnosticMessage {
340+
match self {
341+
DiagnosticMessage::Str(s) => SubdiagnosticMessage::Str(s),
342+
DiagnosticMessage::FluentIdentifier(id, None) => {
343+
SubdiagnosticMessage::FluentIdentifier(id)
344+
}
345+
// There isn't really a sensible behaviour for this because it loses information but
346+
// this is the most sensible of the behaviours.
347+
DiagnosticMessage::FluentIdentifier(_, Some(attr)) => {
348+
SubdiagnosticMessage::FluentAttr(attr)
349+
}
350+
}
351+
}
352+
}
353+
350354
/// A span together with some additional data.
351355
#[derive(Clone, Debug)]
352356
pub struct SpanLabel {

compiler/rustc_lint_defs/src/builtin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ declare_lint! {
289289
"constant evaluation encountered erroneous expression",
290290
@future_incompatible = FutureIncompatibleInfo {
291291
reference: "issue #71800 <https://github.com/rust-lang/rust/issues/71800>",
292+
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
292293
};
293294
report_in_external_macro
294295
}

0 commit comments

Comments
 (0)