Rollup merge of #47372 - topecongiro:issue-43925, r=alexcrichton

Avoid panicking when invalid argument is passed to cfg(..)

Closes #43925.
Closes #43926.
This commit is contained in:
kennytm 2018-01-15 16:55:33 +08:00
commit f98a9a681e
No known key found for this signature in database
GPG key ID: FEF6C8051D0E013C
3 changed files with 43 additions and 3 deletions

View file

@ -0,0 +1,16 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(attr_literals)]
#[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)`
extern {}
fn main() {}

View file

@ -0,0 +1,14 @@
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[link(name="foo", cfg())] //~ ERROR `cfg()` must have an argument
extern {}
fn main() {}