1 // compile-flags: --cfg something
2 // build-pass (FIXME(62277): could be check-pass?)
4 #![feature(param_attrs)]
9 #[cfg(something)] b: i32,
10 #[cfg_attr(something, cfg(nothing))] c: i32,
12 #[forbid(C)] #[warn(C)] ...
18 #[cfg(something)] b: i32,
19 #[cfg_attr(something, cfg(nothing))] c: i32,
21 #[forbid(C)] #[warn(C)] e: i32
26 #[cfg(something)] b: i32,
27 #[cfg_attr(something, cfg(nothing))] c: i32,
29 #[forbid(C)] #[warn(C)] e: i32
32 // self, &self and &mut self
38 #[cfg(something)] a: i32,
39 #[cfg_attr(something, cfg(nothing))]
48 #[cfg(something)] a: i32,
49 #[cfg_attr(something, cfg(nothing))]
59 impl RefTrait for RefStruct {
69 #[allow(C)] &mut self,
70 #[cfg(something)] a: i32,
71 #[cfg_attr(something, cfg(nothing))]
77 #[forbid(C)] &mut self,
81 impl MutTrait for MutStruct {
83 #[forbid(C)] &mut self,
88 // self: Self, self: &Self and self: &mut Self
90 struct NamedSelfSelfStruct {}
91 impl NamedSelfSelfStruct {
93 #[allow(C)] self: Self,
94 #[cfg(something)] a: i32,
95 #[cfg_attr(something, cfg(nothing))]
100 struct NamedSelfRefStruct {}
101 impl NamedSelfRefStruct {
103 #[allow(C)] self: &Self,
104 #[cfg(something)] a: i32,
105 #[cfg_attr(something, cfg(nothing))]
109 trait NamedSelfRefTrait {
111 #[forbid(C)] self: &Self,
115 impl NamedSelfRefTrait for NamedSelfRefStruct {
117 #[forbid(C)] self: &Self,
122 struct NamedSelfMutStruct {}
123 impl NamedSelfMutStruct {
125 #[allow(C)] self: &mut Self,
126 #[cfg(something)] a: i32,
127 #[cfg_attr(something, cfg(nothing))]
131 trait NamedSelfMutTrait {
133 #[forbid(C)] self: &mut Self,
137 impl NamedSelfMutTrait for NamedSelfMutStruct {
139 #[forbid(C)] self: &mut Self,
144 // &'a self and &'a mut self
146 struct NamedLifetimeRefStruct {}
147 impl NamedLifetimeRefStruct {
149 #[allow(C)] self: &'a Self,
150 #[cfg(something)] a: i32,
151 #[cfg_attr(something, cfg(nothing))]
155 trait NamedLifetimeRefTrait {
157 #[forbid(C)] &'a self,
161 impl NamedLifetimeRefTrait for NamedLifetimeRefStruct {
163 #[forbid(C)] &'a self,
168 struct NamedLifetimeMutStruct {}
169 impl NamedLifetimeMutStruct {
171 #[allow(C)] self: &'a mut Self,
172 #[cfg(something)] a: i32,
173 #[cfg_attr(something, cfg(nothing))]
177 trait NamedLifetimeMutTrait {
179 #[forbid(C)] &'a mut self,
183 impl NamedLifetimeMutTrait for NamedLifetimeMutStruct {
185 #[forbid(C)] &'a mut self,
192 struct BoxSelfStruct {}
195 #[allow(C)] self: Box<Self>,
196 #[cfg(something)] a: i32,
197 #[cfg_attr(something, cfg(nothing))]
203 #[forbid(C)] self: Box<Self>,
207 impl BoxSelfTrait for BoxSelfStruct {
209 #[forbid(C)] self: Box<Self>,
215 let _: unsafe extern "C" fn(_, _, _, ...) = ffi;
216 let _: fn(_, _, _, _) = foo;
217 let _: FnType = |_, _, _, _| {};
220 #[cfg(something)] b: i32,
221 #[cfg_attr(something, cfg(nothing))]