@@ -7,7 +7,9 @@ use rustc_span::{Span, Symbol};
77use 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+ ) ]
1113pub ( 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" ) ]
2022pub ( 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" ) ]
2628pub 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}`" ) ]
3642pub 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" ) ]
4450pub struct MixedBinCrate ;
4551
4652#[ derive( Diagnostic ) ]
47- #[ diag( interface_mixed_proc_macro_crate ) ]
53+ #[ diag( "cannot mix `proc-macro` crate type with others" ) ]
4854pub struct MixedProcMacroCrate ;
4955
5056#[ derive( Diagnostic ) ]
51- #[ diag( interface_error_writing_dependencies ) ]
57+ #[ diag( "error writing dependencies to `{$path}`: {$error}" ) ]
5258pub 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" ) ]
5965pub 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+ ) ]
6573pub 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`" ) ]
7280pub 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`" ) ]
7684pub struct OutDirError ;
7785
7886#[ derive( Diagnostic ) ]
79- #[ diag( interface_failed_writing_file ) ]
87+ #[ diag( "failed to write file {$path}: {$error} \" " ) ]
8088pub 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+ ) ]
8797pub 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+ ) ]
91103pub struct MultipleOutputTypesAdaption ;
92104
93105#[ derive( Diagnostic ) ]
94- #[ diag( interface_ignoring_extra_filename ) ]
106+ #[ diag( "ignoring -C extra-filename flag due to -o flag" ) ]
95107pub struct IgnoringExtraFilename ;
96108
97109#[ derive( Diagnostic ) ]
98- #[ diag( interface_ignoring_out_dir ) ]
110+ #[ diag( "ignoring --out-dir flag due to -o flag" ) ]
99111pub 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" ) ]
103115pub 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>" ) ]
109125pub ( 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}`" ) ]
116132pub ( 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}`" ) ]
123139pub ( crate ) struct UnsupportedCrateTypeForTarget < ' a > {
124140 pub ( crate ) crate_type : CrateType ,
125141 pub ( crate ) target_triple : & ' a TargetTuple ,
0 commit comments