Skip to content

Commit 930ecbc

Browse files
committed
Auto merge of #152089 - JonathanBrouwer:rollup-h74gaTC, r=JonathanBrouwer
Rollup of 5 pull requests Successful merges: - #151893 (Move the query list into a new `rustc_middle::queries` module) - #152060 (ci: Optimize loongarch64-linux dist builders) - #151993 (Add uv to the list of possible python runners) - #152047 (Convert to inline diagnostics in `rustc_interface`) - #152053 (Avoid semicolon suggestion when tail expr is error) Failed merges: - #152023 (Some `rustc_query_system` cleanups)
2 parents 794495e + b8755a4 commit 930ecbc

File tree

24 files changed

+3006
-3005
lines changed

24 files changed

+3006
-3005
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4114,7 +4114,6 @@ dependencies = [
41144114
"rustc_errors",
41154115
"rustc_expand",
41164116
"rustc_feature",
4117-
"rustc_fluent_macro",
41184117
"rustc_fs_util",
41194118
"rustc_hir",
41204119
"rustc_hir_analysis",

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
124124
rustc_expand::DEFAULT_LOCALE_RESOURCE,
125125
rustc_hir_analysis::DEFAULT_LOCALE_RESOURCE,
126126
rustc_hir_typeck::DEFAULT_LOCALE_RESOURCE,
127-
rustc_interface::DEFAULT_LOCALE_RESOURCE,
128127
rustc_lint::DEFAULT_LOCALE_RESOURCE,
129128
rustc_metadata::DEFAULT_LOCALE_RESOURCE,
130129
rustc_middle::DEFAULT_LOCALE_RESOURCE,

compiler/rustc_interface/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ rustc_data_structures = { path = "../rustc_data_structures" }
1919
rustc_errors = { path = "../rustc_errors" }
2020
rustc_expand = { path = "../rustc_expand" }
2121
rustc_feature = { path = "../rustc_feature" }
22-
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
2322
rustc_fs_util = { path = "../rustc_fs_util" }
2423
rustc_hir = { path = "../rustc_hir" }
2524
rustc_hir_analysis = { path = "../rustc_hir_analysis" }

compiler/rustc_interface/messages.ftl

Lines changed: 0 additions & 56 deletions
This file was deleted.

compiler/rustc_interface/src/errors.rs

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use rustc_span::{Span, Symbol};
77
use rustc_target::spec::TargetTuple;
88

99
#[derive(Diagnostic)]
10-
#[diag(interface_crate_name_does_not_match)]
10+
#[diag(
11+
"`--crate-name` and `#[crate_name]` are required to match, but `{$crate_name}` != `{$attr_crate_name}`"
12+
)]
1113
pub(crate) struct CrateNameDoesNotMatch {
1214
#[primary_span]
1315
pub(crate) span: Span,
@@ -16,110 +18,124 @@ pub(crate) struct CrateNameDoesNotMatch {
1618
}
1719

1820
#[derive(Diagnostic)]
19-
#[diag(interface_crate_name_invalid)]
21+
#[diag("crate names cannot start with a `-`, but `{$crate_name}` has a leading hyphen")]
2022
pub(crate) struct CrateNameInvalid<'a> {
2123
pub(crate) crate_name: &'a str,
2224
}
2325

2426
#[derive(Diagnostic)]
25-
#[diag(interface_ferris_identifier)]
27+
#[diag("Ferris cannot be used as an identifier")]
2628
pub struct FerrisIdentifier {
2729
#[primary_span]
2830
pub spans: Vec<Span>,
29-
#[suggestion(code = "{ferris_fix}", applicability = "maybe-incorrect")]
31+
#[suggestion(
32+
"try using their name instead",
33+
code = "{ferris_fix}",
34+
applicability = "maybe-incorrect"
35+
)]
3036
pub first_span: Span,
3137
pub ferris_fix: &'static str,
3238
}
3339

3440
#[derive(Diagnostic)]
35-
#[diag(interface_emoji_identifier)]
41+
#[diag("identifiers cannot contain emoji: `{$ident}`")]
3642
pub struct EmojiIdentifier {
3743
#[primary_span]
3844
pub spans: Vec<Span>,
3945
pub ident: Symbol,
4046
}
4147

4248
#[derive(Diagnostic)]
43-
#[diag(interface_mixed_bin_crate)]
49+
#[diag("cannot mix `bin` crate type with others")]
4450
pub struct MixedBinCrate;
4551

4652
#[derive(Diagnostic)]
47-
#[diag(interface_mixed_proc_macro_crate)]
53+
#[diag("cannot mix `proc-macro` crate type with others")]
4854
pub struct MixedProcMacroCrate;
4955

5056
#[derive(Diagnostic)]
51-
#[diag(interface_error_writing_dependencies)]
57+
#[diag("error writing dependencies to `{$path}`: {$error}")]
5258
pub struct ErrorWritingDependencies<'a> {
5359
pub path: &'a Path,
5460
pub error: io::Error,
5561
}
5662

5763
#[derive(Diagnostic)]
58-
#[diag(interface_input_file_would_be_overwritten)]
64+
#[diag("the input file \"{$path}\" would be overwritten by the generated executable")]
5965
pub struct InputFileWouldBeOverWritten<'a> {
6066
pub path: &'a Path,
6167
}
6268

6369
#[derive(Diagnostic)]
64-
#[diag(interface_generated_file_conflicts_with_directory)]
70+
#[diag(
71+
"the generated executable for the input file \"{$input_path}\" conflicts with the existing directory \"{$dir_path}\""
72+
)]
6573
pub struct GeneratedFileConflictsWithDirectory<'a> {
6674
pub input_path: &'a Path,
6775
pub dir_path: &'a Path,
6876
}
6977

7078
#[derive(Diagnostic)]
71-
#[diag(interface_temps_dir_error)]
79+
#[diag("failed to find or create the directory specified by `--temps-dir`")]
7280
pub struct TempsDirError;
7381

7482
#[derive(Diagnostic)]
75-
#[diag(interface_out_dir_error)]
83+
#[diag("failed to find or create the directory specified by `--out-dir`")]
7684
pub struct OutDirError;
7785

7886
#[derive(Diagnostic)]
79-
#[diag(interface_failed_writing_file)]
87+
#[diag("failed to write file {$path}: {$error}\"")]
8088
pub struct FailedWritingFile<'a> {
8189
pub path: &'a Path,
8290
pub error: io::Error,
8391
}
8492

8593
#[derive(Diagnostic)]
86-
#[diag(interface_proc_macro_crate_panic_abort)]
94+
#[diag(
95+
"building proc macro crate with `panic=abort` or `panic=immediate-abort` may crash the compiler should the proc-macro panic"
96+
)]
8797
pub struct ProcMacroCratePanicAbort;
8898

8999
#[derive(Diagnostic)]
90-
#[diag(interface_multiple_output_types_adaption)]
100+
#[diag(
101+
"due to multiple output types requested, the explicitly specified output file name will be adapted for each output type"
102+
)]
91103
pub struct MultipleOutputTypesAdaption;
92104

93105
#[derive(Diagnostic)]
94-
#[diag(interface_ignoring_extra_filename)]
106+
#[diag("ignoring -C extra-filename flag due to -o flag")]
95107
pub struct IgnoringExtraFilename;
96108

97109
#[derive(Diagnostic)]
98-
#[diag(interface_ignoring_out_dir)]
110+
#[diag("ignoring --out-dir flag due to -o flag")]
99111
pub struct IgnoringOutDir;
100112

101113
#[derive(Diagnostic)]
102-
#[diag(interface_multiple_output_types_to_stdout)]
114+
#[diag("can't use option `-o` or `--emit` to write multiple output types to stdout")]
103115
pub struct MultipleOutputTypesToStdout;
104116

105117
#[derive(Diagnostic)]
106-
#[diag(interface_abi_required_feature)]
107-
#[note]
108-
#[note(interface_abi_required_feature_issue)]
118+
#[diag(
119+
"target feature `{$feature}` must be {$enabled} to ensure that the ABI of the current target can be implemented correctly"
120+
)]
121+
#[note(
122+
"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
123+
)]
124+
#[note("for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>")]
109125
pub(crate) struct AbiRequiredTargetFeature<'a> {
110126
pub feature: &'a str,
111127
pub enabled: &'a str,
112128
}
113129

114130
#[derive(Diagnostic)]
115-
#[diag(interface_unsupported_crate_type_for_codegen_backend)]
131+
#[diag("dropping unsupported crate type `{$crate_type}` for codegen backend `{$codegen_backend}`")]
116132
pub(crate) struct UnsupportedCrateTypeForCodegenBackend {
117133
pub(crate) crate_type: CrateType,
118134
pub(crate) codegen_backend: &'static str,
119135
}
120136

121137
#[derive(Diagnostic)]
122-
#[diag(interface_unsupported_crate_type_for_target)]
138+
#[diag("dropping unsupported crate type `{$crate_type}` for target `{$target_triple}`")]
123139
pub(crate) struct UnsupportedCrateTypeForTarget<'a> {
124140
pub(crate) crate_type: CrateType,
125141
pub(crate) target_triple: &'a TargetTuple,

compiler/rustc_interface/src/interface.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ pub(crate) fn parse_cfg(dcx: DiagCtxtHandle<'_>, cfgs: Vec<String>) -> Cfg {
5555
cfgs.into_iter()
5656
.map(|s| {
5757
let psess = ParseSess::emitter_with_note(
58-
vec![
59-
crate::DEFAULT_LOCALE_RESOURCE,
60-
rustc_parse::DEFAULT_LOCALE_RESOURCE,
61-
rustc_session::DEFAULT_LOCALE_RESOURCE,
62-
],
58+
vec![rustc_parse::DEFAULT_LOCALE_RESOURCE, rustc_session::DEFAULT_LOCALE_RESOURCE],
6359
format!("this occurred on the command line: `--cfg={s}`"),
6460
);
6561
let filename = FileName::cfg_spec_source_code(&s);
@@ -131,11 +127,7 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch
131127

132128
for s in specs {
133129
let psess = ParseSess::emitter_with_note(
134-
vec![
135-
crate::DEFAULT_LOCALE_RESOURCE,
136-
rustc_parse::DEFAULT_LOCALE_RESOURCE,
137-
rustc_session::DEFAULT_LOCALE_RESOURCE,
138-
],
130+
vec![rustc_parse::DEFAULT_LOCALE_RESOURCE, rustc_session::DEFAULT_LOCALE_RESOURCE],
139131
format!("this occurred on the command line: `--check-cfg={s}`"),
140132
);
141133
let filename = FileName::cfg_spec_source_code(&s);

compiler/rustc_interface/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,3 @@ pub use queries::Linker;
2121

2222
#[cfg(test)]
2323
mod tests;
24-
25-
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

compiler/rustc_macros/src/query.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ fn add_query_desc_cached_impl(
289289
cached.extend(quote! {
290290
#[allow(unused_variables, unused_braces, rustc::pass_by_value)]
291291
#[inline]
292-
pub fn #name<'tcx>(#tcx: TyCtxt<'tcx>, #key: &crate::query::queries::#name::Key<'tcx>) -> bool {
292+
pub fn #name<'tcx>(#tcx: TyCtxt<'tcx>, #key: &crate::queries::#name::Key<'tcx>) -> bool {
293293
#ra_hint
294294
#expr
295295
}
@@ -301,7 +301,7 @@ fn add_query_desc_cached_impl(
301301

302302
let desc = quote! {
303303
#[allow(unused_variables)]
304-
pub fn #name<'tcx>(tcx: TyCtxt<'tcx>, key: crate::query::queries::#name::Key<'tcx>) -> String {
304+
pub fn #name<'tcx>(tcx: TyCtxt<'tcx>, key: crate::queries::#name::Key<'tcx>) -> String {
305305
let (#tcx, #key) = (tcx, key);
306306
format!(#desc)
307307
}

compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use rustc_middle::bug;
1111
use rustc_middle::metadata::{AmbigModChild, ModChild};
1212
use rustc_middle::middle::exported_symbols::ExportedSymbol;
1313
use rustc_middle::middle::stability::DeprecationEntry;
14-
use rustc_middle::query::{ExternProviders, LocalCrate};
14+
use rustc_middle::queries::ExternProviders;
15+
use rustc_middle::query::LocalCrate;
1516
use rustc_middle::ty::fast_reject::SimplifiedType;
1617
use rustc_middle::ty::{self, TyCtxt};
1718
use rustc_middle::util::Providers;
@@ -134,8 +135,8 @@ macro_rules! provide_one {
134135
($tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $name:ident => $compute:block) => {
135136
fn $name<'tcx>(
136137
$tcx: TyCtxt<'tcx>,
137-
def_id_arg: rustc_middle::query::queries::$name::Key<'tcx>,
138-
) -> rustc_middle::query::queries::$name::ProvidedValue<'tcx> {
138+
def_id_arg: rustc_middle::queries::$name::Key<'tcx>,
139+
) -> rustc_middle::queries::$name::ProvidedValue<'tcx> {
139140
let _prof_timer =
140141
$tcx.prof.generic_activity(concat!("metadata_decode_entry_", stringify!($name)));
141142

compiler/rustc_middle/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ mod values;
8686
#[macro_use]
8787
pub mod query;
8888
#[macro_use]
89+
pub mod queries;
90+
#[macro_use]
8991
pub mod dep_graph;
9092

9193
// Allows macros to refer to this crate as `::rustc_middle`

0 commit comments

Comments
 (0)