Skip to content

Commit 3ae2174

Browse files
committed
Feature gate
1 parent 91f8144 commit 3ae2174

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

src/librustc/session/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,10 @@ pub fn build_session_options_and_crate_config(matches: &getopts::Matches)
14801480
s));
14811481
}
14821482
};
1483+
if kind == cstore::NativeStaticNobundle && !nightly_options::is_nightly_build() {
1484+
early_error(error_format, &format!("the library kind 'static-nobundle' is only \
1485+
accepted on the nightly compiler"));
1486+
}
14831487
let mut name_parts = name.splitn(2, ':');
14841488
let name = name_parts.next().unwrap();
14851489
let new_name = name_parts.next();

src/librustc_metadata/creader.rs

+7
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ fn register_native_lib(sess: &Session,
111111
GateIssue::Language,
112112
"is feature gated");
113113
}
114+
if lib.kind == cstore::NativeStaticNobundle && !sess.features.borrow().static_nobundle {
115+
feature_gate::emit_feature_err(&sess.parse_sess,
116+
"static_nobundle",
117+
span.unwrap(),
118+
GateIssue::Language,
119+
"kind=\"static-nobundle\" is feature gated");
120+
}
114121
cstore.add_used_library(lib);
115122
}
116123

src/libsyntax/feature_gate.rs

+3
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,9 @@ declare_features! (
322322
// Allows attributes on struct literal fields.
323323
(active, struct_field_attributes, "1.16.0", Some(38814)),
324324

325+
// Allows #[link(kind="static-nobundle"...]
326+
(active, static_nobundle, "1.16.0", Some(37403)),
327+
325328
// `extern "msp430-interrupt" fn()`
326329
(active, abi_msp430_interrupt, "1.16.0", Some(38487)),
327330
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2016 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+
#[link(name="foo", kind="static-nobundle")]
12+
//~^ ERROR: kind="static-nobundle" is feature gated
13+
extern {}

src/test/run-make/static-nobundle/bar.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_type = "rlib"]
12+
#![feature(static_nobundle)]
1213

1314
#[link(name = "foo", kind = "static-nobundle")]
1415
extern {

0 commit comments

Comments
 (0)