Skip to content

Commit 12b3498

Browse files
committed
Strip empty strings from link args
Closes #15487
1 parent 4f120e6 commit 12b3498

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/librustc/metadata/cstore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl CStore {
196196
}
197197

198198
pub fn add_used_link_args(&self, args: &str) {
199-
for s in args.split(' ') {
199+
for s in args.split(' ').filter(|s| !s.is_empty()) {
200200
self.used_link_args.borrow_mut().push(s.to_string());
201201
}
202202
}

src/test/run-pass/issue-15487.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// ignore-win32
12+
13+
#![feature(link_args)]
14+
15+
#[link_args="-lc -lm"]
16+
#[link_args=" -lc"]
17+
#[link_args="-lc "]
18+
extern {}
19+
20+
fn main() {}

0 commit comments

Comments
 (0)