File tree 2 files changed +81
-0
lines changed
ide-diagnostics/src/handlers
2 files changed +81
-0
lines changed Original file line number Diff line number Diff line change @@ -1274,3 +1274,65 @@ impl S {
1274
1274
"# ] ] ,
1275
1275
) ;
1276
1276
}
1277
+
1278
+ #[ test]
1279
+ fn infer_in_unexpandable_attr_proc_macro_1 ( ) {
1280
+ check_types (
1281
+ r#"
1282
+ //- /main.rs crate:main deps:mac
1283
+ #[mac::attr_macro]
1284
+ fn foo() {
1285
+ let xxx = 1;
1286
+ //^^^ i32
1287
+ }
1288
+
1289
+ //- /mac.rs crate:mac
1290
+ #![crate_type="proc-macro"]
1291
+ #[proc_macro_attribute]
1292
+ pub fn attr_macro() {}
1293
+ "# ,
1294
+ ) ;
1295
+ }
1296
+
1297
+ #[ test]
1298
+ fn infer_in_unexpandable_attr_proc_macro_in_impl ( ) {
1299
+ check_types (
1300
+ r#"
1301
+ //- /main.rs crate:main deps:mac
1302
+ struct Foo;
1303
+ impl Foo {
1304
+ #[mac::attr_macro]
1305
+ fn foo() {
1306
+ let xxx = 1;
1307
+ //^^^ i32
1308
+ }
1309
+ }
1310
+
1311
+ //- /mac.rs crate:mac
1312
+ #![crate_type="proc-macro"]
1313
+ #[proc_macro_attribute]
1314
+ pub fn attr_macro() {}
1315
+ "# ,
1316
+ ) ;
1317
+ }
1318
+
1319
+ #[ test]
1320
+ fn infer_in_unexpandable_attr_proc_macro_in_trait ( ) {
1321
+ check_types (
1322
+ r#"
1323
+ //- /main.rs crate:main deps:mac
1324
+ trait Foo {
1325
+ #[mac::attr_macro]
1326
+ fn foo() {
1327
+ let xxx = 1;
1328
+ //^^^ i32
1329
+ }
1330
+ }
1331
+
1332
+ //- /mac.rs crate:mac
1333
+ #![crate_type="proc-macro"]
1334
+ #[proc_macro_attribute]
1335
+ pub fn attr_macro() {}
1336
+ "# ,
1337
+ ) ;
1338
+ }
Original file line number Diff line number Diff line change @@ -104,6 +104,25 @@ fn f() {
104
104
) ;
105
105
}
106
106
107
+ #[ test]
108
+ fn inactive_assoc_item ( ) {
109
+ // FIXME these currently don't work, hence the *
110
+ check (
111
+ r#"
112
+ struct Foo;
113
+ impl Foo {
114
+ #[cfg(any())] pub fn f() {}
115
+ //*************************** weak: code is inactive due to #[cfg] directives
116
+ }
117
+
118
+ trait Bar {
119
+ #[cfg(any())] pub fn f() {}
120
+ //*************************** weak: code is inactive due to #[cfg] directives
121
+ }
122
+ "# ,
123
+ ) ;
124
+ }
125
+
107
126
/// Tests that `cfg` attributes behind `cfg_attr` is handled properly.
108
127
#[ test]
109
128
fn inactive_via_cfg_attr ( ) {
You can’t perform that action at this time.
0 commit comments