Skip to content

Commit faf5355

Browse files
committed
rollup merge of rust-lang#20382: alexcrichton/isuse-20376
2 parents 074996d + a6f5b98 commit faf5355

File tree

4 files changed

+45
-28
lines changed

4 files changed

+45
-28
lines changed

src/librustc/session/config.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
744744
opt::multi("l", "", "Link the generated crate(s) to the specified native
745745
library NAME. The optional KIND can be one of,
746746
static, dylib, or framework. If omitted, dylib is
747-
assumed.", "NAME[:KIND]"),
747+
assumed.", "[KIND=]NAME"),
748748
opt::multi("", "crate-type", "Comma separated list of types of crates
749749
for the compiler to emit",
750750
"[bin|lib|rlib|dylib|staticlib]"),
@@ -1017,6 +1017,24 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
10171017
}
10181018

10191019
let libs = matches.opt_strs("l").into_iter().map(|s| {
1020+
let mut parts = s.splitn(1, '=');
1021+
let kind = parts.next().unwrap();
1022+
if let Some(name) = parts.next() {
1023+
let kind = match kind {
1024+
"dylib" => cstore::NativeUnknown,
1025+
"framework" => cstore::NativeFramework,
1026+
"static" => cstore::NativeStatic,
1027+
s => {
1028+
early_error(format!("unknown library kind `{}`, expected \
1029+
one of dylib, framework, or static",
1030+
s)[]);
1031+
}
1032+
};
1033+
return (name.to_string(), kind)
1034+
}
1035+
1036+
// FIXME(acrichto) remove this once crates have stopped using it, this
1037+
// is deprecated behavior now.
10201038
let mut parts = s.rsplitn(1, ':');
10211039
let kind = parts.next().unwrap();
10221040
let (name, kind) = match (parts.next(), kind) {

src/librustc/session/search_paths.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,14 @@ impl SearchPaths {
3434
}
3535

3636
pub fn add_path(&mut self, path: &str) {
37-
let (kind, path) = if path.ends_with(":native") {
38-
(PathKind::Native, path.slice_to(path.len() - ":native".len()))
39-
} else if path.ends_with(":crate") {
40-
(PathKind::Crate, path.slice_to(path.len() - ":crate".len()))
41-
} else if path.ends_with(":dependency") {
42-
(PathKind::Dependency,
43-
path.slice_to(path.len() - ":dependency".len()))
44-
} else if path.ends_with(":all") {
45-
(PathKind::All, path.slice_to(path.len() - ":all".len()))
37+
let (kind, path) = if path.starts_with("native=") {
38+
(PathKind::Native, path.slice_from("native=".len()))
39+
} else if path.starts_with("crate=") {
40+
(PathKind::Crate, path.slice_from("crate=".len()))
41+
} else if path.starts_with("dependency=") {
42+
(PathKind::Dependency, path.slice_from("dependency=".len()))
43+
} else if path.starts_with("all=") {
44+
(PathKind::All, path.slice_from("all=".len()))
4645
} else {
4746
(PathKind::All, path)
4847
};

src/test/run-make/compiler-lookup-paths/Makefile

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ all: $(TMPDIR)/libnative.a
66
mv $(TMPDIR)/libnative.a $(TMPDIR)/native
77
$(RUSTC) a.rs
88
mv $(TMPDIR)/liba.rlib $(TMPDIR)/crate
9-
$(RUSTC) b.rs -L $(TMPDIR)/crate:native && exit 1 || exit 0
10-
$(RUSTC) b.rs -L $(TMPDIR)/crate:dependency && exit 1 || exit 0
11-
$(RUSTC) b.rs -L $(TMPDIR)/crate:crate
12-
$(RUSTC) b.rs -L $(TMPDIR)/crate
13-
$(RUSTC) c.rs -L $(TMPDIR)/crate:native && exit 1 || exit 0
14-
$(RUSTC) c.rs -L $(TMPDIR)/crate:crate && exit 1 || exit 0
15-
$(RUSTC) c.rs -L $(TMPDIR)/crate:dependency
16-
$(RUSTC) c.rs -L $(TMPDIR)/crate
17-
$(RUSTC) d.rs -L $(TMPDIR)/native:dependency && exit 1 || exit 0
18-
$(RUSTC) d.rs -L $(TMPDIR)/native:crate && exit 1 || exit 0
19-
$(RUSTC) d.rs -L $(TMPDIR)/native:native
20-
$(RUSTC) d.rs -L $(TMPDIR)/native
9+
$(RUSTC) b.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0
10+
$(RUSTC) b.rs -L dependency=$(TMPDIR)/crate && exit 1 || exit 0
11+
$(RUSTC) b.rs -L crate=$(TMPDIR)/crate
12+
$(RUSTC) b.rs -L all=$(TMPDIR)/crate
13+
$(RUSTC) c.rs -L native=$(TMPDIR)/crate && exit 1 || exit 0
14+
$(RUSTC) c.rs -L crate=$(TMPDIR)/crate && exit 1 || exit 0
15+
$(RUSTC) c.rs -L dependency=$(TMPDIR)/crate
16+
$(RUSTC) c.rs -L all=$(TMPDIR)/crate
17+
$(RUSTC) d.rs -L dependency=$(TMPDIR)/native && exit 1 || exit 0
18+
$(RUSTC) d.rs -L crate=$(TMPDIR)/native && exit 1 || exit 0
19+
$(RUSTC) d.rs -L native=$(TMPDIR)/native
20+
$(RUSTC) d.rs -L all=$(TMPDIR)/native
2121
mkdir -p $(TMPDIR)/e1
2222
mkdir -p $(TMPDIR)/e2
2323
$(RUSTC) e.rs -o $(TMPDIR)/e1/libe.rlib
2424
$(RUSTC) e.rs -o $(TMPDIR)/e2/libe.rlib
2525
$(RUSTC) f.rs -L $(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0
26-
$(RUSTC) f.rs -L $(TMPDIR)/e1:crate -L $(TMPDIR)/e2 && exit 1 || exit 0
27-
$(RUSTC) f.rs -L $(TMPDIR)/e1:crate -L $(TMPDIR)/e2:crate && exit 1 || exit 0
28-
$(RUSTC) f.rs -L $(TMPDIR)/e1:native -L $(TMPDIR)/e2
29-
$(RUSTC) f.rs -L $(TMPDIR)/e1:dependency -L $(TMPDIR)/e2
30-
$(RUSTC) f.rs -L $(TMPDIR)/e1:dependency -L $(TMPDIR)/e2:crate
26+
$(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L $(TMPDIR)/e2 && exit 1 || exit 0
27+
$(RUSTC) f.rs -L crate=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2 && exit 1 || exit 0
28+
$(RUSTC) f.rs -L native=$(TMPDIR)/e1 -L $(TMPDIR)/e2
29+
$(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L $(TMPDIR)/e2
30+
$(RUSTC) f.rs -L dependency=$(TMPDIR)/e1 -L crate=$(TMPDIR)/e2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-include ../tools.mk
22

33
all: $(TMPDIR)/libbar.a
4-
$(RUSTC) foo.rs -lbar:static
4+
$(RUSTC) foo.rs -lstatic=bar
55
$(RUSTC) main.rs
66
$(call RUN,main)
77

0 commit comments

Comments
 (0)