Auto merge of #155145 - jhpratt:rollup-atReM8h, r=jhpratt

Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#154827 (distinguish "expected a single argument" and "expected an argument" on attribute parsing)
 - rust-lang/rust#155104 (bootstrap: auto-patch libgccjit.so for NixOS)
 - rust-lang/rust#155120 (Use a linting node closer the parsing of `#[cfg_attr]`)
This commit is contained in:
bors
2026-04-11 09:03:13 +00:00
35 changed files with 194 additions and 160 deletions
@@ -2,7 +2,7 @@
use rustc_ast::token::Delimiter;
use rustc_ast::tokenstream::DelimSpan;
use rustc_ast::{AttrItem, Attribute, CRATE_NODE_ID, LitKind, ast, token};
use rustc_ast::{AttrItem, Attribute, LitKind, ast, token};
use rustc_errors::{Applicability, PResult, msg};
use rustc_feature::{
AttrSuggestionStyle, AttributeTemplate, Features, GatedCfg, find_gated_cfg, template,
@@ -78,7 +78,7 @@ pub fn parse_cfg<S: Stage>(
}
}
adcx.expected_single_argument(list.span);
adcx.expected_single_argument(list.span, list.len());
return None;
};
parse_cfg_entry(cx, single).ok()
@@ -93,7 +93,7 @@ pub fn parse_cfg_entry<S: Stage>(
ArgParser::List(list) => match meta.path().word_sym() {
Some(sym::not) => {
let Some(single) = list.single() else {
return Err(cx.adcx().expected_single_argument(list.span));
return Err(cx.adcx().expected_single_argument(list.span, list.len()));
};
CfgEntry::Not(Box::new(parse_cfg_entry(cx, single)?), list.span)
}
@@ -324,12 +324,13 @@ pub fn parse_cfg_attr(
cfg_attr: &Attribute,
sess: &Session,
features: Option<&Features>,
lint_node_id: ast::NodeId,
) -> Option<(CfgEntry, Vec<(AttrItem, Span)>)> {
match cfg_attr.get_normal_item().args.unparsed_ref().unwrap() {
ast::AttrArgs::Delimited(ast::DelimArgs { dspan, delim, tokens }) if !tokens.is_empty() => {
check_cfg_attr_bad_delim(&sess.psess, *dspan, *delim);
match parse_in(&sess.psess, tokens.clone(), "`cfg_attr` input", |p| {
parse_cfg_attr_internal(p, sess, features, cfg_attr)
parse_cfg_attr_internal(p, sess, features, lint_node_id, cfg_attr)
}) {
Ok(r) => return Some(r),
Err(e) => {
@@ -390,6 +391,7 @@ fn parse_cfg_attr_internal<'a>(
parser: &mut Parser<'a>,
sess: &'a Session,
features: Option<&Features>,
lint_node_id: ast::NodeId,
attribute: &Attribute,
) -> PResult<'a, (CfgEntry, Vec<(ast::AttrItem, Span)>)> {
// Parse cfg predicate
@@ -410,7 +412,7 @@ fn parse_cfg_attr_internal<'a>(
Some(attribute.get_normal_item().unsafety),
ParsedDescription::Attribute,
pred_span,
CRATE_NODE_ID,
lint_node_id,
Target::Crate,
features,
ShouldEmit::ErrorsAndLints { recovery: Recovery::Allowed },
@@ -23,16 +23,7 @@ impl<S: Stage> SingleAttributeParser<S> for OptimizeParser {
const TEMPLATE: AttributeTemplate = template!(List: &["size", "speed", "none"]);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(list) = args.list() else {
let attr_span = cx.attr_span;
cx.adcx().expected_list(attr_span, args);
return None;
};
let Some(single) = list.single() else {
cx.adcx().expected_single_argument(list.span);
return None;
};
let single = cx.single_element_list(args, cx.attr_span)?;
let res = match single.meta_item().and_then(|i| i.path().word().map(|i| i.name)) {
Some(sym::size) => OptimizeAttr::Size,
@@ -84,22 +75,13 @@ impl<S: Stage> SingleAttributeParser<S> for CoverageParser {
const TEMPLATE: AttributeTemplate = template!(OneOf: &[sym::off, sym::on]);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(args) = args.list() else {
let attr_span = cx.attr_span;
cx.adcx().expected_specific_argument_and_list(attr_span, &[sym::on, sym::off]);
return None;
};
let Some(arg) = args.single() else {
cx.adcx().expected_single_argument(args.span);
return None;
};
let arg = cx.single_element_list(args, cx.attr_span)?;
let mut fail_incorrect_argument =
|span| cx.adcx().expected_specific_argument(span, &[sym::on, sym::off]);
let Some(arg) = arg.meta_item() else {
fail_incorrect_argument(args.span);
fail_incorrect_argument(arg.span());
return None;
};
@@ -389,7 +371,7 @@ impl<S: Stage> AttributeParser<S> for UsedParser {
ArgParser::NoArgs => UsedBy::Default,
ArgParser::List(list) => {
let Some(l) = list.single() else {
cx.adcx().expected_single_argument(list.span);
cx.adcx().expected_single_argument(list.span, list.len());
return;
};
@@ -750,7 +732,7 @@ fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<Attrib
let mut entry = None;
if meta_item_list.len() == 0 {
cx.adcx().expected_list(meta_item_list.span, args);
cx.adcx().expected_at_least_one_argument(meta_item_list.span);
return None;
}
@@ -20,15 +20,7 @@ fn extend(
cx: &mut AcceptContext<'_, '_, S>,
args: &ArgParser,
) -> impl IntoIterator<Item = Self::Item> {
let Some(l) = args.list() else {
let attr_span = cx.attr_span;
cx.adcx().expected_list(attr_span, args);
return None;
};
let Some(single) = l.single() else {
cx.adcx().expected_single_argument(l.span);
return None;
};
let single = cx.single_element_list(args, cx.attr_span)?;
let Some(mi) = single.meta_item() else {
cx.adcx().expected_name_value(single.span(), None);
return None;
@@ -38,7 +38,7 @@ fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<Attrib
ArgParser::NoArgs => Some(AttributeKind::Inline(InlineAttr::Hint, cx.attr_span)),
ArgParser::List(list) => {
let Some(l) = list.single() else {
cx.adcx().expected_single_argument(list.span);
cx.adcx().expected_single_argument(list.span, list.len());
return None;
};
@@ -80,7 +80,7 @@ fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<Attrib
ArgParser::NoArgs => None,
ArgParser::List(list) => {
let Some(l) = list.single() else {
cx.adcx().expected_single_argument(list.span);
cx.adcx().expected_single_argument(list.span, list.len());
return None;
};
@@ -20,11 +20,7 @@ impl<S: Stage> SingleAttributeParser<S> for InstructionSetParser {
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
const POSSIBLE_SYMBOLS: &[Symbol] = &[sym::arm_a32, sym::arm_t32];
const POSSIBLE_ARM_SYMBOLS: &[Symbol] = &[sym::a32, sym::t32];
let Some(maybe_meta_item) = args.list().and_then(MetaItemListParser::single) else {
let attr_span = cx.attr_span;
cx.adcx().expected_specific_argument(attr_span, POSSIBLE_SYMBOLS);
return None;
};
let maybe_meta_item = cx.single_element_list(args, cx.attr_span)?;
let Some(meta_item) = maybe_meta_item.meta_item() else {
cx.adcx().expected_specific_argument(maybe_meta_item.span(), POSSIBLE_SYMBOLS);
@@ -388,12 +388,7 @@ fn parse_link_cfg<S: Stage>(
cx.adcx().duplicate_key(item.span(), sym::cfg);
return true;
}
let Some(link_cfg) = item.args().list() else {
cx.adcx().expected_list(item.span(), item.args());
return true;
};
let Some(link_cfg) = link_cfg.single() else {
cx.adcx().expected_single_argument(item.span());
let Some(link_cfg) = cx.single_element_list(item.args(), item.span()) else {
return true;
};
if !features.link_cfg() {
@@ -175,15 +175,7 @@ impl<S: Stage> SingleAttributeParser<S> for CollapseDebugInfoParser {
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::MacroDef)]);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(list) = args.list() else {
let attr_span = cx.attr_span;
cx.adcx().expected_list(attr_span, args);
return None;
};
let Some(single) = list.single() else {
cx.adcx().expected_single_argument(list.span);
return None;
};
let single = cx.single_element_list(args, cx.attr_span)?;
let Some(mi) = single.meta_item() else {
cx.adcx().expected_not_literal(single.span());
return None;
@@ -82,7 +82,7 @@ fn extract_value<S: Stage>(
}
let Some(val) = arg.name_value() else {
cx.adcx().expected_single_argument(arg.span().unwrap_or(span));
cx.adcx().expected_name_value(span, Some(key));
*failed = true;
return;
};
@@ -297,7 +297,7 @@ fn parse<S: Stage>(&mut self, cx: &mut AcceptContext<'_, '_, S>, args: &ArgParse
}
ArgParser::List(list) => {
let Some(align) = list.single() else {
cx.adcx().expected_single_argument(list.span);
cx.adcx().expected_single_argument(list.span, list.len());
return;
};
@@ -194,11 +194,7 @@ impl<S: Stage> SingleAttributeParser<S> for RustcLintOptDenyFieldAccessParser {
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Field)]);
const TEMPLATE: AttributeTemplate = template!(Word);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(arg) = args.list().and_then(MetaItemListParser::single) else {
let attr_span = cx.attr_span;
cx.adcx().expected_single_argument(attr_span);
return None;
};
let arg = cx.single_element_list(args, cx.attr_span)?;
let MetaItemOrLitParser::Lit(MetaItemLit { kind: LitKind::Str(lint_message, _), .. }) = arg
else {
@@ -374,19 +370,10 @@ impl<S: Stage> SingleAttributeParser<S> for RustcDeprecatedSafe2024Parser {
const TEMPLATE: AttributeTemplate = template!(List: &[r#"audit_that = "...""#]);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(args) = args.list() else {
let attr_span = cx.attr_span;
cx.adcx().expected_list(attr_span, args);
return None;
};
let Some(single) = args.single() else {
cx.adcx().expected_single_argument(args.span);
return None;
};
let single = cx.single_element_list(args, cx.attr_span)?;
let Some(arg) = single.meta_item() else {
cx.adcx().expected_name_value(args.span, None);
cx.adcx().expected_name_value(single.span(), None);
return None;
};
@@ -955,7 +942,7 @@ fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<Attrib
ArgParser::List(list) => {
let Some(item) = list.single() else {
let attr_span = cx.attr_span;
cx.adcx().expected_single_argument(attr_span);
cx.adcx().expected_single_argument(attr_span, list.len());
return None;
};
let Some(ident) = item.meta_item().and_then(|item| item.ident()) else {
@@ -1015,11 +1002,7 @@ fn extend(
if !cx.cx.sess.opts.unstable_opts.query_dep_graph {
cx.emit_err(AttributeRequiresOpt { span: cx.attr_span, opt: "-Z query-dep-graph" });
}
let Some(item) = args.list().and_then(|l| l.single()) else {
let inner_span = cx.inner_span;
cx.adcx().expected_single_argument(inner_span);
return None;
};
let item = cx.single_element_list(args, cx.attr_span)?;
let Some(ident) = item.meta_item().and_then(|item| item.ident()) else {
cx.adcx().expected_identifier(item.span());
return None;
@@ -72,7 +72,7 @@ fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<Attrib
}
ArgParser::List(list) => {
let Some(single) = list.single() else {
cx.adcx().expected_single_argument(list.span);
cx.adcx().expected_single_argument(list.span, list.len());
return None;
};
let Some(single) = single.meta_item() else {
@@ -150,7 +150,7 @@ fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<Attrib
let Some(arg) = args.single() else {
let attr_span = cx.attr_span;
cx.adcx().expected_single_argument(attr_span);
cx.adcx().expected_single_argument(attr_span, args.len());
return None;
};
@@ -208,16 +208,7 @@ impl<S: Stage> SingleAttributeParser<S> for TestRunnerParser {
const TEMPLATE: AttributeTemplate = template!(List: &["path"]);
fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<AttributeKind> {
let Some(list) = args.list() else {
let attr_span = cx.attr_span;
cx.adcx().expected_list(attr_span, args);
return None;
};
let Some(single) = list.single() else {
cx.adcx().expected_single_argument(list.span);
return None;
};
let single = cx.single_element_list(args, cx.attr_span)?;
let Some(meta) = single.meta_item() else {
cx.adcx().expected_not_literal(single.span());
@@ -41,15 +41,7 @@ pub(crate) fn parse_single_integer<S: Stage>(
cx: &mut AcceptContext<'_, '_, S>,
args: &ArgParser,
) -> Option<u128> {
let Some(list) = args.list() else {
let attr_span = cx.attr_span;
cx.adcx().expected_list(attr_span, args);
return None;
};
let Some(single) = list.single() else {
cx.adcx().expected_single_argument(list.span);
return None;
};
let single = cx.single_element_list(args, cx.attr_span)?;
let Some(lit) = single.lit() else {
cx.adcx().expected_integer_literal(single.span());
return None;
+50 -4
View File
@@ -60,7 +60,7 @@
use crate::attributes::traits::*;
use crate::attributes::transparency::*;
use crate::attributes::{AttributeParser as _, Combine, Single, WithoutArgs};
use crate::parser::{ArgParser, RefPathParser};
use crate::parser::{ArgParser, MetaItemOrLitParser, RefPathParser};
use crate::session_diagnostics::{
AttributeParseError, AttributeParseErrorReason, AttributeParseErrorSuggestions,
ParsedDescription,
@@ -506,6 +506,36 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
pub(crate) fn adcx(&mut self) -> AttributeDiagnosticContext<'_, 'f, 'sess, S> {
AttributeDiagnosticContext { ctx: self, custom_suggestions: Vec::new() }
}
/// Asserts that this MetaItem is a list that contains a single element. Emits an error and
/// returns `None` if it is not the case.
///
/// Some examples:
///
/// - In `#[allow(warnings)]`, `warnings` is returned
/// - In `#[cfg_attr(docsrs, doc = "foo")]`, `None` is returned, "expected a single argument
/// here" is emitted.
/// - In `#[cfg()]`, `None` is returned, "expected an argument here" is emitted.
///
/// The provided span is used as a fallback for diagnostic generation in case `arg` does not
/// contain any. It should be the span of the node that contains `arg`.
pub(crate) fn single_element_list<'arg>(
&mut self,
arg: &'arg ArgParser,
span: Span,
) -> Option<&'arg MetaItemOrLitParser> {
let ArgParser::List(l) = arg else {
self.adcx().expected_list(span, arg);
return None;
};
let Some(single) = l.single() else {
self.adcx().expected_single_argument(l.span, l.len());
return None;
};
Some(single)
}
}
impl<'f, 'sess, S: Stage> Deref for AcceptContext<'f, 'sess, S> {
@@ -693,6 +723,8 @@ pub(crate) fn expected_integer_literal_in_range(
)
}
/// The provided span is used as a fallback in case `args` does not contain any. It should be
/// the span of the node that contains `args`.
pub(crate) fn expected_list(&mut self, span: Span, args: &ArgParser) -> ErrorGuaranteed {
let span = match args {
ArgParser::NoArgs => span,
@@ -749,14 +781,28 @@ pub(crate) fn duplicate_key(&mut self, span: Span, key: Symbol) -> ErrorGuarante
self.emit_parse_error(span, AttributeParseErrorReason::DuplicateKey(key))
}
/// An error that should be emitted when a [`MetaItemOrLitParser`](crate::parser::MetaItemOrLitParser)
/// An error that should be emitted when a [`MetaItemOrLitParser`]
/// was expected *not* to be a literal, but instead a meta item.
pub(crate) fn expected_not_literal(&mut self, span: Span) -> ErrorGuaranteed {
self.emit_parse_error(span, AttributeParseErrorReason::ExpectedNotLiteral)
}
pub(crate) fn expected_single_argument(&mut self, span: Span) -> ErrorGuaranteed {
self.emit_parse_error(span, AttributeParseErrorReason::ExpectedSingleArgument)
/// Signals that we expected exactly one argument and that we got either zero or two or more.
/// The `provided_arguments` argument allows distinguishing between "expected an argument here"
/// (when zero arguments are provided) and "expect a single argument here" (when two or more
/// arguments are provided).
pub(crate) fn expected_single_argument(
&mut self,
span: Span,
provided_arguments: usize,
) -> ErrorGuaranteed {
let reason = if provided_arguments == 0 {
AttributeParseErrorReason::ExpectedArgument
} else {
AttributeParseErrorReason::ExpectedSingleArgument
};
self.emit_parse_error(span, reason)
}
pub(crate) fn expected_at_least_one_argument(&mut self, span: Span) -> ErrorGuaranteed {
@@ -557,6 +557,7 @@ pub(crate) enum AttributeParseErrorReason<'a> {
upper_bound: isize,
},
ExpectedAtLeastOneArgument,
ExpectedArgument,
ExpectedSingleArgument,
ExpectedList,
ExpectedListOrNoArgs,
@@ -773,6 +774,10 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
diag.span_label(self.span, "expected a single argument here");
diag.code(E0805);
}
AttributeParseErrorReason::ExpectedArgument => {
diag.span_label(self.span, "expected an argument here");
diag.code(E0805);
}
AttributeParseErrorReason::ExpectedAtLeastOneArgument => {
diag.span_label(self.span, "expected at least 1 argument here");
}
+6 -3
View File
@@ -283,9 +283,12 @@ pub(crate) fn expand_cfg_attr(&self, cfg_attr: &Attribute, recursive: bool) -> V
trace_attr.replace_args(AttrItemKind::Parsed(EarlyParsedAttribute::CfgAttrTrace));
let trace_attr = attr_into_trace(trace_attr, sym::cfg_attr_trace);
let Some((cfg_predicate, expanded_attrs)) =
rustc_attr_parsing::parse_cfg_attr(cfg_attr, &self.sess, self.features)
else {
let Some((cfg_predicate, expanded_attrs)) = rustc_attr_parsing::parse_cfg_attr(
cfg_attr,
&self.sess,
self.features,
self.lint_node_id,
) else {
return vec![trace_attr];
};
+13
View File
@@ -398,6 +398,16 @@ pub fn download_ci_gcc(&self, gcc_sha: &str, root_dir: &Path) {
self.download_file(&format!("{base}/{gcc_sha}/{filename}"), &tarball, help_on_error);
}
self.unpack(&tarball, root_dir, "gcc-dev");
if self.should_fix_bins_and_dylibs() {
let lib_dir = root_dir.join("lib");
for entry in t!(fs::read_dir(lib_dir)) {
let lib = t!(entry).path();
if path_is_dylib(&lib) {
self.fix_bin_or_dylib(&lib);
}
}
}
}
}
@@ -677,6 +687,8 @@ fn fix_bin_or_dylib(out: &Path, fname: &Path, exec_ctx: &ExecutionContext) {
// bintools: Needed for the path of `ld-linux.so` (via `nix-support/dynamic-linker`).
// cc.lib: Needed similarly for `libstdc++.so.6`.
// zlib: Needed as a system dependency of `libLLVM-*.so`.
// zstd.out: Needed as a system dependency of `libgccjit.so`. `.out` is necessary as the
// default output of `zstd` derivation is `.bin`.
// patchelf: Needed for patching ELF binaries (see doc comment above).
let nix_deps_dir = out.join(".nix-deps");
const NIX_EXPR: &str = "
@@ -685,6 +697,7 @@ fn fix_bin_or_dylib(out: &Path, fname: &Path, exec_ctx: &ExecutionContext) {
name = \"rust-stage0-dependencies\";
paths = [
zlib
zstd.out
patchelf
stdenv.cc.bintools
stdenv.cc.cc.lib
+2 -2
View File
@@ -4,7 +4,7 @@ error[E0805]: malformed `doc` attribute input
LL | #[doc(cfg(), cfg(foo, bar))]
| ^^^^^^^^^--^^^^^^^^^^^^^^^^^
| |
| expected a single argument here
| expected an argument here
|
help: if the function should be disabled, use `#[cfg(false)]`
|
@@ -36,7 +36,7 @@ error[E0805]: malformed `doc` attribute input
LL | #[doc(cfg())]
| ^^^^^^^^^--^^
| |
| expected a single argument here
| expected an argument here
|
help: if the function should be disabled, use `#[cfg(false)]`
|
@@ -25,7 +25,7 @@ error[E0805]: malformed `inline` attribute input
LL | #[inline()]
| ^^^^^^^^--^
| |
| expected a single argument here
| expected an argument here
|
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute>
help: try changing it to one of the following valid forms of the attribute
+3 -3
View File
@@ -322,7 +322,7 @@ error[E0805]: malformed `used` attribute input
LL | #[used()]
| ^^^^^^--^
| |
| expected a single argument here
| expected an argument here
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -394,7 +394,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/malformed-attrs.rs:92:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -433,7 +433,7 @@ error[E0539]: malformed `instruction_set` attribute input
LL | #[instruction_set]
| ^^^^^^^^^^^^^^^^^^
| |
| valid arguments are `arm::a32` or `arm::t32`
| expected this to be a list
| help: must be of the form: `#[instruction_set(set)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute>
+1 -1
View File
@@ -24,7 +24,7 @@ error[E0805]: malformed `cfg` attribute input
LL | #[cfg()]
| ^^^^^--^
| |
| expected a single argument here
| expected an argument here
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
help: if the struct should be disabled, use `#[cfg(false)]`
+16
View File
@@ -0,0 +1,16 @@
// This test check that a module-level `#![allow(unexpected_cfgs)]` works
//
// Related to https://github.com/rust-lang/rust/issues/155118
//
//@ check-pass
//@ no-auto-check-cfg
//@ compile-flags: --check-cfg=cfg()
mod my_mod {
#![allow(unexpected_cfgs)]
#[cfg_attr(asan, sanitize(address = "off"))]
static MY_ITEM: () = ();
}
fn main() {}
@@ -12,7 +12,7 @@
#[cfg()]
//~^ ERROR malformed `cfg` attribute
//~| NOTE expected a single argument here
//~| NOTE expected an argument here
//~| NOTE for more information, visit
struct S3;
@@ -26,7 +26,7 @@ error[E0805]: malformed `cfg` attribute input
LL | #[cfg()]
| ^^^^^--^
| |
| expected a single argument here
| expected an argument here
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
help: if the struct should be disabled, use `#[cfg(false)]`
@@ -123,7 +123,7 @@ error[E0805]: malformed `inline` attribute input
LL | #[cfg_attr(true, inline())]
| ^^^^^^--
| |
| expected a single argument here
| expected an argument here
|
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute>
help: try changing it to one of the following valid forms of the attribute
@@ -2,7 +2,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/bad-attr-ice.rs:11:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -12,7 +12,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/bad-attr-ice.rs:11:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
+5 -3
View File
@@ -26,7 +26,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/bad-syntax.rs:17:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -39,7 +39,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/bad-syntax.rs:20:1
|
LL | #[coverage = true]
| ^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -56,7 +58,7 @@ error[E0805]: malformed `coverage` attribute input
LL | #[coverage()]
| ^^^^^^^^^^--^
| |
| expected a single argument here
| expected an argument here
|
help: try changing it to one of the following valid forms of the attribute
|
+36 -12
View File
@@ -2,7 +2,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:12:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -17,7 +19,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:17:5
|
LL | #![coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -32,7 +36,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:21:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -55,7 +61,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:26:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -70,7 +78,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:29:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -93,7 +103,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:35:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -116,7 +128,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:39:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -139,7 +153,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:44:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -162,7 +178,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:50:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -177,7 +195,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:53:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -200,7 +220,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:58:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -223,7 +245,9 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:64:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^-------^
| |
| expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
+12 -12
View File
@@ -2,7 +2,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:12:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -15,7 +15,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:17:5
|
LL | #![coverage]
| ^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -28,7 +28,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:21:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -49,7 +49,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:26:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -62,7 +62,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:29:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -83,7 +83,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:35:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -104,7 +104,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:39:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -125,7 +125,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:44:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -146,7 +146,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:50:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -159,7 +159,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:53:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -180,7 +180,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:58:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
@@ -201,7 +201,7 @@ error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:64:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
| ^^^^^^^^^^^ expected this to be a list
|
help: try changing it to one of the following valid forms of the attribute
|
+1 -1
View File
@@ -4,7 +4,7 @@ error[E0805]: malformed `inline` attribute input
LL | #[inline()]
| ^^^^^^^^--^
| |
| expected a single argument here
| expected an argument here
|
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute>
help: try changing it to one of the following valid forms of the attribute
+3 -3
View File
@@ -2,9 +2,9 @@ error[E0805]: malformed `link` attribute input
--> $DIR/issue-43926.rs:1:1
|
LL | #[link(name = "foo", cfg())]
| ^^^^^^^^^^^^^^^^^^^^^-----^^
| |
| expected a single argument here
| ^^^^^^^^^^^^^^^^^^^^^^^^--^^
| |
| expected an argument here
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
@@ -2,12 +2,12 @@
extern "C" {
#[link_ordinal()]
//~^ ERROR malformed `link_ordinal` attribute input
//~| NOTE expected a single argument
//~| NOTE expected an argument here
//~| NOTE for more information, visit
fn foo();
#[link_ordinal()]
//~^ ERROR malformed `link_ordinal` attribute input
//~| NOTE expected a single argument
//~| NOTE expected an argument here
//~| NOTE for more information, visit
static mut imported_variable: i32;
}
@@ -4,7 +4,7 @@ error[E0805]: malformed `link_ordinal` attribute input
LL | #[link_ordinal()]
| ^^^^^^^^^^^^^^--^
| | |
| | expected a single argument here
| | expected an argument here
| help: must be of the form: `#[link_ordinal(ordinal)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
@@ -15,7 +15,7 @@ error[E0805]: malformed `link_ordinal` attribute input
LL | #[link_ordinal()]
| ^^^^^^^^^^^^^^--^
| | |
| | expected a single argument here
| | expected an argument here
| help: must be of the form: `#[link_ordinal(ordinal)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
@@ -40,7 +40,7 @@ error[E0539]: malformed `patchable_function_entry` attribute input
LL | #[patchable_function_entry()]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^--^
| | |
| | expected this to be a list
| | expected at least 1 argument here
| help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
error[E0538]: malformed `patchable_function_entry` attribute input
+1 -1
View File
@@ -4,7 +4,7 @@ error[E0805]: malformed `cfg` macro input
LL | if cfg!(not()) { }
| ^^^^^^^^--^
| | |
| | expected a single argument here
| | expected an argument here
| help: must be of the form: `cfg!(predicate)`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>