Skip to content

Commit 9f925ec

Browse files
Apply suggestions from review
Co-authored-by: Vadim Petrochenkov <[email protected]>
1 parent dd26ffd commit 9f925ec

File tree

20 files changed

+20
-52
lines changed

20 files changed

+20
-52
lines changed

compiler/rustc_metadata/src/native_libs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ impl<'tcx> Collector<'tcx> {
165165
feature_err(
166166
&sess.parse_sess,
167167
sym::link_arg_attribute,
168-
item.span(),
169-
"link-arg link kind is unstable",
168+
span,
169+
"link kind `link-arg` is unstable",
170170
)
171171
.emit();
172172
}

tests/run-make/linker-flags-from-attribute-flavor/Makefile

-8
This file was deleted.

tests/run-make/linker-flags-from-attribute-from-dep/Makefile

-10
This file was deleted.

tests/run-make/linker-flags-from-attribute-from-dep/main.rs

-3
This file was deleted.

tests/run-make/linker-flags-from-attribute-from-dep/native_dep_1.rs

-1
This file was deleted.

tests/run-make/linker-flags-from-attribute-from-dep/native_dep_2.rs

-1
This file was deleted.

tests/run-make/linker-flags-from-attribute/Makefile

-4
This file was deleted.

tests/run-make/linker-flags-from-attribute/rs.rs

-11
This file was deleted.

tests/run-make/pass-linker-flags-flavor/Makefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
include ../tools.mk
44

55
all:
6-
$(RUSTC) rs.rs -Z unstable-options -C linker-flavor=gnu-cc -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*-Wl,a1.*l2.*-Wl,a2.*d1.*-Wl,a3'
7-
$(RUSTC) rs.rs -Z unstable-options -C linker-flavor=gnu-cc -l static=l1 -l link-arg:+verbatim=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*-Wl,a2.*d1.*-Wl,a3'
8-
$(RUSTC) rs.rs -Z unstable-options -C linker-flavor=ld -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*"a2".*d1.*"a3"'
6+
$(RUSTC) empty.rs -Z unstable-options -C linker-flavor=gnu-cc -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*-Wl,a1.*l2.*-Wl,a2.*d1.*-Wl,a3'
7+
$(RUSTC) empty.rs -Z unstable-options -C linker-flavor=gnu-cc -l static=l1 -l link-arg:+verbatim=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*-Wl,a2.*d1.*-Wl,a3'
8+
$(RUSTC) empty.rs -Z unstable-options -C linker-flavor=ld -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*"a2".*d1.*"a3"'
9+
$(RUSTC) attribute.rs -Z unstable-options -C linker-flavor=gnu-cc --print link-args | $(CGREP) -e 'l1.*-Wl,a1.*l2.*-Wl,a2.*d1.*-Wl,a3'
10+
$(RUSTC) --cfg 'feature="verbatim"' attribute.rs -Z unstable-options -C linker-flavor=gnu-cc --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*-Wl,a2.*d1.*-Wl,a3'
11+
$(RUSTC) attribute.rs -C linker-flavor=ld --print link-args | $(CGREP) -e 'l1.*"a1".*l2.*"a2".*d1.*"a3"'

tests/run-make/linker-flags-from-attribute-flavor/verbatim.rs renamed to tests/run-make/pass-linker-flags-flavor/attribute.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#![feature(link_arg_attribute)]
22

33
#[link(kind = "static", name = "l1")]
4-
#[link(kind = "link-arg", name = "a1", modifiers = "+verbatim")]
4+
#[cfg_attr(feature = "verbatim", link(kind = "link-arg", name = "a1", modifiers = "+verbatim"))]
5+
#[cfg_attr(not(feature = "verbatim"), link(kind = "link-arg", name = "a1"))]
56
#[link(kind = "static", name = "l2")]
67
#[link(kind = "link-arg", name = "a2")]
78
#[link(kind = "dylib", name = "d1")]

tests/run-make/pass-linker-flags-from-dep/Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ all:
44
# Build deps
55
$(RUSTC) native_dep_1.rs --crate-type=staticlib
66
$(RUSTC) native_dep_2.rs --crate-type=staticlib
7-
$(RUSTC) rust_dep.rs -l static:-bundle=native_dep_1 -l link-arg=some_flag -l static:-bundle=native_dep_2 --crate-type=lib -Z unstable-options
7+
$(RUSTC) rust_dep_flag.rs -l static:-bundle=native_dep_1 -l link-arg=some_flag -l static:-bundle=native_dep_2 --crate-type=lib -Z unstable-options
8+
$(RUSTC) rust_dep_attr.rs --crate-type=lib
89

910
# Check sequence of linker args
10-
$(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep.rlib --crate-type=bin --print link-args | $(CGREP) -e 'native_dep_1.*some_flag.*native_dep_2'
11+
$(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep_flag.rlib --crate-type=bin --print link-args | $(CGREP) -e 'native_dep_1.*some_flag.*native_dep_2'
12+
$(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep_attr.rlib --crate-type=bin --print link-args | $(CGREP) -e 'native_dep_1.*some_flag.*native_dep_2'
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
include ../tools.mk
22

33
all:
4-
$(RUSTC) rs.rs -Z unstable-options -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3'
4+
$(RUSTC) empty.rs -Z unstable-options -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3'
5+
$(RUSTC) attribute.rs --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3'
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[link(kind = "link-arg", name = "foo")]
2-
//~^ ERROR: is unstable
2+
//~^ ERROR link kind `link-arg` is unstable
33
extern "C" {}
44

55
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#![feature(link_arg_attribute)]
22

3-
// compile-flags:
4-
// error-pattern: linking modifier `bundle` is only compatible with `static` linking kind
5-
63
#[link(kind = "link-arg", name = "arg", modifiers = "+bundle")]
4+
//~^ ERROR linking modifier `bundle` is only compatible with `static` linking kind
75
extern "C" {}
6+
87
pub fn main() {}

tests/ui/native-library-link-flags/link-arg-from-rs.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: linking modifier `bundle` is only compatible with `static` linking kind
2-
--> $DIR/link-arg-from-rs.rs:6:53
2+
--> $DIR/link-arg-from-rs.rs:3:53
33
|
44
LL | #[link(kind = "link-arg", name = "arg", modifiers = "+bundle")]
55
| ^^^^^^^^^

0 commit comments

Comments
 (0)