rustc: Stricter checking for #[link] attributes

This commit is contained in:
Vadim Petrochenkov 2022-03-14 13:28:34 +03:00
parent 70b3681bf6
commit 4fa24bcb54
61 changed files with 787 additions and 548 deletions

View file

@ -396,37 +396,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
} }
} }
// Check for unstable modifiers on `#[link(..)]` attribute
if attr.has_name(sym::link) {
for nested_meta in attr.meta_item_list().unwrap_or_default() {
if nested_meta.has_name(sym::modifiers) {
if let Some(modifiers) = nested_meta.value_str() {
for modifier in modifiers.as_str().split(',') {
if let Some(modifier) = modifier.strip_prefix(&['+', '-']) {
macro_rules! gate_modifier { ($($name:literal => $feature:ident)*) => {
$(if modifier == $name {
let msg = concat!("`#[link(modifiers=\"", $name, "\")]` is unstable");
gate_feature_post!(
self,
$feature,
nested_meta.name_value_literal_span().unwrap(),
msg
);
})*
}}
gate_modifier!(
"bundle" => native_link_modifiers_bundle
"verbatim" => native_link_modifiers_verbatim
"as-needed" => native_link_modifiers_as_needed
);
}
}
}
}
}
}
// Emit errors for non-staged-api crates. // Emit errors for non-staged-api crates.
if !self.features.staged_api { if !self.features.staged_api {
if attr.has_name(sym::rustc_deprecated) if attr.has_name(sym::rustc_deprecated)

View file

@ -1,6 +1,11 @@
Some linking kinds are target-specific and not supported on all platforms.
Linking with `kind=framework` is only supported when targeting macOS, Linking with `kind=framework` is only supported when targeting macOS,
as frameworks are specific to that operating system. as frameworks are specific to that operating system.
Similarly, `kind=raw-dylib` is only supported when targeting Windows-like
platforms.
Erroneous code example: Erroneous code example:
```ignore (should-compile_fail-but-cannot-doctest-conditionally-without-macos) ```ignore (should-compile_fail-but-cannot-doctest-conditionally-without-macos)

View file

@ -12,3 +12,4 @@ Please specify a valid "kind" value, from one of the following:
* static * static
* dylib * dylib
* framework * framework
* raw-dylib

View file

@ -1,7 +1,9 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(crate_visibility_modifier)] #![feature(crate_visibility_modifier)]
#![feature(decl_macro)]
#![feature(drain_filter)] #![feature(drain_filter)]
#![feature(generators)] #![feature(generators)]
#![feature(let_chains)]
#![feature(let_else)] #![feature(let_else)]
#![feature(nll)] #![feature(nll)]
#![feature(once_cell)] #![feature(once_cell)]

View file

@ -1,4 +1,4 @@
use rustc_ast::CRATE_NODE_ID; use rustc_ast::{NestedMetaItem, CRATE_NODE_ID};
use rustc_attr as attr; use rustc_attr as attr;
use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::fx::FxHashSet;
use rustc_errors::struct_span_err; use rustc_errors::struct_span_err;
@ -9,8 +9,7 @@ use rustc_session::cstore::{DllCallingConvention, DllImport, NativeLib};
use rustc_session::parse::feature_err; use rustc_session::parse::feature_err;
use rustc_session::utils::NativeLibKind; use rustc_session::utils::NativeLibKind;
use rustc_session::Session; use rustc_session::Session;
use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
use rustc_target::spec::abi::Abi; use rustc_target::spec::abi::Abi;
crate fn collect(tcx: TyCtxt<'_>) -> Vec<NativeLib> { crate fn collect(tcx: TyCtxt<'_>) -> Vec<NativeLib> {
@ -51,283 +50,315 @@ impl<'tcx> Collector<'tcx> {
// Process all of the #[link(..)]-style arguments // Process all of the #[link(..)]-style arguments
let sess = &self.tcx.sess; let sess = &self.tcx.sess;
let features = self.tcx.features();
for m in self.tcx.hir().attrs(it.hir_id()).iter().filter(|a| a.has_name(sym::link)) { for m in self.tcx.hir().attrs(it.hir_id()).iter().filter(|a| a.has_name(sym::link)) {
let Some(items) = m.meta_item_list() else { let Some(items) = m.meta_item_list() else {
continue; continue;
}; };
let mut lib = NativeLib {
name: None,
kind: NativeLibKind::Unspecified,
cfg: None,
foreign_module: Some(it.def_id.to_def_id()),
wasm_import_module: None,
verbatim: None,
dll_imports: Vec::new(),
};
let mut kind_specified = false;
let mut name = None;
let mut kind = None;
let mut modifiers = None;
let mut cfg = None;
let mut wasm_import_module = None;
for item in items.iter() { for item in items.iter() {
if item.has_name(sym::kind) { match item.name_or_empty() {
kind_specified = true; sym::name => {
let Some(kind) = item.value_str() else { if name.is_some() {
continue; // skip like historical compilers let msg = "multiple `name` arguments in a single `#[link]` attribute";
}; sess.span_err(item.span(), msg);
lib.kind = match kind.as_str() { continue;
"static" => NativeLibKind::Static { bundle: None, whole_archive: None }, }
"static-nobundle" => { let Some(link_name) = item.value_str() else {
sess.struct_span_warn( let msg = "link name must be of the form `name = \"string\"`";
item.span(), sess.span_err(item.span(), msg);
"library kind `static-nobundle` has been superseded by specifying \ continue;
modifier `-bundle` with library kind `static`", };
) let span = item.name_value_literal_span().unwrap();
.emit(); if link_name.is_empty() {
if !self.tcx.features().static_nobundle { struct_span_err!(sess, span, E0454, "link name must not be empty")
feature_err( .span_label(span, "empty link name")
&self.tcx.sess.parse_sess, .emit();
sym::static_nobundle, }
item.span(), name = Some((link_name, span));
"kind=\"static-nobundle\" is unstable", }
sym::kind => {
if kind.is_some() {
let msg = "multiple `kind` arguments in a single `#[link]` attribute";
sess.span_err(item.span(), msg);
continue;
}
let Some(link_kind) = item.value_str() else {
let msg = "link kind must be of the form `kind = \"string\"`";
sess.span_err(item.span(), msg);
continue;
};
let span = item.name_value_literal_span().unwrap();
let link_kind = match link_kind.as_str() {
"static" => NativeLibKind::Static { bundle: None, whole_archive: None },
"static-nobundle" => {
sess.struct_span_warn(
span,
"link kind `static-nobundle` has been superseded by specifying \
modifier `-bundle` with link kind `static`",
) )
.emit(); .emit();
if !features.static_nobundle {
feature_err(
&sess.parse_sess,
sym::static_nobundle,
span,
"link kind `static-nobundle` is unstable",
)
.emit();
}
NativeLibKind::Static { bundle: Some(false), whole_archive: None }
} }
NativeLibKind::Static { bundle: Some(false), whole_archive: None } "dylib" => NativeLibKind::Dylib { as_needed: None },
} "framework" => {
"dylib" => NativeLibKind::Dylib { as_needed: None }, if !sess.target.is_like_osx {
"framework" => NativeLibKind::Framework { as_needed: None }, struct_span_err!(
"raw-dylib" => NativeLibKind::RawDylib, sess,
k => { span,
struct_span_err!(sess, item.span(), E0458, "unknown kind: `{}`", k) E0455,
.span_label(item.span(), "unknown kind") "link kind `framework` is only supported on Apple targets"
.span_label(m.span, "") )
.emit(); .emit();
NativeLibKind::Unspecified }
} NativeLibKind::Framework { as_needed: None }
}; }
} else if item.has_name(sym::name) { "raw-dylib" => {
lib.name = item.value_str(); if !sess.target.is_like_windows {
} else if item.has_name(sym::cfg) { struct_span_err!(
let Some(cfg) = item.meta_item_list() else { sess,
continue; // skip like historical compilers span,
}; E0455,
if cfg.is_empty() { "link kind `raw-dylib` is only supported on Windows targets"
sess.span_err(item.span(), "`cfg()` must have an argument"); )
} else if let cfg @ Some(..) = cfg[0].meta_item() { .emit();
lib.cfg = cfg.cloned(); } else if !features.raw_dylib {
} else { feature_err(
sess.span_err(cfg[0].span(), "invalid argument for `cfg(..)`"); &sess.parse_sess,
} sym::raw_dylib,
} else if item.has_name(sym::wasm_import_module) { span,
match item.value_str() { "link kind `raw-dylib` is unstable",
Some(s) => lib.wasm_import_module = Some(s), )
None => { .emit();
let msg = "must be of the form `#[link(wasm_import_module = \"...\")]`"; }
sess.span_err(item.span(), msg); NativeLibKind::RawDylib
} }
} kind => {
} else { let msg = format!(
// currently, like past compilers, ignore unknown "unknown link kind `{kind}`, expected one of: \
// directives here. static, dylib, framework, raw-dylib"
}
}
// Do this outside the above loop so we don't depend on modifiers coming
// after kinds
let mut modifiers_count = 0;
for item in items.iter().filter(|item| item.has_name(sym::modifiers)) {
if let Some(modifiers) = item.value_str() {
modifiers_count += 1;
let span = item.name_value_literal_span().unwrap();
let mut has_duplicate_modifiers = false;
for modifier in modifiers.as_str().split(',') {
let (modifier, value) = match modifier.strip_prefix(&['+', '-']) {
Some(m) => (m, modifier.starts_with('+')),
None => {
// Note: this error also excludes the case with empty modifier
// string, like `modifiers = ""`.
sess.span_err(
span,
"invalid linking modifier syntax, expected '+' or '-' prefix \
before one of: bundle, verbatim, whole-archive, as-needed",
); );
struct_span_err!(sess, span, E0458, "{}", msg)
.span_label(span, "unknown link kind")
.emit();
continue; continue;
} }
}; };
kind = Some(link_kind);
match (modifier, &mut lib.kind) {
("bundle", NativeLibKind::Static { bundle, .. }) => {
if bundle.is_some() {
has_duplicate_modifiers = true;
}
*bundle = Some(value);
}
("bundle", _) => {
sess.span_err(
span,
"bundle linking modifier is only compatible with \
`static` linking kind",
);
}
("verbatim", _) => {
if lib.verbatim.is_some() {
has_duplicate_modifiers = true;
}
lib.verbatim = Some(value);
}
("whole-archive", NativeLibKind::Static { whole_archive, .. }) => {
if whole_archive.is_some() {
has_duplicate_modifiers = true;
}
*whole_archive = Some(value);
}
("whole-archive", _) => {
sess.span_err(
span,
"whole-archive linking modifier is only compatible with \
`static` linking kind",
);
}
("as-needed", NativeLibKind::Dylib { as_needed })
| ("as-needed", NativeLibKind::Framework { as_needed }) => {
if as_needed.is_some() {
has_duplicate_modifiers = true;
}
*as_needed = Some(value);
}
("as-needed", _) => {
sess.span_err(
span,
"as-needed linking modifier is only compatible with \
`dylib` and `framework` linking kinds",
);
}
_ => {
sess.span_err(
span,
&format!(
"unrecognized linking modifier `{}`, expected one \
of: bundle, verbatim, whole-archive, as-needed",
modifier
),
);
}
}
} }
if has_duplicate_modifiers { sym::modifiers => {
let msg = if modifiers.is_some() {
"same modifier is used multiple times in a single `modifiers` argument"; let msg =
"multiple `modifiers` arguments in a single `#[link]` attribute";
sess.span_err(item.span(), msg);
continue;
}
let Some(link_modifiers) = item.value_str() else {
let msg = "link modifiers must be of the form `modifiers = \"string\"`";
sess.span_err(item.span(), msg);
continue;
};
modifiers = Some((link_modifiers, item.name_value_literal_span().unwrap()));
}
sym::cfg => {
if cfg.is_some() {
let msg = "multiple `cfg` arguments in a single `#[link]` attribute";
sess.span_err(item.span(), msg);
continue;
}
let Some(link_cfg) = item.meta_item_list() else {
let msg = "link cfg must be of the form `cfg(/* predicate */)`";
sess.span_err(item.span(), msg);
continue;
};
let [NestedMetaItem::MetaItem(link_cfg)] = link_cfg else {
let msg = "link cfg must have a single predicate argument";
sess.span_err(item.span(), msg);
continue;
};
if !features.link_cfg {
feature_err(
&sess.parse_sess,
sym::link_cfg,
item.span(),
"link cfg is unstable",
)
.emit();
}
cfg = Some(link_cfg.clone());
}
sym::wasm_import_module => {
if wasm_import_module.is_some() {
let msg = "multiple `wasm_import_module` arguments \
in a single `#[link]` attribute";
sess.span_err(item.span(), msg);
continue;
}
let Some(link_wasm_import_module) = item.value_str() else {
let msg = "wasm import module must be of the form \
`wasm_import_module = \"string\"`";
sess.span_err(item.span(), msg);
continue;
};
wasm_import_module = Some((link_wasm_import_module, item.span()));
}
_ => {
let msg = "unexpected `#[link]` argument, expected one of: \
name, kind, modifiers, cfg, wasm_import_module";
sess.span_err(item.span(), msg); sess.span_err(item.span(), msg);
} }
} else {
let msg = "must be of the form `#[link(modifiers = \"...\")]`";
sess.span_err(item.span(), msg);
} }
} }
if modifiers_count > 1 { // Do this outside the above loop so we don't depend on modifiers coming after kinds
let msg = "multiple `modifiers` arguments in a single `#[link]` attribute"; let mut verbatim = None;
sess.span_err(m.span, msg); if let Some((modifiers, span)) = modifiers {
for modifier in modifiers.as_str().split(',') {
let (modifier, value) = match modifier.strip_prefix(&['+', '-']) {
Some(m) => (m, modifier.starts_with('+')),
None => {
sess.span_err(
span,
"invalid linking modifier syntax, expected '+' or '-' prefix \
before one of: bundle, verbatim, whole-archive, as-needed",
);
continue;
}
};
macro report_unstable_modifier($feature: ident) {
if !features.$feature {
feature_err(
&sess.parse_sess,
sym::$feature,
span,
&format!("linking modifier `{modifier}` is unstable"),
)
.emit();
}
}
let assign_modifier = |dst: &mut Option<bool>| {
if dst.is_some() {
let msg = format!(
"multiple `{modifier}` modifiers in a single `modifiers` argument"
);
sess.span_err(span, &msg);
} else {
*dst = Some(value);
}
};
match (modifier, &mut kind) {
("bundle", Some(NativeLibKind::Static { bundle, .. })) => {
report_unstable_modifier!(native_link_modifiers_bundle);
assign_modifier(bundle)
}
("bundle", _) => {
sess.span_err(
span,
"linking modifier `bundle` is only compatible with \
`static` linking kind",
);
}
("verbatim", _) => {
report_unstable_modifier!(native_link_modifiers_verbatim);
assign_modifier(&mut verbatim)
}
("whole-archive", Some(NativeLibKind::Static { whole_archive, .. })) => {
assign_modifier(whole_archive)
}
("whole-archive", _) => {
sess.span_err(
span,
"linking modifier `whole-archive` is only compatible with \
`static` linking kind",
);
}
("as-needed", Some(NativeLibKind::Dylib { as_needed }))
| ("as-needed", Some(NativeLibKind::Framework { as_needed })) => {
report_unstable_modifier!(native_link_modifiers_as_needed);
assign_modifier(as_needed)
}
("as-needed", _) => {
sess.span_err(
span,
"linking modifier `as-needed` is only compatible with \
`dylib` and `framework` linking kinds",
);
}
_ => {
sess.span_err(
span,
format!(
"unknown linking modifier `{modifier}`, expected one of: \
bundle, verbatim, whole-archive, as-needed"
),
);
}
}
}
} }
// In general we require #[link(name = "...")] but we allow if let Some((_, span)) = wasm_import_module {
// #[link(wasm_import_module = "...")] without the `name`. if name.is_some() || kind.is_some() || modifiers.is_some() || cfg.is_some() {
let requires_name = kind_specified || lib.wasm_import_module.is_none(); let msg = "`wasm_import_module` is incompatible with \
if lib.name.is_none() && requires_name { other arguments in `#[link]` attributes";
sess.span_err(span, msg);
}
} else if name.is_none() {
struct_span_err!( struct_span_err!(
sess, sess,
m.span, m.span,
E0459, E0459,
"`#[link(...)]` specified without \ "`#[link]` attribute requires a `name = \"string\"` argument"
`name = \"foo\"`"
) )
.span_label(m.span, "missing `name` argument") .span_label(m.span, "missing `name` argument")
.emit(); .emit();
} }
if lib.kind == NativeLibKind::RawDylib { let dll_imports = match kind {
lib.dll_imports.extend( Some(NativeLibKind::RawDylib) => {
if let Some((name, span)) = name && name.as_str().contains('\0') {
sess.span_err(
span,
"link name must not contain NUL characters if link kind is `raw-dylib`",
);
}
foreign_mod_items foreign_mod_items
.iter() .iter()
.map(|child_item| self.build_dll_import(abi, child_item)), .map(|child_item| self.build_dll_import(abi, child_item))
); .collect()
}
self.register_native_lib(Some(m.span), lib);
}
}
fn register_native_lib(&mut self, span: Option<Span>, lib: NativeLib) {
if lib.name.as_ref().map_or(false, |&s| s == kw::Empty) {
match span {
Some(span) => {
struct_span_err!(
self.tcx.sess,
span,
E0454,
"`#[link(name = \"\")]` given with empty name"
)
.span_label(span, "empty name given")
.emit();
} }
None => { _ => Vec::new(),
self.tcx.sess.err("empty library name given via `-l`");
}
}
return;
}
let is_osx = self.tcx.sess.target.is_like_osx;
if matches!(lib.kind, NativeLibKind::Framework { .. }) && !is_osx {
let msg = "native frameworks are only available on macOS targets";
match span {
Some(span) => {
struct_span_err!(self.tcx.sess, span, E0455, "{}", msg).emit();
}
None => {
self.tcx.sess.err(msg);
}
}
}
if lib.cfg.is_some() && !self.tcx.features().link_cfg {
feature_err(
&self.tcx.sess.parse_sess,
sym::link_cfg,
span.unwrap(),
"kind=\"link_cfg\" is unstable",
)
.emit();
}
// this just unwraps lib.name; we already established that it isn't empty above.
if let (NativeLibKind::RawDylib, Some(lib_name)) = (lib.kind, lib.name) {
let Some(span) = span else {
bug!("raw-dylib libraries are not supported on the command line");
}; };
self.libs.push(NativeLib {
if !self.tcx.sess.target.options.is_like_windows { name: name.map(|(name, _)| name),
self.tcx.sess.span_fatal( kind: kind.unwrap_or(NativeLibKind::Unspecified),
span, cfg,
"`#[link(...)]` with `kind = \"raw-dylib\"` only supported on Windows", foreign_module: Some(it.def_id.to_def_id()),
); wasm_import_module: wasm_import_module.map(|(name, _)| name),
} verbatim,
dll_imports,
if lib_name.as_str().contains('\0') { });
self.tcx.sess.span_err(span, "library name may not contain NUL characters");
}
if !self.tcx.features().raw_dylib {
feature_err(
&self.tcx.sess.parse_sess,
sym::raw_dylib,
span,
"kind=\"raw-dylib\" is unstable",
)
.emit();
}
} }
self.libs.push(lib);
} }
// Process libs passed on the command line // Process libs passed on the command line
@ -335,6 +366,10 @@ impl<'tcx> Collector<'tcx> {
// First, check for errors // First, check for errors
let mut renames = FxHashSet::default(); let mut renames = FxHashSet::default();
for lib in &self.tcx.sess.opts.libs { for lib in &self.tcx.sess.opts.libs {
if let NativeLibKind::Framework { .. } = lib.kind && !self.tcx.sess.target.is_like_osx {
// Cannot check this when parsing options because the target is not yet available.
self.tcx.sess.err("library kind `framework` is only supported on Apple targets");
}
if let Some(ref new_name) = lib.new_name { if let Some(ref new_name) = lib.new_name {
let any_duplicate = self let any_duplicate = self
.libs .libs
@ -342,19 +377,19 @@ impl<'tcx> Collector<'tcx> {
.filter_map(|lib| lib.name.as_ref()) .filter_map(|lib| lib.name.as_ref())
.any(|n| n.as_str() == lib.name); .any(|n| n.as_str() == lib.name);
if new_name.is_empty() { if new_name.is_empty() {
self.tcx.sess.err(&format!( self.tcx.sess.err(format!(
"an empty renaming target was specified for library `{}`", "an empty renaming target was specified for library `{}`",
lib.name lib.name
)); ));
} else if !any_duplicate { } else if !any_duplicate {
self.tcx.sess.err(&format!( self.tcx.sess.err(format!(
"renaming of the library `{}` was specified, \ "renaming of the library `{}` was specified, \
however this crate contains no `#[link(...)]` \ however this crate contains no `#[link(...)]` \
attributes referencing this library", attributes referencing this library",
lib.name lib.name
)); ));
} else if !renames.insert(&lib.name) { } else if !renames.insert(&lib.name) {
self.tcx.sess.err(&format!( self.tcx.sess.err(format!(
"multiple renamings were \ "multiple renamings were \
specified for library `{}`", specified for library `{}`",
lib.name lib.name
@ -404,7 +439,7 @@ impl<'tcx> Collector<'tcx> {
if existing.is_empty() { if existing.is_empty() {
// Add if not found // Add if not found
let new_name: Option<&str> = passed_lib.new_name.as_deref(); let new_name: Option<&str> = passed_lib.new_name.as_deref();
let lib = NativeLib { self.libs.push(NativeLib {
name: Some(Symbol::intern(new_name.unwrap_or(&passed_lib.name))), name: Some(Symbol::intern(new_name.unwrap_or(&passed_lib.name))),
kind: passed_lib.kind, kind: passed_lib.kind,
cfg: None, cfg: None,
@ -412,8 +447,7 @@ impl<'tcx> Collector<'tcx> {
wasm_import_module: None, wasm_import_module: None,
verbatim: passed_lib.verbatim, verbatim: passed_lib.verbatim,
dll_imports: Vec::new(), dll_imports: Vec::new(),
}; });
self.register_native_lib(None, lib);
} else { } else {
// Move all existing libraries with the same name to the // Move all existing libraries with the same name to the
// end of the command line. // end of the command line.

View file

@ -23,6 +23,7 @@ use rustc_session::lint::builtin::{
use rustc_session::parse::feature_err; use rustc_session::parse::feature_err;
use rustc_span::symbol::{kw, sym, Symbol}; use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::{Span, DUMMY_SP}; use rustc_span::{Span, DUMMY_SP};
use rustc_target::spec::abi::Abi;
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
pub(crate) fn target_from_impl_item<'tcx>( pub(crate) fn target_from_impl_item<'tcx>(
@ -1317,22 +1318,27 @@ impl CheckAttrVisitor<'_> {
/// Checks if `#[link]` is applied to an item other than a foreign module. /// Checks if `#[link]` is applied to an item other than a foreign module.
fn check_link(&self, hir_id: HirId, attr: &Attribute, span: Span, target: Target) { fn check_link(&self, hir_id: HirId, attr: &Attribute, span: Span, target: Target) {
match target { if target == Target::ForeignMod
Target::ForeignMod => {} && let hir::Node::Item(item) = self.tcx.hir().get(hir_id)
_ => { && let Item { kind: ItemKind::ForeignMod { abi, .. }, .. } = item
self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| { && !matches!(abi, Abi::Rust | Abi::RustIntrinsic | Abi::PlatformIntrinsic)
let mut diag = lint.build("attribute should be applied to an `extern` block"); {
diag.warn( return;
"this was previously accepted by the compiler but is \
being phased out; it will become a hard error in \
a future release!",
);
diag.span_label(span, "not an `extern` block");
diag.emit();
});
}
} }
self.tcx.struct_span_lint_hir(UNUSED_ATTRIBUTES, hir_id, attr.span, |lint| {
let mut diag =
lint.build("attribute should be applied to an `extern` block with non-Rust ABI");
diag.warn(
"this was previously accepted by the compiler but is \
being phased out; it will become a hard error in \
a future release!",
);
if target != Target::ForeignMod {
diag.span_label(span, "not an `extern` block");
}
diag.emit();
});
} }
/// Checks if `#[link_name]` is applied to an item other than a foreign function or static. /// Checks if `#[link_name]` is applied to an item other than a foreign function or static.

View file

@ -1937,33 +1937,27 @@ fn parse_native_lib_kind(
}; };
let kind = match kind { let kind = match kind {
"dylib" => NativeLibKind::Dylib { as_needed: None },
"framework" => NativeLibKind::Framework { as_needed: None },
"static" => NativeLibKind::Static { bundle: None, whole_archive: None }, "static" => NativeLibKind::Static { bundle: None, whole_archive: None },
"static-nobundle" => { "static-nobundle" => {
early_warn( early_warn(
error_format, error_format,
"library kind `static-nobundle` has been superseded by specifying \ "library kind `static-nobundle` has been superseded by specifying \
`-bundle` on library kind `static`. Try `static:-bundle`", modifier `-bundle` with library kind `static`. Try `static:-bundle`",
); );
if modifiers.is_some() {
early_error(
error_format,
"linking modifier can't be used with library kind `static-nobundle`",
)
}
if !nightly_options::match_is_nightly_build(matches) { if !nightly_options::match_is_nightly_build(matches) {
early_error( early_error(
error_format, error_format,
"library kind `static-nobundle` are currently unstable and only accepted on \ "library kind `static-nobundle` is unstable \
the nightly compiler", and only accepted on the nightly compiler",
); );
} }
NativeLibKind::Static { bundle: Some(false), whole_archive: None } NativeLibKind::Static { bundle: Some(false), whole_archive: None }
} }
s => early_error( "dylib" => NativeLibKind::Dylib { as_needed: None },
"framework" => NativeLibKind::Framework { as_needed: None },
_ => early_error(
error_format, error_format,
&format!("unknown library kind `{s}`, expected one of dylib, framework, or static"), &format!("unknown library kind `{kind}`, expected one of: static, dylib, framework"),
), ),
}; };
match modifiers { match modifiers {
@ -1978,21 +1972,6 @@ fn parse_native_lib_modifiers(
error_format: ErrorOutputType, error_format: ErrorOutputType,
matches: &getopts::Matches, matches: &getopts::Matches,
) -> (NativeLibKind, Option<bool>) { ) -> (NativeLibKind, Option<bool>) {
let report_unstable_modifier = |modifier| {
if !nightly_options::is_unstable_enabled(matches) {
let why = if nightly_options::match_is_nightly_build(matches) {
" and only accepted on the nightly compiler"
} else {
", the `-Z unstable-options` flag must also be passed to use it"
};
early_error(
error_format,
&format!("{modifier} linking modifier is currently unstable{why}"),
)
}
};
let mut has_duplicate_modifiers = false;
let mut verbatim = None; let mut verbatim = None;
for modifier in modifiers.split(',') { for modifier in modifiers.split(',') {
let (modifier, value) = match modifier.strip_prefix(&['+', '-']) { let (modifier, value) = match modifier.strip_prefix(&['+', '-']) {
@ -2000,56 +1979,63 @@ fn parse_native_lib_modifiers(
None => early_error( None => early_error(
error_format, error_format,
"invalid linking modifier syntax, expected '+' or '-' prefix \ "invalid linking modifier syntax, expected '+' or '-' prefix \
before one of: bundle, verbatim, whole-archive, as-needed", before one of: bundle, verbatim, whole-archive, as-needed",
), ),
}; };
let report_unstable_modifier = || {
if !nightly_options::is_unstable_enabled(matches) {
let why = if nightly_options::match_is_nightly_build(matches) {
" and only accepted on the nightly compiler"
} else {
", the `-Z unstable-options` flag must also be passed to use it"
};
early_error(
error_format,
&format!("linking modifier `{modifier}` is unstable{why}"),
)
}
};
let assign_modifier = |dst: &mut Option<bool>| {
if dst.is_some() {
let msg = format!("multiple `{modifier}` modifiers in a single `-l` option");
early_error(error_format, &msg)
} else {
*dst = Some(value);
}
};
match (modifier, &mut kind) { match (modifier, &mut kind) {
("bundle", NativeLibKind::Static { bundle, .. }) => { ("bundle", NativeLibKind::Static { bundle, .. }) => {
report_unstable_modifier(modifier); report_unstable_modifier();
if bundle.is_some() { assign_modifier(bundle)
has_duplicate_modifiers = true;
}
*bundle = Some(value);
} }
("bundle", _) => early_error( ("bundle", _) => early_error(
error_format, error_format,
"bundle linking modifier is only compatible with \ "linking modifier `bundle` is only compatible with `static` linking kind",
`static` linking kind",
), ),
("verbatim", _) => { ("verbatim", _) => {
report_unstable_modifier(modifier); report_unstable_modifier();
if verbatim.is_some() { assign_modifier(&mut verbatim)
has_duplicate_modifiers = true;
}
verbatim = Some(value);
} }
("whole-archive", NativeLibKind::Static { whole_archive, .. }) => { ("whole-archive", NativeLibKind::Static { whole_archive, .. }) => {
if whole_archive.is_some() { assign_modifier(whole_archive)
has_duplicate_modifiers = true;
}
*whole_archive = Some(value);
} }
("whole-archive", _) => early_error( ("whole-archive", _) => early_error(
error_format, error_format,
"whole-archive linking modifier is only compatible with \ "linking modifier `whole-archive` is only compatible with `static` linking kind",
`static` linking kind",
), ),
("as-needed", NativeLibKind::Dylib { as_needed }) ("as-needed", NativeLibKind::Dylib { as_needed })
| ("as-needed", NativeLibKind::Framework { as_needed }) => { | ("as-needed", NativeLibKind::Framework { as_needed }) => {
report_unstable_modifier(modifier); report_unstable_modifier();
if as_needed.is_some() { assign_modifier(as_needed)
has_duplicate_modifiers = true;
}
*as_needed = Some(value);
} }
("as-needed", _) => early_error( ("as-needed", _) => early_error(
error_format, error_format,
"as-needed linking modifier is only compatible with \ "linking modifier `as-needed` is only compatible with \
`dylib` and `framework` linking kinds", `dylib` and `framework` linking kinds",
), ),
// Note: this error also excludes the case with empty modifier // Note: this error also excludes the case with empty modifier
@ -2057,15 +2043,12 @@ fn parse_native_lib_modifiers(
_ => early_error( _ => early_error(
error_format, error_format,
&format!( &format!(
"unrecognized linking modifier `{modifier}`, expected one \ "unknown linking modifier `{modifier}`, expected one \
of: bundle, verbatim, whole-archive, as-needed" of: bundle, verbatim, whole-archive, as-needed"
), ),
), ),
} }
} }
if has_duplicate_modifiers {
report_unstable_modifier("duplicating")
}
(kind, verbatim) (kind, verbatim)
} }
@ -2093,6 +2076,9 @@ fn parse_libs(matches: &getopts::Matches, error_format: ErrorOutputType) -> Vec<
None => (name, None), None => (name, None),
Some((name, new_name)) => (name.to_string(), Some(new_name.to_owned())), Some((name, new_name)) => (name.to_string(), Some(new_name.to_owned())),
}; };
if name.is_empty() {
early_error(error_format, "library name must not be empty");
}
NativeLib { name, new_name, kind, verbatim } NativeLib { name, new_name, kind, verbatim }
}) })
.collect() .collect()

View file

@ -52,7 +52,8 @@ where `KIND` may be one of:
If the kind is specified, then linking modifiers can be attached to it. If the kind is specified, then linking modifiers can be attached to it.
Modifiers are specified as a comma-delimited string with each modifier prefixed with Modifiers are specified as a comma-delimited string with each modifier prefixed with
either a `+` or `-` to indicate that the modifier is enabled or disabled, respectively. either a `+` or `-` to indicate that the modifier is enabled or disabled, respectively.
The last boolean value specified for a given modifier wins. \ Specifying multiple `modifiers` arguments in a single `link` attribute,
or multiple identical modifiers in the same `modifiers` argument is not currently supported. \
Example: `-l static:+whole-archive=mylib`. Example: `-l static:+whole-archive=mylib`.
The kind of library and the modifiers can also be specified in a [`#[link]` The kind of library and the modifiers can also be specified in a [`#[link]`

View file

@ -1,4 +1,4 @@
#[link(name = "")] //~ ERROR: given with empty name #[link(name = "")] //~ ERROR: link name must not be empty
extern "C" {} extern "C" {}
fn main() {} fn main() {}

View file

@ -1,8 +1,8 @@
error[E0454]: `#[link(name = "")]` given with empty name error[E0454]: link name must not be empty
--> $DIR/empty-linkname.rs:1:1 --> $DIR/empty-linkname.rs:1:15
| |
LL | #[link(name = "")] LL | #[link(name = "")]
| ^^^^^^^^^^^^^^^^^^ empty name given | ^^ empty link name
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,8 +1,8 @@
error[E0454]: `#[link(name = "")]` given with empty name error[E0454]: link name must not be empty
--> $DIR/E0454.rs:1:1 --> $DIR/E0454.rs:1:15
| |
LL | #[link(name = "")] extern "C" {} LL | #[link(name = "")] extern "C" {}
| ^^^^^^^^^^^^^^^^^^ empty name given | ^^ empty link name
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,12 +1,10 @@
error[E0458]: unknown kind: `wonderful_unicorn` error[E0458]: unknown link kind `wonderful_unicorn`, expected one of: static, dylib, framework, raw-dylib
--> $DIR/E0458.rs:1:8 --> $DIR/E0458.rs:1:15
| |
LL | #[link(kind = "wonderful_unicorn")] extern "C" {} LL | #[link(kind = "wonderful_unicorn")] extern "C" {}
| -------^^^^^^^^^^^^^^^^^^^^^^^^^^-- | ^^^^^^^^^^^^^^^^^^^ unknown link kind
| |
| unknown kind
error[E0459]: `#[link(...)]` specified without `name = "foo"` error[E0459]: `#[link]` attribute requires a `name = "string"` argument
--> $DIR/E0458.rs:1:1 --> $DIR/E0458.rs:1:1
| |
LL | #[link(kind = "wonderful_unicorn")] extern "C" {} LL | #[link(kind = "wonderful_unicorn")] extern "C" {}

View file

@ -1,4 +1,4 @@
error[E0459]: `#[link(...)]` specified without `name = "foo"` error[E0459]: `#[link]` attribute requires a `name = "string"` argument
--> $DIR/E0459.rs:1:1 --> $DIR/E0459.rs:1:1
| |
LL | #[link(kind = "dylib")] extern "C" {} LL | #[link(kind = "dylib")] extern "C" {}

View file

@ -1,8 +1,8 @@
error[E0658]: kind="link_cfg" is unstable error[E0658]: link cfg is unstable
--> $DIR/feature-gate-link_cfg.rs:1:1 --> $DIR/feature-gate-link_cfg.rs:1:22
| |
LL | #[link(name = "foo", cfg(foo))] LL | #[link(name = "foo", cfg(foo))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^
| |
= note: see issue #37406 <https://github.com/rust-lang/rust/issues/37406> for more information = note: see issue #37406 <https://github.com/rust-lang/rust/issues/37406> for more information
= help: add `#![feature(link_cfg)]` to the crate attributes to enable = help: add `#![feature(link_cfg)]` to the crate attributes to enable

View file

@ -1,5 +1,5 @@
#[link(name = "foo", modifiers = "+as-needed")] #[link(name = "foo", kind = "dylib", modifiers = "+as-needed")]
//~^ ERROR: `#[link(modifiers="as-needed")]` is unstable //~^ ERROR: linking modifier `as-needed` is unstable
extern "C" {} extern "C" {}
fn main() {} fn main() {}

View file

@ -1,8 +1,8 @@
error[E0658]: `#[link(modifiers="as-needed")]` is unstable error[E0658]: linking modifier `as-needed` is unstable
--> $DIR/feature-gate-native_link_modifiers_as_needed.rs:1:34 --> $DIR/feature-gate-native_link_modifiers_as_needed.rs:1:50
| |
LL | #[link(name = "foo", modifiers = "+as-needed")] LL | #[link(name = "foo", kind = "dylib", modifiers = "+as-needed")]
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
| |
= note: see issue #81490 <https://github.com/rust-lang/rust/issues/81490> for more information = note: see issue #81490 <https://github.com/rust-lang/rust/issues/81490> for more information
= help: add `#![feature(native_link_modifiers_as_needed)]` to the crate attributes to enable = help: add `#![feature(native_link_modifiers_as_needed)]` to the crate attributes to enable

View file

@ -1,2 +1,2 @@
error: bundle linking modifier is currently unstable and only accepted on the nightly compiler error: linking modifier `bundle` is unstable and only accepted on the nightly compiler

View file

@ -1,5 +1,5 @@
#[link(name = "foo", modifiers = "+bundle")] #[link(name = "foo", kind = "static", modifiers = "+bundle")]
//~^ ERROR: `#[link(modifiers="bundle")]` is unstable //~^ ERROR: linking modifier `bundle` is unstable
extern "C" {} extern "C" {}
fn main() {} fn main() {}

View file

@ -1,8 +1,8 @@
error[E0658]: `#[link(modifiers="bundle")]` is unstable error[E0658]: linking modifier `bundle` is unstable
--> $DIR/feature-gate-native_link_modifiers_bundle.rs:1:34 --> $DIR/feature-gate-native_link_modifiers_bundle.rs:1:51
| |
LL | #[link(name = "foo", modifiers = "+bundle")] LL | #[link(name = "foo", kind = "static", modifiers = "+bundle")]
| ^^^^^^^^^ | ^^^^^^^^^
| |
= note: see issue #81490 <https://github.com/rust-lang/rust/issues/81490> for more information = note: see issue #81490 <https://github.com/rust-lang/rust/issues/81490> for more information
= help: add `#![feature(native_link_modifiers_bundle)]` to the crate attributes to enable = help: add `#![feature(native_link_modifiers_bundle)]` to the crate attributes to enable

View file

@ -1,5 +1,5 @@
#[link(name = "foo", modifiers = "+verbatim")] #[link(name = "foo", modifiers = "+verbatim")]
//~^ ERROR: `#[link(modifiers="verbatim")]` is unstable //~^ ERROR: linking modifier `verbatim` is unstable
extern "C" {} extern "C" {}
fn main() {} fn main() {}

View file

@ -1,4 +1,4 @@
error[E0658]: `#[link(modifiers="verbatim")]` is unstable error[E0658]: linking modifier `verbatim` is unstable
--> $DIR/feature-gate-native_link_modifiers_verbatim.rs:1:34 --> $DIR/feature-gate-native_link_modifiers_verbatim.rs:1:34
| |
LL | #[link(name = "foo", modifiers = "+verbatim")] LL | #[link(name = "foo", modifiers = "+verbatim")]

View file

@ -1,6 +1,6 @@
// only-windows // only-windows
#[link(name = "foo", kind = "raw-dylib")] #[link(name = "foo", kind = "raw-dylib")]
//~^ ERROR: kind="raw-dylib" is unstable //~^ ERROR: link kind `raw-dylib` is unstable
extern "C" {} extern "C" {}
fn main() {} fn main() {}

View file

@ -1,8 +1,8 @@
error[E0658]: kind="raw-dylib" is unstable error[E0658]: link kind `raw-dylib` is unstable
--> $DIR/feature-gate-raw-dylib.rs:2:1 --> $DIR/feature-gate-raw-dylib.rs:2:29
| |
LL | #[link(name = "foo", kind = "raw-dylib")] LL | #[link(name = "foo", kind = "raw-dylib")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^
| |
= note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information
= help: add `#![feature(raw_dylib)]` to the crate attributes to enable = help: add `#![feature(raw_dylib)]` to the crate attributes to enable

View file

@ -1,2 +1,2 @@
warning: library kind `static-nobundle` has been superseded by specifying `-bundle` on library kind `static`. Try `static:-bundle` warning: library kind `static-nobundle` has been superseded by specifying modifier `-bundle` with library kind `static`. Try `static:-bundle`

View file

@ -1,6 +1,6 @@
#[link(name = "foo", kind = "static-nobundle")] #[link(name = "foo", kind = "static-nobundle")]
//~^ WARNING: library kind `static-nobundle` has been superseded by specifying modifier `-bundle` with library kind `static` //~^ WARNING: link kind `static-nobundle` has been superseded by specifying modifier `-bundle` with link kind `static`
//~^^ ERROR: kind="static-nobundle" is unstable //~^^ ERROR: link kind `static-nobundle` is unstable
extern "C" {} extern "C" {}
fn main() {} fn main() {}

View file

@ -1,14 +1,14 @@
warning: library kind `static-nobundle` has been superseded by specifying modifier `-bundle` with library kind `static` warning: link kind `static-nobundle` has been superseded by specifying modifier `-bundle` with link kind `static`
--> $DIR/feature-gate-static-nobundle.rs:1:22 --> $DIR/feature-gate-static-nobundle.rs:1:29
| |
LL | #[link(name = "foo", kind = "static-nobundle")] LL | #[link(name = "foo", kind = "static-nobundle")]
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error[E0658]: kind="static-nobundle" is unstable error[E0658]: link kind `static-nobundle` is unstable
--> $DIR/feature-gate-static-nobundle.rs:1:22 --> $DIR/feature-gate-static-nobundle.rs:1:29
| |
LL | #[link(name = "foo", kind = "static-nobundle")] LL | #[link(name = "foo", kind = "static-nobundle")]
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information = note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information
= help: add `#![feature(static_nobundle)]` to the crate attributes to enable = help: add `#![feature(static_nobundle)]` to the crate attributes to enable

View file

@ -581,6 +581,10 @@ mod link {
//~^ WARN attribute should be applied to an `extern` block //~^ WARN attribute should be applied to an `extern` block
//~| WARN this was previously accepted //~| WARN this was previously accepted
//~| NOTE not an `extern` block //~| NOTE not an `extern` block
#[link()] extern "Rust" {}
//~^ WARN attribute should be applied to an `extern` block
//~| WARN this was previously accepted
} }
struct StructForDeprecated; struct StructForDeprecated;

View file

@ -310,7 +310,7 @@ LL | | }
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block warning: attribute should be applied to an `extern` block with non-Rust ABI
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:554:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:554:1
| |
LL | #[link()] LL | #[link()]
@ -328,55 +328,55 @@ LL | | }
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: `#[must_use]` has no effect when applied to a module warning: `#[must_use]` has no effect when applied to a module
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:601:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:605:1
| |
LL | #[must_use] LL | #[must_use]
| ^^^^^^^^^^^ | ^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:614:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:618:1
| |
LL | #[windows_subsystem = "windows"] LL | #[windows_subsystem = "windows"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:1
| |
LL | #[crate_name = "0900"] LL | #[crate_name = "0900"]
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:654:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:658:1
| |
LL | #[crate_type = "0800"] LL | #[crate_type = "0800"]
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:673:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:677:1
| |
LL | #[feature(x0600)] LL | #[feature(x0600)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:1
| |
LL | #[no_main] LL | #[no_main]
| ^^^^^^^^^^ | ^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:1
| |
LL | #[no_builtins] LL | #[no_builtins]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:731:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:735:1
| |
LL | #[recursion_limit="0200"] LL | #[recursion_limit="0200"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:754:1
| |
LL | #[type_length_limit="0100"] LL | #[type_length_limit="0100"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -407,7 +407,7 @@ LL | #![cold]
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block warning: attribute should be applied to an `extern` block with non-Rust ABI
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:64:1 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:64:1
| |
LL | #![link()] LL | #![link()]
@ -863,7 +863,7 @@ LL | #[link_section = "1800"] impl S { }
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block warning: attribute should be applied to an `extern` block with non-Rust ABI
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:560:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:560:17
| |
LL | mod inner { #![link()] } LL | mod inner { #![link()] }
@ -871,7 +871,7 @@ LL | mod inner { #![link()] }
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block warning: attribute should be applied to an `extern` block with non-Rust ABI
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:565:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:565:5
| |
LL | #[link()] fn f() { } LL | #[link()] fn f() { }
@ -879,7 +879,7 @@ LL | #[link()] fn f() { }
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block warning: attribute should be applied to an `extern` block with non-Rust ABI
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:570:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:570:5
| |
LL | #[link()] struct S; LL | #[link()] struct S;
@ -887,7 +887,7 @@ LL | #[link()] struct S;
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block warning: attribute should be applied to an `extern` block with non-Rust ABI
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:575:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:575:5
| |
LL | #[link()] type T = S; LL | #[link()] type T = S;
@ -895,7 +895,7 @@ LL | #[link()] type T = S;
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block warning: attribute should be applied to an `extern` block with non-Rust ABI
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:580:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:580:5
| |
LL | #[link()] impl S { } LL | #[link()] impl S { }
@ -903,260 +903,268 @@ LL | #[link()] impl S { }
| |
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: attribute should be applied to an `extern` block with non-Rust ABI
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:585:5
|
LL | #[link()] extern "Rust" {}
| ^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
warning: `#[must_use]` has no effect when applied to a module warning: `#[must_use]` has no effect when applied to a module
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:603:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:607:17
| |
LL | mod inner { #![must_use] } LL | mod inner { #![must_use] }
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
warning: `#[must_use]` has no effect when applied to a type alias warning: `#[must_use]` has no effect when applied to a type alias
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:609:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:613:5
| |
LL | #[must_use] type T = S; LL | #[must_use] type T = S;
| ^^^^^^^^^^^ | ^^^^^^^^^^^
warning: `#[must_use]` has no effect when applied to an item warning: `#[must_use]` has no effect when applied to an item
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:611:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:615:5
| |
LL | #[must_use] impl S { } LL | #[must_use] impl S { }
| ^^^^^^^^^^^ | ^^^^^^^^^^^
warning: crate-level attribute should be in the root module warning: crate-level attribute should be in the root module
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:617:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:621:17
| |
LL | mod inner { #![windows_subsystem="windows"] } LL | mod inner { #![windows_subsystem="windows"] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:620:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:624:5
| |
LL | #[windows_subsystem = "windows"] fn f() { } LL | #[windows_subsystem = "windows"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:623:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:627:5
| |
LL | #[windows_subsystem = "windows"] struct S; LL | #[windows_subsystem = "windows"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:626:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:630:5
| |
LL | #[windows_subsystem = "windows"] type T = S; LL | #[windows_subsystem = "windows"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:629:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:633:5
| |
LL | #[windows_subsystem = "windows"] impl S { } LL | #[windows_subsystem = "windows"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module warning: crate-level attribute should be in the root module
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:638:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:642:17
| |
LL | mod inner { #![crate_name="0900"] } LL | mod inner { #![crate_name="0900"] }
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:641:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:645:5
| |
LL | #[crate_name = "0900"] fn f() { } LL | #[crate_name = "0900"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:644:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:648:5
| |
LL | #[crate_name = "0900"] struct S; LL | #[crate_name = "0900"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5
| |
LL | #[crate_name = "0900"] type T = S; LL | #[crate_name = "0900"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:650:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:654:5
| |
LL | #[crate_name = "0900"] impl S { } LL | #[crate_name = "0900"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module warning: crate-level attribute should be in the root module
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:657:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:661:17
| |
LL | mod inner { #![crate_type="0800"] } LL | mod inner { #![crate_type="0800"] }
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:5
| |
LL | #[crate_type = "0800"] fn f() { } LL | #[crate_type = "0800"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:663:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:667:5
| |
LL | #[crate_type = "0800"] struct S; LL | #[crate_type = "0800"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:666:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:670:5
| |
LL | #[crate_type = "0800"] type T = S; LL | #[crate_type = "0800"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:669:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:673:5
| |
LL | #[crate_type = "0800"] impl S { } LL | #[crate_type = "0800"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module warning: crate-level attribute should be in the root module
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:680:17
| |
LL | mod inner { #![feature(x0600)] } LL | mod inner { #![feature(x0600)] }
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:5
| |
LL | #[feature(x0600)] fn f() { } LL | #[feature(x0600)] fn f() { }
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:686:5
| |
LL | #[feature(x0600)] struct S; LL | #[feature(x0600)] struct S;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:5
| |
LL | #[feature(x0600)] type T = S; LL | #[feature(x0600)] type T = S;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:688:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:692:5
| |
LL | #[feature(x0600)] impl S { } LL | #[feature(x0600)] impl S { }
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module warning: crate-level attribute should be in the root module
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:696:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:17
| |
LL | mod inner { #![no_main] } LL | mod inner { #![no_main] }
| ^^^^^^^^^^^ | ^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:5
| |
LL | #[no_main] fn f() { } LL | #[no_main] fn f() { }
| ^^^^^^^^^^ | ^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:702:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:706:5
| |
LL | #[no_main] struct S; LL | #[no_main] struct S;
| ^^^^^^^^^^ | ^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:705:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:709:5
| |
LL | #[no_main] type T = S; LL | #[no_main] type T = S;
| ^^^^^^^^^^ | ^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:708:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:5
| |
LL | #[no_main] impl S { } LL | #[no_main] impl S { }
| ^^^^^^^^^^ | ^^^^^^^^^^
warning: crate-level attribute should be in the root module warning: crate-level attribute should be in the root module
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:17
| |
LL | mod inner { #![no_builtins] } LL | mod inner { #![no_builtins] }
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:718:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:722:5
| |
LL | #[no_builtins] fn f() { } LL | #[no_builtins] fn f() { }
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:721:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:725:5
| |
LL | #[no_builtins] struct S; LL | #[no_builtins] struct S;
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:5
| |
LL | #[no_builtins] type T = S; LL | #[no_builtins] type T = S;
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:727:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:731:5
| |
LL | #[no_builtins] impl S { } LL | #[no_builtins] impl S { }
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module warning: crate-level attribute should be in the root module
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:734:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:738:17
| |
LL | mod inner { #![recursion_limit="0200"] } LL | mod inner { #![recursion_limit="0200"] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:737:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:741:5
| |
LL | #[recursion_limit="0200"] fn f() { } LL | #[recursion_limit="0200"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:5
| |
LL | #[recursion_limit="0200"] struct S; LL | #[recursion_limit="0200"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:743:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:747:5
| |
LL | #[recursion_limit="0200"] type T = S; LL | #[recursion_limit="0200"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:746:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:5
| |
LL | #[recursion_limit="0200"] impl S { } LL | #[recursion_limit="0200"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be in the root module warning: crate-level attribute should be in the root module
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:17 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:757:17
| |
LL | mod inner { #![type_length_limit="0100"] } LL | mod inner { #![type_length_limit="0100"] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:756:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:760:5
| |
LL | #[type_length_limit="0100"] fn f() { } LL | #[type_length_limit="0100"] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:5
| |
LL | #[type_length_limit="0100"] struct S; LL | #[type_length_limit="0100"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:766:5
| |
LL | #[type_length_limit="0100"] type T = S; LL | #[type_length_limit="0100"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]` warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:769:5
| |
LL | #[type_length_limit="0100"] impl S { } LL | #[type_length_limit="0100"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -1169,5 +1177,5 @@ LL | #![feature(rust1)]
| |
= note: `#[warn(stable_features)]` on by default = note: `#[warn(stable_features)]` on by default
warning: 172 warnings emitted warning: 173 warnings emitted

View file

@ -1,4 +1,4 @@
#[link(name = "foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)` #[link(name = "foo", cfg("rlib"))] //~ ERROR link cfg must have a single predicate argument
extern "C" {} extern "C" {}
fn main() {} fn main() {}

View file

@ -1,8 +1,8 @@
error: invalid argument for `cfg(..)` error: link cfg must have a single predicate argument
--> $DIR/issue-43925.rs:1:26 --> $DIR/issue-43925.rs:1:22
| |
LL | #[link(name = "foo", cfg("rlib"))] LL | #[link(name = "foo", cfg("rlib"))]
| ^^^^^^ | ^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,4 +1,4 @@
#[link(name = "foo", cfg())] //~ ERROR `cfg()` must have an argument #[link(name = "foo", cfg())] //~ ERROR link cfg must have a single predicate argument
extern "C" {} extern "C" {}
fn main() {} fn main() {}

View file

@ -1,4 +1,4 @@
error: `cfg()` must have an argument error: link cfg must have a single predicate argument
--> $DIR/issue-43926.rs:1:22 --> $DIR/issue-43926.rs:1:22
| |
LL | #[link(name = "foo", cfg())] LL | #[link(name = "foo", cfg())]

View file

@ -1,7 +0,0 @@
#[link()] //~ ERROR: specified without `name =
#[link(name = "")] //~ ERROR: with empty name
#[link(name = "foo")]
#[link(name = "foo", kind = "bar")] //~ ERROR: unknown kind
extern "C" {}
fn main() {}

View file

@ -1,24 +0,0 @@
error[E0459]: `#[link(...)]` specified without `name = "foo"`
--> $DIR/bad-extern-link-attrs.rs:1:1
|
LL | #[link()]
| ^^^^^^^^^ missing `name` argument
error[E0454]: `#[link(name = "")]` given with empty name
--> $DIR/bad-extern-link-attrs.rs:2:1
|
LL | #[link(name = "")]
| ^^^^^^^^^^^^^^^^^^ empty name given
error[E0458]: unknown kind: `bar`
--> $DIR/bad-extern-link-attrs.rs:4:22
|
LL | #[link(name = "foo", kind = "bar")]
| ---------------------^^^^^^^^^^^^--
| |
| unknown kind
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0454, E0458, E0459.
For more information about an error, try `rustc --explain E0454`.

View file

@ -0,0 +1,8 @@
// Top-level ill-formed
#[link] //~ ERROR attribute must be of the form
//~| WARN this was previously accepted
#[link = "foo"] //~ ERROR attribute must be of the form
//~| WARN this was previously accepted
extern "C" {}
fn main() {}

View file

@ -0,0 +1,21 @@
error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...")]`
--> $DIR/link-attr-validation-early.rs:2:1
|
LL | #[link]
| ^^^^^^^
|
= note: `#[deny(ill_formed_attribute_input)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...")]`
--> $DIR/link-attr-validation-early.rs:4:1
|
LL | #[link = "foo"]
| ^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
error: aborting due to 2 previous errors

View file

@ -0,0 +1,40 @@
#![feature(native_link_modifiers_verbatim)]
#![feature(link_cfg)]
// Top-level ill-formed
#[link(name = "...", "literal")] //~ ERROR unexpected `#[link]` argument
#[link(name = "...", unknown)] //~ ERROR unexpected `#[link]` argument
extern "C" {}
// Duplicate arguments
#[link(name = "foo", name = "bar")] //~ ERROR multiple `name` arguments
#[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR multiple `kind` arguments
#[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] //~ ERROR multiple `modifiers` arguments
#[link(name = "...", cfg(FALSE), cfg(FALSE))] //~ ERROR multiple `cfg` arguments
#[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR multiple `wasm_import_module` arguments
extern "C" {}
// Ill-formed arguments
#[link(name)] //~ ERROR link name must be of the form `name = "string"`
//~| ERROR `#[link]` attribute requires a `name = "string"` argument
#[link(name())] //~ ERROR link name must be of the form `name = "string"`
//~| ERROR `#[link]` attribute requires a `name = "string"` argument
#[link(name = "...", kind)] //~ ERROR link kind must be of the form `kind = "string"`
#[link(name = "...", kind())] //~ ERROR link kind must be of the form `kind = "string"`
#[link(name = "...", modifiers)] //~ ERROR link modifiers must be of the form `modifiers = "string"`
#[link(name = "...", modifiers())] //~ ERROR link modifiers must be of the form `modifiers = "string"`
#[link(name = "...", cfg)] //~ ERROR link cfg must be of the form `cfg(/* predicate */)`
#[link(name = "...", cfg = "literal")] //~ ERROR link cfg must be of the form `cfg(/* predicate */)`
#[link(name = "...", cfg("literal"))] //~ ERROR link cfg must have a single predicate argument
#[link(name = "...", wasm_import_module)] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"`
#[link(name = "...", wasm_import_module())] //~ ERROR wasm import module must be of the form `wasm_import_module = "string"`
extern "C" {}
// Basic modifier validation
#[link(name = "...", modifiers = "")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix
#[link(name = "...", modifiers = "no-plus-minus")] //~ ERROR invalid linking modifier syntax, expected '+' or '-' prefix
#[link(name = "...", modifiers = "+unknown")] //~ ERROR unknown linking modifier `unknown`
#[link(name = "...", modifiers = "+verbatim,+verbatim")] //~ ERROR multiple `verbatim` modifiers
extern "C" {}
fn main() {}

View file

@ -0,0 +1,147 @@
error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module
--> $DIR/link-attr-validation-late.rs:5:22
|
LL | #[link(name = "...", "literal")]
| ^^^^^^^^^
error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module
--> $DIR/link-attr-validation-late.rs:6:22
|
LL | #[link(name = "...", unknown)]
| ^^^^^^^
error: multiple `name` arguments in a single `#[link]` attribute
--> $DIR/link-attr-validation-late.rs:10:22
|
LL | #[link(name = "foo", name = "bar")]
| ^^^^^^^^^^^^
error: multiple `kind` arguments in a single `#[link]` attribute
--> $DIR/link-attr-validation-late.rs:11:38
|
LL | #[link(name = "...", kind = "dylib", kind = "bar")]
| ^^^^^^^^^^^^
error: multiple `modifiers` arguments in a single `#[link]` attribute
--> $DIR/link-attr-validation-late.rs:12:47
|
LL | #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")]
| ^^^^^^^^^^^^^^^^^
error: multiple `cfg` arguments in a single `#[link]` attribute
--> $DIR/link-attr-validation-late.rs:13:34
|
LL | #[link(name = "...", cfg(FALSE), cfg(FALSE))]
| ^^^^^^^^^^
error: multiple `wasm_import_module` arguments in a single `#[link]` attribute
--> $DIR/link-attr-validation-late.rs:14:36
|
LL | #[link(wasm_import_module = "foo", wasm_import_module = "bar")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: link name must be of the form `name = "string"`
--> $DIR/link-attr-validation-late.rs:18:8
|
LL | #[link(name)]
| ^^^^
error[E0459]: `#[link]` attribute requires a `name = "string"` argument
--> $DIR/link-attr-validation-late.rs:18:1
|
LL | #[link(name)]
| ^^^^^^^^^^^^^ missing `name` argument
error: link name must be of the form `name = "string"`
--> $DIR/link-attr-validation-late.rs:20:8
|
LL | #[link(name())]
| ^^^^^^
error[E0459]: `#[link]` attribute requires a `name = "string"` argument
--> $DIR/link-attr-validation-late.rs:20:1
|
LL | #[link(name())]
| ^^^^^^^^^^^^^^^ missing `name` argument
error: link kind must be of the form `kind = "string"`
--> $DIR/link-attr-validation-late.rs:22:22
|
LL | #[link(name = "...", kind)]
| ^^^^
error: link kind must be of the form `kind = "string"`
--> $DIR/link-attr-validation-late.rs:23:22
|
LL | #[link(name = "...", kind())]
| ^^^^^^
error: link modifiers must be of the form `modifiers = "string"`
--> $DIR/link-attr-validation-late.rs:24:22
|
LL | #[link(name = "...", modifiers)]
| ^^^^^^^^^
error: link modifiers must be of the form `modifiers = "string"`
--> $DIR/link-attr-validation-late.rs:25:22
|
LL | #[link(name = "...", modifiers())]
| ^^^^^^^^^^^
error: link cfg must be of the form `cfg(/* predicate */)`
--> $DIR/link-attr-validation-late.rs:26:22
|
LL | #[link(name = "...", cfg)]
| ^^^
error: link cfg must be of the form `cfg(/* predicate */)`
--> $DIR/link-attr-validation-late.rs:27:22
|
LL | #[link(name = "...", cfg = "literal")]
| ^^^^^^^^^^^^^^^
error: link cfg must have a single predicate argument
--> $DIR/link-attr-validation-late.rs:28:22
|
LL | #[link(name = "...", cfg("literal"))]
| ^^^^^^^^^^^^^^
error: wasm import module must be of the form `wasm_import_module = "string"`
--> $DIR/link-attr-validation-late.rs:29:22
|
LL | #[link(name = "...", wasm_import_module)]
| ^^^^^^^^^^^^^^^^^^
error: wasm import module must be of the form `wasm_import_module = "string"`
--> $DIR/link-attr-validation-late.rs:30:22
|
LL | #[link(name = "...", wasm_import_module())]
| ^^^^^^^^^^^^^^^^^^^^
error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed
--> $DIR/link-attr-validation-late.rs:34:34
|
LL | #[link(name = "...", modifiers = "")]
| ^^
error: invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed
--> $DIR/link-attr-validation-late.rs:35:34
|
LL | #[link(name = "...", modifiers = "no-plus-minus")]
| ^^^^^^^^^^^^^^^
error: unknown linking modifier `unknown`, expected one of: bundle, verbatim, whole-archive, as-needed
--> $DIR/link-attr-validation-late.rs:36:34
|
LL | #[link(name = "...", modifiers = "+unknown")]
| ^^^^^^^^^^
error: multiple `verbatim` modifiers in a single `modifiers` argument
--> $DIR/link-attr-validation-late.rs:37:34
|
LL | #[link(name = "...", modifiers = "+verbatim,+verbatim")]
| ^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 24 previous errors
For more information about this error, try `rustc --explain E0459`.

View file

@ -1,5 +1,5 @@
// compile-flags:-l static= // compile-flags:-l static=
// error-pattern: empty library name given via `-l` // error-pattern: library name must not be empty
fn main() { fn main() {
} }

View file

@ -1,4 +1,2 @@
error: empty library name given via `-l` error: library name must not be empty
error: aborting due to previous error

View file

@ -1,5 +1,5 @@
// compile-flags:-l bar=foo // compile-flags:-l bar=foo
// error-pattern: unknown library kind `bar`, expected one of dylib, framework, or static // error-pattern: unknown library kind `bar`, expected one of: static, dylib, framework
fn main() { fn main() {
} }

View file

@ -1,2 +1,2 @@
error: unknown library kind `bar`, expected one of dylib, framework, or static error: unknown library kind `bar`, expected one of: static, dylib, framework

View file

@ -1,7 +1,7 @@
// ignore-macos // ignore-macos
// ignore-ios // ignore-ios
// compile-flags:-l framework=foo // compile-flags:-l framework=foo
// error-pattern: native frameworks are only available on macOS targets // error-pattern: library kind `framework` is only supported on Apple targets
fn main() { fn main() {
} }

View file

@ -1,4 +1,4 @@
error: native frameworks are only available on macOS targets error: library kind `framework` is only supported on Apple targets
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,5 +1,5 @@
// compile-flags:-l raw-dylib=foo // compile-flags:-l raw-dylib=foo
// error-pattern: unknown library kind `raw-dylib`, expected one of dylib, framework, or static // error-pattern: unknown library kind `raw-dylib`, expected one of: static, dylib, framework
fn main() { fn main() {
} }

View file

@ -1,2 +1,2 @@
error: unknown library kind `raw-dylib`, expected one of dylib, framework, or static error: unknown library kind `raw-dylib`, expected one of: static, dylib, framework

View file

@ -1,6 +1,6 @@
// Unspecified kind should fail with an error // Unspecified kind should fail with an error
// compile-flags: -l =mylib // compile-flags: -l =mylib
// error-pattern: unknown library kind ``, expected one of dylib, framework, or static // error-pattern: unknown library kind ``, expected one of: static, dylib, framework
fn main() {} fn main() {}

View file

@ -1,2 +1,2 @@
error: unknown library kind ``, expected one of dylib, framework, or static error: unknown library kind ``, expected one of: static, dylib, framework

View file

@ -1,6 +1,6 @@
// Unspecified kind should fail with an error // Unspecified kind should fail with an error
// compile-flags: -l :+bundle=mylib // compile-flags: -l :+bundle=mylib
// error-pattern: unknown library kind ``, expected one of dylib, framework, or static // error-pattern: unknown library kind ``, expected one of: static, dylib, framework
fn main() {} fn main() {}

View file

@ -1,2 +1,2 @@
error: unknown library kind ``, expected one of dylib, framework, or static error: unknown library kind ``, expected one of: static, dylib, framework

View file

@ -1,2 +1,2 @@
error: duplicating linking modifier is currently unstable and only accepted on the nightly compiler error: multiple `whole-archive` modifiers in a single `-l` option

View file

@ -3,12 +3,13 @@
#![feature(native_link_modifiers_bundle)] #![feature(native_link_modifiers_bundle)]
#[link(name = "foo")] #[link(name = "foo")]
#[link( //~ ERROR multiple `modifiers` arguments in a single `#[link]` attribute #[link(
name = "bar", name = "bar",
kind = "static", kind = "static",
modifiers = "+whole-archive,-whole-archive", modifiers = "+whole-archive,-whole-archive",
//~^ ERROR same modifier is used multiple times in a single `modifiers` argument //~^ ERROR multiple `whole-archive` modifiers in a single `modifiers` argument
modifiers = "+bundle" modifiers = "+bundle"
//~^ ERROR multiple `modifiers` arguments in a single `#[link]` attribute
)] )]
extern "C" {} extern "C" {}
//~^ ERROR overriding linking modifiers from command line is not supported //~^ ERROR overriding linking modifiers from command line is not supported

View file

@ -1,29 +1,23 @@
error: same modifier is used multiple times in a single `modifiers` argument error: multiple `modifiers` arguments in a single `#[link]` attribute
--> $DIR/modifiers-override.rs:9:5 --> $DIR/modifiers-override.rs:11:5
|
LL | modifiers = "+bundle"
| ^^^^^^^^^^^^^^^^^^^^^
error: multiple `whole-archive` modifiers in a single `modifiers` argument
--> $DIR/modifiers-override.rs:9:17
| |
LL | modifiers = "+whole-archive,-whole-archive", LL | modifiers = "+whole-archive,-whole-archive",
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: multiple `modifiers` arguments in a single `#[link]` attribute
--> $DIR/modifiers-override.rs:6:1
|
LL | / #[link(
LL | | name = "bar",
LL | | kind = "static",
LL | | modifiers = "+whole-archive,-whole-archive",
LL | |
LL | | modifiers = "+bundle"
LL | | )]
| |__^
error: overriding linking modifiers from command line is not supported error: overriding linking modifiers from command line is not supported
--> $DIR/modifiers-override.rs:13:1 --> $DIR/modifiers-override.rs:14:1
| |
LL | extern "C" {} LL | extern "C" {}
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: overriding linking modifiers from command line is not supported error: overriding linking modifiers from command line is not supported
--> $DIR/modifiers-override.rs:13:1 --> $DIR/modifiers-override.rs:14:1
| |
LL | extern "C" {} LL | extern "C" {}
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^

View file

@ -2,6 +2,6 @@
#[link(name = "foo", kind = "framework")] #[link(name = "foo", kind = "framework")]
extern "C" {} extern "C" {}
//~^^ ERROR: native frameworks are only available on macOS //~^^ ERROR: link kind `framework` is only supported on Apple targets
fn main() {} fn main() {}

View file

@ -1,8 +1,8 @@
error[E0455]: native frameworks are only available on macOS targets error[E0455]: link kind `framework` is only supported on Apple targets
--> $DIR/osx-frameworks.rs:3:1 --> $DIR/osx-frameworks.rs:3:29
| |
LL | #[link(name = "foo", kind = "framework")] LL | #[link(name = "foo", kind = "framework")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View file

@ -0,0 +1,9 @@
// compile-flags: -l dylib=foo:bar
// error-pattern: overriding linking modifiers from command line is not supported
#![feature(native_link_modifiers_as_needed)]
#![crate_type = "lib"]
#[link(name = "foo", kind = "dylib", modifiers = "-as-needed")]
extern "C" {}

View file

@ -0,0 +1,8 @@
error: overriding linking modifiers from command line is not supported
--> $DIR/rename-modifiers.rs:9:1
|
LL | extern "C" {}
| ^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -3,5 +3,5 @@
#![feature(raw_dylib)] #![feature(raw_dylib)]
//~^ WARNING: the feature `raw_dylib` is incomplete //~^ WARNING: the feature `raw_dylib` is incomplete
#[link(name = "foo", kind = "raw-dylib")] #[link(name = "foo", kind = "raw-dylib")]
//~^ ERROR: `#[link(...)]` with `kind = "raw-dylib"` only supported on Windows //~^ ERROR: link kind `raw-dylib` is only supported on Windows targets
extern "C" {} extern "C" {}

View file

@ -7,11 +7,12 @@ LL | #![feature(raw_dylib)]
= note: `#[warn(incomplete_features)]` on by default = note: `#[warn(incomplete_features)]` on by default
= note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information = note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information
error: `#[link(...)]` with `kind = "raw-dylib"` only supported on Windows error[E0455]: link kind `raw-dylib` is only supported on Windows targets
--> $DIR/raw-dylib-windows-only.rs:5:1 --> $DIR/raw-dylib-windows-only.rs:5:29
| |
LL | #[link(name = "foo", kind = "raw-dylib")] LL | #[link(name = "foo", kind = "raw-dylib")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0455`.

View file

@ -1,3 +1,5 @@
#![feature(link_cfg)]
#[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form #[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form
extern "C" {} extern "C" {}
@ -7,4 +9,13 @@ extern "C" {}
#[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form #[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form
extern "C" {} extern "C" {}
#[link(wasm_import_module = "foo", name = "bar")] //~ ERROR: `wasm_import_module` is incompatible with other arguments
extern "C" {}
#[link(wasm_import_module = "foo", kind = "dylib")] //~ ERROR: `wasm_import_module` is incompatible with other arguments
extern "C" {}
#[link(wasm_import_module = "foo", cfg(FALSE))] //~ ERROR: `wasm_import_module` is incompatible with other arguments
extern "C" {}
fn main() {} fn main() {}

View file

@ -1,20 +1,38 @@
error: must be of the form `#[link(wasm_import_module = "...")]` error: wasm import module must be of the form `wasm_import_module = "string"`
--> $DIR/wasm-import-module.rs:1:22 --> $DIR/wasm-import-module.rs:3:22
| |
LL | #[link(name = "...", wasm_import_module)] LL | #[link(name = "...", wasm_import_module)]
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
error: must be of the form `#[link(wasm_import_module = "...")]` error: wasm import module must be of the form `wasm_import_module = "string"`
--> $DIR/wasm-import-module.rs:4:22 --> $DIR/wasm-import-module.rs:6:22
| |
LL | #[link(name = "...", wasm_import_module(x))] LL | #[link(name = "...", wasm_import_module(x))]
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
error: must be of the form `#[link(wasm_import_module = "...")]` error: wasm import module must be of the form `wasm_import_module = "string"`
--> $DIR/wasm-import-module.rs:7:22 --> $DIR/wasm-import-module.rs:9:22
| |
LL | #[link(name = "...", wasm_import_module())] LL | #[link(name = "...", wasm_import_module())]
| ^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes
--> $DIR/wasm-import-module.rs:12:8
|
LL | #[link(wasm_import_module = "foo", name = "bar")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes
--> $DIR/wasm-import-module.rs:15:8
|
LL | #[link(wasm_import_module = "foo", kind = "dylib")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `wasm_import_module` is incompatible with other arguments in `#[link]` attributes
--> $DIR/wasm-import-module.rs:18:8
|
LL | #[link(wasm_import_module = "foo", cfg(FALSE))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 6 previous errors