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

Closes #43925.
Closes #43926.
This commit is contained in:
Seiichi Uchida 2018-01-12 11:41:33 +09:00
parent 73ac5d6a80
commit d088b25d7e
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() {}