]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-51279.rs
Rollup merge of #52453 - srijs:fix-52436, r=TimNN
[rust.git] / src / test / ui / issues / issue-51279.rs
1 // Copyright 2018 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 pub struct X<#[cfg(none)] 'a, #[cfg(none)] T>(&'a T);
12 //~^ ERROR #[cfg] cannot be applied on a generic parameter
13 //~^^ ERROR #[cfg] cannot be applied on a generic parameter
14
15 impl<#[cfg(none)] 'a, #[cfg(none)] T> X<'a, T> {}
16 //~^ ERROR #[cfg] cannot be applied on a generic parameter
17 //~^^ ERROR #[cfg] cannot be applied on a generic parameter
18
19 pub fn f<#[cfg(none)] 'a, #[cfg(none)] T>(_: &'a T) {}
20 //~^ ERROR #[cfg] cannot be applied on a generic parameter
21 //~^^ ERROR #[cfg] cannot be applied on a generic parameter
22
23 #[cfg(none)]
24 pub struct Y<#[cfg(none)] T>(T); // shouldn't care when the entire item is stripped out
25
26 struct M<T>(*const T);
27
28 unsafe impl<#[cfg_attr(none, may_dangle)] T> Drop for M<T> {
29     //~^ ERROR #[cfg_attr] cannot be applied on a generic parameter
30     fn drop(&mut self) {}
31 }
32
33 type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>;
34 //~^ ERROR #[cfg] cannot be applied on a generic parameter