]> git.lizzy.rs Git - rust.git/commitdiff
Stabilize native library modifier `verbatim`
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sun, 13 Nov 2022 10:03:01 +0000 (13:03 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sun, 27 Nov 2022 19:36:32 +0000 (22:36 +0300)
17 files changed:
compiler/rustc_codegen_ssa/src/back/link.rs
compiler/rustc_codegen_ssa/src/back/linker.rs
compiler/rustc_codegen_ssa/src/lib.rs
compiler/rustc_feature/src/accepted.rs
compiler/rustc_feature/src/active.rs
compiler/rustc_metadata/src/native_libs.rs
compiler/rustc_session/src/config.rs
src/doc/rustc/src/command-line-arguments.md
src/doc/unstable-book/src/language-features/native-link-modifiers-verbatim.md [deleted file]
src/test/run-make/native-link-modifier-verbatim-linker/Makefile
src/test/run-make/native-link-modifier-verbatim-rustc/Makefile
src/test/run-make/raw-dylib-c/lib.rs
src/test/run-make/rlib-format-packed-bundled-libs-2/rust_dep.rs
src/test/ui/feature-gates/feature-gate-native_link_modifiers_verbatim.rs [deleted file]
src/test/ui/feature-gates/feature-gate-native_link_modifiers_verbatim.stderr [deleted file]
src/test/ui/linkage-attr/link-attr-validation-late.rs
src/test/ui/linkage-attr/link-attr-validation-late.stderr

index 762430c6187216b8ff2b66ee8832eef2a9c921e4..b103c7de74c1430e4df94350a7bd011bd6301158 100644 (file)
@@ -377,12 +377,8 @@ fn link_rlib<'a>(
                 find_native_static_library(name.as_str(), lib.verbatim, &lib_search_paths, sess);
             if sess.opts.unstable_opts.packed_bundled_libs && flavor == RlibFlavor::Normal {
                 let filename = lib.filename.unwrap();
-                let lib_path = find_native_static_library(
-                    filename.as_str(),
-                    Some(true),
-                    &lib_search_paths,
-                    sess,
-                );
+                let lib_path =
+                    find_native_static_library(filename.as_str(), true, &lib_search_paths, sess);
                 let src = read(lib_path)
                     .map_err(|e| sess.emit_fatal(errors::ReadFileError { message: e }))?;
                 let (data, _) = create_wrapper_file(sess, b".bundled_lib".to_vec(), &src);
@@ -465,7 +461,7 @@ fn collate_raw_dylibs<'a, 'b>(
 
     for lib in used_libraries {
         if lib.kind == NativeLibKind::RawDylib {
-            let ext = if matches!(lib.verbatim, Some(true)) { "" } else { ".dll" };
+            let ext = if lib.verbatim { "" } else { ".dll" };
             let name = format!("{}{}", lib.name.expect("unnamed raw-dylib library"), ext);
             let imports = dylib_table.entry(name.clone()).or_default();
             for import in &lib.dll_imports {
@@ -1335,7 +1331,7 @@ fn print_native_static_libs(sess: &Session, all_native_libs: &[NativeLib]) {
                 NativeLibKind::Static { bundle: Some(false), .. }
                 | NativeLibKind::Dylib { .. }
                 | NativeLibKind::Unspecified => {
-                    let verbatim = lib.verbatim.unwrap_or(false);
+                    let verbatim = lib.verbatim;
                     if sess.target.is_like_msvc {
                         Some(format!("{}{}", name, if verbatim { "" } else { ".lib" }))
                     } else if sess.target.linker_flavor.is_gnu() {
@@ -2306,7 +2302,7 @@ fn add_native_libs_from_crate(
         _ => &codegen_results.crate_info.native_libraries[&cnum],
     };
 
-    let mut last = (None, NativeLibKind::Unspecified, None);
+    let mut last = (None, NativeLibKind::Unspecified, false);
     for lib in native_libs {
         let Some(name) = lib.name else {
             continue;
@@ -2323,7 +2319,7 @@ fn add_native_libs_from_crate(
         };
 
         let name = name.as_str();
-        let verbatim = lib.verbatim.unwrap_or(false);
+        let verbatim = lib.verbatim;
         match lib.kind {
             NativeLibKind::Static { bundle, whole_archive } => {
                 if link_static {
index 7f0c2861f7e29014de16da9d8817dc50a7c8c6c6..5fb11e6b914b8d03cb96691b72eaba9e78109f7e 100644 (file)
@@ -515,7 +515,7 @@ fn link_whole_staticlib(&mut self, lib: &str, verbatim: bool, search_path: &[Pat
             // -force_load is the macOS equivalent of --whole-archive, but it
             // involves passing the full path to the library to link.
             self.linker_arg("-force_load");
-            let lib = find_native_static_library(lib, Some(verbatim), search_path, &self.sess);
+            let lib = find_native_static_library(lib, verbatim, search_path, &self.sess);
             self.linker_arg(&lib);
         }
     }
index ade33b6c77728defec98a0e57bfc8d3e8b20c869..def6390f6a36bcbd15d9610ceaa412eef883eeda 100644 (file)
@@ -116,7 +116,7 @@ pub struct NativeLib {
     pub name: Option<Symbol>,
     pub filename: Option<Symbol>,
     pub cfg: Option<ast::MetaItem>,
-    pub verbatim: Option<bool>,
+    pub verbatim: bool,
     pub dll_imports: Vec<cstore::DllImport>,
 }
 
@@ -127,7 +127,7 @@ fn from(lib: &cstore::NativeLib) -> Self {
             filename: lib.filename,
             name: lib.name,
             cfg: lib.cfg.clone(),
-            verbatim: lib.verbatim,
+            verbatim: lib.verbatim.unwrap_or(false),
             dll_imports: lib.dll_imports.clone(),
         }
     }
index 1646727a1c85f9b72f14f01596b72d8a42929184..7678ce323dfbc04fb0f254e47e214ca9ed833e68 100644 (file)
@@ -237,6 +237,8 @@ macro_rules! declare_features {
     (accepted, native_link_modifiers, "1.61.0", Some(81490), None),
     /// Allows specifying the bundle link modifier
     (accepted, native_link_modifiers_bundle, "1.63.0", Some(81490), None),
+    /// Allows specifying the verbatim link modifier
+    (accepted, native_link_modifiers_verbatim, "CURRENT_RUSTC_VERSION", Some(81490), None),
     /// Allows specifying the whole-archive link modifier
     (accepted, native_link_modifiers_whole_archive, "1.61.0", Some(81490), None),
     /// Allows using non lexical lifetimes (RFC 2094).
index 9ca63c393c623746524833e90ca58d1362c338a6..69c5297bf6b82564395b902052c9ce01ec38e3fa 100644 (file)
@@ -455,8 +455,6 @@ pub fn set(&self, features: &mut Features, span: Span) {
     (active, naked_functions, "1.9.0", Some(32408), None),
     /// Allows specifying the as-needed link modifier
     (active, native_link_modifiers_as_needed, "1.53.0", Some(81490), None),
-    /// Allows specifying the verbatim link modifier
-    (active, native_link_modifiers_verbatim, "1.53.0", Some(81490), None),
     /// Allow negative trait implementations.
     (active, negative_impls, "1.44.0", Some(68318), None),
     /// Allows the `!` type. Does not imply 'exhaustive_patterns' (below) any more.
index 20a2e78299aed0bb49dbe047f3befefc65e58046..1fd35adf1bd2cc4c4ac7f865e10d55d0d1a04b82 100644 (file)
 
 pub fn find_native_static_library(
     name: &str,
-    verbatim: Option<bool>,
+    verbatim: bool,
     search_paths: &[PathBuf],
     sess: &Session,
 ) -> PathBuf {
-    let formats = if verbatim.unwrap_or(false) {
+    let formats = if verbatim {
         vec![("".into(), "".into())]
     } else {
         let os = (sess.target.staticlib_prefix.clone(), sess.target.staticlib_suffix.clone());
@@ -52,7 +52,7 @@ pub fn find_native_static_library(
         }
     }
 
-    sess.emit_fatal(MissingNativeLibrary::new(name, verbatim.unwrap_or(false)));
+    sess.emit_fatal(MissingNativeLibrary::new(name, verbatim));
 }
 
 fn find_bundled_library(
@@ -66,7 +66,7 @@ fn find_bundled_library(
             let NativeLibKind::Static { bundle: Some(true) | None, .. } = kind {
         find_native_static_library(
             name.unwrap().as_str(),
-            verbatim,
+            verbatim.unwrap_or(false),
             &sess.target_filesearch(PathKind::Native).search_path_dirs(),
             sess,
         ).file_name().and_then(|s| s.to_str()).map(Symbol::intern)
@@ -311,10 +311,7 @@ fn process_item(&mut self, id: rustc_hir::ItemId) {
                             sess.emit_err(BundleNeedsStatic { span });
                         }
 
-                        ("verbatim", _) => {
-                            report_unstable_modifier!(native_link_modifiers_verbatim);
-                            assign_modifier(&mut verbatim)
-                        }
+                        ("verbatim", _) => assign_modifier(&mut verbatim),
 
                         ("whole-archive", Some(NativeLibKind::Static { whole_archive, .. })) => {
                             assign_modifier(whole_archive)
index 3b1b33aa095a1a3b7f9c526e888d8c078864d74c..927810351e958c1f73e7879bb8df49cbf75922f4 100644 (file)
@@ -2029,10 +2029,7 @@ fn parse_native_lib_modifiers(
                 "linking modifier `bundle` is only compatible with `static` linking kind",
             ),
 
-            ("verbatim", _) => {
-                report_unstable_modifier();
-                assign_modifier(&mut verbatim)
-            }
+            ("verbatim", _) => assign_modifier(&mut verbatim),
 
             ("whole-archive", NativeLibKind::Static { whole_archive, .. }) => {
                 assign_modifier(whole_archive)
index 2dc182b3d83edb7cf29e6c729b74f87c5bb54047..ef6eee75f1ce6c2cdc4d0ed83e43144e60bb68de 100644 (file)
@@ -104,6 +104,33 @@ This modifier has no effect when building other targets like executables or dyna
 
 The default for this modifier is `+bundle`.
 
+### Linking modifiers: `verbatim`
+
+This modifier is compatible with all linking kinds.
+
+`+verbatim` means that rustc itself won't add any target-specified library prefixes or suffixes
+(like `lib` or `.a`) to the library name, and will try its best to ask for the same thing from the
+linker.
+
+For `ld`-like linkers supporting GNU extensions rustc will use the `-l:filename` syntax (note the
+colon) when passing the library, so the linker won't add any prefixes or suffixes to it.
+See [`-l namespec`](https://sourceware.org/binutils/docs/ld/Options.html) in ld documentation for
+more details. \
+For linkers not supporting any verbatim modifiers (e.g. `link.exe` or `ld64`) the library name will
+be passed as is. So the most reliable cross-platform use scenarios for this option are when no
+linker is involved, for example bundling native libraries into rlibs.
+
+`-verbatim` means that rustc will either add a target-specific prefix and suffix to the library
+name before passing it to linker, or won't prevent linker from implicitly adding it. \
+In case of `raw-dylib` kind in particular `.dll` will be added to the library name on Windows.
+
+The default for this modifier is `-verbatim`.
+
+NOTE: Even with `+verbatim` and `-l:filename` syntax `ld`-like linkers do not typically support
+passing absolute paths to libraries. Usually such paths need to be passed as input files without
+using any options like `-l`, e.g. `ld /my/absolute/path`. \
+`-Clink-arg=/my/absolute/path` can be used for doing this from stable `rustc`.
+
 <a id="option-crate-type"></a>
 ## `--crate-type`: a list of types of crates for the compiler to emit
 
diff --git a/src/doc/unstable-book/src/language-features/native-link-modifiers-verbatim.md b/src/doc/unstable-book/src/language-features/native-link-modifiers-verbatim.md
deleted file mode 100644 (file)
index 02bd87e..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# `native_link_modifiers_verbatim`
-
-The tracking issue for this feature is: [#81490]
-
-[#81490]: https://github.com/rust-lang/rust/issues/81490
-
-------------------------
-
-The `native_link_modifiers_verbatim` feature allows you to use the `verbatim` modifier.
-
-`+verbatim` means that rustc itself won't add any target-specified library prefixes or suffixes (like `lib` or `.a`) to the library name, and will try its best to ask for the same thing from the linker.
-
-For `ld`-like linkers rustc will use the `-l:filename` syntax (note the colon) when passing the library, so the linker won't add any prefixes or suffixes as well.
-See [`-l namespec`](https://sourceware.org/binutils/docs/ld/Options.html) in ld documentation for more details.
-For linkers not supporting any verbatim modifiers (e.g. `link.exe` or `ld64`) the library name will be passed as is.
-
-The default for this modifier is `-verbatim`.
-
-This RFC changes the behavior of `raw-dylib` linking kind specified by [RFC 2627](https://github.com/rust-lang/rfcs/pull/2627). The `.dll` suffix (or other target-specified suffixes for other targets) is now added automatically.
-If your DLL doesn't have the `.dll` suffix, it can be specified with `+verbatim`.
index e56e1e94ec5b1d2cc7e2f6437db8328676d2e052..666e4084ce295d4cc16b80d61b2b6bacecd53006 100644 (file)
@@ -6,10 +6,10 @@ include ../../run-make-fulldeps/tools.mk
 all:
        # Verbatim allows specify precise name.
        $(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_some_strange_name.ext
-       $(RUSTC) main.rs -Zunstable-options -l static:+verbatim=local_some_strange_name.ext
+       $(RUSTC) main.rs -l static:+verbatim=local_some_strange_name.ext
 
        # With verbatim any other name cannot be used (local).
        $(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/liblocal_native_dep.a
        $(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_native_dep.a
        $(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_native_dep.lib
-       $(RUSTC) main.rs -Zunstable-options -l static:+verbatim=local_native_dep 2>&1 | $(CGREP) "local_native_dep"
+       $(RUSTC) main.rs -l static:+verbatim=local_native_dep 2>&1 | $(CGREP) "local_native_dep"
index 1093b1cd3694d1de267da2c7850d9c7e71fb9711..6f01f37804a2ac5e2dd0f738e95a5dc21bdd3cea 100644 (file)
@@ -3,10 +3,10 @@ include ../../run-make-fulldeps/tools.mk
 all:
        # Verbatim allows specify precise name.
        $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_some_strange_name.ext
-       $(RUSTC) rust_dep.rs -Zunstable-options -l static:+verbatim=upstream_some_strange_name.ext --crate-type rlib
+       $(RUSTC) rust_dep.rs -l static:+verbatim=upstream_some_strange_name.ext --crate-type rlib
 
        # With verbatim any other name cannot be used (upstream).
        $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/libupstream_native_dep.a
        $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_native_dep.a
        $(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_native_dep.lib
-       $(RUSTC) rust_dep.rs -Zunstable-options -l static:+verbatim=upstream_native_dep --crate-type rlib 2>&1 | $(CGREP) "upstream_native_dep"
+       $(RUSTC) rust_dep.rs -l static:+verbatim=upstream_native_dep --crate-type rlib 2>&1 | $(CGREP) "upstream_native_dep"
index 005ffcdda5c2ed84b76a5c32109a17c6fe9ff0e5..5fb1204037c933e3168b844231cb006f971f658f 100644 (file)
@@ -1,4 +1,4 @@
-#![feature(raw_dylib, native_link_modifiers_verbatim)]
+#![feature(raw_dylib)]
 
 #[link(name = "extern_1.dll", kind = "raw-dylib", modifiers = "+verbatim")]
 extern {
index d99dda05cf215dc5ef2abaeb23731567e333335b..77e41e237d42a2f2cfaa0abc7e0b8af27df94eea 100644 (file)
@@ -1,4 +1,3 @@
-#![feature(native_link_modifiers_verbatim)]
 #[link(name = "native_dep.ext", kind = "static", modifiers = "+verbatim")]
 extern "C" {
     fn native_f1() -> i32;
diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_verbatim.rs b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_verbatim.rs
deleted file mode 100644 (file)
index 7b09195..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#[link(name = "foo", modifiers = "+verbatim")]
-//~^ ERROR: linking modifier `verbatim` is unstable
-extern "C" {}
-
-fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-native_link_modifiers_verbatim.stderr b/src/test/ui/feature-gates/feature-gate-native_link_modifiers_verbatim.stderr
deleted file mode 100644 (file)
index 3bfbeb8..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: linking modifier `verbatim` is unstable
-  --> $DIR/feature-gate-native_link_modifiers_verbatim.rs:1:34
-   |
-LL | #[link(name = "foo", modifiers = "+verbatim")]
-   |                                  ^^^^^^^^^^^
-   |
-   = note: see issue #81490 <https://github.com/rust-lang/rust/issues/81490> for more information
-   = help: add `#![feature(native_link_modifiers_verbatim)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
index b454fbd0ed117f88b223d13fc0f261d3fd326930..34f720dd2d3c588e1847c73ba6938417e71050f2 100644 (file)
@@ -1,4 +1,3 @@
-#![feature(native_link_modifiers_verbatim)]
 #![feature(link_cfg)]
 
 // Top-level ill-formed
index dd0f1dba2ecf7c0df2b51baea06fddfc09bef970..1ad5fbaf7de8066f2f34d8a4828ada45e9b4b833 100644 (file)
 error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type
-  --> $DIR/link-attr-validation-late.rs:5:22
+  --> $DIR/link-attr-validation-late.rs:4:22
    |
 LL | #[link(name = "...", "literal")]
    |                      ^^^^^^^^^
 
 error: unexpected `#[link]` argument, expected one of: name, kind, modifiers, cfg, wasm_import_module, import_name_type
-  --> $DIR/link-attr-validation-late.rs:6:22
+  --> $DIR/link-attr-validation-late.rs:5:22
    |
 LL | #[link(name = "...", unknown)]
    |                      ^^^^^^^
 
 error: multiple `name` arguments in a single `#[link]` attribute
-  --> $DIR/link-attr-validation-late.rs:10:22
+  --> $DIR/link-attr-validation-late.rs:9:22
    |
 LL | #[link(name = "foo", name = "bar")]
    |                      ^^^^^^^^^^^^
 
 error: multiple `kind` arguments in a single `#[link]` attribute
-  --> $DIR/link-attr-validation-late.rs:11:38
+  --> $DIR/link-attr-validation-late.rs:10: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
+  --> $DIR/link-attr-validation-late.rs:11: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
+  --> $DIR/link-attr-validation-late.rs:12: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
+  --> $DIR/link-attr-validation-late.rs:13: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
+  --> $DIR/link-attr-validation-late.rs:17:8
    |
 LL | #[link(name)]
    |        ^^^^
 
 error[E0459]: `#[link]` attribute requires a `name = "string"` argument
-  --> $DIR/link-attr-validation-late.rs:18:1
+  --> $DIR/link-attr-validation-late.rs:17: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
+  --> $DIR/link-attr-validation-late.rs:19:8
    |
 LL | #[link(name())]
    |        ^^^^^^
 
 error[E0459]: `#[link]` attribute requires a `name = "string"` argument
-  --> $DIR/link-attr-validation-late.rs:20:1
+  --> $DIR/link-attr-validation-late.rs:19: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
+  --> $DIR/link-attr-validation-late.rs:21:22
    |
 LL | #[link(name = "...", kind)]
    |                      ^^^^
 
 error: link kind must be of the form `kind = "string"`
-  --> $DIR/link-attr-validation-late.rs:23:22
+  --> $DIR/link-attr-validation-late.rs:22:22
    |
 LL | #[link(name = "...", kind())]
    |                      ^^^^^^
 
 error: link modifiers must be of the form `modifiers = "string"`
-  --> $DIR/link-attr-validation-late.rs:24:22
+  --> $DIR/link-attr-validation-late.rs:23:22
    |
 LL | #[link(name = "...", modifiers)]
    |                      ^^^^^^^^^
 
 error: link modifiers must be of the form `modifiers = "string"`
-  --> $DIR/link-attr-validation-late.rs:25:22
+  --> $DIR/link-attr-validation-late.rs:24:22
    |
 LL | #[link(name = "...", modifiers())]
    |                      ^^^^^^^^^^^
 
 error: link cfg must be of the form `cfg(/* predicate */)`
-  --> $DIR/link-attr-validation-late.rs:26:22
+  --> $DIR/link-attr-validation-late.rs:25:22
    |
 LL | #[link(name = "...", cfg)]
    |                      ^^^
 
 error: link cfg must be of the form `cfg(/* predicate */)`
-  --> $DIR/link-attr-validation-late.rs:27:22
+  --> $DIR/link-attr-validation-late.rs:26:22
    |
 LL | #[link(name = "...", cfg = "literal")]
    |                      ^^^^^^^^^^^^^^^
 
 error: link cfg must have a single predicate argument
-  --> $DIR/link-attr-validation-late.rs:28:22
+  --> $DIR/link-attr-validation-late.rs:27: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
+  --> $DIR/link-attr-validation-late.rs:28: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
+  --> $DIR/link-attr-validation-late.rs:29: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
+  --> $DIR/link-attr-validation-late.rs:33: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
+  --> $DIR/link-attr-validation-late.rs:34: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
+  --> $DIR/link-attr-validation-late.rs:35:34
    |
 LL | #[link(name = "...", modifiers = "+unknown")]
    |                                  ^^^^^^^^^^
 
 error: multiple `verbatim` modifiers in a single `modifiers` argument
-  --> $DIR/link-attr-validation-late.rs:37:34
+  --> $DIR/link-attr-validation-late.rs:36:34
    |
 LL | #[link(name = "...", modifiers = "+verbatim,+verbatim")]
    |                                  ^^^^^^^^^^^^^^^^^^^^^