authorbors <bors@rust-lang.org> 2026-02-04 13:54:17 UTC
committerbors <bors@rust-lang.org> 2026-02-04 13:54:17 UTC
log8bccf1224deab49b54694c9090e577bfe90a94e6
treed0a240a96c11fec2181b150683e825c5e82a0e34
parent930ecbcdf8905c5c8549056c73fcabdd8d6e1b3d
parentcf0e19b0b4c213bc64ce0e9724721afe4db6fe79

Auto merge of #152104 - JonathanBrouwer:rollup-N93TdHm, r=JonathanBrouwer

Rollup of 12 pull requests Successful merges: - rust-lang/rust#150992 (link modifier `export-symbols`: export all global symbols from selected uptream c static libraries) - rust-lang/rust#151534 (target: fix destabilising target-spec-json) - rust-lang/rust#152088 (rustbook/README.md: add missing `)`) - rust-lang/rust#151526 (Fix autodiff codegen tests) - rust-lang/rust#151810 (citool: report debuginfo test statistics) - rust-lang/rust#151952 (Revert doc attribute parsing errors to future warnings) - rust-lang/rust#152065 (Convert to inline diagnostics in `rustc_ty_utils`) - rust-lang/rust#152066 (Convert to inline diagnostics in `rustc_session`) - rust-lang/rust#152069 (Convert to inline diagnostics in `rustc_privacy`) - rust-lang/rust#152072 (Convert to inline diagnostics in `rustc_monomorphize`) - rust-lang/rust#152083 (Fix set_times_nofollow for directory on windows) - rust-lang/rust#152102 (Convert to inline diagnostics in all codegen backends) Failed merges: - rust-lang/rust#152068 (Convert to inline diagnostics in `rustc_resolve`) - rust-lang/rust#152070 (Convert to inline diagnostics in `rustc_pattern_analysis`)

119 files changed, 1373 insertions(+), 1171 deletions(-)

Cargo.lock-8
......@@ -3635,7 +3635,6 @@ dependencies = [
36353635 "rustc_codegen_ssa",
36363636 "rustc_data_structures",
36373637 "rustc_errors",
3638 "rustc_fluent_macro",
36393638 "rustc_fs_util",
36403639 "rustc_hashes",
36413640 "rustc_hir",
......@@ -3799,18 +3798,15 @@ dependencies = [
37993798 "rustc_middle",
38003799 "rustc_mir_build",
38013800 "rustc_mir_transform",
3802 "rustc_monomorphize",
38033801 "rustc_parse",
38043802 "rustc_passes",
38053803 "rustc_pattern_analysis",
3806 "rustc_privacy",
38073804 "rustc_public",
38083805 "rustc_resolve",
38093806 "rustc_session",
38103807 "rustc_span",
38113808 "rustc_target",
38123809 "rustc_trait_selection",
3813 "rustc_ty_utils",
38143810 "serde_json",
38153811 "shlex",
38163812 "tracing",
......@@ -4373,7 +4369,6 @@ dependencies = [
43734369 "rustc_abi",
43744370 "rustc_data_structures",
43754371 "rustc_errors",
4376 "rustc_fluent_macro",
43774372 "rustc_hir",
43784373 "rustc_index",
43794374 "rustc_macros",
......@@ -4486,7 +4481,6 @@ dependencies = [
44864481 "rustc_ast",
44874482 "rustc_data_structures",
44884483 "rustc_errors",
4489 "rustc_fluent_macro",
44904484 "rustc_hir",
44914485 "rustc_macros",
44924486 "rustc_middle",
......@@ -4641,7 +4635,6 @@ dependencies = [
46414635 "rustc_data_structures",
46424636 "rustc_errors",
46434637 "rustc_feature",
4644 "rustc_fluent_macro",
46454638 "rustc_fs_util",
46464639 "rustc_hashes",
46474640 "rustc_hir",
......@@ -4797,7 +4790,6 @@ dependencies = [
47974790 "rustc_abi",
47984791 "rustc_data_structures",
47994792 "rustc_errors",
4800 "rustc_fluent_macro",
48014793 "rustc_hashes",
48024794 "rustc_hir",
48034795 "rustc_index",
compiler/rustc_attr_parsing/src/attributes/doc.rs+83-17
......@@ -70,6 +70,42 @@ fn check_attr_crate_level<S: Stage>(cx: &mut AcceptContext<'_, '_, S>, span: Spa
7070 true
7171}
7272
73// FIXME: To be removed once merged and replace with `cx.expected_name_value(span, _name)`.
74fn expected_name_value<S: Stage>(
75 cx: &mut AcceptContext<'_, '_, S>,
76 span: Span,
77 _name: Option<Symbol>,
78) {
79 cx.emit_lint(
80 rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
81 AttributeLintKind::ExpectedNameValue,
82 span,
83 );
84}
85
86// FIXME: remove this method once merged and use `cx.expected_no_args(span)` instead.
87fn expected_no_args<S: Stage>(cx: &mut AcceptContext<'_, '_, S>, span: Span) {
88 cx.emit_lint(
89 rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
90 AttributeLintKind::ExpectedNoArgs,
91 span,
92 );
93}
94
95// FIXME: remove this method once merged and use `cx.expected_no_args(span)` instead.
96// cx.expected_string_literal(span, _actual_literal);
97fn expected_string_literal<S: Stage>(
98 cx: &mut AcceptContext<'_, '_, S>,
99 span: Span,
100 _actual_literal: Option<&MetaItemLit>,
101) {
102 cx.emit_lint(
103 rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
104 AttributeLintKind::MalformedDoc,
105 span,
106 );
107}
108
73109fn parse_keyword_and_attribute<S: Stage>(
74110 cx: &mut AcceptContext<'_, '_, S>,
75111 path: &OwnedPathParser,
......@@ -78,12 +114,12 @@ fn parse_keyword_and_attribute<S: Stage>(
78114 attr_name: Symbol,
79115) {
80116 let Some(nv) = args.name_value() else {
81 cx.expected_name_value(args.span().unwrap_or(path.span()), path.word_sym());
117 expected_name_value(cx, args.span().unwrap_or(path.span()), path.word_sym());
82118 return;
83119 };
84120
85121 let Some(value) = nv.value_as_str() else {
86 cx.expected_string_literal(nv.value_span, Some(nv.value_as_lit()));
122 expected_string_literal(cx, nv.value_span, Some(nv.value_as_lit()));
87123 return;
88124 };
89125
......@@ -127,12 +163,21 @@ impl DocParser {
127163 match path.word_sym() {
128164 Some(sym::no_crate_inject) => {
129165 if let Err(span) = args.no_args() {
130 cx.expected_no_args(span);
166 expected_no_args(cx, span);
131167 return;
132168 }
133169
134 if self.attribute.no_crate_inject.is_some() {
135 cx.duplicate_key(path.span(), sym::no_crate_inject);
170 if let Some(used_span) = self.attribute.no_crate_inject {
171 let unused_span = path.span();
172 cx.emit_lint(
173 rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
174 AttributeLintKind::UnusedDuplicate {
175 this: unused_span,
176 other: used_span,
177 warning: true,
178 },
179 unused_span,
180 );
136181 return;
137182 }
138183
......@@ -144,7 +189,14 @@ impl DocParser {
144189 }
145190 Some(sym::attr) => {
146191 let Some(list) = args.list() else {
147 cx.expected_list(cx.attr_span, args);
192 // FIXME: remove this method once merged and uncomment the line below instead.
193 // cx.expected_list(cx.attr_span, args);
194 let span = cx.attr_span;
195 cx.emit_lint(
196 rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
197 AttributeLintKind::MalformedDoc,
198 span,
199 );
148200 return;
149201 };
150202
......@@ -246,7 +298,7 @@ impl DocParser {
246298 inline: DocInline,
247299 ) {
248300 if let Err(span) = args.no_args() {
249 cx.expected_no_args(span);
301 expected_no_args(cx, span);
250302 return;
251303 }
252304
......@@ -328,7 +380,14 @@ impl DocParser {
328380 match sub_item.args() {
329381 a @ (ArgParser::NoArgs | ArgParser::NameValue(_)) => {
330382 let Some(name) = sub_item.path().word_sym() else {
331 cx.expected_identifier(sub_item.path().span());
383 // FIXME: remove this method once merged and uncomment the line
384 // below instead.
385 // cx.expected_identifier(sub_item.path().span());
386 cx.emit_lint(
387 rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
388 AttributeLintKind::MalformedDoc,
389 sub_item.path().span(),
390 );
332391 continue;
333392 };
334393 if let Ok(CfgEntry::NameValue { name, value, .. }) =
......@@ -391,7 +450,7 @@ impl DocParser {
391450 macro_rules! no_args {
392451 ($ident: ident) => {{
393452 if let Err(span) = args.no_args() {
394 cx.expected_no_args(span);
453 expected_no_args(cx, span);
395454 return;
396455 }
397456
......@@ -410,7 +469,7 @@ impl DocParser {
410469 macro_rules! no_args_and_not_crate_level {
411470 ($ident: ident) => {{
412471 if let Err(span) = args.no_args() {
413 cx.expected_no_args(span);
472 expected_no_args(cx, span);
414473 return;
415474 }
416475 let span = path.span();
......@@ -423,7 +482,7 @@ impl DocParser {
423482 macro_rules! no_args_and_crate_level {
424483 ($ident: ident) => {{
425484 if let Err(span) = args.no_args() {
426 cx.expected_no_args(span);
485 expected_no_args(cx, span);
427486 return;
428487 }
429488 let span = path.span();
......@@ -436,12 +495,12 @@ impl DocParser {
436495 macro_rules! string_arg_and_crate_level {
437496 ($ident: ident) => {{
438497 let Some(nv) = args.name_value() else {
439 cx.expected_name_value(args.span().unwrap_or(path.span()), path.word_sym());
498 expected_name_value(cx, args.span().unwrap_or(path.span()), path.word_sym());
440499 return;
441500 };
442501
443502 let Some(s) = nv.value_as_str() else {
444 cx.expected_string_literal(nv.value_span, Some(nv.value_as_lit()));
503 expected_string_literal(cx, nv.value_span, Some(nv.value_as_lit()));
445504 return;
446505 };
447506
......@@ -512,7 +571,14 @@ impl DocParser {
512571 self.parse_single_test_doc_attr_item(cx, mip);
513572 }
514573 MetaItemOrLitParser::Lit(lit) => {
515 cx.unexpected_literal(lit.span);
574 // FIXME: remove this method once merged and uncomment the line
575 // below instead.
576 // cx.unexpected_literal(lit.span);
577 cx.emit_lint(
578 rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
579 AttributeLintKind::MalformedDoc,
580 lit.span,
581 );
516582 }
517583 }
518584 }
......@@ -582,7 +648,7 @@ impl DocParser {
582648 let suggestions = cx.suggestions();
583649 let span = cx.attr_span;
584650 cx.emit_lint(
585 rustc_session::lint::builtin::ILL_FORMED_ATTRIBUTE_INPUT,
651 rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
586652 AttributeLintKind::IllFormedAttributeInput { suggestions, docs: None },
587653 span,
588654 );
......@@ -595,14 +661,14 @@ impl DocParser {
595661 self.parse_single_doc_attr_item(cx, mip);
596662 }
597663 MetaItemOrLitParser::Lit(lit) => {
598 cx.expected_name_value(lit.span, None);
664 expected_name_value(cx, lit.span, None);
599665 }
600666 }
601667 }
602668 }
603669 ArgParser::NameValue(nv) => {
604670 if nv.value_as_str().is_none() {
605 cx.expected_string_literal(nv.value_span, Some(nv.value_as_lit()));
671 expected_string_literal(cx, nv.value_span, Some(nv.value_as_lit()));
606672 } else {
607673 unreachable!(
608674 "Should have been handled at the same time as sugar-syntaxed doc comments"
compiler/rustc_attr_parsing/src/attributes/link_attrs.rs+16-5
......@@ -12,10 +12,10 @@ use super::prelude::*;
1212use super::util::parse_single_integer;
1313use crate::attributes::cfg::parse_cfg_entry;
1414use crate::session_diagnostics::{
15 AsNeededCompatibility, BundleNeedsStatic, EmptyLinkName, ImportNameTypeRaw, ImportNameTypeX86,
16 IncompatibleWasmLink, InvalidLinkModifier, LinkFrameworkApple, LinkOrdinalOutOfRange,
17 LinkRequiresName, MultipleModifiers, NullOnLinkSection, RawDylibNoNul, RawDylibOnlyWindows,
18 WholeArchiveNeedsStatic,
15 AsNeededCompatibility, BundleNeedsStatic, EmptyLinkName, ExportSymbolsNeedsStatic,
16 ImportNameTypeRaw, ImportNameTypeX86, IncompatibleWasmLink, InvalidLinkModifier,
17 LinkFrameworkApple, LinkOrdinalOutOfRange, LinkRequiresName, MultipleModifiers,
18 NullOnLinkSection, RawDylibNoNul, RawDylibOnlyWindows, WholeArchiveNeedsStatic,
1919};
2020
2121pub(crate) struct LinkNameParser;
......@@ -165,6 +165,14 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
165165 cx.emit_err(BundleNeedsStatic { span });
166166 }
167167
168 (sym::export_symbols, Some(NativeLibKind::Static { export_symbols, .. })) => {
169 assign_modifier(export_symbols)
170 }
171
172 (sym::export_symbols, _) => {
173 cx.emit_err(ExportSymbolsNeedsStatic { span });
174 }
175
168176 (sym::verbatim, _) => assign_modifier(&mut verbatim),
169177
170178 (
......@@ -190,6 +198,7 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
190198 span,
191199 &[
192200 sym::bundle,
201 sym::export_symbols,
193202 sym::verbatim,
194203 sym::whole_dash_archive,
195204 sym::as_dash_needed,
......@@ -285,7 +294,9 @@ impl LinkParser {
285294 };
286295
287296 let link_kind = match link_kind {
288 kw::Static => NativeLibKind::Static { bundle: None, whole_archive: None },
297 kw::Static => {
298 NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None }
299 }
289300 sym::dylib => NativeLibKind::Dylib { as_needed: None },
290301 sym::framework => {
291302 if !sess.target.is_like_darwin {
compiler/rustc_attr_parsing/src/session_diagnostics.rs+8-1
......@@ -909,7 +909,7 @@ pub(crate) struct RawDylibOnlyWindows {
909909
910910#[derive(Diagnostic)]
911911#[diag(
912 "invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed"
912 "invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols"
913913)]
914914pub(crate) struct InvalidLinkModifier {
915915 #[primary_span]
......@@ -938,6 +938,13 @@ pub(crate) struct BundleNeedsStatic {
938938 pub span: Span,
939939}
940940
941#[derive(Diagnostic)]
942#[diag("linking modifier `export-symbols` is only compatible with `static` linking kind")]
943pub(crate) struct ExportSymbolsNeedsStatic {
944 #[primary_span]
945 pub span: Span,
946}
947
941948#[derive(Diagnostic)]
942949#[diag("linking modifier `whole-archive` is only compatible with `static` linking kind")]
943950pub(crate) struct WholeArchiveNeedsStatic {
compiler/rustc_codegen_cranelift/src/lib.rs-5
......@@ -125,11 +125,6 @@ pub struct CraneliftCodegenBackend {
125125}
126126
127127impl CodegenBackend for CraneliftCodegenBackend {
128 fn locale_resource(&self) -> &'static str {
129 // FIXME(rust-lang/rust#100717) - cranelift codegen backend is not yet translated
130 ""
131 }
132
133128 fn name(&self) -> &'static str {
134129 "cranelift"
135130 }
compiler/rustc_codegen_gcc/messages.ftl deleted-8
......@@ -1,8 +0,0 @@
1codegen_gcc_unwinding_inline_asm =
2 GCC backend does not support unwinding from inline asm
3
4codegen_gcc_copy_bitcode = failed to copy bitcode to object file: {$err}
5
6codegen_gcc_lto_bitcode_from_rlib = failed to get bitcode from object file for LTO ({$gcc_err})
7
8codegen_gcc_explicit_tail_calls_unsupported = explicit tail calls with the 'become' keyword are not implemented in the GCC backend
compiler/rustc_codegen_gcc/src/errors.rs+4-4
......@@ -2,24 +2,24 @@ use rustc_macros::Diagnostic;
22use rustc_span::Span;
33
44#[derive(Diagnostic)]
5#[diag(codegen_gcc_unwinding_inline_asm)]
5#[diag("GCC backend does not support unwinding from inline asm")]
66pub(crate) struct UnwindingInlineAsm {
77 #[primary_span]
88 pub span: Span,
99}
1010
1111#[derive(Diagnostic)]
12#[diag(codegen_gcc_copy_bitcode)]
12#[diag("failed to copy bitcode to object file: {$err}")]
1313pub(crate) struct CopyBitcode {
1414 pub err: std::io::Error,
1515}
1616
1717#[derive(Diagnostic)]
18#[diag(codegen_gcc_lto_bitcode_from_rlib)]
18#[diag("failed to get bitcode from object file for LTO ({$gcc_err})")]
1919pub(crate) struct LtoBitcodeFromRlib {
2020 pub gcc_err: String,
2121}
2222
2323#[derive(Diagnostic)]
24#[diag(codegen_gcc_explicit_tail_calls_unsupported)]
24#[diag("explicit tail calls with the 'become' keyword are not implemented in the GCC backend")]
2525pub(crate) struct ExplicitTailCallsUnsupported;
compiler/rustc_codegen_gcc/src/lib.rs-7
......@@ -27,7 +27,6 @@ extern crate rustc_ast;
2727extern crate rustc_codegen_ssa;
2828extern crate rustc_data_structures;
2929extern crate rustc_errors;
30extern crate rustc_fluent_macro;
3130extern crate rustc_fs_util;
3231extern crate rustc_hir;
3332extern crate rustc_index;
......@@ -105,8 +104,6 @@ use tempfile::TempDir;
105104use crate::back::lto::ModuleBuffer;
106105use crate::gcc_util::{target_cpu, to_gcc_features};
107106
108rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
109
110107pub struct PrintOnPanic<F: Fn() -> String>(pub F);
111108
112109impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
......@@ -197,10 +194,6 @@ fn load_libgccjit_if_needed(libgccjit_target_lib_file: &Path) {
197194}
198195
199196impl CodegenBackend for GccCodegenBackend {
200 fn locale_resource(&self) -> &'static str {
201 crate::DEFAULT_LOCALE_RESOURCE
202 }
203
204197 fn name(&self) -> &'static str {
205198 "gcc"
206199 }
compiler/rustc_codegen_llvm/Cargo.toml-1
......@@ -23,7 +23,6 @@ rustc_ast = { path = "../rustc_ast" }
2323rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
2424rustc_data_structures = { path = "../rustc_data_structures" }
2525rustc_errors = { path = "../rustc_errors" }
26rustc_fluent_macro = { path = "../rustc_fluent_macro" }
2726rustc_fs_util = { path = "../rustc_fs_util" }
2827rustc_hashes = { path = "../rustc_hashes" }
2928rustc_hir = { path = "../rustc_hir" }
compiler/rustc_codegen_llvm/messages.ftl deleted-75
......@@ -1,75 +0,0 @@
1codegen_llvm_autodiff_component_missing = autodiff backend not found in the sysroot: {$err}
2 .note = it will be distributed via rustup in the future
3
4codegen_llvm_autodiff_component_unavailable = failed to load our autodiff backend: {$err}
5
6codegen_llvm_autodiff_without_enable = using the autodiff feature requires -Z autodiff=Enable
7codegen_llvm_autodiff_without_lto = using the autodiff feature requires setting `lto="fat"` in your Cargo.toml
8
9codegen_llvm_copy_bitcode = failed to copy bitcode to object file: {$err}
10
11codegen_llvm_fixed_x18_invalid_arch = the `-Zfixed-x18` flag is not supported on the `{$arch}` architecture
12
13codegen_llvm_from_llvm_diag = {$message}
14
15codegen_llvm_from_llvm_optimization_diag = {$filename}:{$line}:{$column} {$pass_name} ({$kind}): {$message}
16
17codegen_llvm_load_bitcode = failed to load bitcode of module "{$name}"
18codegen_llvm_load_bitcode_with_llvm_err = failed to load bitcode of module "{$name}": {$llvm_err}
19
20codegen_llvm_lto_bitcode_from_rlib = failed to get bitcode from object file for LTO ({$err})
21
22codegen_llvm_mismatch_data_layout =
23 data-layout for target `{$rustc_target}`, `{$rustc_layout}`, differs from LLVM target's `{$llvm_target}` default layout, `{$llvm_layout}`
24
25codegen_llvm_offload_bundleimages_failed = call to BundleImages failed, `host.out` was not created
26codegen_llvm_offload_embed_failed = call to EmbedBufferInModule failed, `host.o` was not created
27codegen_llvm_offload_no_abs_path = using the `-Z offload=Host=/absolute/path/to/host.out` flag requires an absolute path
28codegen_llvm_offload_no_host_out = using the `-Z offload=Host=/absolute/path/to/host.out` flag must point to a `host.out` file
29codegen_llvm_offload_nonexisting = the given path/file to `host.out` does not exist. Did you forget to run the device compilation first?
30codegen_llvm_offload_without_enable = using the offload feature requires -Z offload=<Device or Host=/absolute/path/to/host.out>
31codegen_llvm_offload_without_fat_lto = using the offload feature requires -C lto=fat
32
33codegen_llvm_parse_bitcode = failed to parse bitcode for LTO module
34codegen_llvm_parse_bitcode_with_llvm_err = failed to parse bitcode for LTO module: {$llvm_err}
35
36codegen_llvm_parse_target_machine_config =
37 failed to parse target machine config to target machine: {$error}
38
39codegen_llvm_prepare_autodiff = failed to prepare autodiff: src: {$src}, target: {$target}, {$error}
40codegen_llvm_prepare_autodiff_with_llvm_err = failed to prepare autodiff: {$llvm_err}, src: {$src}, target: {$target}, {$error}
41codegen_llvm_prepare_thin_lto_context = failed to prepare thin LTO context
42codegen_llvm_prepare_thin_lto_context_with_llvm_err = failed to prepare thin LTO context: {$llvm_err}
43
44codegen_llvm_prepare_thin_lto_module = failed to prepare thin LTO module
45codegen_llvm_prepare_thin_lto_module_with_llvm_err = failed to prepare thin LTO module: {$llvm_err}
46
47codegen_llvm_run_passes = failed to run LLVM passes
48codegen_llvm_run_passes_with_llvm_err = failed to run LLVM passes: {$llvm_err}
49
50codegen_llvm_sanitizer_kcfi_arity_requires_llvm_21_0_0 = `-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later.
51
52codegen_llvm_sanitizer_memtag_requires_mte =
53 `-Zsanitizer=memtag` requires `-Ctarget-feature=+mte`
54
55codegen_llvm_serialize_module = failed to serialize module {$name}
56codegen_llvm_serialize_module_with_llvm_err = failed to serialize module {$name}: {$llvm_err}
57
58codegen_llvm_symbol_already_defined =
59 symbol `{$symbol_name}` is already defined
60
61codegen_llvm_target_machine = could not create LLVM TargetMachine for triple: {$triple}
62codegen_llvm_target_machine_with_llvm_err = could not create LLVM TargetMachine for triple: {$triple}: {$llvm_err}
63
64codegen_llvm_unknown_debuginfo_compression = unknown debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo
65
66codegen_llvm_write_bytecode = failed to write bytecode to {$path}: {$err}
67
68codegen_llvm_write_ir = failed to write LLVM IR to {$path}
69codegen_llvm_write_ir_with_llvm_err = failed to write LLVM IR to {$path}: {$llvm_err}
70
71codegen_llvm_write_output = could not write output to {$path}
72codegen_llvm_write_output_with_llvm_err = could not write output to {$path}: {$llvm_err}
73
74codegen_llvm_write_thinlto_key = error while writing ThinLTO key data: {$err}
75codegen_llvm_write_thinlto_key_with_llvm_err = error while writing ThinLTO key data: {$err}: {$llvm_err}
compiler/rustc_codegen_llvm/src/errors.rs+74-50
......@@ -2,14 +2,12 @@ use std::ffi::CString;
22use std::path::Path;
33
44use rustc_data_structures::small_c_str::SmallCStr;
5use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level};
5use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, inline_fluent};
66use rustc_macros::Diagnostic;
77use rustc_span::Span;
88
9use crate::fluent_generated as fluent;
10
119#[derive(Diagnostic)]
12#[diag(codegen_llvm_symbol_already_defined)]
10#[diag("symbol `{$symbol_name}` is already defined")]
1311pub(crate) struct SymbolAlreadyDefined<'a> {
1412 #[primary_span]
1513 pub span: Span,
......@@ -17,7 +15,7 @@ pub(crate) struct SymbolAlreadyDefined<'a> {
1715}
1816
1917#[derive(Diagnostic)]
20#[diag(codegen_llvm_sanitizer_memtag_requires_mte)]
18#[diag("`-Zsanitizer=memtag` requires `-Ctarget-feature=+mte`")]
2119pub(crate) struct SanitizerMemtagRequiresMte;
2220
2321pub(crate) struct ParseTargetMachineConfig<'a>(pub LlvmError<'a>);
......@@ -27,89 +25,97 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for ParseTargetMachineConfig<'_> {
2725 let diag: Diag<'_, G> = self.0.into_diag(dcx, level);
2826 let (message, _) = diag.messages.first().expect("`LlvmError` with no message");
2927 let message = dcx.eagerly_translate_to_string(message.clone(), diag.args.iter());
30 Diag::new(dcx, level, fluent::codegen_llvm_parse_target_machine_config)
31 .with_arg("error", message)
28 Diag::new(
29 dcx,
30 level,
31 inline_fluent!("failed to parse target machine config to target machine: {$error}"),
32 )
33 .with_arg("error", message)
3234 }
3335}
3436
3537#[derive(Diagnostic)]
36#[diag(codegen_llvm_autodiff_component_unavailable)]
38#[diag("failed to load our autodiff backend: {$err}")]
3739pub(crate) struct AutoDiffComponentUnavailable {
3840 pub err: String,
3941}
4042
4143#[derive(Diagnostic)]
42#[diag(codegen_llvm_autodiff_component_missing)]
43#[note]
44#[diag("autodiff backend not found in the sysroot: {$err}")]
45#[note("it will be distributed via rustup in the future")]
4446pub(crate) struct AutoDiffComponentMissing {
4547 pub err: String,
4648}
4749
4850#[derive(Diagnostic)]
49#[diag(codegen_llvm_autodiff_without_lto)]
51#[diag("using the autodiff feature requires setting `lto=\"fat\"` in your Cargo.toml")]
5052pub(crate) struct AutoDiffWithoutLto;
5153
5254#[derive(Diagnostic)]
53#[diag(codegen_llvm_autodiff_without_enable)]
55#[diag("using the autodiff feature requires -Z autodiff=Enable")]
5456pub(crate) struct AutoDiffWithoutEnable;
5557
5658#[derive(Diagnostic)]
57#[diag(codegen_llvm_offload_without_enable)]
59#[diag("using the offload feature requires -Z offload=<Device or Host=/absolute/path/to/host.out>")]
5860pub(crate) struct OffloadWithoutEnable;
5961
6062#[derive(Diagnostic)]
61#[diag(codegen_llvm_offload_without_fat_lto)]
63#[diag("using the offload feature requires -C lto=fat")]
6264pub(crate) struct OffloadWithoutFatLTO;
6365
6466#[derive(Diagnostic)]
65#[diag(codegen_llvm_offload_no_abs_path)]
67#[diag("using the `-Z offload=Host=/absolute/path/to/host.out` flag requires an absolute path")]
6668pub(crate) struct OffloadWithoutAbsPath;
6769
6870#[derive(Diagnostic)]
69#[diag(codegen_llvm_offload_no_host_out)]
71#[diag(
72 "using the `-Z offload=Host=/absolute/path/to/host.out` flag must point to a `host.out` file"
73)]
7074pub(crate) struct OffloadWrongFileName;
7175
7276#[derive(Diagnostic)]
73#[diag(codegen_llvm_offload_nonexisting)]
77#[diag(
78 "the given path/file to `host.out` does not exist. Did you forget to run the device compilation first?"
79)]
7480pub(crate) struct OffloadNonexistingPath;
7581
7682#[derive(Diagnostic)]
77#[diag(codegen_llvm_offload_bundleimages_failed)]
83#[diag("call to BundleImages failed, `host.out` was not created")]
7884pub(crate) struct OffloadBundleImagesFailed;
7985
8086#[derive(Diagnostic)]
81#[diag(codegen_llvm_offload_embed_failed)]
87#[diag("call to EmbedBufferInModule failed, `host.o` was not created")]
8288pub(crate) struct OffloadEmbedFailed;
8389
8490#[derive(Diagnostic)]
85#[diag(codegen_llvm_lto_bitcode_from_rlib)]
91#[diag("failed to get bitcode from object file for LTO ({$err})")]
8692pub(crate) struct LtoBitcodeFromRlib {
8793 pub err: String,
8894}
8995
9096#[derive(Diagnostic)]
9197pub enum LlvmError<'a> {
92 #[diag(codegen_llvm_write_output)]
98 #[diag("could not write output to {$path}")]
9399 WriteOutput { path: &'a Path },
94 #[diag(codegen_llvm_target_machine)]
100 #[diag("could not create LLVM TargetMachine for triple: {$triple}")]
95101 CreateTargetMachine { triple: SmallCStr },
96 #[diag(codegen_llvm_run_passes)]
102 #[diag("failed to run LLVM passes")]
97103 RunLlvmPasses,
98 #[diag(codegen_llvm_serialize_module)]
104 #[diag("failed to serialize module {$name}")]
99105 SerializeModule { name: &'a str },
100 #[diag(codegen_llvm_write_ir)]
106 #[diag("failed to write LLVM IR to {$path}")]
101107 WriteIr { path: &'a Path },
102 #[diag(codegen_llvm_prepare_thin_lto_context)]
108 #[diag("failed to prepare thin LTO context")]
103109 PrepareThinLtoContext,
104 #[diag(codegen_llvm_load_bitcode)]
110 #[diag("failed to load bitcode of module \"{$name}\"")]
105111 LoadBitcode { name: CString },
106 #[diag(codegen_llvm_write_thinlto_key)]
112 #[diag("error while writing ThinLTO key data: {$err}")]
107113 WriteThinLtoKey { err: std::io::Error },
108 #[diag(codegen_llvm_prepare_thin_lto_module)]
114 #[diag("failed to prepare thin LTO module")]
109115 PrepareThinLtoModule,
110 #[diag(codegen_llvm_parse_bitcode)]
116 #[diag("failed to parse bitcode for LTO module")]
111117 ParseBitcode,
112 #[diag(codegen_llvm_prepare_autodiff)]
118 #[diag("failed to prepare autodiff: src: {$src}, target: {$target}, {$error}")]
113119 PrepareAutoDiff { src: String, target: String, error: String },
114120}
115121
......@@ -119,17 +125,31 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for WithLlvmError<'_> {
119125 fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
120126 use LlvmError::*;
121127 let msg_with_llvm_err = match &self.0 {
122 WriteOutput { .. } => fluent::codegen_llvm_write_output_with_llvm_err,
123 CreateTargetMachine { .. } => fluent::codegen_llvm_target_machine_with_llvm_err,
124 RunLlvmPasses => fluent::codegen_llvm_run_passes_with_llvm_err,
125 SerializeModule { .. } => fluent::codegen_llvm_serialize_module_with_llvm_err,
126 WriteIr { .. } => fluent::codegen_llvm_write_ir_with_llvm_err,
127 PrepareThinLtoContext => fluent::codegen_llvm_prepare_thin_lto_context_with_llvm_err,
128 LoadBitcode { .. } => fluent::codegen_llvm_load_bitcode_with_llvm_err,
129 WriteThinLtoKey { .. } => fluent::codegen_llvm_write_thinlto_key_with_llvm_err,
130 PrepareThinLtoModule => fluent::codegen_llvm_prepare_thin_lto_module_with_llvm_err,
131 ParseBitcode => fluent::codegen_llvm_parse_bitcode_with_llvm_err,
132 PrepareAutoDiff { .. } => fluent::codegen_llvm_prepare_autodiff_with_llvm_err,
128 WriteOutput { .. } => inline_fluent!("could not write output to {$path}: {$llvm_err}"),
129 CreateTargetMachine { .. } => inline_fluent!(
130 "could not create LLVM TargetMachine for triple: {$triple}: {$llvm_err}"
131 ),
132 RunLlvmPasses => inline_fluent!("failed to run LLVM passes: {$llvm_err}"),
133 SerializeModule { .. } => {
134 inline_fluent!("failed to serialize module {$name}: {$llvm_err}")
135 }
136 WriteIr { .. } => inline_fluent!("failed to write LLVM IR to {$path}: {$llvm_err}"),
137 PrepareThinLtoContext => {
138 inline_fluent!("failed to prepare thin LTO context: {$llvm_err}")
139 }
140 LoadBitcode { .. } => {
141 inline_fluent!("failed to load bitcode of module \"{$name}\": {$llvm_err}")
142 }
143 WriteThinLtoKey { .. } => {
144 inline_fluent!("error while writing ThinLTO key data: {$err}: {$llvm_err}")
145 }
146 PrepareThinLtoModule => {
147 inline_fluent!("failed to prepare thin LTO module: {$llvm_err}")
148 }
149 ParseBitcode => inline_fluent!("failed to parse bitcode for LTO module: {$llvm_err}"),
150 PrepareAutoDiff { .. } => inline_fluent!(
151 "failed to prepare autodiff: {$llvm_err}, src: {$src}, target: {$target}, {$error}"
152 ),
133153 };
134154 self.0
135155 .into_diag(dcx, level)
......@@ -139,7 +159,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for WithLlvmError<'_> {
139159}
140160
141161#[derive(Diagnostic)]
142#[diag(codegen_llvm_from_llvm_optimization_diag)]
162#[diag("{$filename}:{$line}:{$column} {$pass_name} ({$kind}): {$message}")]
143163pub(crate) struct FromLlvmOptimizationDiag<'a> {
144164 pub filename: &'a str,
145165 pub line: std::ffi::c_uint,
......@@ -150,32 +170,36 @@ pub(crate) struct FromLlvmOptimizationDiag<'a> {
150170}
151171
152172#[derive(Diagnostic)]
153#[diag(codegen_llvm_from_llvm_diag)]
173#[diag("{$message}")]
154174pub(crate) struct FromLlvmDiag {
155175 pub message: String,
156176}
157177
158178#[derive(Diagnostic)]
159#[diag(codegen_llvm_write_bytecode)]
179#[diag("failed to write bytecode to {$path}: {$err}")]
160180pub(crate) struct WriteBytecode<'a> {
161181 pub path: &'a Path,
162182 pub err: std::io::Error,
163183}
164184
165185#[derive(Diagnostic)]
166#[diag(codegen_llvm_copy_bitcode)]
186#[diag("failed to copy bitcode to object file: {$err}")]
167187pub(crate) struct CopyBitcode {
168188 pub err: std::io::Error,
169189}
170190
171191#[derive(Diagnostic)]
172#[diag(codegen_llvm_unknown_debuginfo_compression)]
192#[diag(
193 "unknown debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo"
194)]
173195pub(crate) struct UnknownCompression {
174196 pub algorithm: &'static str,
175197}
176198
177199#[derive(Diagnostic)]
178#[diag(codegen_llvm_mismatch_data_layout)]
200#[diag(
201 "data-layout for target `{$rustc_target}`, `{$rustc_layout}`, differs from LLVM target's `{$llvm_target}` default layout, `{$llvm_layout}`"
202)]
179203pub(crate) struct MismatchedDataLayout<'a> {
180204 pub rustc_target: &'a str,
181205 pub rustc_layout: &'a str,
......@@ -184,11 +208,11 @@ pub(crate) struct MismatchedDataLayout<'a> {
184208}
185209
186210#[derive(Diagnostic)]
187#[diag(codegen_llvm_fixed_x18_invalid_arch)]
211#[diag("the `-Zfixed-x18` flag is not supported on the `{$arch}` architecture")]
188212pub(crate) struct FixedX18InvalidArch<'a> {
189213 pub arch: &'a str,
190214}
191215
192216#[derive(Diagnostic)]
193#[diag(codegen_llvm_sanitizer_kcfi_arity_requires_llvm_21_0_0)]
217#[diag("`-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later.")]
194218pub(crate) struct SanitizerKcfiArityRequiresLLVM2100;
compiler/rustc_codegen_llvm/src/lib.rs-6
......@@ -74,8 +74,6 @@ mod typetree;
7474mod va_arg;
7575mod value;
7676
77rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
78
7977pub(crate) use macros::TryFromU32;
8078
8179#[derive(Clone)]
......@@ -241,10 +239,6 @@ impl LlvmCodegenBackend {
241239}
242240
243241impl CodegenBackend for LlvmCodegenBackend {
244 fn locale_resource(&self) -> &'static str {
245 crate::DEFAULT_LOCALE_RESOURCE
246 }
247
248242 fn name(&self) -> &'static str {
249243 "llvm"
250244 }
compiler/rustc_codegen_ssa/src/back/link.rs+88-7
......@@ -11,10 +11,11 @@ use std::{env, fmt, fs, io, mem, str};
1111
1212use find_msvc_tools;
1313use itertools::Itertools;
14use object::{Object, ObjectSection, ObjectSymbol};
1415use regex::Regex;
1516use rustc_arena::TypedArena;
1617use rustc_attr_parsing::eval_config_entry;
17use rustc_data_structures::fx::FxIndexSet;
18use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
1819use rustc_data_structures::memmap::Mmap;
1920use rustc_data_structures::temp_dir::MaybeTempDir;
2021use rustc_errors::{DiagCtxtHandle, LintDiagnostic};
......@@ -2185,6 +2186,71 @@ fn add_rpath_args(
21852186 }
21862187}
21872188
2189fn add_c_staticlib_symbols(
2190 sess: &Session,
2191 lib: &NativeLib,
2192 out: &mut Vec<(String, SymbolExportKind)>,
2193) -> io::Result<()> {
2194 let file_path = find_native_static_library(lib.name.as_str(), lib.verbatim, sess);
2195
2196 let archive_map = unsafe { Mmap::map(File::open(&file_path)?)? };
2197
2198 let archive = object::read::archive::ArchiveFile::parse(&*archive_map)
2199 .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
2200
2201 for member in archive.members() {
2202 let member = member.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
2203
2204 let data = member
2205 .data(&*archive_map)
2206 .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
2207
2208 // clang LTO: raw LLVM bitcode
2209 if data.starts_with(b"BC\xc0\xde") {
2210 return Err(io::Error::new(
2211 io::ErrorKind::InvalidData,
2212 "LLVM bitcode object in C static library (LTO not supported)",
2213 ));
2214 }
2215
2216 let object = object::File::parse(&*data)
2217 .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
2218
2219 // gcc / clang ELF / Mach-O LTO
2220 if object.sections().any(|s| {
2221 s.name().map(|n| n.starts_with(".gnu.lto_") || n == ".llvm.lto").unwrap_or(false)
2222 }) {
2223 return Err(io::Error::new(
2224 io::ErrorKind::InvalidData,
2225 "LTO object in C static library is not supported",
2226 ));
2227 }
2228
2229 for symbol in object.symbols() {
2230 if symbol.scope() != object::SymbolScope::Dynamic {
2231 continue;
2232 }
2233
2234 let name = match symbol.name() {
2235 Ok(n) => n,
2236 Err(_) => continue,
2237 };
2238
2239 let export_kind = match symbol.kind() {
2240 object::SymbolKind::Text => SymbolExportKind::Text,
2241 object::SymbolKind::Data => SymbolExportKind::Data,
2242 _ => continue,
2243 };
2244
2245 // FIXME:The symbol mangle rules are slightly different in Windows(32-bit) and Apple.
2246 // Need to be resolved.
2247 out.push((name.to_string(), export_kind));
2248 }
2249 }
2250
2251 Ok(())
2252}
2253
21882254/// Produce the linker command line containing linker path and arguments.
21892255///
21902256/// When comments in the function say "order-(in)dependent" they mean order-dependence between
......@@ -2217,6 +2283,25 @@ fn linker_with_args(
22172283 );
22182284 let link_output_kind = link_output_kind(sess, crate_type);
22192285
2286 let mut export_symbols = codegen_results.crate_info.exported_symbols[&crate_type].clone();
2287
2288 if crate_type == CrateType::Cdylib {
2289 let mut seen = FxHashSet::default();
2290
2291 for lib in &codegen_results.crate_info.used_libraries {
2292 if let NativeLibKind::Static { export_symbols: Some(true), .. } = lib.kind
2293 && seen.insert((lib.name, lib.verbatim))
2294 {
2295 if let Err(err) = add_c_staticlib_symbols(&sess, lib, &mut export_symbols) {
2296 sess.dcx().fatal(format!(
2297 "failed to process C static library `{}`: {}",
2298 lib.name, err
2299 ));
2300 }
2301 }
2302 }
2303 }
2304
22202305 // ------------ Early order-dependent options ------------
22212306
22222307 // If we're building something like a dynamic library then some platforms
......@@ -2224,11 +2309,7 @@ fn linker_with_args(
22242309 // dynamic library.
22252310 // Must be passed before any libraries to prevent the symbols to export from being thrown away,
22262311 // at least on some platforms (e.g. windows-gnu).
2227 cmd.export_symbols(
2228 tmpdir,
2229 crate_type,
2230 &codegen_results.crate_info.exported_symbols[&crate_type],
2231 );
2312 cmd.export_symbols(tmpdir, crate_type, &export_symbols);
22322313
22332314 // Can be used for adding custom CRT objects or overriding order-dependent options above.
22342315 // FIXME: In practice built-in target specs use this for arbitrary order-independent options,
......@@ -2678,7 +2759,7 @@ fn add_native_libs_from_crate(
26782759 let name = lib.name.as_str();
26792760 let verbatim = lib.verbatim;
26802761 match lib.kind {
2681 NativeLibKind::Static { bundle, whole_archive } => {
2762 NativeLibKind::Static { bundle, whole_archive, .. } => {
26822763 if link_static {
26832764 let bundle = bundle.unwrap_or(true);
26842765 let whole_archive = whole_archive == Some(true);
compiler/rustc_codegen_ssa/src/traits/backend.rs-4
......@@ -37,10 +37,6 @@ pub trait BackendTypes {
3737}
3838
3939pub trait CodegenBackend {
40 /// Locale resources for diagnostic messages - a string the content of the Fluent resource.
41 /// Called before `init` so that all other functions are able to emit translatable diagnostics.
42 fn locale_resource(&self) -> &'static str;
43
4440 fn name(&self) -> &'static str;
4541
4642 fn init(&self, _sess: &Session) {}
compiler/rustc_driver_impl/Cargo.toml-3
......@@ -33,18 +33,15 @@ rustc_metadata = { path = "../rustc_metadata" }
3333rustc_middle = { path = "../rustc_middle" }
3434rustc_mir_build = { path = "../rustc_mir_build" }
3535rustc_mir_transform = { path = "../rustc_mir_transform" }
36rustc_monomorphize = { path = "../rustc_monomorphize" }
3736rustc_parse = { path = "../rustc_parse" }
3837rustc_passes = { path = "../rustc_passes" }
3938rustc_pattern_analysis = { path = "../rustc_pattern_analysis" }
40rustc_privacy = { path = "../rustc_privacy" }
4139rustc_public = { path = "../rustc_public", features = ["rustc_internal"] }
4240rustc_resolve = { path = "../rustc_resolve" }
4341rustc_session = { path = "../rustc_session" }
4442rustc_span = { path = "../rustc_span" }
4543rustc_target = { path = "../rustc_target" }
4644rustc_trait_selection = { path = "../rustc_trait_selection" }
47rustc_ty_utils = { path = "../rustc_ty_utils" }
4845serde_json = "1.0.59"
4946shlex = "1.0"
5047tracing = { version = "0.1.35" }
compiler/rustc_driver_impl/src/lib.rs-4
......@@ -129,15 +129,11 @@ pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[
129129 rustc_middle::DEFAULT_LOCALE_RESOURCE,
130130 rustc_mir_build::DEFAULT_LOCALE_RESOURCE,
131131 rustc_mir_transform::DEFAULT_LOCALE_RESOURCE,
132 rustc_monomorphize::DEFAULT_LOCALE_RESOURCE,
133132 rustc_parse::DEFAULT_LOCALE_RESOURCE,
134133 rustc_passes::DEFAULT_LOCALE_RESOURCE,
135134 rustc_pattern_analysis::DEFAULT_LOCALE_RESOURCE,
136 rustc_privacy::DEFAULT_LOCALE_RESOURCE,
137135 rustc_resolve::DEFAULT_LOCALE_RESOURCE,
138 rustc_session::DEFAULT_LOCALE_RESOURCE,
139136 rustc_trait_selection::DEFAULT_LOCALE_RESOURCE,
140 rustc_ty_utils::DEFAULT_LOCALE_RESOURCE,
141137 // tidy-alphabetical-end
142138];
143139
compiler/rustc_hir/src/attrs/data_structures.rs+4-2
......@@ -331,6 +331,8 @@ pub enum NativeLibKind {
331331 bundle: Option<bool>,
332332 /// Whether to link static library without throwing any object files away
333333 whole_archive: Option<bool>,
334 /// Whether to export c static library symbols
335 export_symbols: Option<bool>,
334336 },
335337 /// Dynamic library (e.g. `libfoo.so` on Linux)
336338 /// or an import library corresponding to a dynamic library (e.g. `foo.lib` on Windows/MSVC).
......@@ -363,8 +365,8 @@ pub enum NativeLibKind {
363365impl NativeLibKind {
364366 pub fn has_modifiers(&self) -> bool {
365367 match self {
366 NativeLibKind::Static { bundle, whole_archive } => {
367 bundle.is_some() || whole_archive.is_some()
368 NativeLibKind::Static { bundle, whole_archive, export_symbols } => {
369 bundle.is_some() || whole_archive.is_some() || export_symbols.is_some()
368370 }
369371 NativeLibKind::Dylib { as_needed }
370372 | NativeLibKind::Framework { as_needed }
compiler/rustc_interface/src/interface.rs+3-6
......@@ -55,7 +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![rustc_parse::DEFAULT_LOCALE_RESOURCE, rustc_session::DEFAULT_LOCALE_RESOURCE],
58 vec![rustc_parse::DEFAULT_LOCALE_RESOURCE],
5959 format!("this occurred on the command line: `--cfg={s}`"),
6060 );
6161 let filename = FileName::cfg_spec_source_code(&s);
......@@ -127,7 +127,7 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch
127127
128128 for s in specs {
129129 let psess = ParseSess::emitter_with_note(
130 vec![rustc_parse::DEFAULT_LOCALE_RESOURCE, rustc_session::DEFAULT_LOCALE_RESOURCE],
130 vec![rustc_parse::DEFAULT_LOCALE_RESOURCE],
131131 format!("this occurred on the command line: `--check-cfg={s}`"),
132132 );
133133 let filename = FileName::cfg_spec_source_code(&s);
......@@ -455,9 +455,6 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
455455 Err(e) => early_dcx.early_fatal(format!("failed to load fluent bundle: {e}")),
456456 };
457457
458 let mut locale_resources = config.locale_resources;
459 locale_resources.push(codegen_backend.locale_resource());
460
461458 let mut sess = rustc_session::build_session(
462459 config.opts,
463460 CompilerIO {
......@@ -468,7 +465,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
468465 },
469466 bundle,
470467 config.registry,
471 locale_resources,
468 config.locale_resources,
472469 config.lint_caps,
473470 target,
474471 util::rustc_version_str().unwrap_or("unknown"),
compiler/rustc_interface/src/tests.rs+9-9
......@@ -379,7 +379,7 @@ fn test_native_libs_tracking_hash_different_values() {
379379 NativeLib {
380380 name: String::from("a"),
381381 new_name: None,
382 kind: NativeLibKind::Static { bundle: None, whole_archive: None },
382 kind: NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None },
383383 verbatim: None,
384384 },
385385 NativeLib {
......@@ -401,7 +401,7 @@ fn test_native_libs_tracking_hash_different_values() {
401401 NativeLib {
402402 name: String::from("a"),
403403 new_name: None,
404 kind: NativeLibKind::Static { bundle: None, whole_archive: None },
404 kind: NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None },
405405 verbatim: None,
406406 },
407407 NativeLib {
......@@ -423,13 +423,13 @@ fn test_native_libs_tracking_hash_different_values() {
423423 NativeLib {
424424 name: String::from("a"),
425425 new_name: None,
426 kind: NativeLibKind::Static { bundle: None, whole_archive: None },
426 kind: NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None },
427427 verbatim: None,
428428 },
429429 NativeLib {
430430 name: String::from("b"),
431431 new_name: None,
432 kind: NativeLibKind::Static { bundle: None, whole_archive: None },
432 kind: NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None },
433433 verbatim: None,
434434 },
435435 NativeLib {
......@@ -445,7 +445,7 @@ fn test_native_libs_tracking_hash_different_values() {
445445 NativeLib {
446446 name: String::from("a"),
447447 new_name: None,
448 kind: NativeLibKind::Static { bundle: None, whole_archive: None },
448 kind: NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None },
449449 verbatim: None,
450450 },
451451 NativeLib {
......@@ -467,7 +467,7 @@ fn test_native_libs_tracking_hash_different_values() {
467467 NativeLib {
468468 name: String::from("a"),
469469 new_name: None,
470 kind: NativeLibKind::Static { bundle: None, whole_archive: None },
470 kind: NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None },
471471 verbatim: None,
472472 },
473473 NativeLib {
......@@ -501,7 +501,7 @@ fn test_native_libs_tracking_hash_different_order() {
501501 NativeLib {
502502 name: String::from("a"),
503503 new_name: None,
504 kind: NativeLibKind::Static { bundle: None, whole_archive: None },
504 kind: NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None },
505505 verbatim: None,
506506 },
507507 NativeLib {
......@@ -528,7 +528,7 @@ fn test_native_libs_tracking_hash_different_order() {
528528 NativeLib {
529529 name: String::from("a"),
530530 new_name: None,
531 kind: NativeLibKind::Static { bundle: None, whole_archive: None },
531 kind: NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None },
532532 verbatim: None,
533533 },
534534 NativeLib {
......@@ -549,7 +549,7 @@ fn test_native_libs_tracking_hash_different_order() {
549549 NativeLib {
550550 name: String::from("a"),
551551 new_name: None,
552 kind: NativeLibKind::Static { bundle: None, whole_archive: None },
552 kind: NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None },
553553 verbatim: None,
554554 },
555555 NativeLib {
compiler/rustc_interface/src/util.rs-4
......@@ -361,10 +361,6 @@ pub struct DummyCodegenBackend {
361361}
362362
363363impl CodegenBackend for DummyCodegenBackend {
364 fn locale_resource(&self) -> &'static str {
365 ""
366 }
367
368364 fn name(&self) -> &'static str {
369365 "dummy"
370366 }
compiler/rustc_lint/messages.ftl+12
......@@ -326,6 +326,14 @@ lint_expectation = this lint expectation is unfulfilled
326326 .note = the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message
327327 .rationale = {$rationale}
328328
329lint_expected_name_value =
330 expected this to be of the form `... = "..."`
331 .warn = {-lint_previously_accepted}
332
333lint_expected_no_args =
334 didn't expect any arguments here
335 .warn = {-lint_previously_accepted}
336
329337lint_for_loops_over_fallibles =
330338 for loop over {$article} `{$ref_prefix}{$ty}`. This is more readably written as an `if let` statement
331339 .suggestion = consider using `if let` to clear intent
......@@ -558,6 +566,10 @@ lint_macro_expr_fragment_specifier_2024_migration =
558566
559567lint_malformed_attribute = malformed lint attribute input
560568
569lint_malformed_doc =
570 malformed `doc` attribute input
571 .warn = {-lint_previously_accepted}
572
561573lint_map_unit_fn = `Iterator::map` call that discard the iterator's values
562574 .note = `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated
563575 .function_label = this function returns `()`, which is likely not what you wanted
compiler/rustc_lint/src/early/diagnostics.rs+6
......@@ -428,5 +428,11 @@ pub fn decorate_attribute_lint(
428428 sugg: suggested.map(|s| lints::UnknownCrateTypesSuggestion { span, snippet: s }),
429429 }
430430 .decorate_lint(diag),
431
432 &AttributeLintKind::MalformedDoc => lints::MalformedDoc.decorate_lint(diag),
433
434 &AttributeLintKind::ExpectedNoArgs => lints::ExpectedNoArgs.decorate_lint(diag),
435
436 &AttributeLintKind::ExpectedNameValue => lints::ExpectedNameValue.decorate_lint(diag),
431437 }
432438}
compiler/rustc_lint/src/lints.rs+15
......@@ -3185,6 +3185,21 @@ pub(crate) struct UnusedDuplicate {
31853185 pub warning: bool,
31863186}
31873187
3188#[derive(LintDiagnostic)]
3189#[diag(lint_malformed_doc)]
3190#[warning]
3191pub(crate) struct MalformedDoc;
3192
3193#[derive(LintDiagnostic)]
3194#[diag(lint_expected_no_args)]
3195#[warning]
3196pub(crate) struct ExpectedNoArgs;
3197
3198#[derive(LintDiagnostic)]
3199#[diag(lint_expected_name_value)]
3200#[warning]
3201pub(crate) struct ExpectedNameValue;
3202
31883203#[derive(LintDiagnostic)]
31893204#[diag(lint_unsafe_attr_outside_unsafe)]
31903205pub(crate) struct UnsafeAttrOutsideUnsafeLint {
compiler/rustc_lint_defs/src/builtin.rs+1-1
......@@ -3458,7 +3458,7 @@ declare_lint! {
34583458 /// but this lint was introduced to avoid breaking any existing
34593459 /// crates which included them.
34603460 pub INVALID_DOC_ATTRIBUTES,
3461 Deny,
3461 Warn,
34623462 "detects invalid `#[doc(...)]` attributes",
34633463}
34643464
compiler/rustc_lint_defs/src/lib.rs+3
......@@ -826,6 +826,9 @@ pub enum AttributeLintKind {
826826 span: Span,
827827 suggested: Option<Symbol>,
828828 },
829 MalformedDoc,
830 ExpectedNoArgs,
831 ExpectedNameValue,
829832}
830833
831834pub type RegisteredTools = FxIndexSet<Ident>;
compiler/rustc_metadata/src/native_libs.rs+1-1
......@@ -161,7 +161,7 @@ fn find_bundled_library(
161161 tcx: TyCtxt<'_>,
162162) -> Option<Symbol> {
163163 let sess = tcx.sess;
164 if let NativeLibKind::Static { bundle: Some(true) | None, whole_archive } = kind
164 if let NativeLibKind::Static { bundle: Some(true) | None, whole_archive, .. } = kind
165165 && tcx.crate_types().iter().any(|t| matches!(t, &CrateType::Rlib | CrateType::StaticLib))
166166 && (sess.opts.unstable_opts.packed_bundled_libs || has_cfg || whole_archive == Some(true))
167167 {
compiler/rustc_monomorphize/Cargo.toml-1
......@@ -8,7 +8,6 @@ edition = "2024"
88rustc_abi = { path = "../rustc_abi" }
99rustc_data_structures = { path = "../rustc_data_structures" }
1010rustc_errors = { path = "../rustc_errors" }
11rustc_fluent_macro = { path = "../rustc_fluent_macro" }
1211rustc_hir = { path = "../rustc_hir" }
1312rustc_index = { path = "../rustc_index" }
1413rustc_macros = { path = "../rustc_macros" }
compiler/rustc_monomorphize/messages.ftl deleted-82
......@@ -1,82 +0,0 @@
1monomorphize_abi_error_disabled_vector_type =
2 this function {$is_call ->
3 [true] call
4 *[false] definition
5 } uses {$is_scalable ->
6 [true] scalable
7 *[false] SIMD
8 } vector type `{$ty}` which (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled{$is_call ->
9 [true] {" "}in the caller
10 *[false] {""}
11 }
12 .label = function {$is_call ->
13 [true] called
14 *[false] defined
15 } here
16 .help = consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable="{$required_feature}")]`)
17
18monomorphize_abi_error_unsupported_unsized_parameter =
19 this function {$is_call ->
20 [true] call
21 *[false] definition
22 } uses unsized type `{$ty}` which is not supported with the chosen ABI
23 .label = function {$is_call ->
24 [true] called
25 *[false] defined
26 } here
27 .help = only rustic ABIs support unsized parameters
28
29monomorphize_abi_error_unsupported_vector_type =
30 this function {$is_call ->
31 [true] call
32 *[false] definition
33 } uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI
34 .label = function {$is_call ->
35 [true] called
36 *[false] defined
37 } here
38
39monomorphize_abi_required_target_feature =
40 this function {$is_call ->
41 [true] call
42 *[false] definition
43 } uses ABI "{$abi}" which requires the `{$required_feature}` target feature, which is not enabled{$is_call ->
44 [true] {" "}in the caller
45 *[false] {""}
46 }
47 .label = function {$is_call ->
48 [true] called
49 *[false] defined
50 } here
51 .help = consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable="{$required_feature}")]`)
52
53monomorphize_couldnt_dump_mono_stats =
54 unexpected error occurred while dumping monomorphization stats: {$error}
55
56monomorphize_encountered_error_while_instantiating =
57 the above error was encountered while instantiating `{$kind} {$instance}`
58
59monomorphize_encountered_error_while_instantiating_global_asm =
60 the above error was encountered while instantiating `global_asm`
61
62monomorphize_large_assignments =
63 moving {$size} bytes
64 .label = value moved from here
65 .note = the current maximum size is {$limit}, but it can be customized with the move_size_limit attribute: `#![move_size_limit = "..."]`
66
67monomorphize_no_optimized_mir =
68 missing optimized MIR for `{$instance}` in the crate `{$crate_name}`
69 .note = missing optimized MIR for this item (was the crate `{$crate_name}` compiled with `--emit=metadata`?)
70
71monomorphize_recursion_limit =
72 reached the recursion limit while instantiating `{$instance}`
73 .note = `{$def_path_str}` defined here
74
75monomorphize_start_not_found = using `fn main` requires the standard library
76 .help = use `#![no_main]` to bypass the Rust generated entrypoint and declare a platform specific entrypoint yourself, usually with `#[no_mangle]`
77
78monomorphize_static_initializer_cyclic = static initializer forms a cycle involving `{$head}`
79 .label = part of this cycle
80 .note = cyclic static initializers are not supported for target `{$target}`
81
82monomorphize_symbol_already_defined = symbol `{$symbol}` is already defined
compiler/rustc_monomorphize/src/errors.rs+82-27
......@@ -3,37 +3,41 @@ use rustc_middle::ty::{Instance, Ty};
33use rustc_span::{Span, Symbol};
44
55#[derive(Diagnostic)]
6#[diag(monomorphize_recursion_limit)]
6#[diag("reached the recursion limit while instantiating `{$instance}`")]
77pub(crate) struct RecursionLimit<'tcx> {
88 #[primary_span]
99 pub span: Span,
1010 pub instance: Instance<'tcx>,
11 #[note]
11 #[note("`{$def_path_str}` defined here")]
1212 pub def_span: Span,
1313 pub def_path_str: String,
1414}
1515
1616#[derive(Diagnostic)]
17#[diag(monomorphize_no_optimized_mir)]
17#[diag("missing optimized MIR for `{$instance}` in the crate `{$crate_name}`")]
1818pub(crate) struct NoOptimizedMir {
19 #[note]
19 #[note(
20 "missing optimized MIR for this item (was the crate `{$crate_name}` compiled with `--emit=metadata`?)"
21 )]
2022 pub span: Span,
2123 pub crate_name: Symbol,
2224 pub instance: String,
2325}
2426
2527#[derive(LintDiagnostic)]
26#[diag(monomorphize_large_assignments)]
27#[note]
28#[diag("moving {$size} bytes")]
29#[note(
30 "the current maximum size is {$limit}, but it can be customized with the move_size_limit attribute: `#![move_size_limit = \"...\"]`"
31)]
2832pub(crate) struct LargeAssignmentsLint {
29 #[label]
33 #[label("value moved from here")]
3034 pub span: Span,
3135 pub size: u64,
3236 pub limit: u64,
3337}
3438
3539#[derive(Diagnostic)]
36#[diag(monomorphize_symbol_already_defined)]
40#[diag("symbol `{$symbol}` is already defined")]
3741pub(crate) struct SymbolAlreadyDefined {
3842 #[primary_span]
3943 pub span: Option<Span>,
......@@ -41,13 +45,13 @@ pub(crate) struct SymbolAlreadyDefined {
4145}
4246
4347#[derive(Diagnostic)]
44#[diag(monomorphize_couldnt_dump_mono_stats)]
48#[diag("unexpected error occurred while dumping monomorphization stats: {$error}")]
4549pub(crate) struct CouldntDumpMonoStats {
4650 pub error: String,
4751}
4852
4953#[derive(Diagnostic)]
50#[diag(monomorphize_encountered_error_while_instantiating)]
54#[diag("the above error was encountered while instantiating `{$kind} {$instance}`")]
5155pub(crate) struct EncounteredErrorWhileInstantiating<'tcx> {
5256 #[primary_span]
5357 pub span: Span,
......@@ -56,23 +60,41 @@ pub(crate) struct EncounteredErrorWhileInstantiating<'tcx> {
5660}
5761
5862#[derive(Diagnostic)]
59#[diag(monomorphize_encountered_error_while_instantiating_global_asm)]
63#[diag("the above error was encountered while instantiating `global_asm`")]
6064pub(crate) struct EncounteredErrorWhileInstantiatingGlobalAsm {
6165 #[primary_span]
6266 pub span: Span,
6367}
6468
6569#[derive(Diagnostic)]
66#[diag(monomorphize_start_not_found)]
67#[help]
70#[diag("using `fn main` requires the standard library")]
71#[help(
72 "use `#![no_main]` to bypass the Rust generated entrypoint and declare a platform specific entrypoint yourself, usually with `#[no_mangle]`"
73)]
6874pub(crate) struct StartNotFound;
6975
7076#[derive(Diagnostic)]
71#[diag(monomorphize_abi_error_disabled_vector_type)]
72#[help]
77#[diag("this function {$is_call ->
78 [true] call
79 *[false] definition
80} uses {$is_scalable ->
81 [true] scalable
82 *[false] SIMD
83} vector type `{$ty}` which (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled{$is_call ->
84 [true] {\" \"}in the caller
85 *[false] {\"\"}
86}")]
87#[help(
88 "consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)"
89)]
7390pub(crate) struct AbiErrorDisabledVectorType<'a> {
7491 #[primary_span]
75 #[label]
92 #[label(
93 "function {$is_call ->
94 [true] called
95 *[false] defined
96 } here"
97 )]
7698 pub span: Span,
7799 pub required_feature: &'a str,
78100 pub ty: Ty<'a>,
......@@ -83,11 +105,21 @@ pub(crate) struct AbiErrorDisabledVectorType<'a> {
83105}
84106
85107#[derive(Diagnostic)]
86#[diag(monomorphize_abi_error_unsupported_unsized_parameter)]
87#[help]
108#[diag(
109 "this function {$is_call ->
110 [true] call
111 *[false] definition
112 } uses unsized type `{$ty}` which is not supported with the chosen ABI"
113)]
114#[help("only rustic ABIs support unsized parameters")]
88115pub(crate) struct AbiErrorUnsupportedUnsizedParameter<'a> {
89116 #[primary_span]
90 #[label]
117 #[label(
118 "function {$is_call ->
119 [true] called
120 *[false] defined
121 } here"
122 )]
91123 pub span: Span,
92124 pub ty: Ty<'a>,
93125 /// Whether this is a problem at a call site or at a declaration.
......@@ -95,10 +127,20 @@ pub(crate) struct AbiErrorUnsupportedUnsizedParameter<'a> {
95127}
96128
97129#[derive(Diagnostic)]
98#[diag(monomorphize_abi_error_unsupported_vector_type)]
130#[diag(
131 "this function {$is_call ->
132 [true] call
133 *[false] definition
134 } uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI"
135)]
99136pub(crate) struct AbiErrorUnsupportedVectorType<'a> {
100137 #[primary_span]
101 #[label]
138 #[label(
139 "function {$is_call ->
140 [true] called
141 *[false] defined
142 } here"
143 )]
102144 pub span: Span,
103145 pub ty: Ty<'a>,
104146 /// Whether this is a problem at a call site or at a declaration.
......@@ -106,11 +148,24 @@ pub(crate) struct AbiErrorUnsupportedVectorType<'a> {
106148}
107149
108150#[derive(Diagnostic)]
109#[diag(monomorphize_abi_required_target_feature)]
110#[help]
151#[diag("this function {$is_call ->
152 [true] call
153 *[false] definition
154} uses ABI \"{$abi}\" which requires the `{$required_feature}` target feature, which is not enabled{$is_call ->
155 [true] {\" \"}in the caller
156 *[false] {\"\"}
157}")]
158#[help(
159 "consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)"
160)]
111161pub(crate) struct AbiRequiredTargetFeature<'a> {
112162 #[primary_span]
113 #[label]
163 #[label(
164 "function {$is_call ->
165[true] called
166*[false] defined
167} here"
168 )]
114169 pub span: Span,
115170 pub required_feature: &'a str,
116171 pub abi: &'a str,
......@@ -119,12 +174,12 @@ pub(crate) struct AbiRequiredTargetFeature<'a> {
119174}
120175
121176#[derive(Diagnostic)]
122#[diag(monomorphize_static_initializer_cyclic)]
123#[note]
177#[diag("static initializer forms a cycle involving `{$head}`")]
178#[note("cyclic static initializers are not supported for target `{$target}`")]
124179pub(crate) struct StaticInitializerCyclic<'a> {
125180 #[primary_span]
126181 pub span: Span,
127 #[label]
182 #[label("part of this cycle")]
128183 pub labels: Vec<Span>,
129184 pub head: &'a str,
130185 pub target: &'a str,
compiler/rustc_monomorphize/src/lib.rs-2
......@@ -20,8 +20,6 @@ mod mono_checks;
2020mod partitioning;
2121mod util;
2222
23rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
24
2523fn custom_coerce_unsize_info<'tcx>(
2624 tcx: TyCtxtAt<'tcx>,
2725 source_ty: Ty<'tcx>,
compiler/rustc_privacy/Cargo.toml-1
......@@ -8,7 +8,6 @@ edition = "2024"
88rustc_ast = { path = "../rustc_ast" }
99rustc_data_structures = { path = "../rustc_data_structures" }
1010rustc_errors = { path = "../rustc_errors" }
11rustc_fluent_macro = { path = "../rustc_fluent_macro" }
1211rustc_hir = { path = "../rustc_hir" }
1312rustc_macros = { path = "../rustc_macros" }
1413rustc_middle = { path = "../rustc_middle" }
compiler/rustc_privacy/messages.ftl deleted-39
......@@ -1,39 +0,0 @@
1privacy_field_is_private =
2 {$len ->
3 [1] field
4 *[other] fields
5 } {$field_names} of {$variant_descr} `{$def_path_str}` {$len ->
6 [1] is
7 *[other] are
8 } private
9 .label = in this type
10privacy_field_is_private_is_update_syntax_label = {$rest_len ->
11 [1] field
12 *[other] fields
13 } {$rest_field_names} {$rest_len ->
14 [1] is
15 *[other] are
16 } private
17privacy_field_is_private_label = private field
18
19privacy_from_private_dep_in_public_interface =
20 {$kind} `{$descr}` from private dependency '{$krate}' in public interface
21
22privacy_in_public_interface = {$vis_descr} {$kind} `{$descr}` in public interface
23 .label = can't leak {$vis_descr} {$kind}
24 .visibility_label = `{$descr}` declared as {$vis_descr}
25
26privacy_item_is_private = {$kind} `{$descr}` is private
27 .label = private {$kind}
28
29privacy_private_interface_or_bounds_lint = {$ty_kind} `{$ty_descr}` is more private than the item `{$item_descr}`
30 .item_label = {$item_kind} `{$item_descr}` is reachable at visibility `{$item_vis_descr}`
31 .ty_note = but {$ty_kind} `{$ty_descr}` is only usable at visibility `{$ty_vis_descr}`
32
33privacy_report_effective_visibility = {$descr}
34
35privacy_unnameable_types_lint = {$kind} `{$descr}` is reachable but cannot be named
36 .label = reachable at visibility `{$reachable_vis}`, but can only be named at visibility `{$reexported_vis}`
37
38privacy_unnamed_item_is_private = {$kind} is private
39 .label = private {$kind}
compiler/rustc_privacy/src/errors.rs+33-17
......@@ -4,11 +4,17 @@ use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
44use rustc_span::{Span, Symbol};
55
66#[derive(Diagnostic)]
7#[diag(privacy_field_is_private, code = E0451)]
7#[diag("{$len ->
8 [1] field
9 *[other] fields
10} {$field_names} of {$variant_descr} `{$def_path_str}` {$len ->
11 [1] is
12 *[other] are
13} private", code = E0451)]
814pub(crate) struct FieldIsPrivate {
915 #[primary_span]
1016 pub span: MultiSpan,
11 #[label]
17 #[label("in this type")]
1218 pub struct_span: Option<Span>,
1319 pub field_names: String,
1420 pub variant_descr: &'static str,
......@@ -20,14 +26,22 @@ pub(crate) struct FieldIsPrivate {
2026
2127#[derive(Subdiagnostic)]
2228pub(crate) enum FieldIsPrivateLabel {
23 #[label(privacy_field_is_private_is_update_syntax_label)]
29 #[label(
30 "{$rest_len ->
31 [1] field
32 *[other] fields
33 } {$rest_field_names} {$rest_len ->
34 [1] is
35 *[other] are
36 } private"
37 )]
2438 IsUpdateSyntax {
2539 #[primary_span]
2640 span: Span,
2741 rest_field_names: String,
2842 rest_len: usize,
2943 },
30 #[label(privacy_field_is_private_label)]
44 #[label("private field")]
3145 Other {
3246 #[primary_span]
3347 span: Span,
......@@ -35,17 +49,17 @@ pub(crate) enum FieldIsPrivateLabel {
3549}
3650
3751#[derive(Diagnostic)]
38#[diag(privacy_item_is_private)]
52#[diag("{$kind} `{$descr}` is private")]
3953pub(crate) struct ItemIsPrivate<'a> {
4054 #[primary_span]
41 #[label]
55 #[label("private {$kind}")]
4256 pub span: Span,
4357 pub kind: &'a str,
4458 pub descr: DiagArgFromDisplay<'a>,
4559}
4660
4761#[derive(Diagnostic)]
48#[diag(privacy_unnamed_item_is_private)]
62#[diag("{$kind} is private")]
4963pub(crate) struct UnnamedItemIsPrivate {
5064 #[primary_span]
5165 pub span: Span,
......@@ -53,20 +67,20 @@ pub(crate) struct UnnamedItemIsPrivate {
5367}
5468
5569#[derive(Diagnostic)]
56#[diag(privacy_in_public_interface, code = E0446)]
70#[diag("{$vis_descr} {$kind} `{$descr}` in public interface", code = E0446)]
5771pub(crate) struct InPublicInterface<'a> {
5872 #[primary_span]
59 #[label]
73 #[label("can't leak {$vis_descr} {$kind}")]
6074 pub span: Span,
6175 pub vis_descr: &'static str,
6276 pub kind: &'a str,
6377 pub descr: DiagArgFromDisplay<'a>,
64 #[label(privacy_visibility_label)]
78 #[label("`{$descr}` declared as {$vis_descr}")]
6579 pub vis_span: Span,
6680}
6781
6882#[derive(Diagnostic)]
69#[diag(privacy_report_effective_visibility)]
83#[diag("{$descr}")]
7084pub(crate) struct ReportEffectiveVisibility {
7185 #[primary_span]
7286 pub span: Span,
......@@ -74,7 +88,7 @@ pub(crate) struct ReportEffectiveVisibility {
7488}
7589
7690#[derive(LintDiagnostic)]
77#[diag(privacy_from_private_dep_in_public_interface)]
91#[diag("{$kind} `{$descr}` from private dependency '{$krate}' in public interface")]
7892pub(crate) struct FromPrivateDependencyInPublicInterface<'a> {
7993 pub kind: &'a str,
8094 pub descr: DiagArgFromDisplay<'a>,
......@@ -82,9 +96,11 @@ pub(crate) struct FromPrivateDependencyInPublicInterface<'a> {
8296}
8397
8498#[derive(LintDiagnostic)]
85#[diag(privacy_unnameable_types_lint)]
99#[diag("{$kind} `{$descr}` is reachable but cannot be named")]
86100pub(crate) struct UnnameableTypesLint<'a> {
87 #[label]
101 #[label(
102 "reachable at visibility `{$reachable_vis}`, but can only be named at visibility `{$reexported_vis}`"
103 )]
88104 pub span: Span,
89105 pub kind: &'a str,
90106 pub descr: DiagArgFromDisplay<'a>,
......@@ -96,14 +112,14 @@ pub(crate) struct UnnameableTypesLint<'a> {
96112// They will replace private-in-public errors and compatibility lints in future.
97113// See https://rust-lang.github.io/rfcs/2145-type-privacy.html for more details.
98114#[derive(LintDiagnostic)]
99#[diag(privacy_private_interface_or_bounds_lint)]
115#[diag("{$ty_kind} `{$ty_descr}` is more private than the item `{$item_descr}`")]
100116pub(crate) struct PrivateInterfacesOrBoundsLint<'a> {
101 #[label(privacy_item_label)]
117 #[label("{$item_kind} `{$item_descr}` is reachable at visibility `{$item_vis_descr}`")]
102118 pub item_span: Span,
103119 pub item_kind: &'a str,
104120 pub item_descr: DiagArgFromDisplay<'a>,
105121 pub item_vis_descr: &'a str,
106 #[note(privacy_ty_note)]
122 #[note("but {$ty_kind} `{$ty_descr}` is only usable at visibility `{$ty_vis_descr}`")]
107123 pub ty_span: Span,
108124 pub ty_kind: &'a str,
109125 pub ty_descr: DiagArgFromDisplay<'a>,
compiler/rustc_privacy/src/lib.rs-2
......@@ -39,8 +39,6 @@ use rustc_span::hygiene::Transparency;
3939use rustc_span::{Ident, Span, Symbol, sym};
4040use tracing::debug;
4141
42rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
43
4442////////////////////////////////////////////////////////////////////////////////
4543// Generic infrastructure used to implement specific visitors below.
4644////////////////////////////////////////////////////////////////////////////////
compiler/rustc_session/Cargo.toml-1
......@@ -12,7 +12,6 @@ rustc_ast = { path = "../rustc_ast" }
1212rustc_data_structures = { path = "../rustc_data_structures" }
1313rustc_errors = { path = "../rustc_errors" }
1414rustc_feature = { path = "../rustc_feature" }
15rustc_fluent_macro = { path = "../rustc_fluent_macro" }
1615rustc_fs_util = { path = "../rustc_fs_util" }
1716rustc_hashes = { path = "../rustc_hashes" }
1817rustc_hir = { path = "../rustc_hir" }
compiler/rustc_session/messages.ftl deleted-149
......@@ -1,149 +0,0 @@
1session_apple_deployment_target_invalid =
2 failed to parse deployment target specified in {$env_var}: {$error}
3
4session_apple_deployment_target_too_low =
5 deployment target in {$env_var} was set to {$version}, but the minimum supported by `rustc` is {$os_min}
6
7session_binary_float_literal_not_supported = binary float literal is not supported
8session_branch_protection_requires_aarch64 = `-Zbranch-protection` is only supported on aarch64
9
10session_cannot_enable_crt_static_linux = sanitizer is incompatible with statically linked libc, disable it using `-C target-feature=-crt-static`
11
12session_cannot_mix_and_match_sanitizers = `-Zsanitizer={$first}` is incompatible with `-Zsanitizer={$second}`
13
14session_cli_feature_diagnostic_help =
15 add `-Zcrate-attr="feature({$feature})"` to the command-line options to enable
16
17session_crate_name_empty = crate name must not be empty
18
19session_embed_source_insufficient_dwarf_version = `-Zembed-source=y` requires at least `-Z dwarf-version=5` but DWARF version is {$dwarf_version}
20
21session_embed_source_requires_debug_info = `-Zembed-source=y` requires debug information to be enabled
22
23session_expr_parentheses_needed = parentheses are required to parse this as an expression
24
25session_failed_to_create_profiler = failed to create profiler: {$err}
26
27session_feature_diagnostic_for_issue =
28 see issue #{$n} <https://github.com/rust-lang/rust/issues/{$n}> for more information
29
30session_feature_diagnostic_help =
31 add `#![feature({$feature})]` to the crate attributes to enable
32
33session_feature_diagnostic_suggestion =
34 add `#![feature({$feature})]` to the crate attributes to enable
35
36session_feature_suggest_upgrade_compiler =
37 this compiler was built on {$date}; consider upgrading it if it is out of date
38
39session_file_is_not_writeable = output file {$file} is not writeable -- check its permissions
40
41session_file_write_fail = failed to write `{$path}` due to error `{$err}`
42
43session_function_return_requires_x86_or_x86_64 = `-Zfunction-return` (except `keep`) is only supported on x86 and x86_64
44
45session_function_return_thunk_extern_requires_non_large_code_model = `-Zfunction-return=thunk-extern` is only supported on non-large code models
46
47session_hexadecimal_float_literal_not_supported = hexadecimal float literal is not supported
48
49session_incompatible_linker_flavor = linker flavor `{$flavor}` is incompatible with the current target
50 .note = compatible flavors are: {$compatible_list}
51
52session_indirect_branch_cs_prefix_requires_x86_or_x86_64 = `-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64
53
54session_instrumentation_not_supported = {$us} instrumentation is not supported for this target
55
56session_int_literal_too_large = integer literal is too large
57 .note = value exceeds limit of `{$limit}`
58
59session_invalid_character_in_crate_name = invalid character {$character} in crate name: `{$crate_name}`
60
61session_invalid_float_literal_suffix = invalid suffix `{$suffix}` for float literal
62 .label = invalid suffix `{$suffix}`
63 .help = valid suffixes are `f32` and `f64`
64
65session_invalid_float_literal_width = invalid width `{$width}` for float literal
66 .help = valid widths are 32 and 64
67
68session_invalid_int_literal_width = invalid width `{$width}` for integer literal
69 .help = valid widths are 8, 16, 32, 64 and 128
70
71session_invalid_literal_suffix = suffixes on {$kind} literals are invalid
72 .label = invalid suffix `{$suffix}`
73
74session_invalid_num_literal_base_prefix = invalid base prefix for number literal
75 .note = base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase
76 .suggestion = try making the prefix lowercase
77
78session_invalid_num_literal_suffix = invalid suffix `{$suffix}` for number literal
79 .label = invalid suffix `{$suffix}`
80 .help = the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)
81
82session_linker_plugin_lto_windows_not_supported = linker plugin based LTO is not supported together with `-C prefer-dynamic` when targeting Windows-like targets
83
84session_must_be_name_of_associated_function = must be a name of an associated function
85
86session_not_circumvent_feature = `-Zunleash-the-miri-inside-of-you` may not be used to circumvent feature gates, except when testing error paths in the CTFE engine
87
88session_not_supported = not supported
89
90session_octal_float_literal_not_supported = octal float literal is not supported
91
92session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C profile-sample-use` does not exist
93
94session_profile_use_file_does_not_exist = file `{$path}` passed to `-C profile-use` does not exist
95
96session_sanitizer_cfi_canonical_jump_tables_requires_cfi = `-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`
97
98session_sanitizer_cfi_generalize_pointers_requires_cfi = `-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`
99
100session_sanitizer_cfi_normalize_integers_requires_cfi = `-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`
101
102session_sanitizer_cfi_requires_lto = `-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`
103
104session_sanitizer_cfi_requires_single_codegen_unit = `-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`
105
106session_sanitizer_kcfi_arity_requires_kcfi = `-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi`
107
108session_sanitizer_kcfi_requires_panic_abort = `-Z sanitizer=kcfi` requires `-C panic=abort`
109
110session_sanitizer_not_supported = {$us} sanitizer is not supported for this target
111
112session_sanitizers_not_supported = {$us} sanitizers are not supported for this target
113
114session_skipping_const_checks = skipping const checks
115
116session_soft_float_deprecated =
117 `-Csoft-float` is unsound and deprecated; use a corresponding *eabi target instead
118 .note = it will be removed or ignored in a future version of Rust
119session_soft_float_deprecated_issue = see issue #129893 <https://github.com/rust-lang/rust/issues/129893> for more information
120
121session_soft_float_ignored =
122 `-Csoft-float` is ignored on this target; it only has an effect on *eabihf targets
123 .note = this may become a hard error in a future version of Rust
124
125session_split_debuginfo_unstable_platform = `-Csplit-debuginfo={$debuginfo}` is unstable on this platform
126
127session_split_lto_unit_requires_lto = `-Zsplit-lto-unit` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`
128
129session_target_requires_unwind_tables = target requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`
130
131session_target_small_data_threshold_not_supported = `-Z small-data-threshold` is not supported for target {$target_triple} and will be ignored
132
133session_target_stack_protector_not_supported = `-Z stack-protector={$stack_protector}` is not supported for target {$target_triple} and will be ignored
134
135session_unexpected_builtin_cfg = unexpected `--cfg {$cfg}` flag
136 .controlled_by = config `{$cfg_name}` is only supposed to be controlled by `{$controlled_by}`
137 .incoherent = manually setting a built-in cfg can and does create incoherent behaviors
138
139session_unleashed_feature_help_named = skipping check for `{$gate}` feature
140session_unleashed_feature_help_unnamed = skipping check that does not even have a feature gate
141
142session_unstable_virtual_function_elimination = `-Zvirtual-function-elimination` requires `-Clto`
143
144session_unsupported_dwarf_version = requested DWARF version {$dwarf_version} is not supported
145session_unsupported_dwarf_version_help = supported DWARF versions are 2, 3, 4 and 5
146
147session_unsupported_reg_struct_return_arch = `-Zreg-struct-return` is only supported on x86
148session_unsupported_regparm = `-Zregparm={$regparm}` is unsupported (valid values 0-3)
149session_unsupported_regparm_arch = `-Zregparm=N` is only supported on x86
compiler/rustc_session/src/config/native_libs.rs+12-3
......@@ -53,7 +53,9 @@ fn parse_native_lib(cx: &ParseNativeLibCx<'_>, value: &str) -> NativeLib {
5353 let NativeLibParts { kind, modifiers, name, new_name } = split_native_lib_value(value);
5454
5555 let kind = kind.map_or(NativeLibKind::Unspecified, |kind| match kind {
56 "static" => NativeLibKind::Static { bundle: None, whole_archive: None },
56 "static" => {
57 NativeLibKind::Static { bundle: None, whole_archive: None, export_symbols: None }
58 }
5759 "dylib" => NativeLibKind::Dylib { as_needed: None },
5860 "framework" => NativeLibKind::Framework { as_needed: None },
5961 "link-arg" => {
......@@ -105,7 +107,7 @@ fn parse_and_apply_modifier(cx: &ParseNativeLibCx<'_>, modifier: &str, native_li
105107 Some(("-", m)) => (m, false),
106108 _ => cx.early_dcx.early_fatal(
107109 "invalid linking modifier syntax, expected '+' or '-' prefix \
108 before one of: bundle, verbatim, whole-archive, as-needed",
110 before one of: bundle, verbatim, whole-archive, as-needed, export-symbols",
109111 ),
110112 };
111113
......@@ -125,6 +127,13 @@ fn parse_and_apply_modifier(cx: &ParseNativeLibCx<'_>, modifier: &str, native_li
125127 ("bundle", _) => early_dcx
126128 .early_fatal("linking modifier `bundle` is only compatible with `static` linking kind"),
127129
130 ("export-symbols", NativeLibKind::Static { export_symbols, .. }) => {
131 assign_modifier(export_symbols)
132 }
133 ("export-symbols", _) => early_dcx.early_fatal(
134 "linking modifier `export-symbols` is only compatible with `static` linking kind",
135 ),
136
128137 ("verbatim", _) => assign_modifier(&mut native_lib.verbatim),
129138
130139 ("whole-archive", NativeLibKind::Static { whole_archive, .. }) => {
......@@ -151,7 +160,7 @@ fn parse_and_apply_modifier(cx: &ParseNativeLibCx<'_>, modifier: &str, native_li
151160
152161 _ => early_dcx.early_fatal(format!(
153162 "unknown linking modifier `{modifier}`, expected one \
154 of: bundle, verbatim, whole-archive, as-needed"
163 of: bundle, verbatim, whole-archive, as-needed, export-symbols"
155164 )),
156165 }
157166}
compiler/rustc_session/src/errors.rs+104-83
......@@ -15,9 +15,11 @@ use crate::parse::ParseSess;
1515
1616#[derive(Diagnostic)]
1717pub(crate) enum AppleDeploymentTarget {
18 #[diag(session_apple_deployment_target_invalid)]
18 #[diag("failed to parse deployment target specified in {$env_var}: {$error}")]
1919 Invalid { env_var: &'static str, error: ParseIntError },
20 #[diag(session_apple_deployment_target_too_low)]
20 #[diag(
21 "deployment target in {$env_var} was set to {$version}, but the minimum supported by `rustc` is {$os_min}"
22 )]
2123 TooLow { env_var: &'static str, version: String, os_min: String },
2224}
2325
......@@ -34,13 +36,13 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for FeatureGateError {
3436}
3537
3638#[derive(Subdiagnostic)]
37#[note(session_feature_diagnostic_for_issue)]
39#[note("see issue #{$n} <https://github.com/rust-lang/rust/issues/{$n}> for more information")]
3840pub(crate) struct FeatureDiagnosticForIssue {
3941 pub(crate) n: NonZero<u32>,
4042}
4143
4244#[derive(Subdiagnostic)]
43#[note(session_feature_suggest_upgrade_compiler)]
45#[note("this compiler was built on {$date}; consider upgrading it if it is out of date")]
4446pub(crate) struct SuggestUpgradeCompiler {
4547 date: &'static str,
4648}
......@@ -58,14 +60,14 @@ impl SuggestUpgradeCompiler {
5860}
5961
6062#[derive(Subdiagnostic)]
61#[help(session_feature_diagnostic_help)]
63#[help("add `#![feature({$feature})]` to the crate attributes to enable")]
6264pub(crate) struct FeatureDiagnosticHelp {
6365 pub(crate) feature: Symbol,
6466}
6567
6668#[derive(Subdiagnostic)]
6769#[suggestion(
68 session_feature_diagnostic_suggestion,
70 "add `#![feature({$feature})]` to the crate attributes to enable",
6971 applicability = "maybe-incorrect",
7072 code = "#![feature({feature})]\n"
7173)]
......@@ -76,169 +78,181 @@ pub struct FeatureDiagnosticSuggestion {
7678}
7779
7880#[derive(Subdiagnostic)]
79#[help(session_cli_feature_diagnostic_help)]
81#[help("add `-Zcrate-attr=\"feature({$feature})\"` to the command-line options to enable")]
8082pub(crate) struct CliFeatureDiagnosticHelp {
8183 pub(crate) feature: Symbol,
8284}
8385
8486#[derive(Diagnostic)]
85#[diag(session_must_be_name_of_associated_function)]
87#[diag("must be a name of an associated function")]
8688pub struct MustBeNameOfAssociatedFunction {
8789 #[primary_span]
8890 pub span: Span,
8991}
9092
9193#[derive(Diagnostic)]
92#[diag(session_not_circumvent_feature)]
94#[diag(
95 "`-Zunleash-the-miri-inside-of-you` may not be used to circumvent feature gates, except when testing error paths in the CTFE engine"
96)]
9397pub(crate) struct NotCircumventFeature;
9498
9599#[derive(Diagnostic)]
96#[diag(session_linker_plugin_lto_windows_not_supported)]
100#[diag(
101 "linker plugin based LTO is not supported together with `-C prefer-dynamic` when targeting Windows-like targets"
102)]
97103pub(crate) struct LinkerPluginToWindowsNotSupported;
98104
99105#[derive(Diagnostic)]
100#[diag(session_profile_use_file_does_not_exist)]
106#[diag("file `{$path}` passed to `-C profile-use` does not exist")]
101107pub(crate) struct ProfileUseFileDoesNotExist<'a> {
102108 pub(crate) path: &'a std::path::Path,
103109}
104110
105111#[derive(Diagnostic)]
106#[diag(session_profile_sample_use_file_does_not_exist)]
112#[diag("file `{$path}` passed to `-C profile-sample-use` does not exist")]
107113pub(crate) struct ProfileSampleUseFileDoesNotExist<'a> {
108114 pub(crate) path: &'a std::path::Path,
109115}
110116
111117#[derive(Diagnostic)]
112#[diag(session_target_requires_unwind_tables)]
118#[diag("target requires unwind tables, they cannot be disabled with `-C force-unwind-tables=no`")]
113119pub(crate) struct TargetRequiresUnwindTables;
114120
115121#[derive(Diagnostic)]
116#[diag(session_instrumentation_not_supported)]
122#[diag("{$us} instrumentation is not supported for this target")]
117123pub(crate) struct InstrumentationNotSupported {
118124 pub(crate) us: String,
119125}
120126
121127#[derive(Diagnostic)]
122#[diag(session_sanitizer_not_supported)]
128#[diag("{$us} sanitizer is not supported for this target")]
123129pub(crate) struct SanitizerNotSupported {
124130 pub(crate) us: String,
125131}
126132
127133#[derive(Diagnostic)]
128#[diag(session_sanitizers_not_supported)]
134#[diag("{$us} sanitizers are not supported for this target")]
129135pub(crate) struct SanitizersNotSupported {
130136 pub(crate) us: String,
131137}
132138
133139#[derive(Diagnostic)]
134#[diag(session_cannot_mix_and_match_sanitizers)]
140#[diag("`-Zsanitizer={$first}` is incompatible with `-Zsanitizer={$second}`")]
135141pub(crate) struct CannotMixAndMatchSanitizers {
136142 pub(crate) first: String,
137143 pub(crate) second: String,
138144}
139145
140146#[derive(Diagnostic)]
141#[diag(session_cannot_enable_crt_static_linux)]
147#[diag(
148 "sanitizer is incompatible with statically linked libc, disable it using `-C target-feature=-crt-static`"
149)]
142150pub(crate) struct CannotEnableCrtStaticLinux;
143151
144152#[derive(Diagnostic)]
145#[diag(session_sanitizer_cfi_requires_lto)]
153#[diag("`-Zsanitizer=cfi` requires `-Clto` or `-Clinker-plugin-lto`")]
146154pub(crate) struct SanitizerCfiRequiresLto;
147155
148156#[derive(Diagnostic)]
149#[diag(session_sanitizer_cfi_requires_single_codegen_unit)]
157#[diag("`-Zsanitizer=cfi` with `-Clto` requires `-Ccodegen-units=1`")]
150158pub(crate) struct SanitizerCfiRequiresSingleCodegenUnit;
151159
152160#[derive(Diagnostic)]
153#[diag(session_sanitizer_cfi_canonical_jump_tables_requires_cfi)]
161#[diag("`-Zsanitizer-cfi-canonical-jump-tables` requires `-Zsanitizer=cfi`")]
154162pub(crate) struct SanitizerCfiCanonicalJumpTablesRequiresCfi;
155163
156164#[derive(Diagnostic)]
157#[diag(session_sanitizer_cfi_generalize_pointers_requires_cfi)]
165#[diag("`-Zsanitizer-cfi-generalize-pointers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`")]
158166pub(crate) struct SanitizerCfiGeneralizePointersRequiresCfi;
159167
160168#[derive(Diagnostic)]
161#[diag(session_sanitizer_cfi_normalize_integers_requires_cfi)]
169#[diag("`-Zsanitizer-cfi-normalize-integers` requires `-Zsanitizer=cfi` or `-Zsanitizer=kcfi`")]
162170pub(crate) struct SanitizerCfiNormalizeIntegersRequiresCfi;
163171
164172#[derive(Diagnostic)]
165#[diag(session_sanitizer_kcfi_arity_requires_kcfi)]
173#[diag("`-Zsanitizer-kcfi-arity` requires `-Zsanitizer=kcfi`")]
166174pub(crate) struct SanitizerKcfiArityRequiresKcfi;
167175
168176#[derive(Diagnostic)]
169#[diag(session_sanitizer_kcfi_requires_panic_abort)]
177#[diag("`-Z sanitizer=kcfi` requires `-C panic=abort`")]
170178pub(crate) struct SanitizerKcfiRequiresPanicAbort;
171179
172180#[derive(Diagnostic)]
173#[diag(session_split_lto_unit_requires_lto)]
181#[diag("`-Zsplit-lto-unit` requires `-Clto`, `-Clto=thin`, or `-Clinker-plugin-lto`")]
174182pub(crate) struct SplitLtoUnitRequiresLto;
175183
176184#[derive(Diagnostic)]
177#[diag(session_unstable_virtual_function_elimination)]
185#[diag("`-Zvirtual-function-elimination` requires `-Clto`")]
178186pub(crate) struct UnstableVirtualFunctionElimination;
179187
180188#[derive(Diagnostic)]
181#[diag(session_unsupported_dwarf_version)]
182#[help(session_unsupported_dwarf_version_help)]
189#[diag("requested DWARF version {$dwarf_version} is not supported")]
190#[help("supported DWARF versions are 2, 3, 4 and 5")]
183191pub(crate) struct UnsupportedDwarfVersion {
184192 pub(crate) dwarf_version: u32,
185193}
186194
187195#[derive(Diagnostic)]
188#[diag(session_embed_source_insufficient_dwarf_version)]
196#[diag(
197 "`-Zembed-source=y` requires at least `-Z dwarf-version=5` but DWARF version is {$dwarf_version}"
198)]
189199pub(crate) struct EmbedSourceInsufficientDwarfVersion {
190200 pub(crate) dwarf_version: u32,
191201}
192202
193203#[derive(Diagnostic)]
194#[diag(session_embed_source_requires_debug_info)]
204#[diag("`-Zembed-source=y` requires debug information to be enabled")]
195205pub(crate) struct EmbedSourceRequiresDebugInfo;
196206
197207#[derive(Diagnostic)]
198#[diag(session_target_stack_protector_not_supported)]
208#[diag(
209 "`-Z stack-protector={$stack_protector}` is not supported for target {$target_triple} and will be ignored"
210)]
199211pub(crate) struct StackProtectorNotSupportedForTarget<'a> {
200212 pub(crate) stack_protector: StackProtector,
201213 pub(crate) target_triple: &'a TargetTuple,
202214}
203215
204216#[derive(Diagnostic)]
205#[diag(session_target_small_data_threshold_not_supported)]
217#[diag(
218 "`-Z small-data-threshold` is not supported for target {$target_triple} and will be ignored"
219)]
206220pub(crate) struct SmallDataThresholdNotSupportedForTarget<'a> {
207221 pub(crate) target_triple: &'a TargetTuple,
208222}
209223
210224#[derive(Diagnostic)]
211#[diag(session_branch_protection_requires_aarch64)]
225#[diag("`-Zbranch-protection` is only supported on aarch64")]
212226pub(crate) struct BranchProtectionRequiresAArch64;
213227
214228#[derive(Diagnostic)]
215#[diag(session_split_debuginfo_unstable_platform)]
229#[diag("`-Csplit-debuginfo={$debuginfo}` is unstable on this platform")]
216230pub(crate) struct SplitDebugInfoUnstablePlatform {
217231 pub(crate) debuginfo: SplitDebuginfo,
218232}
219233
220234#[derive(Diagnostic)]
221#[diag(session_file_is_not_writeable)]
235#[diag("output file {$file} is not writeable -- check its permissions")]
222236pub(crate) struct FileIsNotWriteable<'a> {
223237 pub(crate) file: &'a std::path::Path,
224238}
225239
226240#[derive(Diagnostic)]
227#[diag(session_file_write_fail)]
241#[diag("failed to write `{$path}` due to error `{$err}`")]
228242pub(crate) struct FileWriteFail<'a> {
229243 pub(crate) path: &'a std::path::Path,
230244 pub(crate) err: String,
231245}
232246
233247#[derive(Diagnostic)]
234#[diag(session_crate_name_empty)]
248#[diag("crate name must not be empty")]
235249pub(crate) struct CrateNameEmpty {
236250 #[primary_span]
237251 pub(crate) span: Option<Span>,
238252}
239253
240254#[derive(Diagnostic)]
241#[diag(session_invalid_character_in_crate_name)]
255#[diag("invalid character {$character} in crate name: `{$crate_name}`")]
242256pub(crate) struct InvalidCharacterInCrateName {
243257 #[primary_span]
244258 pub(crate) span: Option<Span>,
......@@ -247,7 +261,10 @@ pub(crate) struct InvalidCharacterInCrateName {
247261}
248262
249263#[derive(Subdiagnostic)]
250#[multipart_suggestion(session_expr_parentheses_needed, applicability = "machine-applicable")]
264#[multipart_suggestion(
265 "parentheses are required to parse this as an expression",
266 applicability = "machine-applicable"
267)]
251268pub struct ExprParenthesesNeeded {
252269 #[suggestion_part(code = "(")]
253270 left: Span,
......@@ -262,7 +279,7 @@ impl ExprParenthesesNeeded {
262279}
263280
264281#[derive(Diagnostic)]
265#[diag(session_skipping_const_checks)]
282#[diag("skipping const checks")]
266283pub(crate) struct SkippingConstChecks {
267284 #[subdiagnostic]
268285 pub(crate) unleashed_features: Vec<UnleashedFeatureHelp>,
......@@ -270,13 +287,13 @@ pub(crate) struct SkippingConstChecks {
270287
271288#[derive(Subdiagnostic)]
272289pub(crate) enum UnleashedFeatureHelp {
273 #[help(session_unleashed_feature_help_named)]
290 #[help("skipping check for `{$gate}` feature")]
274291 Named {
275292 #[primary_span]
276293 span: Span,
277294 gate: Symbol,
278295 },
279 #[help(session_unleashed_feature_help_unnamed)]
296 #[help("skipping check that does not even have a feature gate")]
280297 Unnamed {
281298 #[primary_span]
282299 span: Span,
......@@ -284,10 +301,10 @@ pub(crate) enum UnleashedFeatureHelp {
284301}
285302
286303#[derive(Diagnostic)]
287#[diag(session_invalid_literal_suffix)]
304#[diag("suffixes on {$kind} literals are invalid")]
288305struct InvalidLiteralSuffix<'a> {
289306 #[primary_span]
290 #[label]
307 #[label("invalid suffix `{$suffix}`")]
291308 span: Span,
292309 // FIXME(#100717)
293310 kind: &'a str,
......@@ -295,8 +312,8 @@ struct InvalidLiteralSuffix<'a> {
295312}
296313
297314#[derive(Diagnostic)]
298#[diag(session_invalid_int_literal_width)]
299#[help]
315#[diag("invalid width `{$width}` for integer literal")]
316#[help("valid widths are 8, 16, 32, 64 and 128")]
300317struct InvalidIntLiteralWidth {
301318 #[primary_span]
302319 span: Span,
......@@ -304,28 +321,32 @@ struct InvalidIntLiteralWidth {
304321}
305322
306323#[derive(Diagnostic)]
307#[diag(session_invalid_num_literal_base_prefix)]
308#[note]
324#[diag("invalid base prefix for number literal")]
325#[note("base prefixes (`0xff`, `0b1010`, `0o755`) are lowercase")]
309326struct InvalidNumLiteralBasePrefix {
310327 #[primary_span]
311 #[suggestion(applicability = "maybe-incorrect", code = "{fixed}")]
328 #[suggestion(
329 "try making the prefix lowercase",
330 applicability = "maybe-incorrect",
331 code = "{fixed}"
332 )]
312333 span: Span,
313334 fixed: String,
314335}
315336
316337#[derive(Diagnostic)]
317#[diag(session_invalid_num_literal_suffix)]
318#[help]
338#[diag("invalid suffix `{$suffix}` for number literal")]
339#[help("the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.)")]
319340struct InvalidNumLiteralSuffix {
320341 #[primary_span]
321 #[label]
342 #[label("invalid suffix `{$suffix}`")]
322343 span: Span,
323344 suffix: String,
324345}
325346
326347#[derive(Diagnostic)]
327#[diag(session_invalid_float_literal_width)]
328#[help]
348#[diag("invalid width `{$width}` for float literal")]
349#[help("valid widths are 32 and 64")]
329350struct InvalidFloatLiteralWidth {
330351 #[primary_span]
331352 span: Span,
......@@ -333,18 +354,18 @@ struct InvalidFloatLiteralWidth {
333354}
334355
335356#[derive(Diagnostic)]
336#[diag(session_invalid_float_literal_suffix)]
337#[help]
357#[diag("invalid suffix `{$suffix}` for float literal")]
358#[help("valid suffixes are `f32` and `f64`")]
338359struct InvalidFloatLiteralSuffix {
339360 #[primary_span]
340 #[label]
361 #[label("invalid suffix `{$suffix}`")]
341362 span: Span,
342363 suffix: String,
343364}
344365
345366#[derive(Diagnostic)]
346#[diag(session_int_literal_too_large)]
347#[note]
367#[diag("integer literal is too large")]
368#[note("value exceeds limit of `{$limit}`")]
348369struct IntLiteralTooLarge {
349370 #[primary_span]
350371 span: Span,
......@@ -352,26 +373,26 @@ struct IntLiteralTooLarge {
352373}
353374
354375#[derive(Diagnostic)]
355#[diag(session_hexadecimal_float_literal_not_supported)]
376#[diag("hexadecimal float literal is not supported")]
356377struct HexadecimalFloatLiteralNotSupported {
357378 #[primary_span]
358 #[label(session_not_supported)]
379 #[label("not supported")]
359380 span: Span,
360381}
361382
362383#[derive(Diagnostic)]
363#[diag(session_octal_float_literal_not_supported)]
384#[diag("octal float literal is not supported")]
364385struct OctalFloatLiteralNotSupported {
365386 #[primary_span]
366 #[label(session_not_supported)]
387 #[label("not supported")]
367388 span: Span,
368389}
369390
370391#[derive(Diagnostic)]
371#[diag(session_binary_float_literal_not_supported)]
392#[diag("binary float literal is not supported")]
372393struct BinaryFloatLiteralNotSupported {
373394 #[primary_span]
374 #[label(session_not_supported)]
395 #[label("not supported")]
375396 span: Span,
376397}
377398
......@@ -457,60 +478,60 @@ pub fn create_lit_error(psess: &ParseSess, err: LitError, lit: token::Lit, span:
457478}
458479
459480#[derive(Diagnostic)]
460#[diag(session_incompatible_linker_flavor)]
461#[note]
481#[diag("linker flavor `{$flavor}` is incompatible with the current target")]
482#[note("compatible flavors are: {$compatible_list}")]
462483pub(crate) struct IncompatibleLinkerFlavor {
463484 pub(crate) flavor: &'static str,
464485 pub(crate) compatible_list: String,
465486}
466487
467488#[derive(Diagnostic)]
468#[diag(session_function_return_requires_x86_or_x86_64)]
489#[diag("`-Zfunction-return` (except `keep`) is only supported on x86 and x86_64")]
469490pub(crate) struct FunctionReturnRequiresX86OrX8664;
470491
471492#[derive(Diagnostic)]
472#[diag(session_function_return_thunk_extern_requires_non_large_code_model)]
493#[diag("`-Zfunction-return=thunk-extern` is only supported on non-large code models")]
473494pub(crate) struct FunctionReturnThunkExternRequiresNonLargeCodeModel;
474495
475496#[derive(Diagnostic)]
476#[diag(session_indirect_branch_cs_prefix_requires_x86_or_x86_64)]
497#[diag("`-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64")]
477498pub(crate) struct IndirectBranchCsPrefixRequiresX86OrX8664;
478499
479500#[derive(Diagnostic)]
480#[diag(session_unsupported_regparm)]
501#[diag("`-Zregparm={$regparm}` is unsupported (valid values 0-3)")]
481502pub(crate) struct UnsupportedRegparm {
482503 pub(crate) regparm: u32,
483504}
484505
485506#[derive(Diagnostic)]
486#[diag(session_unsupported_regparm_arch)]
507#[diag("`-Zregparm=N` is only supported on x86")]
487508pub(crate) struct UnsupportedRegparmArch;
488509
489510#[derive(Diagnostic)]
490#[diag(session_unsupported_reg_struct_return_arch)]
511#[diag("`-Zreg-struct-return` is only supported on x86")]
491512pub(crate) struct UnsupportedRegStructReturnArch;
492513
493514#[derive(Diagnostic)]
494#[diag(session_failed_to_create_profiler)]
515#[diag("failed to create profiler: {$err}")]
495516pub(crate) struct FailedToCreateProfiler {
496517 pub(crate) err: String,
497518}
498519
499520#[derive(Diagnostic)]
500#[diag(session_soft_float_ignored)]
501#[note]
521#[diag("`-Csoft-float` is ignored on this target; it only has an effect on *eabihf targets")]
522#[note("this may become a hard error in a future version of Rust")]
502523pub(crate) struct SoftFloatIgnored;
503524
504525#[derive(Diagnostic)]
505#[diag(session_soft_float_deprecated)]
506#[note]
507#[note(session_soft_float_deprecated_issue)]
526#[diag("`-Csoft-float` is unsound and deprecated; use a corresponding *eabi target instead")]
527#[note("it will be removed or ignored in a future version of Rust")]
528#[note("see issue #129893 <https://github.com/rust-lang/rust/issues/129893> for more information")]
508529pub(crate) struct SoftFloatDeprecated;
509530
510531#[derive(LintDiagnostic)]
511#[diag(session_unexpected_builtin_cfg)]
512#[note(session_controlled_by)]
513#[note(session_incoherent)]
532#[diag("unexpected `--cfg {$cfg}` flag")]
533#[note("config `{$cfg_name}` is only supposed to be controlled by `{$controlled_by}`")]
534#[note("manually setting a built-in cfg can and does create incoherent behaviors")]
514535pub(crate) struct UnexpectedBuiltinCfg {
515536 pub(crate) cfg: String,
516537 pub(crate) cfg_name: Symbol,
compiler/rustc_session/src/lib.rs-2
......@@ -32,8 +32,6 @@ pub mod output;
3232
3333pub use getopts;
3434
35rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
36
3735/// Requirements for a `StableHashingContext` to be used in this crate.
3836/// This is a hack to allow using the `HashStable_Generic` derive macro
3937/// instead of implementing everything in `rustc_middle`.
compiler/rustc_span/src/symbol.rs+1
......@@ -1002,6 +1002,7 @@ symbols! {
10021002 explicit_tail_calls,
10031003 export_name,
10041004 export_stable,
1005 export_symbols: "export-symbols",
10051006 expr,
10061007 expr_2021,
10071008 expr_fragment_specifier_2024,
compiler/rustc_target/src/spec/mod.rs+3
......@@ -3363,6 +3363,9 @@ impl Target {
33633363
33643364 Err(format!("could not find specification for target {target_tuple:?}"))
33653365 }
3366 TargetTuple::TargetJson { ref contents, .. } if !unstable_options => {
3367 Err("custom targets are unstable and require `-Zunstable-options`".to_string())
3368 }
33663369 TargetTuple::TargetJson { ref contents, .. } => Target::from_json(contents),
33673370 }
33683371 }
compiler/rustc_ty_utils/Cargo.toml-1
......@@ -9,7 +9,6 @@ itertools = "0.12"
99rustc_abi = { path = "../rustc_abi" }
1010rustc_data_structures = { path = "../rustc_data_structures" }
1111rustc_errors = { path = "../rustc_errors" }
12rustc_fluent_macro = { path = "../rustc_fluent_macro" }
1312rustc_hashes = { path = "../rustc_hashes" }
1413rustc_hir = { path = "../rustc_hir" }
1514rustc_index = { path = "../rustc_index" }
compiler/rustc_ty_utils/messages.ftl deleted-61
......@@ -1,61 +0,0 @@
1ty_utils_address_and_deref_not_supported = dereferencing or taking the address is not supported in generic constants
2
3ty_utils_adt_not_supported = struct/enum construction is not supported in generic constants
4
5ty_utils_array_not_supported = array construction is not supported in generic constants
6
7ty_utils_assign_not_supported = assignment is not supported in generic constants
8
9ty_utils_binary_not_supported = unsupported binary operation in generic constants
10
11ty_utils_block_not_supported = blocks are not supported in generic constants
12
13ty_utils_borrow_not_supported = borrowing is not supported in generic constants
14
15ty_utils_box_not_supported = allocations are not allowed in generic constants
16
17ty_utils_by_use_not_supported = .use is not allowed in generic constants
18
19ty_utils_closure_and_return_not_supported = closures and function keywords are not supported in generic constants
20
21ty_utils_const_block_not_supported = const blocks are not supported in generic constants
22
23ty_utils_control_flow_not_supported = control flow is not supported in generic constants
24
25ty_utils_field_not_supported = field access is not supported in generic constants
26
27ty_utils_generic_constant_too_complex = overly complex generic constant
28 .help = consider moving this anonymous constant into a `const` function
29 .maybe_supported = this operation may be supported in the future
30
31ty_utils_impl_trait_duplicate_arg = non-defining opaque type use in defining scope
32 .label = generic argument `{$arg}` used twice
33 .note = for this opaque type
34
35ty_utils_impl_trait_not_param = non-defining opaque type use in defining scope
36 .label = argument `{$arg}` is not a generic parameter
37 .note = for this opaque type
38
39ty_utils_index_not_supported = indexing is not supported in generic constants
40
41ty_utils_inline_asm_not_supported = assembly is not supported in generic constants
42
43ty_utils_logical_op_not_supported = unsupported operation in generic constants, short-circuiting operations would imply control flow
44
45ty_utils_loop_not_supported = loops and loop control flow are not supported in generic constants
46
47ty_utils_needs_drop_overflow = overflow while checking whether `{$query_ty}` requires drop
48
49ty_utils_never_to_any_not_supported = coercing the `never` type is not supported in generic constants
50
51ty_utils_non_primitive_simd_type = monomorphising SIMD type `{$ty}` with a non-primitive-scalar (integer/float/pointer) element type `{$e_ty}`
52
53ty_utils_operation_not_supported = unsupported operation in generic constants
54
55ty_utils_pointer_not_supported = pointer casts are not allowed in generic constants
56
57ty_utils_tuple_not_supported = tuple construction is not supported in generic constants
58
59ty_utils_unexpected_fnptr_associated_item = `FnPtr` trait with unexpected associated item
60
61ty_utils_yield_not_supported = coroutine control flow is not allowed in generic constants
compiler/rustc_ty_utils/src/errors.rs+38-34
......@@ -6,18 +6,18 @@ use rustc_middle::ty::{GenericArg, Ty};
66use rustc_span::Span;
77
88#[derive(Diagnostic)]
9#[diag(ty_utils_needs_drop_overflow)]
9#[diag("overflow while checking whether `{$query_ty}` requires drop")]
1010pub(crate) struct NeedsDropOverflow<'tcx> {
1111 pub query_ty: Ty<'tcx>,
1212}
1313
1414#[derive(Diagnostic)]
15#[diag(ty_utils_generic_constant_too_complex)]
16#[help]
15#[diag("overly complex generic constant")]
16#[help("consider moving this anonymous constant into a `const` function")]
1717pub(crate) struct GenericConstantTooComplex {
1818 #[primary_span]
1919 pub span: Span,
20 #[note(ty_utils_maybe_supported)]
20 #[note("this operation may be supported in the future")]
2121 pub maybe_supported: bool,
2222 #[subdiagnostic]
2323 pub sub: GenericConstantTooComplexSub,
......@@ -25,84 +25,88 @@ pub(crate) struct GenericConstantTooComplex {
2525
2626#[derive(Subdiagnostic)]
2727pub(crate) enum GenericConstantTooComplexSub {
28 #[label(ty_utils_borrow_not_supported)]
28 #[label("borrowing is not supported in generic constants")]
2929 BorrowNotSupported(#[primary_span] Span),
30 #[label(ty_utils_address_and_deref_not_supported)]
30 #[label("dereferencing or taking the address is not supported in generic constants")]
3131 AddressAndDerefNotSupported(#[primary_span] Span),
32 #[label(ty_utils_array_not_supported)]
32 #[label("array construction is not supported in generic constants")]
3333 ArrayNotSupported(#[primary_span] Span),
34 #[label(ty_utils_block_not_supported)]
34 #[label("blocks are not supported in generic constants")]
3535 BlockNotSupported(#[primary_span] Span),
36 #[label(ty_utils_never_to_any_not_supported)]
36 #[label("coercing the `never` type is not supported in generic constants")]
3737 NeverToAnyNotSupported(#[primary_span] Span),
38 #[label(ty_utils_tuple_not_supported)]
38 #[label("tuple construction is not supported in generic constants")]
3939 TupleNotSupported(#[primary_span] Span),
40 #[label(ty_utils_index_not_supported)]
40 #[label("indexing is not supported in generic constants")]
4141 IndexNotSupported(#[primary_span] Span),
42 #[label(ty_utils_field_not_supported)]
42 #[label("field access is not supported in generic constants")]
4343 FieldNotSupported(#[primary_span] Span),
44 #[label(ty_utils_const_block_not_supported)]
44 #[label("const blocks are not supported in generic constants")]
4545 ConstBlockNotSupported(#[primary_span] Span),
46 #[label(ty_utils_adt_not_supported)]
46 #[label("struct/enum construction is not supported in generic constants")]
4747 AdtNotSupported(#[primary_span] Span),
48 #[label(ty_utils_pointer_not_supported)]
48 #[label("pointer casts are not allowed in generic constants")]
4949 PointerNotSupported(#[primary_span] Span),
50 #[label(ty_utils_yield_not_supported)]
50 #[label("coroutine control flow is not allowed in generic constants")]
5151 YieldNotSupported(#[primary_span] Span),
52 #[label(ty_utils_loop_not_supported)]
52 #[label("loops and loop control flow are not supported in generic constants")]
5353 LoopNotSupported(#[primary_span] Span),
54 #[label(ty_utils_box_not_supported)]
54 #[label("allocations are not allowed in generic constants")]
5555 BoxNotSupported(#[primary_span] Span),
56 #[label(ty_utils_binary_not_supported)]
56 #[label("unsupported binary operation in generic constants")]
5757 BinaryNotSupported(#[primary_span] Span),
58 #[label(ty_utils_by_use_not_supported)]
58 #[label(".use is not allowed in generic constants")]
5959 ByUseNotSupported(#[primary_span] Span),
60 #[label(ty_utils_logical_op_not_supported)]
60 #[label(
61 "unsupported operation in generic constants, short-circuiting operations would imply control flow"
62 )]
6163 LogicalOpNotSupported(#[primary_span] Span),
62 #[label(ty_utils_assign_not_supported)]
64 #[label("assignment is not supported in generic constants")]
6365 AssignNotSupported(#[primary_span] Span),
64 #[label(ty_utils_closure_and_return_not_supported)]
66 #[label("closures and function keywords are not supported in generic constants")]
6567 ClosureAndReturnNotSupported(#[primary_span] Span),
66 #[label(ty_utils_control_flow_not_supported)]
68 #[label("control flow is not supported in generic constants")]
6769 ControlFlowNotSupported(#[primary_span] Span),
68 #[label(ty_utils_inline_asm_not_supported)]
70 #[label("assembly is not supported in generic constants")]
6971 InlineAsmNotSupported(#[primary_span] Span),
70 #[label(ty_utils_operation_not_supported)]
72 #[label("unsupported operation in generic constants")]
7173 OperationNotSupported(#[primary_span] Span),
7274}
7375
7476#[derive(Diagnostic)]
75#[diag(ty_utils_unexpected_fnptr_associated_item)]
77#[diag("`FnPtr` trait with unexpected associated item")]
7678pub(crate) struct UnexpectedFnPtrAssociatedItem {
7779 #[primary_span]
7880 pub span: Span,
7981}
8082
8183#[derive(Diagnostic)]
82#[diag(ty_utils_non_primitive_simd_type)]
84#[diag(
85 "monomorphising SIMD type `{$ty}` with a non-primitive-scalar (integer/float/pointer) element type `{$e_ty}`"
86)]
8387pub(crate) struct NonPrimitiveSimdType<'tcx> {
8488 pub ty: Ty<'tcx>,
8589 pub e_ty: Ty<'tcx>,
8690}
8791
8892#[derive(Diagnostic)]
89#[diag(ty_utils_impl_trait_duplicate_arg)]
93#[diag("non-defining opaque type use in defining scope")]
9094pub(crate) struct DuplicateArg<'tcx> {
9195 pub arg: GenericArg<'tcx>,
9296 #[primary_span]
93 #[label]
97 #[label("generic argument `{$arg}` used twice")]
9498 pub span: Span,
95 #[note]
99 #[note("for this opaque type")]
96100 pub opaque_span: Span,
97101}
98102
99103#[derive(Diagnostic)]
100#[diag(ty_utils_impl_trait_not_param, code = E0792)]
104#[diag("non-defining opaque type use in defining scope", code = E0792)]
101105pub(crate) struct NotParam<'tcx> {
102106 pub arg: GenericArg<'tcx>,
103107 #[primary_span]
104 #[label]
108 #[label("argument `{$arg}` is not a generic parameter")]
105109 pub span: Span,
106 #[note]
110 #[note("for this opaque type")]
107111 pub opaque_span: Span,
108112}
compiler/rustc_ty_utils/src/lib.rs-2
......@@ -31,8 +31,6 @@ pub mod sig_types;
3131mod structural_match;
3232mod ty;
3333
34rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
35
3634pub fn provide(providers: &mut Providers) {
3735 abi::provide(providers);
3836 assoc::provide(providers);
library/std/src/fs/tests.rs+51
......@@ -2301,6 +2301,57 @@ fn test_fs_set_times() {
23012301 }
23022302}
23032303
2304#[test]
2305fn test_fs_set_times_on_dir() {
2306 #[cfg(target_vendor = "apple")]
2307 use crate::os::darwin::fs::FileTimesExt;
2308 #[cfg(windows)]
2309 use crate::os::windows::fs::FileTimesExt;
2310
2311 let tmp = tmpdir();
2312 let dir_path = tmp.join("testdir");
2313 fs::create_dir(&dir_path).unwrap();
2314
2315 let mut times = FileTimes::new();
2316 let accessed = SystemTime::UNIX_EPOCH + Duration::from_secs(12345);
2317 let modified = SystemTime::UNIX_EPOCH + Duration::from_secs(54321);
2318 times = times.set_accessed(accessed).set_modified(modified);
2319
2320 #[cfg(any(windows, target_vendor = "apple"))]
2321 let created = SystemTime::UNIX_EPOCH + Duration::from_secs(32123);
2322 #[cfg(any(windows, target_vendor = "apple"))]
2323 {
2324 times = times.set_created(created);
2325 }
2326
2327 match fs::set_times(&dir_path, times) {
2328 // Allow unsupported errors on platforms which don't support setting times.
2329 #[cfg(not(any(
2330 windows,
2331 all(
2332 unix,
2333 not(any(
2334 target_os = "android",
2335 target_os = "redox",
2336 target_os = "espidf",
2337 target_os = "horizon"
2338 ))
2339 )
2340 )))]
2341 Err(e) if e.kind() == ErrorKind::Unsupported => return,
2342 Err(e) => panic!("error setting directory times: {e:?}"),
2343 Ok(_) => {}
2344 }
2345
2346 let metadata = fs::metadata(&dir_path).unwrap();
2347 assert_eq!(metadata.accessed().unwrap(), accessed);
2348 assert_eq!(metadata.modified().unwrap(), modified);
2349 #[cfg(any(windows, target_vendor = "apple"))]
2350 {
2351 assert_eq!(metadata.created().unwrap(), created);
2352 }
2353}
2354
23042355#[test]
23052356fn test_fs_set_times_follows_symlink() {
23062357 #[cfg(target_vendor = "apple")]
library/std/src/sys/fs/windows.rs+2-2
......@@ -1556,7 +1556,7 @@ pub fn set_perm(p: &WCStr, perm: FilePermissions) -> io::Result<()> {
15561556
15571557pub fn set_times(p: &WCStr, times: FileTimes) -> io::Result<()> {
15581558 let mut opts = OpenOptions::new();
1559 opts.write(true);
1559 opts.access_mode(c::FILE_WRITE_ATTRIBUTES);
15601560 opts.custom_flags(c::FILE_FLAG_BACKUP_SEMANTICS);
15611561 let file = File::open_native(p, &opts)?;
15621562 file.set_times(times)
......@@ -1564,7 +1564,7 @@ pub fn set_times(p: &WCStr, times: FileTimes) -> io::Result<()> {
15641564
15651565pub fn set_times_nofollow(p: &WCStr, times: FileTimes) -> io::Result<()> {
15661566 let mut opts = OpenOptions::new();
1567 opts.write(true);
1567 opts.access_mode(c::FILE_WRITE_ATTRIBUTES);
15681568 // `FILE_FLAG_OPEN_REPARSE_POINT` for no_follow behavior
15691569 opts.custom_flags(c::FILE_FLAG_BACKUP_SEMANTICS | c::FILE_FLAG_OPEN_REPARSE_POINT);
15701570 let file = File::open_native(p, &opts)?;
src/build_helper/src/metrics.rs+23
......@@ -111,6 +111,29 @@ pub struct JsonStepSystemStats {
111111 pub cpu_utilization_percent: f64,
112112}
113113
114#[derive(Eq, Hash, PartialEq, Debug)]
115pub enum DebuggerKind {
116 Gdb,
117 Lldb,
118 Cdb,
119}
120
121impl DebuggerKind {
122 pub fn debuginfo_kind(name: &str) -> Option<DebuggerKind> {
123 let name = name.to_ascii_lowercase();
124
125 if name.contains("debuginfo-gdb") {
126 Some(DebuggerKind::Gdb)
127 } else if name.contains("debuginfo-lldb") {
128 Some(DebuggerKind::Lldb)
129 } else if name.contains("debuginfo-cdb") {
130 Some(DebuggerKind::Cdb)
131 } else {
132 None
133 }
134 }
135}
136
114137fn null_as_f64_nan<'de, D: serde::Deserializer<'de>>(d: D) -> Result<f64, D::Error> {
115138 use serde::Deserialize as _;
116139 Option::<f64>::deserialize(d).map(|f| f.unwrap_or(f64::NAN))
src/ci/citool/src/analysis.rs+29-1
......@@ -3,7 +3,7 @@ use std::fmt::Debug;
33use std::time::Duration;
44
55use build_helper::metrics::{
6 BuildStep, JsonRoot, TestOutcome, TestSuite, TestSuiteMetadata, escape_step_name,
6 BuildStep, DebuggerKind, JsonRoot, TestOutcome, TestSuite, TestSuiteMetadata, escape_step_name,
77 format_build_steps,
88};
99
......@@ -139,11 +139,39 @@ fn record_test_suites(metrics: &JsonRoot) {
139139 let table = render_table(aggregated);
140140 println!("\n# Test results\n");
141141 println!("{table}");
142 report_debuginfo_statistics(&suites);
142143 } else {
143144 eprintln!("No test suites found in metrics");
144145 }
145146}
146147
148fn report_debuginfo_statistics(suites: &[&TestSuite]) {
149 let mut debugger_test_record: HashMap<DebuggerKind, TestSuiteRecord> = HashMap::new();
150 for suite in suites {
151 if let TestSuiteMetadata::Compiletest { .. } = suite.metadata {
152 for test in &suite.tests {
153 if let Some(kind) = DebuggerKind::debuginfo_kind(&test.name) {
154 let record =
155 debugger_test_record.entry(kind).or_insert(TestSuiteRecord::default());
156 match test.outcome {
157 TestOutcome::Passed => record.passed += 1,
158 TestOutcome::Ignored { .. } => record.ignored += 1,
159 TestOutcome::Failed => record.failed += 1,
160 }
161 }
162 }
163 }
164 }
165
166 println!("## DebugInfo Test Statistics");
167 for (kind, record) in debugger_test_record {
168 println!(
169 "- {:?}: Passed ✅={}, Failed ❌={}, Ignored 🚫={}",
170 kind, record.passed, record.failed, record.ignored
171 );
172 }
173}
174
147175fn render_table(suites: BTreeMap<String, TestSuiteRecord>) -> String {
148176 use std::fmt::Write;
149177
src/ci/docker/scripts/rfl-build.sh+2-2
......@@ -2,8 +2,8 @@
22
33set -euo pipefail
44
5# https://github.com/rust-lang/rust/pull/145974
6LINUX_VERSION=842cfd8e5aff3157cb25481b2900b49c188d628a
5# https://github.com/rust-lang/rust/pull/151534
6LINUX_VERSION=eb268c7972f65fa0b11b051c5ef2b92747bb2b62
77
88# Build rustc, rustdoc, cargo, clippy-driver and rustfmt
99../x.py build --stage 2 library rustdoc clippy rustfmt
src/tools/rustbook/README.md+1-1
......@@ -10,7 +10,7 @@ This is invoked automatically when building mdbook-style documentation, for exam
1010
1111## Cargo workspace
1212
13This package defines a separate cargo workspace from the main Rust workspace for a few reasons (ref [#127786](https://github.com/rust-lang/rust/pull/127786):
13This package defines a separate cargo workspace from the main Rust workspace for a few reasons (ref [#127786](https://github.com/rust-lang/rust/pull/127786)):
1414
1515- Avoids requiring checking out submodules for developers who are not working on the documentation. Otherwise, some submodules such as those that have custom preprocessors would be required for cargo to find the dependencies.
1616- Avoids problems with updating dependencies. Unfortunately this workspace has a rather large set of dependencies, which can make coordinating updates difficult (see [#127890](https://github.com/rust-lang/rust/issues/127890)).
tests/codegen-llvm/autodiff/abi_handling.rs+6-6
......@@ -38,14 +38,14 @@ fn square(x: f32) -> f32 {
3838// CHECK-LABEL: ; abi_handling::df1
3939// CHECK-NEXT: Function Attrs
4040// debug-NEXT: define internal { float, float }
41// debug-SAME: (ptr align 4 %x, ptr align 4 %bx_0)
41// debug-SAME: (ptr {{.*}}%x, ptr {{.*}}%bx_0)
4242// release-NEXT: define internal fastcc float
4343// release-SAME: (float %x.0.val, float %x.4.val)
4444
4545// CHECK-LABEL: ; abi_handling::f1
4646// CHECK-NEXT: Function Attrs
4747// debug-NEXT: define internal float
48// debug-SAME: (ptr align 4 %x)
48// debug-SAME: (ptr {{.*}}%x)
4949// release-NEXT: define internal fastcc noundef float
5050// release-SAME: (float %x.0.val, float %x.4.val)
5151#[autodiff_forward(df1, Dual, Dual)]
......@@ -58,7 +58,7 @@ fn f1(x: &[f32; 2]) -> f32 {
5858// CHECK-NEXT: Function Attrs
5959// debug-NEXT: define internal { float, float }
6060// debug-SAME: (ptr %f, float %x, float %dret)
61// release-NEXT: define internal fastcc float
61// release-NEXT: define internal fastcc noundef float
6262// release-SAME: (float noundef %x)
6363
6464// CHECK-LABEL: ; abi_handling::f2
......@@ -77,13 +77,13 @@ fn f2(f: fn(f32) -> f32, x: f32) -> f32 {
7777// CHECK-NEXT: Function Attrs
7878// debug-NEXT: define internal { float, float }
7979// debug-SAME: (ptr align 4 %x, ptr align 4 %bx_0, ptr align 4 %y, ptr align 4 %by_0)
80// release-NEXT: define internal fastcc { float, float }
80// release-NEXT: define internal fastcc float
8181// release-SAME: (float %x.0.val)
8282
8383// CHECK-LABEL: ; abi_handling::f3
8484// CHECK-NEXT: Function Attrs
8585// debug-NEXT: define internal float
86// debug-SAME: (ptr align 4 %x, ptr align 4 %y)
86// debug-SAME: (ptr {{.*}}%x, ptr {{.*}}%y)
8787// release-NEXT: define internal fastcc noundef float
8888// release-SAME: (float %x.0.val)
8989#[autodiff_forward(df3, Dual, Dual, Dual)]
......@@ -160,7 +160,7 @@ fn f6(i: NestedInput) -> f32 {
160160// CHECK-LABEL: ; abi_handling::f7
161161// CHECK-NEXT: Function Attrs
162162// debug-NEXT: define internal float
163// debug-SAME: (ptr align 4 %x.0, ptr align 4 %x.1)
163// debug-SAME: (ptr {{.*}}%x.0, ptr {{.*}}%x.1)
164164// release-NEXT: define internal fastcc noundef float
165165// release-SAME: (float %x.0.0.val, float %x.1.0.val)
166166#[autodiff_forward(df7, Dual, Dual)]
tests/codegen-llvm/autodiff/batched.rs+16-67
......@@ -1,13 +1,11 @@
11//@ compile-flags: -Zautodiff=Enable,NoTT,NoPostopt -C opt-level=3 -Clto=fat
22//@ no-prefer-dynamic
33//@ needs-enzyme
4//
5// In Enzyme, we test against a large range of LLVM versions (5+) and don't have overly many
6// breakages. One benefit is that we match the IR generated by Enzyme only after running it
7// through LLVM's O3 pipeline, which will remove most of the noise.
8// However, our integration test could also be affected by changes in how rustc lowers MIR into
9// LLVM-IR, which could cause additional noise and thus breakages. If that's the case, we should
10// reduce this test to only match the first lines and the ret instructions.
4
5// This test combines two features of Enzyme, automatic differentiation and batching. As such, it is
6// especially prone to breakages. I reduced it therefore to a minimal check matches argument/return
7// types. Based on the original batching author, implementing the batching feature over MLIR instead
8// of LLVM should give significantly more reliable performance.
119
1210#![feature(autodiff)]
1311
......@@ -22,69 +20,20 @@ fn square(x: &f32) -> f32 {
2220 x * x
2321}
2422
23// The base ("scalar") case d_square3, without batching.
24// CHECK: define internal fastcc float @fwddiffesquare(float %x.0.val, float %"x'.0.val")
25// CHECK: %0 = fadd fast float %"x'.0.val", %"x'.0.val"
26// CHECK-NEXT: %1 = fmul fast float %0, %x.0.val
27// CHECK-NEXT: ret float %1
28// CHECK-NEXT: }
29
2530// d_square2
26// CHECK: define internal [4 x float] @fwddiffe4square(ptr noalias noundef readonly align 4 captures(none) dereferenceable(4) %x, [4 x ptr] %"x'")
27// CHECK-NEXT: start:
28// CHECK-NEXT: %0 = extractvalue [4 x ptr] %"x'", 0
29// CHECK-NEXT: %"_2'ipl" = load float, ptr %0, align 4
30// CHECK-NEXT: %1 = extractvalue [4 x ptr] %"x'", 1
31// CHECK-NEXT: %"_2'ipl1" = load float, ptr %1, align 4
32// CHECK-NEXT: %2 = extractvalue [4 x ptr] %"x'", 2
33// CHECK-NEXT: %"_2'ipl2" = load float, ptr %2, align 4
34// CHECK-NEXT: %3 = extractvalue [4 x ptr] %"x'", 3
35// CHECK-NEXT: %"_2'ipl3" = load float, ptr %3, align 4
36// CHECK-NEXT: %_2 = load float, ptr %x, align 4
37// CHECK-NEXT: %4 = fmul fast float %"_2'ipl", %_2
38// CHECK-NEXT: %5 = fmul fast float %"_2'ipl1", %_2
39// CHECK-NEXT: %6 = fmul fast float %"_2'ipl2", %_2
40// CHECK-NEXT: %7 = fmul fast float %"_2'ipl3", %_2
41// CHECK-NEXT: %8 = fmul fast float %"_2'ipl", %_2
42// CHECK-NEXT: %9 = fmul fast float %"_2'ipl1", %_2
43// CHECK-NEXT: %10 = fmul fast float %"_2'ipl2", %_2
44// CHECK-NEXT: %11 = fmul fast float %"_2'ipl3", %_2
45// CHECK-NEXT: %12 = fadd fast float %4, %8
46// CHECK-NEXT: %13 = insertvalue [4 x float] undef, float %12, 0
47// CHECK-NEXT: %14 = fadd fast float %5, %9
48// CHECK-NEXT: %15 = insertvalue [4 x float] %13, float %14, 1
49// CHECK-NEXT: %16 = fadd fast float %6, %10
50// CHECK-NEXT: %17 = insertvalue [4 x float] %15, float %16, 2
51// CHECK-NEXT: %18 = fadd fast float %7, %11
52// CHECK-NEXT: %19 = insertvalue [4 x float] %17, float %18, 3
53// CHECK-NEXT: ret [4 x float] %19
31// CHECK: define internal fastcc [4 x float] @fwddiffe4square(float %x.0.val, [4 x ptr] %"x'")
32// CHECK: ret [4 x float]
5433// CHECK-NEXT: }
5534
56// d_square3, the extra float is the original return value (x * x)
57// CHECK: define internal { float, [4 x float] } @fwddiffe4square.1(ptr noalias noundef readonly align 4 captures(none) dereferenceable(4) %x, [4 x ptr] %"x'")
58// CHECK-NEXT: start:
59// CHECK-NEXT: %0 = extractvalue [4 x ptr] %"x'", 0
60// CHECK-NEXT: %"_2'ipl" = load float, ptr %0, align 4
61// CHECK-NEXT: %1 = extractvalue [4 x ptr] %"x'", 1
62// CHECK-NEXT: %"_2'ipl1" = load float, ptr %1, align 4
63// CHECK-NEXT: %2 = extractvalue [4 x ptr] %"x'", 2
64// CHECK-NEXT: %"_2'ipl2" = load float, ptr %2, align 4
65// CHECK-NEXT: %3 = extractvalue [4 x ptr] %"x'", 3
66// CHECK-NEXT: %"_2'ipl3" = load float, ptr %3, align 4
67// CHECK-NEXT: %_2 = load float, ptr %x, align 4
68// CHECK-NEXT: %_0 = fmul float %_2, %_2
69// CHECK-NEXT: %4 = fmul fast float %"_2'ipl", %_2
70// CHECK-NEXT: %5 = fmul fast float %"_2'ipl1", %_2
71// CHECK-NEXT: %6 = fmul fast float %"_2'ipl2", %_2
72// CHECK-NEXT: %7 = fmul fast float %"_2'ipl3", %_2
73// CHECK-NEXT: %8 = fmul fast float %"_2'ipl", %_2
74// CHECK-NEXT: %9 = fmul fast float %"_2'ipl1", %_2
75// CHECK-NEXT: %10 = fmul fast float %"_2'ipl2", %_2
76// CHECK-NEXT: %11 = fmul fast float %"_2'ipl3", %_2
77// CHECK-NEXT: %12 = fadd fast float %4, %8
78// CHECK-NEXT: %13 = insertvalue [4 x float] undef, float %12, 0
79// CHECK-NEXT: %14 = fadd fast float %5, %9
80// CHECK-NEXT: %15 = insertvalue [4 x float] %13, float %14, 1
81// CHECK-NEXT: %16 = fadd fast float %6, %10
82// CHECK-NEXT: %17 = insertvalue [4 x float] %15, float %16, 2
83// CHECK-NEXT: %18 = fadd fast float %7, %11
84// CHECK-NEXT: %19 = insertvalue [4 x float] %17, float %18, 3
85// CHECK-NEXT: %20 = insertvalue { float, [4 x float] } undef, float %_0, 0
86// CHECK-NEXT: %21 = insertvalue { float, [4 x float] } %20, [4 x float] %19, 1
87// CHECK-NEXT: ret { float, [4 x float] } %21
35// CHECK: define internal fastcc { float, [4 x float] } @fwddiffe4square.{{.*}}(float %x.0.val, [4 x ptr] %"x'")
36// CHECK: ret { float, [4 x float] }
8837// CHECK-NEXT: }
8938
9039fn main() {
tests/codegen-llvm/autodiff/generic.rs+28-15
......@@ -1,6 +1,14 @@
11//@ compile-flags: -Zautodiff=Enable -Zautodiff=NoPostopt -C opt-level=3 -Clto=fat
22//@ no-prefer-dynamic
33//@ needs-enzyme
4//@ revisions: F32 F64 Main
5
6// Here we verify that the function `square` can be differentiated over f64.
7// This is interesting to test, since the user never calls `square` with f64, so on it's own rustc
8// would have no reason to monomorphize it that way. However, Enzyme needs the f64 version of
9// `square` in order to be able to differentiate it, so we have logic to enforce the
10// monomorphization. Here, we test this logic.
11
412#![feature(autodiff)]
513
614use std::autodiff::autodiff_reverse;
......@@ -12,32 +20,37 @@ fn square<T: std::ops::Mul<Output = T> + Copy>(x: &T) -> T {
1220}
1321
1422// Ensure that `d_square::<f32>` code is generated
15//
16// CHECK: ; generic::square
17// CHECK-NEXT: ; Function Attrs: {{.*}}
18// CHECK-NEXT: define internal {{.*}} float
19// CHECK-NEXT: start:
20// CHECK-NOT: ret
21// CHECK: fmul float
23
24// F32-LABEL: ; generic::square::<f32>
25// F32-NEXT: ; Function Attrs: {{.*}}
26// F32-NEXT: define internal {{.*}} float
27// F32-NEXT: start:
28// F32-NOT: ret
29// F32: fmul float
2230
2331// Ensure that `d_square::<f64>` code is generated even if `square::<f64>` was never called
24//
25// CHECK: ; generic::square
26// CHECK-NEXT: ; Function Attrs:
27// CHECK-NEXT: define internal {{.*}} double
28// CHECK-NEXT: start:
29// CHECK-NOT: ret
30// CHECK: fmul double
32
33// F64-LABEL: ; generic::d_square::<f64>
34// F64-NEXT: ; Function Attrs: {{.*}}
35// F64-NEXT: define internal {{.*}} void
36// F64-NEXT: start:
37// F64-NEXT: {{(tail )?}}call {{(fastcc )?}}void @diffe_{{.*}}(double {{.*}}, ptr {{.*}})
38// F64-NEXT: ret void
39
40// Main-LABEL: ; generic::main
41// Main: ; call generic::square::<f32>
42// Main: ; call generic::d_square::<f64>
3143
3244fn main() {
3345 let xf32: f32 = std::hint::black_box(3.0);
3446 let xf64: f64 = std::hint::black_box(3.0);
47 let seed: f64 = std::hint::black_box(1.0);
3548
3649 let outputf32 = square::<f32>(&xf32);
3750 assert_eq!(9.0, outputf32);
3851
3952 let mut df_dxf64: f64 = std::hint::black_box(0.0);
4053
41 let output_f64 = d_square::<f64>(&xf64, &mut df_dxf64, 1.0);
54 let output_f64 = d_square::<f64>(&xf64, &mut df_dxf64, seed);
4255 assert_eq!(6.0, df_dxf64);
4356}
tests/codegen-llvm/autodiff/identical_fnc.rs+4-4
......@@ -8,7 +8,7 @@
88// merged placeholder function anymore, and compilation would fail. We prevent this by disabling
99// LLVM's merge_function pass before AD. Here we implicetely test that our solution keeps working.
1010// We also explicetly test that we keep running merge_function after AD, by checking for two
11// identical function calls in the LLVM-IR, while having two different calls in the Rust code.
11// identical function calls in the LLVM-IR, despite having two different calls in the Rust code.
1212#![feature(autodiff)]
1313
1414use std::autodiff::autodiff_reverse;
......@@ -27,14 +27,14 @@ fn square2(x: &f64) -> f64 {
2727
2828// CHECK:; identical_fnc::main
2929// CHECK-NEXT:; Function Attrs:
30// CHECK-NEXT:define internal void @_ZN13identical_fnc4main17h6009e4f751bf9407E()
30// CHECK-NEXT:define internal void
3131// CHECK-NEXT:start:
3232// CHECK-NOT:br
3333// CHECK-NOT:ret
3434// CHECK:; call identical_fnc::d_square
35// CHECK-NEXT:call fastcc void @_ZN13identical_fnc8d_square[[HASH:.+]](double %x.val, ptr noalias noundef align 8 dereferenceable(8) %dx1)
35// CHECK-NEXT:call fastcc void @[[HASH:.+]](double %x.val, ptr noalias noundef align 8 dereferenceable(8) %dx1)
3636// CHECK:; call identical_fnc::d_square
37// CHECK-NEXT:call fastcc void @_ZN13identical_fnc8d_square[[HASH]](double %x.val, ptr noalias noundef align 8 dereferenceable(8) %dx2)
37// CHECK-NEXT:call fastcc void @[[HASH]](double %x.val, ptr noalias noundef align 8 dereferenceable(8) %dx2)
3838
3939fn main() {
4040 let x = std::hint::black_box(3.0);
tests/run-make/cdylib-export-c-library-symbols/foo.c created+1
......@@ -0,0 +1 @@
1void my_function() {}
tests/run-make/cdylib-export-c-library-symbols/foo.rs created+10
......@@ -0,0 +1,10 @@
1extern "C" {
2 pub fn my_function();
3}
4
5#[no_mangle]
6pub extern "C" fn rust_entry() {
7 unsafe {
8 my_function();
9 }
10}
tests/run-make/cdylib-export-c-library-symbols/foo_export.rs created+10
......@@ -0,0 +1,10 @@
1extern "C" {
2 fn my_function();
3}
4
5#[no_mangle]
6pub extern "C" fn rust_entry() {
7 unsafe {
8 my_function();
9 }
10}
tests/run-make/cdylib-export-c-library-symbols/rmake.rs created+36
......@@ -0,0 +1,36 @@
1//@ ignore-nvptx64
2//@ ignore-wasm
3//@ ignore-cross-compile
4// FIXME:The symbol mangle rules are slightly different in Windows(32-bit) and Apple.
5// Need to be resolved.
6//@ ignore-windows
7//@ ignore-apple
8// Reason: the compiled binary is executed
9
10use run_make_support::{build_native_static_lib, cc, dynamic_lib_name, is_darwin, llvm_nm, rustc};
11
12fn main() {
13 cc().input("foo.c").arg("-c").out_exe("foo.o").run();
14 build_native_static_lib("foo");
15
16 rustc().input("foo.rs").arg("-lstatic=foo").crate_type("cdylib").run();
17
18 let out = llvm_nm()
19 .input(dynamic_lib_name("foo"))
20 .run()
21 .assert_stdout_not_contains_regex("T *my_function");
22
23 rustc().input("foo_export.rs").arg("-lstatic:+export-symbols=foo").crate_type("cdylib").run();
24
25 if is_darwin() {
26 let out = llvm_nm()
27 .input(dynamic_lib_name("foo_export"))
28 .run()
29 .assert_stdout_contains("T _my_function");
30 } else {
31 let out = llvm_nm()
32 .input(dynamic_lib_name("foo_export"))
33 .run()
34 .assert_stdout_contains("T my_function");
35 }
36}
tests/run-make/rust-lld-custom-target/rmake.rs+5-1
......@@ -15,7 +15,11 @@ fn main() {
1515 // Compile to a custom target spec with rust-lld enabled by default. We'll check that by asking
1616 // the linker to display its version number with a link-arg.
1717 assert_rustc_uses_lld(
18 rustc().crate_type("cdylib").target("custom-target.json").input("lib.rs"),
18 rustc()
19 .crate_type("cdylib")
20 .target("custom-target.json")
21 .arg("-Zunstable-options")
22 .input("lib.rs"),
1923 );
2024
2125 // But it can also be disabled via linker features.
tests/run-make/rustdoc-target-spec-json-path/rmake.rs+7-1
......@@ -5,8 +5,14 @@ use run_make_support::{cwd, rustc, rustdoc};
55
66fn main() {
77 let out_dir = "rustdoc-target-spec-json-path";
8 rustc().crate_type("lib").input("dummy_core.rs").target("target.json").run();
8 rustc()
9 .arg("-Zunstable-options")
10 .crate_type("lib")
11 .input("dummy_core.rs")
12 .target("target.json")
13 .run();
914 rustdoc()
15 .arg("-Zunstable-options")
1016 .input("my_crate.rs")
1117 .out_dir(out_dir)
1218 .library_search_path(cwd())
tests/run-make/target-specs/rmake.rs+8-1
......@@ -20,13 +20,20 @@ fn main() {
2020 .target("my-incomplete-platform.json")
2121 .run_fail()
2222 .assert_stderr_contains("missing field `llvm-target`");
23 let test_platform = rustc()
23 let _ = rustc()
2424 .input("foo.rs")
2525 .target("my-x86_64-unknown-linux-gnu-platform")
2626 .crate_type("lib")
2727 .emit("asm")
2828 .run_fail()
2929 .assert_stderr_contains("custom targets are unstable and require `-Zunstable-options`");
30 let _ = rustc()
31 .input("foo.rs")
32 .target("my-awesome-platform.json")
33 .crate_type("lib")
34 .emit("asm")
35 .run_fail()
36 .assert_stderr_contains("custom targets are unstable and require `-Zunstable-options`");
3037 rustc()
3138 .arg("-Zunstable-options")
3239 .env("RUST_TARGET_PATH", ".")
tests/rustdoc-ui/bad-render-options.rs+19-18
......@@ -1,29 +1,30 @@
11// regression test for https://github.com/rust-lang/rust/issues/149187
2#![deny(invalid_doc_attributes)]
23
34#![doc(html_favicon_url)]
4//~^ ERROR: malformed `doc` attribute
5//~| NOTE expected this to be of the form `html_favicon_url = "..."`
5//~^ ERROR
6//~| WARN
67#![doc(html_logo_url)]
7//~^ ERROR: malformed `doc` attribute
8//~| NOTE expected this to be of the form `html_logo_url = "..."`
8//~^ ERROR
9//~| WARN
910#![doc(html_playground_url)]
10//~^ ERROR: malformed `doc` attribute
11//~| NOTE expected this to be of the form `html_playground_url = "..."`
11//~^ ERROR
12//~| WARN
1213#![doc(issue_tracker_base_url)]
13//~^ ERROR: malformed `doc` attribute
14//~| NOTE expected this to be of the form `issue_tracker_base_url = "..."`
14//~^ ERROR
15//~| WARN
1516#![doc(html_favicon_url = 1)]
16//~^ ERROR malformed `doc` attribute
17//~| NOTE expected a string literal
17//~^ ERROR
18//~| WARN
1819#![doc(html_logo_url = 2)]
19//~^ ERROR malformed `doc` attribute
20//~| NOTE expected a string literal
20//~^ ERROR
21//~| WARN
2122#![doc(html_playground_url = 3)]
22//~^ ERROR malformed `doc` attribute
23//~| NOTE expected a string literal
23//~^ ERROR
24//~| WARN
2425#![doc(issue_tracker_base_url = 4)]
25//~^ ERROR malformed `doc` attribute
26//~| NOTE expected a string literal
26//~^ ERROR
27//~| WARN
2728#![doc(html_no_source = "asdf")]
28//~^ ERROR malformed `doc` attribute
29//~| NOTE didn't expect any arguments here
29//~^ ERROR
30//~| WARN
tests/rustdoc-ui/bad-render-options.stderr+50-47
......@@ -1,76 +1,79 @@
1error[E0539]: malformed `doc` attribute input
2 --> $DIR/bad-render-options.rs:3:1
1error: expected this to be of the form `... = "..."`
2 --> $DIR/bad-render-options.rs:4:8
33 |
44LL | #![doc(html_favicon_url)]
5 | ^^^^^^^----------------^^
6 | |
7 | expected this to be of the form `html_favicon_url = "..."`
5 | ^^^^^^^^^^^^^^^^
6 |
7 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8note: the lint level is defined here
9 --> $DIR/bad-render-options.rs:2:9
10 |
11LL | #![deny(invalid_doc_attributes)]
12 | ^^^^^^^^^^^^^^^^^^^^^^
813
9error[E0539]: malformed `doc` attribute input
10 --> $DIR/bad-render-options.rs:6:1
14error: expected this to be of the form `... = "..."`
15 --> $DIR/bad-render-options.rs:7:8
1116 |
1217LL | #![doc(html_logo_url)]
13 | ^^^^^^^-------------^^
14 | |
15 | expected this to be of the form `html_logo_url = "..."`
18 | ^^^^^^^^^^^^^
19 |
20 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1621
17error[E0539]: malformed `doc` attribute input
18 --> $DIR/bad-render-options.rs:9:1
22error: expected this to be of the form `... = "..."`
23 --> $DIR/bad-render-options.rs:10:8
1924 |
2025LL | #![doc(html_playground_url)]
21 | ^^^^^^^-------------------^^
22 | |
23 | expected this to be of the form `html_playground_url = "..."`
26 | ^^^^^^^^^^^^^^^^^^^
27 |
28 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2429
25error[E0539]: malformed `doc` attribute input
26 --> $DIR/bad-render-options.rs:12:1
30error: expected this to be of the form `... = "..."`
31 --> $DIR/bad-render-options.rs:13:8
2732 |
2833LL | #![doc(issue_tracker_base_url)]
29 | ^^^^^^^----------------------^^
30 | |
31 | expected this to be of the form `issue_tracker_base_url = "..."`
34 | ^^^^^^^^^^^^^^^^^^^^^^
35 |
36 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3237
33error[E0539]: malformed `doc` attribute input
34 --> $DIR/bad-render-options.rs:15:1
38error: malformed `doc` attribute input
39 --> $DIR/bad-render-options.rs:16:27
3540 |
3641LL | #![doc(html_favicon_url = 1)]
37 | ^^^^^^^^^^^^^^^^^^^^^^^^^^-^^
38 | |
39 | expected a string literal here
42 | ^
43 |
44 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4045
41error[E0539]: malformed `doc` attribute input
42 --> $DIR/bad-render-options.rs:18:1
46error: malformed `doc` attribute input
47 --> $DIR/bad-render-options.rs:19:24
4348 |
4449LL | #![doc(html_logo_url = 2)]
45 | ^^^^^^^^^^^^^^^^^^^^^^^-^^
46 | |
47 | expected a string literal here
50 | ^
51 |
52 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4853
49error[E0539]: malformed `doc` attribute input
50 --> $DIR/bad-render-options.rs:21:1
54error: malformed `doc` attribute input
55 --> $DIR/bad-render-options.rs:22:30
5156 |
5257LL | #![doc(html_playground_url = 3)]
53 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^^
54 | |
55 | expected a string literal here
58 | ^
59 |
60 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5661
57error[E0539]: malformed `doc` attribute input
58 --> $DIR/bad-render-options.rs:24:1
62error: malformed `doc` attribute input
63 --> $DIR/bad-render-options.rs:25:33
5964 |
6065LL | #![doc(issue_tracker_base_url = 4)]
61 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^^
62 | |
63 | expected a string literal here
66 | ^
67 |
68 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
6469
65error[E0565]: malformed `doc` attribute input
66 --> $DIR/bad-render-options.rs:27:1
70error: didn't expect any arguments here
71 --> $DIR/bad-render-options.rs:28:23
6772 |
6873LL | #![doc(html_no_source = "asdf")]
69 | ^^^^^^^^^^^^^^^^^^^^^^--------^^
70 | |
71 | didn't expect any arguments here
74 | ^^^^^^^^
75 |
76 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7277
7378error: aborting due to 9 previous errors
7479
75Some errors have detailed explanations: E0539, E0565.
76For more information about an error, try `rustc --explain E0539`.
tests/rustdoc-ui/deprecated-attrs.rs+3-1
......@@ -1,11 +1,13 @@
11//@ compile-flags: --passes unknown-pass
22
3#![deny(invalid_doc_attributes)]
4//~^ NOTE
5
36#![doc(no_default_passes)]
47//~^ ERROR unknown `doc` attribute `no_default_passes`
58//~| NOTE no longer functions
69//~| NOTE see issue #44136
710//~| NOTE `doc(no_default_passes)` is now a no-op
8//~| NOTE `#[deny(invalid_doc_attributes)]` on by default
911#![doc(passes = "collapse-docs unindent-comments")]
1012//~^ ERROR unknown `doc` attribute `passes`
1113//~| NOTE no longer functions
tests/rustdoc-ui/deprecated-attrs.stderr+8-4
......@@ -4,17 +4,21 @@ warning: the `passes` flag no longer functions
44 = help: you may want to use --document-private-items
55
66error: unknown `doc` attribute `no_default_passes`
7 --> $DIR/deprecated-attrs.rs:3:8
7 --> $DIR/deprecated-attrs.rs:6:8
88 |
99LL | #![doc(no_default_passes)]
1010 | ^^^^^^^^^^^^^^^^^ no longer functions
1111 |
1212 = note: `doc` attribute `no_default_passes` no longer functions; see issue #44136 <https://github.com/rust-lang/rust/issues/44136>
1313 = note: `doc(no_default_passes)` is now a no-op
14 = note: `#[deny(invalid_doc_attributes)]` on by default
14note: the lint level is defined here
15 --> $DIR/deprecated-attrs.rs:3:9
16 |
17LL | #![deny(invalid_doc_attributes)]
18 | ^^^^^^^^^^^^^^^^^^^^^^
1519
1620error: unknown `doc` attribute `passes`
17 --> $DIR/deprecated-attrs.rs:9:8
21 --> $DIR/deprecated-attrs.rs:11:8
1822 |
1923LL | #![doc(passes = "collapse-docs unindent-comments")]
2024 | ^^^^^^ no longer functions
......@@ -23,7 +27,7 @@ LL | #![doc(passes = "collapse-docs unindent-comments")]
2327 = note: `doc(passes)` is now a no-op
2428
2529error: unknown `doc` attribute `plugins`
26 --> $DIR/deprecated-attrs.rs:14:8
30 --> $DIR/deprecated-attrs.rs:16:8
2731 |
2832LL | #![doc(plugins = "xxx")]
2933 | ^^^^^^^ no longer functions
tests/rustdoc-ui/doc-cfg-2.rs+1
......@@ -1,3 +1,4 @@
1#![deny(invalid_doc_attributes)]
12#![feature(doc_cfg)]
23
34#[doc(cfg(foo), cfg(bar))]
tests/rustdoc-ui/doc-cfg-2.stderr+15-11
......@@ -1,5 +1,5 @@
11warning: unexpected `cfg` condition name: `foo`
2 --> $DIR/doc-cfg-2.rs:3:11
2 --> $DIR/doc-cfg-2.rs:4:11
33 |
44LL | #[doc(cfg(foo), cfg(bar))]
55 | ^^^
......@@ -10,7 +10,7 @@ LL | #[doc(cfg(foo), cfg(bar))]
1010 = note: `#[warn(unexpected_cfgs)]` on by default
1111
1212warning: unexpected `cfg` condition name: `bar`
13 --> $DIR/doc-cfg-2.rs:3:21
13 --> $DIR/doc-cfg-2.rs:4:21
1414 |
1515LL | #[doc(cfg(foo), cfg(bar))]
1616 | ^^^
......@@ -19,45 +19,49 @@ LL | #[doc(cfg(foo), cfg(bar))]
1919 = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
2020
2121error: only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`
22 --> $DIR/doc-cfg-2.rs:6:16
22 --> $DIR/doc-cfg-2.rs:7:16
2323 |
2424LL | #[doc(auto_cfg(42))]
2525 | ^^
2626 |
27 = note: `#[deny(invalid_doc_attributes)]` on by default
27note: the lint level is defined here
28 --> $DIR/doc-cfg-2.rs:1:9
29 |
30LL | #![deny(invalid_doc_attributes)]
31 | ^^^^^^^^^^^^^^^^^^^^^^
2832
2933error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
30 --> $DIR/doc-cfg-2.rs:7:21
34 --> $DIR/doc-cfg-2.rs:8:21
3135 |
3236LL | #[doc(auto_cfg(hide(true)))]
3337 | ^^^^
3438
3539error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
36 --> $DIR/doc-cfg-2.rs:8:21
40 --> $DIR/doc-cfg-2.rs:9:21
3741 |
3842LL | #[doc(auto_cfg(hide(42)))]
3943 | ^^
4044
4145error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
42 --> $DIR/doc-cfg-2.rs:9:21
46 --> $DIR/doc-cfg-2.rs:10:21
4347 |
4448LL | #[doc(auto_cfg(hide("a")))]
4549 | ^^^
4650
4751error: expected boolean for `#[doc(auto_cfg = ...)]`
48 --> $DIR/doc-cfg-2.rs:10:18
52 --> $DIR/doc-cfg-2.rs:11:18
4953 |
5054LL | #[doc(auto_cfg = 42)]
5155 | ^^
5256
5357error: expected boolean for `#[doc(auto_cfg = ...)]`
54 --> $DIR/doc-cfg-2.rs:11:18
58 --> $DIR/doc-cfg-2.rs:12:18
5559 |
5660LL | #[doc(auto_cfg = "a")]
5761 | ^^^
5862
5963warning: unexpected `cfg` condition name: `feature`
60 --> $DIR/doc-cfg-2.rs:14:21
64 --> $DIR/doc-cfg-2.rs:15:21
6165 |
6266LL | #[doc(auto_cfg(hide(feature = "windows")))]
6367 | ^^^^^^^^^^^^^^^^^^^
......@@ -66,7 +70,7 @@ LL | #[doc(auto_cfg(hide(feature = "windows")))]
6670 = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
6771
6872warning: unexpected `cfg` condition name: `foo`
69 --> $DIR/doc-cfg-2.rs:16:21
73 --> $DIR/doc-cfg-2.rs:17:21
7074 |
7175LL | #[doc(auto_cfg(hide(foo)))]
7276 | ^^^
tests/rustdoc-ui/doc-cfg.rs+4-3
......@@ -1,9 +1,10 @@
1#![deny(invalid_doc_attributes)]
12#![feature(doc_cfg)]
23
34#[doc(cfg(), cfg(foo, bar))]
4//~^ ERROR malformed `doc` attribute input
5//~| ERROR malformed `doc` attribute input
5//~^ ERROR
6//~| ERROR
67#[doc(cfg())] //~ ERROR
78#[doc(cfg(foo, bar))] //~ ERROR
8#[doc(auto_cfg(hide(foo::bar)))] //~ ERROR
9#[doc(auto_cfg(hide(foo::bar)))]
910pub fn foo() {}
tests/rustdoc-ui/doc-cfg.stderr+6-15
......@@ -1,5 +1,5 @@
11error[E0805]: malformed `doc` attribute input
2 --> $DIR/doc-cfg.rs:3:1
2 --> $DIR/doc-cfg.rs:4:1
33 |
44LL | #[doc(cfg(), cfg(foo, bar))]
55 | ^^^^^^^^^--^^^^^^^^^^^^^^^^^
......@@ -7,7 +7,7 @@ LL | #[doc(cfg(), cfg(foo, bar))]
77 | expected a single argument here
88
99error[E0805]: malformed `doc` attribute input
10 --> $DIR/doc-cfg.rs:3:1
10 --> $DIR/doc-cfg.rs:4:1
1111 |
1212LL | #[doc(cfg(), cfg(foo, bar))]
1313 | ^^^^^^^^^^^^^^^^----------^^
......@@ -15,7 +15,7 @@ LL | #[doc(cfg(), cfg(foo, bar))]
1515 | expected a single argument here
1616
1717error[E0805]: malformed `doc` attribute input
18 --> $DIR/doc-cfg.rs:6:1
18 --> $DIR/doc-cfg.rs:7:1
1919 |
2020LL | #[doc(cfg())]
2121 | ^^^^^^^^^--^^
......@@ -23,22 +23,13 @@ LL | #[doc(cfg())]
2323 | expected a single argument here
2424
2525error[E0805]: malformed `doc` attribute input
26 --> $DIR/doc-cfg.rs:7:1
26 --> $DIR/doc-cfg.rs:8:1
2727 |
2828LL | #[doc(cfg(foo, bar))]
2929 | ^^^^^^^^^----------^^
3030 | |
3131 | expected a single argument here
3232
33error[E0539]: malformed `doc` attribute input
34 --> $DIR/doc-cfg.rs:8:1
35 |
36LL | #[doc(auto_cfg(hide(foo::bar)))]
37 | ^^^^^^^^^^^^^^^^^^^^--------^^^^
38 | |
39 | expected a valid identifier here
40
41error: aborting due to 5 previous errors
33error: aborting due to 4 previous errors
4234
43Some errors have detailed explanations: E0539, E0805.
44For more information about an error, try `rustc --explain E0539`.
35For more information about this error, try `rustc --explain E0805`.
tests/rustdoc-ui/doc-include-suggestion.rs+3-1
......@@ -1,6 +1,8 @@
1#![deny(invalid_doc_attributes)]
2//~^ NOTE
3
14#[doc(include = "external-cross-doc.md")]
25//~^ ERROR unknown `doc` attribute `include`
36//~| HELP use `doc = include_str!` instead
47// FIXME(#85497): make this a deny instead so it's more clear what's happening
5//~| NOTE on by default
68pub struct NeedMoreDocs;
tests/rustdoc-ui/doc-include-suggestion.stderr+6-2
......@@ -1,10 +1,14 @@
11error: unknown `doc` attribute `include`
2 --> $DIR/doc-include-suggestion.rs:1:7
2 --> $DIR/doc-include-suggestion.rs:4:7
33 |
44LL | #[doc(include = "external-cross-doc.md")]
55 | ^^^^^^^ help: use `doc = include_str!` instead: `#[doc = include_str!("external-cross-doc.md")]`
66 |
7 = note: `#[deny(invalid_doc_attributes)]` on by default
7note: the lint level is defined here
8 --> $DIR/doc-include-suggestion.rs:1:9
9 |
10LL | #![deny(invalid_doc_attributes)]
11 | ^^^^^^^^^^^^^^^^^^^^^^
812
913error: aborting due to 1 previous error
1014
tests/rustdoc-ui/doctest/doc-test-attr.rs+1
......@@ -1,3 +1,4 @@
1#![deny(invalid_doc_attributes)]
12#![crate_type = "lib"]
23
34#![doc(test)]
tests/rustdoc-ui/doctest/doc-test-attr.stderr+8-4
......@@ -1,19 +1,23 @@
11error: `#[doc(test(...)]` takes a list of attributes
2 --> $DIR/doc-test-attr.rs:3:8
2 --> $DIR/doc-test-attr.rs:4:8
33 |
44LL | #![doc(test)]
55 | ^^^^
66 |
7 = note: `#[deny(invalid_doc_attributes)]` on by default
7note: the lint level is defined here
8 --> $DIR/doc-test-attr.rs:1:9
9 |
10LL | #![deny(invalid_doc_attributes)]
11 | ^^^^^^^^^^^^^^^^^^^^^^
812
913error: `#[doc(test(...)]` takes a list of attributes
10 --> $DIR/doc-test-attr.rs:5:13
14 --> $DIR/doc-test-attr.rs:6:13
1115 |
1216LL | #![doc(test = "hello")]
1317 | ^^^^^^^^^
1418
1519error: unknown `doc(test)` attribute `a`
16 --> $DIR/doc-test-attr.rs:7:13
20 --> $DIR/doc-test-attr.rs:8:13
1721 |
1822LL | #![doc(test(a))]
1923 | ^
tests/rustdoc-ui/lints/doc-attr-2.rs+1
......@@ -1,3 +1,4 @@
1#![deny(invalid_doc_attributes)]
12#![doc(as_ptr)]
23//~^ ERROR unknown `doc` attribute `as_ptr`
34
tests/rustdoc-ui/lints/doc-attr-2.stderr+9-5
......@@ -1,25 +1,29 @@
11error: unknown `doc` attribute `as_ptr`
2 --> $DIR/doc-attr-2.rs:4:7
2 --> $DIR/doc-attr-2.rs:5:7
33 |
44LL | #[doc(as_ptr)]
55 | ^^^^^^
66 |
7 = note: `#[deny(invalid_doc_attributes)]` on by default
7note: the lint level is defined here
8 --> $DIR/doc-attr-2.rs:1:9
9 |
10LL | #![deny(invalid_doc_attributes)]
11 | ^^^^^^^^^^^^^^^^^^^^^^
812
913error: unknown `doc` attribute `foo::bar`
10 --> $DIR/doc-attr-2.rs:8:7
14 --> $DIR/doc-attr-2.rs:9:7
1115 |
1216LL | #[doc(foo::bar, crate::bar::baz = "bye")]
1317 | ^^^^^^^^
1418
1519error: unknown `doc` attribute `crate::bar::baz`
16 --> $DIR/doc-attr-2.rs:8:17
20 --> $DIR/doc-attr-2.rs:9:17
1721 |
1822LL | #[doc(foo::bar, crate::bar::baz = "bye")]
1923 | ^^^^^^^^^^^^^^^
2024
2125error: unknown `doc` attribute `as_ptr`
22 --> $DIR/doc-attr-2.rs:1:8
26 --> $DIR/doc-attr-2.rs:2:8
2327 |
2428LL | #![doc(as_ptr)]
2529 | ^^^^^^
tests/rustdoc-ui/lints/doc-attr.rs+7-3
......@@ -1,8 +1,12 @@
11#![crate_type = "lib"]
2#![deny(invalid_doc_attributes)]
23
34#[doc(123)]
4//~^ ERROR malformed `doc` attribute
5//~^ ERROR
6//~| WARN
57#[doc("hello", "bar")]
6//~^ ERROR malformed `doc` attribute
7//~| ERROR malformed `doc` attribute
8//~^ ERROR
9//~| ERROR
10//~| WARN
11//~| WARN
812fn bar() {}
tests/rustdoc-ui/lints/doc-attr.stderr+20-16
......@@ -1,27 +1,31 @@
1error[E0539]: malformed `doc` attribute input
2 --> $DIR/doc-attr.rs:3:1
1error: expected this to be of the form `... = "..."`
2 --> $DIR/doc-attr.rs:4:7
33 |
44LL | #[doc(123)]
5 | ^^^^^^---^^
6 | |
7 | expected this to be of the form `... = "..."`
5 | ^^^
6 |
7 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8note: the lint level is defined here
9 --> $DIR/doc-attr.rs:2:9
10 |
11LL | #![deny(invalid_doc_attributes)]
12 | ^^^^^^^^^^^^^^^^^^^^^^
813
9error[E0539]: malformed `doc` attribute input
10 --> $DIR/doc-attr.rs:5:1
14error: expected this to be of the form `... = "..."`
15 --> $DIR/doc-attr.rs:7:7
1116 |
1217LL | #[doc("hello", "bar")]
13 | ^^^^^^-------^^^^^^^^^
14 | |
15 | expected this to be of the form `... = "..."`
18 | ^^^^^^^
19 |
20 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1621
17error[E0539]: malformed `doc` attribute input
18 --> $DIR/doc-attr.rs:5:1
22error: expected this to be of the form `... = "..."`
23 --> $DIR/doc-attr.rs:7:16
1924 |
2025LL | #[doc("hello", "bar")]
21 | ^^^^^^^^^^^^^^^-----^^
22 | |
23 | expected this to be of the form `... = "..."`
26 | ^^^^^
27 |
28 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2429
2530error: aborting due to 3 previous errors
2631
27For more information about this error, try `rustc --explain E0539`.
tests/rustdoc-ui/lints/doc-spotlight.fixed+1
......@@ -1,5 +1,6 @@
11//@ run-rustfix
22#![feature(doc_notable_trait)]
3#![deny(invalid_doc_attributes)]
34
45#[doc(notable_trait)]
56//~^ ERROR unknown `doc` attribute `spotlight`
tests/rustdoc-ui/lints/doc-spotlight.rs+1
......@@ -1,5 +1,6 @@
11//@ run-rustfix
22#![feature(doc_notable_trait)]
3#![deny(invalid_doc_attributes)]
34
45#[doc(spotlight)]
56//~^ ERROR unknown `doc` attribute `spotlight`
tests/rustdoc-ui/lints/doc-spotlight.stderr+6-2
......@@ -1,12 +1,16 @@
11error: unknown `doc` attribute `spotlight`
2 --> $DIR/doc-spotlight.rs:4:7
2 --> $DIR/doc-spotlight.rs:5:7
33 |
44LL | #[doc(spotlight)]
55 | ^^^^^^^^^ help: use `notable_trait` instead
66 |
77 = note: `doc(spotlight)` was renamed to `doc(notable_trait)`
88 = note: `doc(spotlight)` is now a no-op
9 = note: `#[deny(invalid_doc_attributes)]` on by default
9note: the lint level is defined here
10 --> $DIR/doc-spotlight.rs:3:9
11 |
12LL | #![deny(invalid_doc_attributes)]
13 | ^^^^^^^^^^^^^^^^^^^^^^
1014
1115error: aborting due to 1 previous error
1216
tests/rustdoc-ui/lints/doc_cfg_hide.rs+1
......@@ -1,3 +1,4 @@
1#![deny(invalid_doc_attributes)]
12#![feature(doc_cfg)]
23#![doc(auto_cfg(hide = "test"))] //~ ERROR
34#![doc(auto_cfg(hide))] //~ ERROR
tests/rustdoc-ui/lints/doc_cfg_hide.stderr+8-4
......@@ -1,19 +1,23 @@
11error: `#![doc(auto_cfg(hide(...)))]` expects a list of items
2 --> $DIR/doc_cfg_hide.rs:2:17
2 --> $DIR/doc_cfg_hide.rs:3:17
33 |
44LL | #![doc(auto_cfg(hide = "test"))]
55 | ^^^^^^^^^^^^^
66 |
7 = note: `#[deny(invalid_doc_attributes)]` on by default
7note: the lint level is defined here
8 --> $DIR/doc_cfg_hide.rs:1:9
9 |
10LL | #![deny(invalid_doc_attributes)]
11 | ^^^^^^^^^^^^^^^^^^^^^^
812
913error: `#![doc(auto_cfg(hide(...)))]` expects a list of items
10 --> $DIR/doc_cfg_hide.rs:3:17
14 --> $DIR/doc_cfg_hide.rs:4:17
1115 |
1216LL | #![doc(auto_cfg(hide))]
1317 | ^^^^
1418
1519error: `#![doc(auto_cfg(hide(...)))]` only accepts identifiers or key/value items
16 --> $DIR/doc_cfg_hide.rs:4:22
20 --> $DIR/doc_cfg_hide.rs:5:22
1721 |
1822LL | #![doc(auto_cfg(hide(not(windows))))]
1923 | ^^^^^^^^^^^^
tests/rustdoc-ui/lints/duplicated-attr.rs created+6
......@@ -0,0 +1,6 @@
1#![deny(invalid_doc_attributes)]
2#![expect(unused_attributes)]
3#![doc(test(no_crate_inject))]
4#![doc(test(no_crate_inject))]
5//~^ ERROR
6//~| WARN
tests/rustdoc-ui/lints/duplicated-attr.stderr created+20
......@@ -0,0 +1,20 @@
1error: unused attribute
2 --> $DIR/duplicated-attr.rs:4:13
3 |
4LL | #![doc(test(no_crate_inject))]
5 | ^^^^^^^^^^^^^^^ help: remove this attribute
6 |
7note: attribute also specified here
8 --> $DIR/duplicated-attr.rs:3:13
9 |
10LL | #![doc(test(no_crate_inject))]
11 | ^^^^^^^^^^^^^^^
12 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
13note: the lint level is defined here
14 --> $DIR/duplicated-attr.rs:1:9
15 |
16LL | #![deny(invalid_doc_attributes)]
17 | ^^^^^^^^^^^^^^^^^^^^^^
18
19error: aborting due to 1 previous error
20
tests/rustdoc-ui/lints/invalid-crate-level-lint.rs+1
......@@ -1,3 +1,4 @@
1#![deny(invalid_doc_attributes)]
12#![crate_type = "lib"]
23
34#[doc(test(no_crate_inject))]
tests/rustdoc-ui/lints/invalid-crate-level-lint.stderr+8-4
......@@ -1,14 +1,18 @@
11error: this attribute can only be applied at the crate level
2 --> $DIR/invalid-crate-level-lint.rs:3:12
2 --> $DIR/invalid-crate-level-lint.rs:4:12
33 |
44LL | #[doc(test(no_crate_inject))]
55 | ^^^^^^^^^^^^^^^
66 |
77 = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
8 = note: `#[deny(invalid_doc_attributes)]` on by default
8note: the lint level is defined here
9 --> $DIR/invalid-crate-level-lint.rs:1:9
10 |
11LL | #![deny(invalid_doc_attributes)]
12 | ^^^^^^^^^^^^^^^^^^^^^^
913
1014error: this attribute can only be applied at the crate level
11 --> $DIR/invalid-crate-level-lint.rs:7:17
15 --> $DIR/invalid-crate-level-lint.rs:8:17
1216 |
1317LL | #![doc(test(no_crate_inject))]
1418 | ^^^^^^^^^^^^^^^
......@@ -16,7 +20,7 @@ LL | #![doc(test(no_crate_inject))]
1620 = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#at-the-crate-level> for more information
1721
1822error: this attribute can only be applied at the crate level
19 --> $DIR/invalid-crate-level-lint.rs:10:16
23 --> $DIR/invalid-crate-level-lint.rs:11:16
2024 |
2125LL | #[doc(test(no_crate_inject))]
2226 | ^^^^^^^^^^^^^^^
tests/rustdoc-ui/lints/invalid-doc-attr-2.rs created+7
......@@ -0,0 +1,7 @@
1#![deny(invalid_doc_attributes)]
2
3#![doc("other attribute")]
4//~^ ERROR
5//~| WARN
6#![doc]
7//~^ ERROR
tests/rustdoc-ui/lints/invalid-doc-attr-2.stderr created+21
......@@ -0,0 +1,21 @@
1error: expected this to be of the form `... = "..."`
2 --> $DIR/invalid-doc-attr-2.rs:3:8
3 |
4LL | #![doc("other attribute")]
5 | ^^^^^^^^^^^^^^^^^
6 |
7 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8note: the lint level is defined here
9 --> $DIR/invalid-doc-attr-2.rs:1:9
10 |
11LL | #![deny(invalid_doc_attributes)]
12 | ^^^^^^^^^^^^^^^^^^^^^^
13
14error: valid forms for the attribute are `#![doc = "string"]`, `#![doc(alias)]`, `#![doc(attribute)]`, `#![doc(auto_cfg)]`, `#![doc(cfg)]`, `#![doc(fake_variadic)]`, `#![doc(hidden)]`, `#![doc(html_favicon_url)]`, `#![doc(html_logo_url)]`, `#![doc(html_no_source)]`, `#![doc(html_playground_url)]`, `#![doc(html_root_url)]`, `#![doc(include)]`, `#![doc(inline)]`, `#![doc(issue_tracker_base_url)]`, `#![doc(keyword)]`, `#![doc(masked)]`, `#![doc(no_default_passes)]`, `#![doc(no_inline)]`, `#![doc(notable_trait)]`, `#![doc(passes)]`, `#![doc(plugins)]`, `#![doc(rust_logo)]`, `#![doc(search_unbox)]`, `#![doc(spotlight)]`, and `#![doc(test)]`
15 --> $DIR/invalid-doc-attr-2.rs:6:1
16 |
17LL | #![doc]
18 | ^^^^^^^
19
20error: aborting due to 2 previous errors
21
tests/rustdoc-ui/lints/invalid-doc-attr-3.rs created+22
......@@ -0,0 +1,22 @@
1#![deny(invalid_doc_attributes)]
2
3#![doc(test(no_crate_inject = 1))]
4//~^ ERROR
5//~| WARN
6#![doc(test(attr = 1))]
7//~^ ERROR
8//~| WARN
9
10#[doc(hidden = true)]
11//~^ ERROR
12//~| WARN
13#[doc(hidden("or you will be fired"))]
14//~^ ERROR
15//~| WARN
16#[doc(hidden = "handled transparently by codegen")]
17//~^ ERROR
18//~| WARN
19#[doc = 1]
20//~^ ERROR
21//~| WARN
22pub struct X;
tests/rustdoc-ui/lints/invalid-doc-attr-3.stderr created+55
......@@ -0,0 +1,55 @@
1error: didn't expect any arguments here
2 --> $DIR/invalid-doc-attr-3.rs:10:14
3 |
4LL | #[doc(hidden = true)]
5 | ^^^^^^
6 |
7 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8note: the lint level is defined here
9 --> $DIR/invalid-doc-attr-3.rs:1:9
10 |
11LL | #![deny(invalid_doc_attributes)]
12 | ^^^^^^^^^^^^^^^^^^^^^^
13
14error: didn't expect any arguments here
15 --> $DIR/invalid-doc-attr-3.rs:13:13
16 |
17LL | #[doc(hidden("or you will be fired"))]
18 | ^^^^^^^^^^^^^^^^^^^^^^^^
19 |
20 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
21
22error: didn't expect any arguments here
23 --> $DIR/invalid-doc-attr-3.rs:16:14
24 |
25LL | #[doc(hidden = "handled transparently by codegen")]
26 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27 |
28 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
29
30error: malformed `doc` attribute input
31 --> $DIR/invalid-doc-attr-3.rs:19:9
32 |
33LL | #[doc = 1]
34 | ^
35 |
36 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
37
38error: didn't expect any arguments here
39 --> $DIR/invalid-doc-attr-3.rs:3:29
40 |
41LL | #![doc(test(no_crate_inject = 1))]
42 | ^^^
43 |
44 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
45
46error: malformed `doc` attribute input
47 --> $DIR/invalid-doc-attr-3.rs:6:1
48 |
49LL | #![doc(test(attr = 1))]
50 | ^^^^^^^^^^^^^^^^^^^^^^^
51 |
52 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
53
54error: aborting due to 6 previous errors
55
tests/rustdoc-ui/lints/invalid-doc-attr.rs+1
......@@ -1,3 +1,4 @@
1#![deny(invalid_doc_attributes)]
12#![crate_type = "lib"]
23#![feature(doc_masked)]
34
tests/rustdoc-ui/lints/invalid-doc-attr.stderr+13-8
......@@ -1,5 +1,5 @@
11error: this attribute can only be applied to a `use` item
2 --> $DIR/invalid-doc-attr.rs:7:7
2 --> $DIR/invalid-doc-attr.rs:8:7
33 |
44LL | #[doc(inline)]
55 | ^^^^^^ only applicable on `use` items
......@@ -8,10 +8,14 @@ LL | pub fn foo() {}
88 | ------------ not a `use` item
99 |
1010 = note: read <https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#inline-and-no_inline> for more information
11 = note: `#[deny(invalid_doc_attributes)]` on by default
11note: the lint level is defined here
12 --> $DIR/invalid-doc-attr.rs:1:9
13 |
14LL | #![deny(invalid_doc_attributes)]
15 | ^^^^^^^^^^^^^^^^^^^^^^
1216
1317error: conflicting doc inlining attributes
14 --> $DIR/invalid-doc-attr.rs:17:7
18 --> $DIR/invalid-doc-attr.rs:18:7
1519 |
1620LL | #[doc(inline)]
1721 | ^^^^^^ this attribute...
......@@ -21,7 +25,7 @@ LL | #[doc(no_inline)]
2125 = help: remove one of the conflicting attributes
2226
2327error: this attribute can only be applied to an `extern crate` item
24 --> $DIR/invalid-doc-attr.rs:23:7
28 --> $DIR/invalid-doc-attr.rs:24:7
2529 |
2630LL | #[doc(masked)]
2731 | ^^^^^^ only applicable on `extern crate` items
......@@ -32,7 +36,7 @@ LL | pub struct Masked;
3236 = note: read <https://doc.rust-lang.org/unstable-book/language-features/doc-masked.html> for more information
3337
3438error: this attribute cannot be applied to an `extern crate self` item
35 --> $DIR/invalid-doc-attr.rs:27:7
39 --> $DIR/invalid-doc-attr.rs:28:7
3640 |
3741LL | #[doc(masked)]
3842 | ^^^^^^ not applicable on `extern crate self` items
......@@ -41,9 +45,10 @@ LL | pub extern crate self as reexport;
4145 | --------------------------------- `extern crate self` defined here
4246
4347error: this attribute can only be applied to an `extern crate` item
44 --> $DIR/invalid-doc-attr.rs:4:8
48 --> $DIR/invalid-doc-attr.rs:5:8
4549 |
46LL | / #![crate_type = "lib"]
50LL | / #![deny(invalid_doc_attributes)]
51LL | | #![crate_type = "lib"]
4752LL | | #![feature(doc_masked)]
4853LL | |
4954LL | | #![doc(masked)]
......@@ -55,7 +60,7 @@ LL | | pub extern crate self as reexport;
5560 = note: read <https://doc.rust-lang.org/unstable-book/language-features/doc-masked.html> for more information
5661
5762error: this attribute can only be applied to a `use` item
58 --> $DIR/invalid-doc-attr.rs:12:11
63 --> $DIR/invalid-doc-attr.rs:13:11
5964 |
6065LL | #[doc(inline)]
6166 | ^^^^^^ only applicable on `use` items
tests/ui-fulldeps/codegen-backend/auxiliary/the_backend.rs-4
......@@ -29,10 +29,6 @@ use rustc_session::config::OutputFilenames;
2929struct TheBackend;
3030
3131impl CodegenBackend for TheBackend {
32 fn locale_resource(&self) -> &'static str {
33 ""
34 }
35
3632 fn name(&self) -> &'static str {
3733 "the-backend"
3834 }
tests/ui/attributes/doc-attr.rs+7-3
......@@ -1,3 +1,4 @@
1#![deny(invalid_doc_attributes)]
12#![crate_type = "lib"]
23#![doc(as_ptr)]
34//~^ ERROR unknown `doc` attribute
......@@ -7,10 +8,13 @@
78pub fn foo() {}
89
910#[doc(123)]
10//~^ ERROR malformed `doc` attribute
11//~^ ERROR
12//~| WARN
1113#[doc("hello", "bar")]
12//~^ ERROR malformed `doc` attribute
13//~| ERROR malformed `doc` attribute
14//~^ ERROR
15//~| ERROR
16//~| WARN
17//~| WARN
1418#[doc(foo::bar, crate::bar::baz = "bye")]
1519//~^ ERROR unknown `doc` attribute
1620//~| ERROR unknown `doc` attribute
tests/ui/attributes/doc-attr.stderr+29-26
......@@ -1,53 +1,56 @@
1error[E0539]: malformed `doc` attribute input
2 --> $DIR/doc-attr.rs:9:1
1error: unknown `doc` attribute `as_ptr`
2 --> $DIR/doc-attr.rs:6:7
33 |
4LL | #[doc(123)]
5 | ^^^^^^---^^
6 | |
7 | expected this to be of the form `... = "..."`
4LL | #[doc(as_ptr)]
5 | ^^^^^^
6 |
7note: the lint level is defined here
8 --> $DIR/doc-attr.rs:1:9
9 |
10LL | #![deny(invalid_doc_attributes)]
11 | ^^^^^^^^^^^^^^^^^^^^^^
812
9error[E0539]: malformed `doc` attribute input
10 --> $DIR/doc-attr.rs:11:1
13error: expected this to be of the form `... = "..."`
14 --> $DIR/doc-attr.rs:10:7
1115 |
12LL | #[doc("hello", "bar")]
13 | ^^^^^^-------^^^^^^^^^
14 | |
15 | expected this to be of the form `... = "..."`
16LL | #[doc(123)]
17 | ^^^
18 |
19 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
1620
17error[E0539]: malformed `doc` attribute input
18 --> $DIR/doc-attr.rs:11:1
21error: expected this to be of the form `... = "..."`
22 --> $DIR/doc-attr.rs:13:7
1923 |
2024LL | #[doc("hello", "bar")]
21 | ^^^^^^^^^^^^^^^-----^^
22 | |
23 | expected this to be of the form `... = "..."`
25 | ^^^^^^^
26 |
27 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2428
25error: unknown `doc` attribute `as_ptr`
26 --> $DIR/doc-attr.rs:5:7
29error: expected this to be of the form `... = "..."`
30 --> $DIR/doc-attr.rs:13:16
2731 |
28LL | #[doc(as_ptr)]
29 | ^^^^^^
32LL | #[doc("hello", "bar")]
33 | ^^^^^
3034 |
31 = note: `#[deny(invalid_doc_attributes)]` on by default
35 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3236
3337error: unknown `doc` attribute `foo::bar`
34 --> $DIR/doc-attr.rs:14:7
38 --> $DIR/doc-attr.rs:18:7
3539 |
3640LL | #[doc(foo::bar, crate::bar::baz = "bye")]
3741 | ^^^^^^^^
3842
3943error: unknown `doc` attribute `crate::bar::baz`
40 --> $DIR/doc-attr.rs:14:17
44 --> $DIR/doc-attr.rs:18:17
4145 |
4246LL | #[doc(foo::bar, crate::bar::baz = "bye")]
4347 | ^^^^^^^^^^^^^^^
4448
4549error: unknown `doc` attribute `as_ptr`
46 --> $DIR/doc-attr.rs:2:8
50 --> $DIR/doc-attr.rs:3:8
4751 |
4852LL | #![doc(as_ptr)]
4953 | ^^^^^^
5054
5155error: aborting due to 7 previous errors
5256
53For more information about this error, try `rustc --explain E0539`.
tests/ui/attributes/doc-test-literal.rs+4-1
......@@ -1,4 +1,7 @@
1#![deny(invalid_doc_attributes)]
2
13#![doc(test(""))]
2//~^ ERROR malformed `doc` attribute input
4//~^ ERROR
5//~| WARN
36
47fn main() {}
tests/ui/attributes/doc-test-literal.stderr+10-6
......@@ -1,11 +1,15 @@
1error[E0565]: malformed `doc` attribute input
2 --> $DIR/doc-test-literal.rs:1:1
1error: malformed `doc` attribute input
2 --> $DIR/doc-test-literal.rs:3:13
33 |
44LL | #![doc(test(""))]
5 | ^^^^^^^^^^^^--^^^
6 | |
7 | didn't expect a literal here
5 | ^^
6 |
7 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8note: the lint level is defined here
9 --> $DIR/doc-test-literal.rs:1:9
10 |
11LL | #![deny(invalid_doc_attributes)]
12 | ^^^^^^^^^^^^^^^^^^^^^^
813
914error: aborting due to 1 previous error
1015
11For more information about this error, try `rustc --explain E0565`.
tests/ui/attributes/malformed-attrs.rs+3-4
......@@ -1,5 +1,6 @@
11// This file contains a bunch of malformed attributes.
22// We enable a bunch of features to not get feature-gate errs in this test.
3#![deny(invalid_doc_attributes)]
34#![feature(rustc_attrs)]
45#![feature(rustc_allow_const_fn_unstable)]
56#![feature(allow_internal_unstable)]
......@@ -39,8 +40,7 @@
3940#[deprecated = 5]
4041//~^ ERROR malformed
4142#[doc]
42//~^ ERROR valid forms for the attribute are
43//~| WARN this was previously accepted by the compiler
43//~^ ERROR
4444#[rustc_macro_transparency]
4545//~^ ERROR malformed
4646//~| ERROR attribute cannot be used on
......@@ -75,8 +75,7 @@
7575//~^ ERROR malformed
7676//~| WARN crate-level attribute should be an inner attribute
7777#[doc]
78//~^ ERROR valid forms for the attribute are
79//~| WARN this was previously accepted by the compiler
78//~^ ERROR
8079#[target_feature]
8180//~^ ERROR malformed
8281#[export_stable = 1]
tests/ui/attributes/malformed-attrs.stderr+75-97
......@@ -1,5 +1,5 @@
11error[E0539]: malformed `cfg` attribute input
2 --> $DIR/malformed-attrs.rs:108:1
2 --> $DIR/malformed-attrs.rs:107:1
33 |
44LL | #[cfg]
55 | ^^^^^^
......@@ -10,7 +10,7 @@ LL | #[cfg]
1010 = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
1111
1212error[E0539]: malformed `cfg_attr` attribute input
13 --> $DIR/malformed-attrs.rs:110:1
13 --> $DIR/malformed-attrs.rs:109:1
1414 |
1515LL | #[cfg_attr]
1616 | ^^^^^^^^^^^
......@@ -21,13 +21,13 @@ LL | #[cfg_attr]
2121 = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
2222
2323error[E0463]: can't find crate for `wloop`
24 --> $DIR/malformed-attrs.rs:218:1
24 --> $DIR/malformed-attrs.rs:217:1
2525 |
2626LL | extern crate wloop;
2727 | ^^^^^^^^^^^^^^^^^^^ can't find crate
2828
2929error: malformed `allow` attribute input
30 --> $DIR/malformed-attrs.rs:184:1
30 --> $DIR/malformed-attrs.rs:183:1
3131 |
3232LL | #[allow]
3333 | ^^^^^^^^
......@@ -43,7 +43,7 @@ LL | #[allow(lint1, lint2, lint3, reason = "...")]
4343 | +++++++++++++++++++++++++++++++++++++
4444
4545error: malformed `expect` attribute input
46 --> $DIR/malformed-attrs.rs:186:1
46 --> $DIR/malformed-attrs.rs:185:1
4747 |
4848LL | #[expect]
4949 | ^^^^^^^^^
......@@ -59,7 +59,7 @@ LL | #[expect(lint1, lint2, lint3, reason = "...")]
5959 | +++++++++++++++++++++++++++++++++++++
6060
6161error: malformed `warn` attribute input
62 --> $DIR/malformed-attrs.rs:188:1
62 --> $DIR/malformed-attrs.rs:187:1
6363 |
6464LL | #[warn]
6565 | ^^^^^^^
......@@ -75,7 +75,7 @@ LL | #[warn(lint1, lint2, lint3, reason = "...")]
7575 | +++++++++++++++++++++++++++++++++++++
7676
7777error: malformed `deny` attribute input
78 --> $DIR/malformed-attrs.rs:190:1
78 --> $DIR/malformed-attrs.rs:189:1
7979 |
8080LL | #[deny]
8181 | ^^^^^^^
......@@ -91,7 +91,7 @@ LL | #[deny(lint1, lint2, lint3, reason = "...")]
9191 | +++++++++++++++++++++++++++++++++++++
9292
9393error: malformed `forbid` attribute input
94 --> $DIR/malformed-attrs.rs:192:1
94 --> $DIR/malformed-attrs.rs:191:1
9595 |
9696LL | #[forbid]
9797 | ^^^^^^^^^
......@@ -107,25 +107,25 @@ LL | #[forbid(lint1, lint2, lint3, reason = "...")]
107107 | +++++++++++++++++++++++++++++++++++++
108108
109109error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type
110 --> $DIR/malformed-attrs.rs:105:1
110 --> $DIR/malformed-attrs.rs:104:1
111111 |
112112LL | #[proc_macro = 18]
113113 | ^^^^^^^^^^^^^^^^^^
114114
115115error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type
116 --> $DIR/malformed-attrs.rs:122:1
116 --> $DIR/malformed-attrs.rs:121:1
117117 |
118118LL | #[proc_macro_attribute = 19]
119119 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
120120
121121error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
122 --> $DIR/malformed-attrs.rs:129:1
122 --> $DIR/malformed-attrs.rs:128:1
123123 |
124124LL | #[proc_macro_derive]
125125 | ^^^^^^^^^^^^^^^^^^^^
126126
127127error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint
128 --> $DIR/malformed-attrs.rs:223:1
128 --> $DIR/malformed-attrs.rs:222:1
129129 |
130130LL | #[allow_internal_unsafe = 1]
131131 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -134,7 +134,7 @@ LL | #[allow_internal_unsafe = 1]
134134 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
135135
136136error[E0539]: malformed `windows_subsystem` attribute input
137 --> $DIR/malformed-attrs.rs:26:1
137 --> $DIR/malformed-attrs.rs:27:1
138138 |
139139LL | #![windows_subsystem]
140140 | ^^^-----------------^
......@@ -150,25 +150,25 @@ LL | #![windows_subsystem = "windows"]
150150 | +++++++++++
151151
152152error[E0539]: malformed `export_name` attribute input
153 --> $DIR/malformed-attrs.rs:29:1
153 --> $DIR/malformed-attrs.rs:30:1
154154 |
155155LL | #[unsafe(export_name)]
156156 | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
157157
158158error: `rustc_allow_const_fn_unstable` expects a list of feature names
159 --> $DIR/malformed-attrs.rs:31:1
159 --> $DIR/malformed-attrs.rs:32:1
160160 |
161161LL | #[rustc_allow_const_fn_unstable]
162162 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163163
164164error: `allow_internal_unstable` expects a list of feature names
165 --> $DIR/malformed-attrs.rs:34:1
165 --> $DIR/malformed-attrs.rs:35:1
166166 |
167167LL | #[allow_internal_unstable]
168168 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
169169
170170error[E0539]: malformed `rustc_confusables` attribute input
171 --> $DIR/malformed-attrs.rs:36:1
171 --> $DIR/malformed-attrs.rs:37:1
172172 |
173173LL | #[rustc_confusables]
174174 | ^^^^^^^^^^^^^^^^^^^^
......@@ -177,7 +177,7 @@ LL | #[rustc_confusables]
177177 | help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]`
178178
179179error: `#[rustc_confusables]` attribute cannot be used on functions
180 --> $DIR/malformed-attrs.rs:36:1
180 --> $DIR/malformed-attrs.rs:37:1
181181 |
182182LL | #[rustc_confusables]
183183 | ^^^^^^^^^^^^^^^^^^^^
......@@ -185,7 +185,7 @@ LL | #[rustc_confusables]
185185 = help: `#[rustc_confusables]` can only be applied to inherent methods
186186
187187error[E0539]: malformed `deprecated` attribute input
188 --> $DIR/malformed-attrs.rs:39:1
188 --> $DIR/malformed-attrs.rs:40:1
189189 |
190190LL | #[deprecated = 5]
191191 | ^^^^^^^^^^^^^^^-^
......@@ -349,7 +349,7 @@ LL | #[crate_name]
349349 | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]`
350350
351351error[E0539]: malformed `target_feature` attribute input
352 --> $DIR/malformed-attrs.rs:80:1
352 --> $DIR/malformed-attrs.rs:79:1
353353 |
354354LL | #[target_feature]
355355 | ^^^^^^^^^^^^^^^^^
......@@ -358,7 +358,7 @@ LL | #[target_feature]
358358 | help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
359359
360360error[E0565]: malformed `export_stable` attribute input
361 --> $DIR/malformed-attrs.rs:82:1
361 --> $DIR/malformed-attrs.rs:81:1
362362 |
363363LL | #[export_stable = 1]
364364 | ^^^^^^^^^^^^^^^^---^
......@@ -367,7 +367,7 @@ LL | #[export_stable = 1]
367367 | help: must be of the form: `#[export_stable]`
368368
369369error[E0539]: malformed `link` attribute input
370 --> $DIR/malformed-attrs.rs:84:1
370 --> $DIR/malformed-attrs.rs:83:1
371371 |
372372LL | #[link]
373373 | ^^^^^^^ expected this to be a list
......@@ -375,7 +375,7 @@ LL | #[link]
375375 = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
376376
377377error[E0539]: malformed `link_name` attribute input
378 --> $DIR/malformed-attrs.rs:88:1
378 --> $DIR/malformed-attrs.rs:87:1
379379 |
380380LL | #[link_name]
381381 | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
......@@ -383,7 +383,7 @@ LL | #[link_name]
383383 = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute>
384384
385385error[E0539]: malformed `link_section` attribute input
386 --> $DIR/malformed-attrs.rs:92:1
386 --> $DIR/malformed-attrs.rs:91:1
387387 |
388388LL | #[link_section]
389389 | ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]`
......@@ -391,7 +391,7 @@ LL | #[link_section]
391391 = note: for more information, visit <https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute>
392392
393393error[E0539]: malformed `coverage` attribute input
394 --> $DIR/malformed-attrs.rs:94:1
394 --> $DIR/malformed-attrs.rs:93:1
395395 |
396396LL | #[coverage]
397397 | ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
......@@ -404,13 +404,13 @@ LL | #[coverage(on)]
404404 | ++++
405405
406406error[E0539]: malformed `sanitize` attribute input
407 --> $DIR/malformed-attrs.rs:96:1
407 --> $DIR/malformed-attrs.rs:95:1
408408 |
409409LL | #[sanitize]
410410 | ^^^^^^^^^^^ expected this to be a list
411411
412412error[E0565]: malformed `no_implicit_prelude` attribute input
413 --> $DIR/malformed-attrs.rs:101:1
413 --> $DIR/malformed-attrs.rs:100:1
414414 |
415415LL | #[no_implicit_prelude = 23]
416416 | ^^^^^^^^^^^^^^^^^^^^^^----^
......@@ -419,7 +419,7 @@ LL | #[no_implicit_prelude = 23]
419419 | help: must be of the form: `#[no_implicit_prelude]`
420420
421421error[E0565]: malformed `proc_macro` attribute input
422 --> $DIR/malformed-attrs.rs:105:1
422 --> $DIR/malformed-attrs.rs:104:1
423423 |
424424LL | #[proc_macro = 18]
425425 | ^^^^^^^^^^^^^----^
......@@ -428,7 +428,7 @@ LL | #[proc_macro = 18]
428428 | help: must be of the form: `#[proc_macro]`
429429
430430error[E0539]: malformed `instruction_set` attribute input
431 --> $DIR/malformed-attrs.rs:112:1
431 --> $DIR/malformed-attrs.rs:111:1
432432 |
433433LL | #[instruction_set]
434434 | ^^^^^^^^^^^^^^^^^^
......@@ -439,7 +439,7 @@ LL | #[instruction_set]
439439 = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute>
440440
441441error[E0539]: malformed `patchable_function_entry` attribute input
442 --> $DIR/malformed-attrs.rs:114:1
442 --> $DIR/malformed-attrs.rs:113:1
443443 |
444444LL | #[patchable_function_entry]
445445 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -448,7 +448,7 @@ LL | #[patchable_function_entry]
448448 | help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
449449
450450error[E0565]: malformed `coroutine` attribute input
451 --> $DIR/malformed-attrs.rs:117:5
451 --> $DIR/malformed-attrs.rs:116:5
452452 |
453453LL | #[coroutine = 63] || {}
454454 | ^^^^^^^^^^^^----^
......@@ -457,7 +457,7 @@ LL | #[coroutine = 63] || {}
457457 | help: must be of the form: `#[coroutine]`
458458
459459error[E0565]: malformed `proc_macro_attribute` attribute input
460 --> $DIR/malformed-attrs.rs:122:1
460 --> $DIR/malformed-attrs.rs:121:1
461461 |
462462LL | #[proc_macro_attribute = 19]
463463 | ^^^^^^^^^^^^^^^^^^^^^^^----^
......@@ -466,7 +466,7 @@ LL | #[proc_macro_attribute = 19]
466466 | help: must be of the form: `#[proc_macro_attribute]`
467467
468468error[E0539]: malformed `must_use` attribute input
469 --> $DIR/malformed-attrs.rs:125:1
469 --> $DIR/malformed-attrs.rs:124:1
470470 |
471471LL | #[must_use = 1]
472472 | ^^^^^^^^^^^^^-^
......@@ -484,7 +484,7 @@ LL + #[must_use]
484484 |
485485
486486error[E0539]: malformed `proc_macro_derive` attribute input
487 --> $DIR/malformed-attrs.rs:129:1
487 --> $DIR/malformed-attrs.rs:128:1
488488 |
489489LL | #[proc_macro_derive]
490490 | ^^^^^^^^^^^^^^^^^^^^ expected this to be a list
......@@ -498,7 +498,7 @@ LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
498498 | ++++++++++++++++++++++++++++++++++++++++++
499499
500500error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input
501 --> $DIR/malformed-attrs.rs:134:1
501 --> $DIR/malformed-attrs.rs:133:1
502502 |
503503LL | #[rustc_layout_scalar_valid_range_start]
504504 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -507,7 +507,7 @@ LL | #[rustc_layout_scalar_valid_range_start]
507507 | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]`
508508
509509error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input
510 --> $DIR/malformed-attrs.rs:136:1
510 --> $DIR/malformed-attrs.rs:135:1
511511 |
512512LL | #[rustc_layout_scalar_valid_range_end]
513513 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -516,7 +516,7 @@ LL | #[rustc_layout_scalar_valid_range_end]
516516 | help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]`
517517
518518error[E0539]: malformed `must_not_suspend` attribute input
519 --> $DIR/malformed-attrs.rs:138:1
519 --> $DIR/malformed-attrs.rs:137:1
520520 |
521521LL | #[must_not_suspend()]
522522 | ^^^^^^^^^^^^^^^^^^--^
......@@ -532,7 +532,7 @@ LL + #[must_not_suspend]
532532 |
533533
534534error[E0539]: malformed `cfi_encoding` attribute input
535 --> $DIR/malformed-attrs.rs:140:1
535 --> $DIR/malformed-attrs.rs:139:1
536536 |
537537LL | #[cfi_encoding = ""]
538538 | ^^^^^^^^^^^^^^^^^--^
......@@ -541,7 +541,7 @@ LL | #[cfi_encoding = ""]
541541 | help: must be of the form: `#[cfi_encoding = "encoding"]`
542542
543543error[E0565]: malformed `marker` attribute input
544 --> $DIR/malformed-attrs.rs:161:1
544 --> $DIR/malformed-attrs.rs:160:1
545545 |
546546LL | #[marker = 3]
547547 | ^^^^^^^^^---^
......@@ -550,7 +550,7 @@ LL | #[marker = 3]
550550 | help: must be of the form: `#[marker]`
551551
552552error[E0565]: malformed `fundamental` attribute input
553 --> $DIR/malformed-attrs.rs:163:1
553 --> $DIR/malformed-attrs.rs:162:1
554554 |
555555LL | #[fundamental()]
556556 | ^^^^^^^^^^^^^--^
......@@ -559,7 +559,7 @@ LL | #[fundamental()]
559559 | help: must be of the form: `#[fundamental]`
560560
561561error[E0565]: malformed `ffi_pure` attribute input
562 --> $DIR/malformed-attrs.rs:171:5
562 --> $DIR/malformed-attrs.rs:170:5
563563 |
564564LL | #[unsafe(ffi_pure = 1)]
565565 | ^^^^^^^^^^^^^^^^^^---^^
......@@ -568,7 +568,7 @@ LL | #[unsafe(ffi_pure = 1)]
568568 | help: must be of the form: `#[ffi_pure]`
569569
570570error[E0539]: malformed `link_ordinal` attribute input
571 --> $DIR/malformed-attrs.rs:173:5
571 --> $DIR/malformed-attrs.rs:172:5
572572 |
573573LL | #[link_ordinal]
574574 | ^^^^^^^^^^^^^^^
......@@ -579,7 +579,7 @@ LL | #[link_ordinal]
579579 = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
580580
581581error[E0565]: malformed `ffi_const` attribute input
582 --> $DIR/malformed-attrs.rs:177:5
582 --> $DIR/malformed-attrs.rs:176:5
583583 |
584584LL | #[unsafe(ffi_const = 1)]
585585 | ^^^^^^^^^^^^^^^^^^^---^^
......@@ -588,13 +588,13 @@ LL | #[unsafe(ffi_const = 1)]
588588 | help: must be of the form: `#[ffi_const]`
589589
590590error[E0539]: malformed `linkage` attribute input
591 --> $DIR/malformed-attrs.rs:179:5
591 --> $DIR/malformed-attrs.rs:178:5
592592 |
593593LL | #[linkage]
594594 | ^^^^^^^^^^ expected this to be of the form `linkage = "..."`
595595
596596error[E0539]: malformed `debugger_visualizer` attribute input
597 --> $DIR/malformed-attrs.rs:194:1
597 --> $DIR/malformed-attrs.rs:193:1
598598 |
599599LL | #[debugger_visualizer]
600600 | ^^^^^^^^^^^^^^^^^^^^^^
......@@ -605,7 +605,7 @@ LL | #[debugger_visualizer]
605605 = note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute>
606606
607607error[E0565]: malformed `automatically_derived` attribute input
608 --> $DIR/malformed-attrs.rs:196:1
608 --> $DIR/malformed-attrs.rs:195:1
609609 |
610610LL | #[automatically_derived = 18]
611611 | ^^^^^^^^^^^^^^^^^^^^^^^^----^
......@@ -614,7 +614,7 @@ LL | #[automatically_derived = 18]
614614 | help: must be of the form: `#[automatically_derived]`
615615
616616error[E0565]: malformed `non_exhaustive` attribute input
617 --> $DIR/malformed-attrs.rs:204:1
617 --> $DIR/malformed-attrs.rs:203:1
618618 |
619619LL | #[non_exhaustive = 1]
620620 | ^^^^^^^^^^^^^^^^^---^
......@@ -623,7 +623,7 @@ LL | #[non_exhaustive = 1]
623623 | help: must be of the form: `#[non_exhaustive]`
624624
625625error[E0565]: malformed `thread_local` attribute input
626 --> $DIR/malformed-attrs.rs:210:1
626 --> $DIR/malformed-attrs.rs:209:1
627627 |
628628LL | #[thread_local()]
629629 | ^^^^^^^^^^^^^^--^
......@@ -632,7 +632,7 @@ LL | #[thread_local()]
632632 | help: must be of the form: `#[thread_local]`
633633
634634error[E0565]: malformed `no_link` attribute input
635 --> $DIR/malformed-attrs.rs:214:1
635 --> $DIR/malformed-attrs.rs:213:1
636636 |
637637LL | #[no_link()]
638638 | ^^^^^^^^^--^
......@@ -641,7 +641,7 @@ LL | #[no_link()]
641641 | help: must be of the form: `#[no_link]`
642642
643643error[E0539]: malformed `macro_use` attribute input
644 --> $DIR/malformed-attrs.rs:216:1
644 --> $DIR/malformed-attrs.rs:215:1
645645 |
646646LL | #[macro_use = 1]
647647 | ^^^^^^^^^^^^---^
......@@ -659,7 +659,7 @@ LL + #[macro_use]
659659 |
660660
661661error[E0539]: malformed `macro_export` attribute input
662 --> $DIR/malformed-attrs.rs:221:1
662 --> $DIR/malformed-attrs.rs:220:1
663663 |
664664LL | #[macro_export = 18]
665665 | ^^^^^^^^^^^^^^^----^
......@@ -676,7 +676,7 @@ LL + #[macro_export]
676676 |
677677
678678error[E0565]: malformed `allow_internal_unsafe` attribute input
679 --> $DIR/malformed-attrs.rs:223:1
679 --> $DIR/malformed-attrs.rs:222:1
680680 |
681681LL | #[allow_internal_unsafe = 1]
682682 | ^^^^^^^^^^^^^^^^^^^^^^^^---^
......@@ -685,7 +685,7 @@ LL | #[allow_internal_unsafe = 1]
685685 | help: must be of the form: `#[allow_internal_unsafe]`
686686
687687error[E0565]: malformed `type_const` attribute input
688 --> $DIR/malformed-attrs.rs:149:5
688 --> $DIR/malformed-attrs.rs:148:5
689689 |
690690LL | #[type_const = 1]
691691 | ^^^^^^^^^^^^^---^
......@@ -694,7 +694,7 @@ LL | #[type_const = 1]
694694 | help: must be of the form: `#[type_const]`
695695
696696error: attribute should be applied to `const fn`
697 --> $DIR/malformed-attrs.rs:31:1
697 --> $DIR/malformed-attrs.rs:32:1
698698 |
699699LL | #[rustc_allow_const_fn_unstable]
700700 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -706,7 +706,7 @@ LL | | }
706706 | |_- not a `const fn`
707707
708708warning: attribute should be applied to an `extern` block with non-Rust ABI
709 --> $DIR/malformed-attrs.rs:84:1
709 --> $DIR/malformed-attrs.rs:83:1
710710 |
711711LL | #[link]
712712 | ^^^^^^^
......@@ -733,7 +733,7 @@ LL | #[repr]
733733 | ^^^^^^^
734734
735735warning: missing options for `on_unimplemented` attribute
736 --> $DIR/malformed-attrs.rs:144:1
736 --> $DIR/malformed-attrs.rs:143:1
737737 |
738738LL | #[diagnostic::on_unimplemented]
739739 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -742,7 +742,7 @@ LL | #[diagnostic::on_unimplemented]
742742 = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default
743743
744744warning: malformed `on_unimplemented` attribute
745 --> $DIR/malformed-attrs.rs:146:1
745 --> $DIR/malformed-attrs.rs:145:1
746746 |
747747LL | #[diagnostic::on_unimplemented = 1]
748748 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
......@@ -750,14 +750,16 @@ LL | #[diagnostic::on_unimplemented = 1]
750750 = help: only `message`, `note` and `label` are allowed as options
751751
752752error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
753 --> $DIR/malformed-attrs.rs:41:1
753 --> $DIR/malformed-attrs.rs:42:1
754754 |
755755LL | #[doc]
756756 | ^^^^^^
757757 |
758 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
759 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
760 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
758note: the lint level is defined here
759 --> $DIR/malformed-attrs.rs:3:9
760 |
761LL | #![deny(invalid_doc_attributes)]
762 | ^^^^^^^^^^^^^^^^^^^^^^
761763
762764error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
763765 --> $DIR/malformed-attrs.rs:52:1
......@@ -767,6 +769,7 @@ LL | #[inline = 5]
767769 |
768770 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
769771 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
772 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
770773
771774warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]`
772775 --> $DIR/malformed-attrs.rs:74:1
......@@ -775,7 +778,7 @@ LL | #[crate_name]
775778 | ^^^^^^^^^^^^^
776779 |
777780note: this attribute does not have an `!`, which means it is applied to this function
778 --> $DIR/malformed-attrs.rs:116:1
781 --> $DIR/malformed-attrs.rs:115:1
779782 |
780783LL | / fn test() {
781784LL | | #[coroutine = 63] || {}
......@@ -788,12 +791,9 @@ error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `
788791 |
789792LL | #[doc]
790793 | ^^^^^^
791 |
792 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
793 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
794794
795795warning: `#[link_name]` attribute cannot be used on functions
796 --> $DIR/malformed-attrs.rs:88:1
796 --> $DIR/malformed-attrs.rs:87:1
797797 |
798798LL | #[link_name]
799799 | ^^^^^^^^^^^^
......@@ -802,7 +802,7 @@ LL | #[link_name]
802802 = help: `#[link_name]` can be applied to foreign functions and foreign statics
803803
804804error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
805 --> $DIR/malformed-attrs.rs:98:1
805 --> $DIR/malformed-attrs.rs:97:1
806806 |
807807LL | #[ignore()]
808808 | ^^^^^^^^^^^
......@@ -811,7 +811,7 @@ LL | #[ignore()]
811811 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
812812
813813warning: `#[no_implicit_prelude]` attribute cannot be used on functions
814 --> $DIR/malformed-attrs.rs:101:1
814 --> $DIR/malformed-attrs.rs:100:1
815815 |
816816LL | #[no_implicit_prelude = 23]
817817 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -820,13 +820,13 @@ LL | #[no_implicit_prelude = 23]
820820 = help: `#[no_implicit_prelude]` can be applied to crates and modules
821821
822822warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
823 --> $DIR/malformed-attrs.rs:155:1
823 --> $DIR/malformed-attrs.rs:154:1
824824 |
825825LL | #[diagnostic::do_not_recommend()]
826826 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
827827
828828warning: `#[automatically_derived]` attribute cannot be used on modules
829 --> $DIR/malformed-attrs.rs:196:1
829 --> $DIR/malformed-attrs.rs:195:1
830830 |
831831LL | #[automatically_derived = 18]
832832 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -835,7 +835,7 @@ LL | #[automatically_derived = 18]
835835 = help: `#[automatically_derived]` can only be applied to trait impl blocks
836836
837837error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
838 --> $DIR/malformed-attrs.rs:230:1
838 --> $DIR/malformed-attrs.rs:229:1
839839 |
840840LL | #[ignore = 1]
841841 | ^^^^^^^^^^^^^
......@@ -844,7 +844,7 @@ LL | #[ignore = 1]
844844 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
845845
846846error[E0308]: mismatched types
847 --> $DIR/malformed-attrs.rs:117:23
847 --> $DIR/malformed-attrs.rs:116:23
848848 |
849849LL | fn test() {
850850 | - help: a return type might be missing here: `-> _`
......@@ -852,24 +852,13 @@ LL | #[coroutine = 63] || {}
852852 | ^^^^^ expected `()`, found coroutine
853853 |
854854 = note: expected unit type `()`
855 found coroutine `{coroutine@$DIR/malformed-attrs.rs:117:23: 117:25}`
855 found coroutine `{coroutine@$DIR/malformed-attrs.rs:116:23: 116:25}`
856856
857857error: aborting due to 76 previous errors; 8 warnings emitted
858858
859859Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805.
860860For more information about an error, try `rustc --explain E0308`.
861861Future incompatibility report: Future breakage diagnostic:
862error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
863 --> $DIR/malformed-attrs.rs:41:1
864 |
865LL | #[doc]
866 | ^^^^^^
867 |
868 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
869 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
870 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
871
872Future breakage diagnostic:
873862error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
874863 --> $DIR/malformed-attrs.rs:52:1
875864 |
......@@ -880,20 +869,9 @@ LL | #[inline = 5]
880869 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
881870 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
882871
883Future breakage diagnostic:
884error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
885 --> $DIR/malformed-attrs.rs:77:1
886 |
887LL | #[doc]
888 | ^^^^^^
889 |
890 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
891 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
892 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
893
894872Future breakage diagnostic:
895873error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
896 --> $DIR/malformed-attrs.rs:98:1
874 --> $DIR/malformed-attrs.rs:97:1
897875 |
898876LL | #[ignore()]
899877 | ^^^^^^^^^^^
......@@ -904,7 +882,7 @@ LL | #[ignore()]
904882
905883Future breakage diagnostic:
906884error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
907 --> $DIR/malformed-attrs.rs:230:1
885 --> $DIR/malformed-attrs.rs:229:1
908886 |
909887LL | #[ignore = 1]
910888 | ^^^^^^^^^^^^^
tests/ui/check-cfg/values-target-json.rs+2-1
......@@ -4,7 +4,8 @@
44//@ check-pass
55//@ no-auto-check-cfg
66//@ needs-llvm-components: x86
7//@ compile-flags: --crate-type=lib --check-cfg=cfg() --target={{src-base}}/check-cfg/my-awesome-platform.json
7//@ compile-flags: --crate-type=lib --check-cfg=cfg()
8//@ compile-flags: -Zunstable-options --target={{src-base}}/check-cfg/my-awesome-platform.json
89//@ ignore-backends: gcc
910
1011#![feature(lang_items, no_core, auto_traits, rustc_attrs)]
tests/ui/feature-gates/feature-gate-link-arg-attribute.in_flag.stderr+1-1
......@@ -1,2 +1,2 @@
1error: unknown linking modifier `link-arg`, expected one of: bundle, verbatim, whole-archive, as-needed
1error: unknown linking modifier `link-arg`, expected one of: bundle, verbatim, whole-archive, as-needed, export-symbols
22
tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.rs+1
......@@ -1,3 +1,4 @@
1#![deny(invalid_doc_attributes)]
12#![feature(external_doc)] //~ ERROR feature has been removed
23#![doc(include("README.md"))] //~ ERROR unknown `doc` attribute `include`
34
tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.stderr+7-3
......@@ -1,5 +1,5 @@
11error[E0557]: feature has been removed
2 --> $DIR/removed-features-note-version-and-pr-issue-141619.rs:1:12
2 --> $DIR/removed-features-note-version-and-pr-issue-141619.rs:2:12
33 |
44LL | #![feature(external_doc)]
55 | ^^^^^^^^^^^^ feature has been removed
......@@ -8,12 +8,16 @@ LL | #![feature(external_doc)]
88 = note: use #[doc = include_str!("filename")] instead, which handles macro invocations
99
1010error: unknown `doc` attribute `include`
11 --> $DIR/removed-features-note-version-and-pr-issue-141619.rs:2:8
11 --> $DIR/removed-features-note-version-and-pr-issue-141619.rs:3:8
1212 |
1313LL | #![doc(include("README.md"))]
1414 | ^^^^^^^
1515 |
16 = note: `#[deny(invalid_doc_attributes)]` on by default
16note: the lint level is defined here
17 --> $DIR/removed-features-note-version-and-pr-issue-141619.rs:1:9
18 |
19LL | #![deny(invalid_doc_attributes)]
20 | ^^^^^^^^^^^^^^^^^^^^^^
1721
1822error: aborting due to 2 previous errors
1923
tests/ui/link-native-libs/link-arg-error2.rs created+5
......@@ -0,0 +1,5 @@
1//@ compile-flags: -l link-arg:+export-symbols=arg -Z unstable-options
2
3fn main() {}
4
5//~? ERROR linking modifier `export-symbols` is only compatible with `static` linking kind
tests/ui/link-native-libs/link-arg-error2.stderr created+2
......@@ -0,0 +1,2 @@
1error: linking modifier `export-symbols` is only compatible with `static` linking kind
2
tests/ui/link-native-libs/link-arg-from-rs2.rs created+7
......@@ -0,0 +1,7 @@
1#![feature(link_arg_attribute)]
2
3#[link(kind = "link-arg", name = "arg", modifiers = "+export-symbols")]
4//~^ ERROR linking modifier `export-symbols` is only compatible with `static` linking kind
5extern "C" {}
6
7pub fn main() {}
tests/ui/link-native-libs/link-arg-from-rs2.stderr created+8
......@@ -0,0 +1,8 @@
1error: linking modifier `export-symbols` is only compatible with `static` linking kind
2 --> $DIR/link-arg-from-rs2.rs:3:53
3 |
4LL | #[link(kind = "link-arg", name = "arg", modifiers = "+export-symbols")]
5 | ^^^^^^^^^^^^^^^^^
6
7error: aborting due to 1 previous error
8
tests/ui/link-native-libs/link-attr-validation-late.stderr+3-3
......@@ -178,13 +178,13 @@ LL | #[link(name = "...", wasm_import_module())]
178178 |
179179 = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
180180
181error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed
181error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols
182182 --> $DIR/link-attr-validation-late.rs:31:34
183183 |
184184LL | #[link(name = "...", modifiers = "")]
185185 | ^^
186186
187error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed
187error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols
188188 --> $DIR/link-attr-validation-late.rs:32:34
189189 |
190190LL | #[link(name = "...", modifiers = "no-plus-minus")]
......@@ -196,7 +196,7 @@ error[E0539]: malformed `link` attribute input
196196LL | #[link(name = "...", modifiers = "+unknown")]
197197 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------^^
198198 | |
199 | valid arguments are "bundle", "verbatim", "whole-archive" or "as-needed"
199 | valid arguments are "bundle", "export-symbols", "verbatim", "whole-archive" or "as-needed"
200200 |
201201 = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
202202
tests/ui/link-native-libs/modifiers-bad.blank.stderr+1-1
......@@ -1,2 +1,2 @@
1error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed
1error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols
22
tests/ui/link-native-libs/modifiers-bad.no-prefix.stderr+1-1
......@@ -1,2 +1,2 @@
1error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed
1error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed, export-symbols
22
tests/ui/link-native-libs/modifiers-bad.prefix-only.stderr+1-1
......@@ -1,2 +1,2 @@
1error: unknown linking modifier ``, expected one of: bundle, verbatim, whole-archive, as-needed
1error: unknown linking modifier ``, expected one of: bundle, verbatim, whole-archive, as-needed, export-symbols
22
tests/ui/link-native-libs/modifiers-bad.unknown.stderr+1-1
......@@ -1,2 +1,2 @@
1error: unknown linking modifier `ferris`, expected one of: bundle, verbatim, whole-archive, as-needed
1error: unknown linking modifier `ferris`, expected one of: bundle, verbatim, whole-archive, as-needed, export-symbols
22
tests/ui/malformed/malformed-regressions.rs+2-1
......@@ -1,5 +1,6 @@
1#![deny(invalid_doc_attributes)]
2
13#[doc] //~ ERROR valid forms for the attribute are
2//~^ WARN this was previously accepted
34#[ignore()] //~ ERROR valid forms for the attribute are
45//~^ WARN this was previously accepted
56#[inline = ""] //~ ERROR valid forms for the attribute are
tests/ui/malformed/malformed-regressions.stderr+14-22
......@@ -1,5 +1,5 @@
11error[E0539]: malformed `link` attribute input
2 --> $DIR/malformed-regressions.rs:7:1
2 --> $DIR/malformed-regressions.rs:8:1
33 |
44LL | #[link]
55 | ^^^^^^^ expected this to be a list
......@@ -7,7 +7,7 @@ LL | #[link]
77 = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
88
99error[E0539]: malformed `link` attribute input
10 --> $DIR/malformed-regressions.rs:10:1
10 --> $DIR/malformed-regressions.rs:11:1
1111 |
1212LL | #[link = ""]
1313 | ^^^^^^^----^
......@@ -17,7 +17,7 @@ LL | #[link = ""]
1717 = note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
1818
1919warning: attribute should be applied to an `extern` block with non-Rust ABI
20 --> $DIR/malformed-regressions.rs:7:1
20 --> $DIR/malformed-regressions.rs:8:1
2121 |
2222LL | #[link]
2323 | ^^^^^^^
......@@ -29,26 +29,29 @@ LL | fn main() {}
2929 = note: requested on the command line with `-W unused-attributes`
3030
3131error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
32 --> $DIR/malformed-regressions.rs:1:1
32 --> $DIR/malformed-regressions.rs:3:1
3333 |
3434LL | #[doc]
3535 | ^^^^^^
3636 |
37 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
38 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
39 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
37note: the lint level is defined here
38 --> $DIR/malformed-regressions.rs:1:9
39 |
40LL | #![deny(invalid_doc_attributes)]
41 | ^^^^^^^^^^^^^^^^^^^^^^
4042
4143error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
42 --> $DIR/malformed-regressions.rs:3:1
44 --> $DIR/malformed-regressions.rs:4:1
4345 |
4446LL | #[ignore()]
4547 | ^^^^^^^^^^^
4648 |
4749 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4850 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
51 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
4952
5053error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
51 --> $DIR/malformed-regressions.rs:5:1
54 --> $DIR/malformed-regressions.rs:6:1
5255 |
5356LL | #[inline = ""]
5457 | ^^^^^^^^^^^^^^
......@@ -60,19 +63,8 @@ error: aborting due to 5 previous errors; 1 warning emitted
6063
6164For more information about this error, try `rustc --explain E0539`.
6265Future incompatibility report: Future breakage diagnostic:
63error: valid forms for the attribute are `#[doc = "string"]`, `#[doc(alias)]`, `#[doc(attribute)]`, `#[doc(auto_cfg)]`, `#[doc(cfg)]`, `#[doc(fake_variadic)]`, `#[doc(hidden)]`, `#[doc(html_favicon_url)]`, `#[doc(html_logo_url)]`, `#[doc(html_no_source)]`, `#[doc(html_playground_url)]`, `#[doc(html_root_url)]`, `#[doc(include)]`, `#[doc(inline)]`, `#[doc(issue_tracker_base_url)]`, `#[doc(keyword)]`, `#[doc(masked)]`, `#[doc(no_default_passes)]`, `#[doc(no_inline)]`, `#[doc(notable_trait)]`, `#[doc(passes)]`, `#[doc(plugins)]`, `#[doc(rust_logo)]`, `#[doc(search_unbox)]`, `#[doc(spotlight)]`, and `#[doc(test)]`
64 --> $DIR/malformed-regressions.rs:1:1
65 |
66LL | #[doc]
67 | ^^^^^^
68 |
69 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
70 = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
71 = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default
72
73Future breakage diagnostic:
7466error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
75 --> $DIR/malformed-regressions.rs:3:1
67 --> $DIR/malformed-regressions.rs:4:1
7668 |
7769LL | #[ignore()]
7870 | ^^^^^^^^^^^
......@@ -83,7 +75,7 @@ LL | #[ignore()]
8375
8476Future breakage diagnostic:
8577error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
86 --> $DIR/malformed-regressions.rs:5:1
78 --> $DIR/malformed-regressions.rs:6:1
8779 |
8880LL | #[inline = ""]
8981 | ^^^^^^^^^^^^^^
tests/ui/malformed/malformed-special-attrs.rs+2
......@@ -1,3 +1,5 @@
1#![deny(invalid_doc_attributes)]
2
13#[cfg_attr] //~ ERROR malformed `cfg_attr` attribute
24struct S1;
35
tests/ui/malformed/malformed-special-attrs.stderr+4-4
......@@ -1,5 +1,5 @@
11error[E0539]: malformed `cfg_attr` attribute input
2 --> $DIR/malformed-special-attrs.rs:1:1
2 --> $DIR/malformed-special-attrs.rs:3:1
33 |
44LL | #[cfg_attr]
55 | ^^^^^^^^^^^
......@@ -10,7 +10,7 @@ LL | #[cfg_attr]
1010 = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
1111
1212error[E0539]: malformed `cfg_attr` attribute input
13 --> $DIR/malformed-special-attrs.rs:4:1
13 --> $DIR/malformed-special-attrs.rs:6:1
1414 |
1515LL | #[cfg_attr = ""]
1616 | ^^^^^^^^^^^^^^^^
......@@ -21,13 +21,13 @@ LL | #[cfg_attr = ""]
2121 = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
2222
2323error: malformed `derive` attribute input
24 --> $DIR/malformed-special-attrs.rs:7:1
24 --> $DIR/malformed-special-attrs.rs:9:1
2525 |
2626LL | #[derive]
2727 | ^^^^^^^^^ help: must be of the form: `#[derive(Trait1, Trait2, ...)]`
2828
2929error: malformed `derive` attribute input
30 --> $DIR/malformed-special-attrs.rs:10:1
30 --> $DIR/malformed-special-attrs.rs:12:1
3131 |
3232LL | #[derive = ""]
3333 | ^^^^^^^^^^^^^^ help: must be of the form: `#[derive(Trait1, Trait2, ...)]`
tests/ui/repr/invalid_repr_list_help.rs+1
......@@ -1,3 +1,4 @@
1#![deny(invalid_doc_attributes)]
12#![crate_type = "lib"]
23
34#[repr(uwu)] //~ERROR: unrecognized representation hint
tests/ui/repr/invalid_repr_list_help.stderr+11-7
......@@ -1,5 +1,5 @@
11error[E0552]: unrecognized representation hint
2 --> $DIR/invalid_repr_list_help.rs:3:8
2 --> $DIR/invalid_repr_list_help.rs:4:8
33 |
44LL | #[repr(uwu)]
55 | ^^^
......@@ -8,7 +8,7 @@ LL | #[repr(uwu)]
88 = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
99
1010error[E0552]: unrecognized representation hint
11 --> $DIR/invalid_repr_list_help.rs:6:8
11 --> $DIR/invalid_repr_list_help.rs:7:8
1212 |
1313LL | #[repr(uwu = "a")]
1414 | ^^^^^^^^^
......@@ -17,7 +17,7 @@ LL | #[repr(uwu = "a")]
1717 = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
1818
1919error[E0552]: unrecognized representation hint
20 --> $DIR/invalid_repr_list_help.rs:9:8
20 --> $DIR/invalid_repr_list_help.rs:10:8
2121 |
2222LL | #[repr(uwu(4))]
2323 | ^^^^^^
......@@ -26,7 +26,7 @@ LL | #[repr(uwu(4))]
2626 = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
2727
2828error[E0552]: unrecognized representation hint
29 --> $DIR/invalid_repr_list_help.rs:14:8
29 --> $DIR/invalid_repr_list_help.rs:15:8
3030 |
3131LL | #[repr(uwu, u8)]
3232 | ^^^
......@@ -35,7 +35,7 @@ LL | #[repr(uwu, u8)]
3535 = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
3636
3737error[E0552]: unrecognized representation hint
38 --> $DIR/invalid_repr_list_help.rs:19:8
38 --> $DIR/invalid_repr_list_help.rs:20:8
3939 |
4040LL | #[repr(uwu)]
4141 | ^^^
......@@ -44,12 +44,16 @@ LL | #[repr(uwu)]
4444 = note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
4545
4646error: unknown `doc` attribute `owo`
47 --> $DIR/invalid_repr_list_help.rs:20:7
47 --> $DIR/invalid_repr_list_help.rs:21:7
4848 |
4949LL | #[doc(owo)]
5050 | ^^^
5151 |
52 = note: `#[deny(invalid_doc_attributes)]` on by default
52note: the lint level is defined here
53 --> $DIR/invalid_repr_list_help.rs:1:9
54 |
55LL | #![deny(invalid_doc_attributes)]
56 | ^^^^^^^^^^^^^^^^^^^^^^
5357
5458error: aborting due to 6 previous errors
5559