1 // Copyright 2017 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.
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.
11 // This test enumerates as many compiler-builtin ungated attributes as
12 // possible (that is, all the mutually compatible ones), and checks
13 // that we get "expected" (*) warnings for each in the various weird
14 // places that users might put them in the syntax.
16 // (*): The word "expected" is in quotes above because the cases where
17 // warnings are and are not emitted might not match a user's intuition
18 // nor the rustc developers' intent. I am really just trying to
19 // capture today's behavior in a test, not so that it become enshrined
20 // as the absolute behavior going forward, but rather so that we do
21 // not change the behavior in the future without even being *aware* of
22 // the change when it happens.
24 // At the time of authoring, the attributes here are listed in the
25 // order that they occur in libsyntax/feature_gate.rs.
27 // Any builtin attributes that:
29 // - are not stable, or
31 // - could not be included here covering the same cases as the other
32 // attributes without raising an *error* from rustc (note though
33 // that warnings are of course expected)
35 // have their own test case referenced by filename in an inline
38 // The test feeds numeric inputs to each attribute that accepts them
39 // without error. We do this for two reasons: (1.) to exercise how
40 // inputs are handled by each, and (2.) to ease searching for related
41 // occurrences in the source text.
43 #![feature(rustc_attrs)] // For `rustc_error`; see note below.
44 #![warn(unused_attributes, unknown_lints)]
47 // UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES
49 #![warn (x5400)] //~ WARN unknown lint: `x5400`
50 #![allow (x5300)] //~ WARN unknown lint: `x5300`
51 #![forbid (x5200)] //~ WARN unknown lint: `x5200`
52 #![deny (x5100)] //~ WARN unknown lint: `x5100`
53 #![macro_reexport = "5000"] //~ WARN unused attribute
54 #![macro_use] // (allowed if no argument; see issue-43160-gating-of-macro_use.rs)
55 #![macro_export = "4800"] //~ WARN unused attribute
56 #![plugin_registrar = "4700"] //~ WARN unused attribute
57 // skipping testing of cfg
58 // skipping testing of cfg_attr
59 #![main = "x4400"] //~ WARN unused attribute
60 #![start = "x4300"] //~ WARN unused attribute
61 // see issue-43106-gating-of-test.rs for crate-level; but non crate-level is below at "4200"
62 // see issue-43106-gating-of-bench.rs for crate-level; but non crate-level is below at "4100"
63 #![simd = "4000"] //~ WARN unused attribute
64 #![repr = "3900"] //~ WARN unused attribute
65 #![path = "3800"] //~ WARN unused attribute
66 #![abi = "3700"] //~ WARN unused attribute
67 #![automatically_derived = "3600"] //~ WARN unused attribute
68 #![no_mangle = "3500"]
69 #![no_link = "3400"] //~ WARN unused attribute
70 // see issue-43106-gating-of-derive.rs
71 #![should_panic = "3200"] //~ WARN unused attribute
72 #![ignore = "3100"] //~ WARN unused attribute
73 #![no_implicit_prelude = "3000"]
74 #![reexport_test_harness_main = "2900"]
75 // see gated-link-args.rs
76 // see issue-43106-gating-of-macro_escape.rs for crate-level; but non crate-level is below at "2700"
77 // (cannot easily test gating of crate-level #[no_std]; but non crate-level is below at "2600")
78 #![proc_macro_derive = "2500"] //~ WARN unused attribute
81 #![export_name = "2200"]
82 // see issue-43106-gating-of-inline.rs
84 #![link_name = "1900"]
85 #![link_section = "1800"]
86 #![no_builtins = "1700"] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "0300")
87 #![no_mangle = "1600"] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "3500")
88 // see issue-43106-gating-of-rustc_deprecated.rs
90 // see issue-43106-gating-of-stable.rs
91 // see issue-43106-gating-of-unstable.rs
92 // see issue-43106-gating-of-deprecated.rs
93 #![windows_subsystem = "1000"]
95 // UNGATED CRATE-LEVEL BUILT-IN ATTRIBUTES
97 #![crate_name = "0900"]
98 #![crate_type = "bin"] // cannot pass "0800" here
100 // For #![crate_id], see issue #43142. (I cannot bear to enshrine current behavior in a test)
102 #![feature ( x0600)] //~ WARN unused or unknown feature
104 // For #![no_start], see issue #43144. (I cannot bear to enshrine current behavior in a test)
106 // (cannot easily gating state of crate-level #[no_main]; but non crate-level is below at "0400")
107 #![no_builtins = "0300"]
108 #![recursion_limit = "0200"]
109 #![type_length_limit = "0100"]
111 // USES OF BUILT-IN ATTRIBUTES IN OTHER ("UNUSUAL") PLACES
114 //~^ WARN unknown lint: `x5400`
116 mod inner { #![warn(x5400)] }
117 //~^ WARN unknown lint: `x5400`
119 #[warn(x5400)] fn f() { }
120 //~^ WARN unknown lint: `x5400`
122 #[warn(x5400)] struct S;
123 //~^ WARN unknown lint: `x5400`
125 #[warn(x5400)] type T = S;
126 //~^ WARN unknown lint: `x5400`
128 #[warn(x5400)] impl S { }
129 //~^ WARN unknown lint: `x5400`
133 //~^ WARN unknown lint: `x5300`
135 mod inner { #![allow(x5300)] }
136 //~^ WARN unknown lint: `x5300`
138 #[allow(x5300)] fn f() { }
139 //~^ WARN unknown lint: `x5300`
141 #[allow(x5300)] struct S;
142 //~^ WARN unknown lint: `x5300`
144 #[allow(x5300)] type T = S;
145 //~^ WARN unknown lint: `x5300`
147 #[allow(x5300)] impl S { }
148 //~^ WARN unknown lint: `x5300`
152 //~^ WARN unknown lint: `x5200`
154 mod inner { #![forbid(x5200)] }
155 //~^ WARN unknown lint: `x5200`
157 #[forbid(x5200)] fn f() { }
158 //~^ WARN unknown lint: `x5200`
160 #[forbid(x5200)] struct S;
161 //~^ WARN unknown lint: `x5200`
163 #[forbid(x5200)] type T = S;
164 //~^ WARN unknown lint: `x5200`
166 #[forbid(x5200)] impl S { }
167 //~^ WARN unknown lint: `x5200`
171 //~^ WARN unknown lint: `x5100`
173 mod inner { #![deny(x5100)] }
174 //~^ WARN unknown lint: `x5100`
176 #[deny(x5100)] fn f() { }
177 //~^ WARN unknown lint: `x5100`
179 #[deny(x5100)] struct S;
180 //~^ WARN unknown lint: `x5100`
182 #[deny(x5100)] type T = S;
183 //~^ WARN unknown lint: `x5100`
185 #[deny(x5100)] impl S { }
186 //~^ WARN unknown lint: `x5100`
189 #[macro_reexport = "5000"]
190 //~^ WARN unused attribute
192 mod inner { #![macro_reexport="5000"] }
193 //~^ WARN unused attribute
195 #[macro_reexport = "5000"] fn f() { }
196 //~^ WARN unused attribute
198 #[macro_reexport = "5000"] struct S;
199 //~^ WARN unused attribute
201 #[macro_reexport = "5000"] type T = S;
202 //~^ WARN unused attribute
204 #[macro_reexport = "5000"] impl S { }
205 //~^ WARN unused attribute
210 mod inner { #![macro_use] }
212 #[macro_use] fn f() { }
213 //~^ WARN unused attribute
215 #[macro_use] struct S;
216 //~^ WARN unused attribute
218 #[macro_use] type T = S;
219 //~^ WARN unused attribute
221 #[macro_use] impl S { }
222 //~^ WARN unused attribute
225 #[macro_export = "4800"]
226 //~^ WARN unused attribute
228 mod inner { #![macro_export="4800"] }
229 //~^ WARN unused attribute
231 #[macro_export = "4800"] fn f() { }
232 //~^ WARN unused attribute
234 #[macro_export = "4800"] struct S;
235 //~^ WARN unused attribute
237 #[macro_export = "4800"] type T = S;
238 //~^ WARN unused attribute
240 #[macro_export = "4800"] impl S { }
241 //~^ WARN unused attribute
244 #[plugin_registrar = "4700"]
245 //~^ WARN unused attribute
246 mod plugin_registrar {
247 mod inner { #![plugin_registrar="4700"] }
248 //~^ WARN unused attribute
250 // for `fn f()` case, see gated-plugin_registrar.rs
252 #[plugin_registrar = "4700"] struct S;
253 //~^ WARN unused attribute
255 #[plugin_registrar = "4700"] type T = S;
256 //~^ WARN unused attribute
258 #[plugin_registrar = "4700"] impl S { }
259 //~^ WARN unused attribute
263 //~^ WARN unused attribute
265 mod inner { #![main="4300"] }
266 //~^ WARN unused attribute
268 // for `fn f()` case, see feature-gate-main.rs
270 #[main = "4400"] struct S;
271 //~^ WARN unused attribute
273 #[main = "4400"] type T = S;
274 //~^ WARN unused attribute
276 #[main = "4400"] impl S { }
277 //~^ WARN unused attribute
281 //~^ WARN unused attribute
283 mod inner { #![start="4300"] }
284 //~^ WARN unused attribute
286 // for `fn f()` case, see feature-gate-start.rs
288 #[start = "4300"] struct S;
289 //~^ WARN unused attribute
291 #[start = "4300"] type T = S;
292 //~^ WARN unused attribute
294 #[start = "4300"] impl S { }
295 //~^ WARN unused attribute
298 // At time of unit test authorship, if compiling without `--test` then
299 // non-crate-level #[test] attributes seem to be ignored.
302 mod test { mod inner { #![test="4200"] }
313 // At time of unit test authorship, if compiling without `--test` then
314 // non-crate-level #[bench] attributes seem to be ignored.
318 mod inner { #![bench="4100"] }
331 //~^ WARN unused attribute
333 mod inner { #![simd="4000"] }
334 //~^ WARN unused attribute
336 #[simd = "4000"] fn f() { }
337 //~^ WARN unused attribute
339 struct S; // for `struct S` case, see feature-gate-repr-simd.rs
341 #[simd = "4000"] type T = S;
342 //~^ WARN unused attribute
344 #[simd = "4000"] impl S { }
345 //~^ WARN unused attribute
349 //~^ WARN unused attribute
351 mod inner { #![repr="3900"] }
352 //~^ WARN unused attribute
354 #[repr = "3900"] fn f() { }
355 //~^ WARN unused attribute
357 #[repr = "3900"] struct S;
358 //~^ WARN unused attribute
360 #[repr = "3900"] type T = S;
361 //~^ WARN unused attribute
363 #[repr = "3900"] impl S { }
364 //~^ WARN unused attribute
369 mod inner { #![path="3800"] }
371 #[path = "3800"] fn f() { }
372 //~^ WARN unused attribute
374 #[path = "3800"] struct S;
375 //~^ WARN unused attribute
377 #[path = "3800"] type T = S;
378 //~^ WARN unused attribute
380 #[path = "3800"] impl S { }
381 //~^ WARN unused attribute
385 //~^ WARN unused attribute
387 mod inner { #![abi="3700"] }
388 //~^ WARN unused attribute
390 #[abi = "3700"] fn f() { }
391 //~^ WARN unused attribute
393 #[abi = "3700"] struct S;
394 //~^ WARN unused attribute
396 #[abi = "3700"] type T = S;
397 //~^ WARN unused attribute
399 #[abi = "3700"] impl S { }
400 //~^ WARN unused attribute
403 #[automatically_derived = "3600"]
404 //~^ WARN unused attribute
405 mod automatically_derived {
406 mod inner { #![automatically_derived="3600"] }
407 //~^ WARN unused attribute
409 #[automatically_derived = "3600"] fn f() { }
410 //~^ WARN unused attribute
412 #[automatically_derived = "3600"] struct S;
413 //~^ WARN unused attribute
415 #[automatically_derived = "3600"] type T = S;
416 //~^ WARN unused attribute
418 #[automatically_derived = "3600"] impl S { }
419 //~^ WARN unused attribute
422 #[no_mangle = "3500"]
424 mod inner { #![no_mangle="3500"] }
426 #[no_mangle = "3500"] fn f() { }
427 //~^ WARN function f is marked #[no_mangle], but not exported
429 #[no_mangle = "3500"] struct S;
431 #[no_mangle = "3500"] type T = S;
433 #[no_mangle = "3500"] impl S { }
437 //~^ WARN unused attribute
439 mod inner { #![no_link="3400"] }
440 //~^ WARN unused attribute
442 #[no_link = "3400"] fn f() { }
443 //~^ WARN unused attribute
445 #[no_link = "3400"] struct S;
446 //~^ WARN unused attribute
448 #[no_link = "3400"]type T = S;
449 //~^ WARN unused attribute
451 #[no_link = "3400"] impl S { }
452 //~^ WARN unused attribute
455 #[should_panic = "3200"]
456 //~^ WARN unused attribute
458 mod inner { #![should_panic="3200"] }
459 //~^ WARN unused attribute
461 #[should_panic = "3200"] fn f() { }
462 //~^ WARN unused attribute
464 #[should_panic = "3200"] struct S;
465 //~^ WARN unused attribute
467 #[should_panic = "3200"] type T = S;
468 //~^ WARN unused attribute
470 #[should_panic = "3200"] impl S { }
471 //~^ WARN unused attribute
475 //~^ WARN unused attribute
477 mod inner { #![ignore="3100"] }
478 //~^ WARN unused attribute
480 #[ignore = "3100"] fn f() { }
481 //~^ WARN unused attribute
483 #[ignore = "3100"] struct S;
484 //~^ WARN unused attribute
486 #[ignore = "3100"] type T = S;
487 //~^ WARN unused attribute
489 #[ignore = "3100"] impl S { }
490 //~^ WARN unused attribute
493 #[no_implicit_prelude = "3000"]
494 //~^ WARN unused attribute
495 mod no_implicit_prelude {
496 mod inner { #![no_implicit_prelude="3000"] }
497 //~^ WARN unused attribute
499 #[no_implicit_prelude = "3000"] fn f() { }
500 //~^ WARN unused attribute
502 #[no_implicit_prelude = "3000"] struct S;
503 //~^ WARN unused attribute
505 #[no_implicit_prelude = "3000"] type T = S;
506 //~^ WARN unused attribute
508 #[no_implicit_prelude = "3000"] impl S { }
509 //~^ WARN unused attribute
512 #[reexport_test_harness_main = "2900"]
513 //~^ WARN unused attribute
514 mod reexport_test_harness_main {
515 mod inner { #![reexport_test_harness_main="2900"] }
516 //~^ WARN unused attribute
518 #[reexport_test_harness_main = "2900"] fn f() { }
519 //~^ WARN unused attribute
521 #[reexport_test_harness_main = "2900"] struct S;
522 //~^ WARN unused attribute
524 #[reexport_test_harness_main = "2900"] type T = S;
525 //~^ WARN unused attribute
527 #[reexport_test_harness_main = "2900"] impl S { }
528 //~^ WARN unused attribute
531 // Cannnot feed "2700" to `#[macro_escape]` without signaling an error.
533 //~^ WARN macro_escape is a deprecated synonym for macro_use
535 mod inner { #![macro_escape] }
536 //~^ WARN macro_escape is a deprecated synonym for macro_use
538 #[macro_escape] fn f() { }
539 //~^ WARN unused attribute
541 #[macro_escape] struct S;
542 //~^ WARN unused attribute
544 #[macro_escape] type T = S;
545 //~^ WARN unused attribute
547 #[macro_escape] impl S { }
548 //~^ WARN unused attribute
552 //~^ WARN unused attribute
553 //~| WARN crate-level attribute should be an inner attribute
555 mod inner { #![no_std="2600"] }
556 //~^ WARN unused attribute
557 //~| WARN crate-level attribute should be in the root module
559 #[no_std = "2600"] fn f() { }
560 //~^ WARN unused attribute
561 //~| WARN crate-level attribute should be an inner attribute
563 #[no_std = "2600"] struct S;
564 //~^ WARN unused attribute
565 //~| WARN crate-level attribute should be an inner attribute
567 #[no_std = "2600"] type T = S;
568 //~^ WARN unused attribute
569 //~| WARN crate-level attribute should be an inner attribute
571 #[no_std = "2600"] impl S { }
572 //~^ WARN unused attribute
573 //~| WARN crate-level attribute should be an inner attribute
576 // At time of authorship, #[proc_macro_derive = "2500"] signals error
577 // when it occurs on a mod (apart from crate-level). Therefore it goes
578 // into its own file; see issue-43106-gating-of-proc_macro_derive.rs
582 mod inner { #![doc="2400"] }
584 #[doc = "2400"] fn f() { }
586 #[doc = "2400"] struct S;
588 #[doc = "2400"] type T = S;
590 #[doc = "2400"] impl S { }
595 mod inner { #![cold="2300"] }
597 #[cold = "2300"] fn f() { }
599 #[cold = "2300"] struct S;
601 #[cold = "2300"] type T = S;
603 #[cold = "2300"] impl S { }
606 #[export_name = "2200"]
608 mod inner { #![export_name="2200"] }
610 #[export_name = "2200"] fn f() { }
612 #[export_name = "2200"] struct S;
614 #[export_name = "2200"] type T = S;
616 #[export_name = "2200"] impl S { }
619 // Note that this test ends with a `#[rustc_error] fn main()`, so it
620 // will never invoke the linker. These are here nonetheless to point
621 // out that we allow them at non-crate-level (though I do not know
622 // whether they have the same effect here as at crate-level).
626 mod inner { #![link="2000"] }
628 #[link = "2000"] fn f() { }
630 #[link = "2000"] struct S;
632 #[link = "2000"] type T = S;
634 #[link = "2000"] impl S { }
637 #[link_name = "1900"]
639 mod inner { #![link_name="1900"] }
641 #[link_name = "1900"] fn f() { }
643 #[link_name = "1900"] struct S;
645 #[link_name = "1900"] type T = S;
647 #[link_name = "1900"] impl S { }
650 #[link_section = "1800"]
652 mod inner { #![link_section="1800"] }
654 #[link_section = "1800"] fn f() { }
656 #[link_section = "1800"] struct S;
658 #[link_section = "1800"] type T = S;
660 #[link_section = "1800"] impl S { }
663 struct StructForDeprecated;
665 #[deprecated = "1500"]
667 mod inner { #![deprecated="1500"] }
669 #[deprecated = "1500"] fn f() { }
671 #[deprecated = "1500"] struct S1;
673 #[deprecated = "1500"] type T = super::StructForDeprecated;
675 #[deprecated = "1500"] impl super::StructForDeprecated { }
680 mod inner { #![must_use="1400"] }
682 #[must_use = "1400"] fn f() { }
684 #[must_use = "1400"] struct S;
686 #[must_use = "1400"] type T = S;
688 #[must_use = "1400"] impl S { }
691 #[windows_subsystem = "1000"]
692 mod windows_subsystem {
693 mod inner { #![windows_subsystem="1000"] }
695 #[windows_subsystem = "1000"] fn f() { }
697 #[windows_subsystem = "1000"] struct S;
699 #[windows_subsystem = "1000"] type T = S;
701 #[windows_subsystem = "1000"] impl S { }
704 // BROKEN USES OF CRATE-LEVEL BUILT-IN ATTRIBUTES
706 #[crate_name = "0900"]
707 //~^ WARN unused attribute
708 //~| WARN crate-level attribute should be an inner attribute
710 mod inner { #![crate_name="0900"] }
711 //~^ WARN unused attribute
712 //~| WARN crate-level attribute should be in the root module
714 #[crate_name = "0900"] fn f() { }
715 //~^ WARN unused attribute
716 //~| WARN crate-level attribute should be an inner attribute
718 #[crate_name = "0900"] struct S;
719 //~^ WARN unused attribute
720 //~| WARN crate-level attribute should be an inner attribute
722 #[crate_name = "0900"] type T = S;
723 //~^ WARN unused attribute
724 //~| WARN crate-level attribute should be an inner attribute
726 #[crate_name = "0900"] impl S { }
727 //~^ WARN unused attribute
728 //~| WARN crate-level attribute should be an inner attribute
731 #[crate_type = "0800"]
732 //~^ WARN unused attribute
733 //~| WARN crate-level attribute should be an inner attribute
735 mod inner { #![crate_type="0800"] }
736 //~^ WARN unused attribute
737 //~| WARN crate-level attribute should be in the root module
739 #[crate_type = "0800"] fn f() { }
740 //~^ WARN unused attribute
741 //~| WARN crate-level attribute should be an inner attribute
743 #[crate_type = "0800"] struct S;
744 //~^ WARN unused attribute
745 //~| WARN crate-level attribute should be an inner attribute
747 #[crate_type = "0800"] type T = S;
748 //~^ WARN unused attribute
749 //~| WARN crate-level attribute should be an inner attribute
751 #[crate_type = "0800"] impl S { }
752 //~^ WARN unused attribute
753 //~| WARN crate-level attribute should be an inner attribute
757 //~^ WARN unused attribute
758 //~| WARN crate-level attribute should be an inner attribute
760 mod inner { #![feature(x0600)] }
761 //~^ WARN unused attribute
762 //~| WARN crate-level attribute should be in the root module
764 #[feature(x0600)] fn f() { }
765 //~^ WARN unused attribute
766 //~| WARN crate-level attribute should be an inner attribute
768 #[feature(x0600)] struct S;
769 //~^ WARN unused attribute
770 //~| WARN crate-level attribute should be an inner attribute
772 #[feature(x0600)] type T = S;
773 //~^ WARN unused attribute
774 //~| WARN crate-level attribute should be an inner attribute
776 #[feature(x0600)] impl S { }
777 //~^ WARN unused attribute
778 //~| WARN crate-level attribute should be an inner attribute
783 //~^ WARN unused attribute
784 //~| WARN crate-level attribute should be an inner attribute
786 mod inner { #![no_main="0400"] }
787 //~^ WARN unused attribute
788 //~| WARN crate-level attribute should be in the root module
790 #[no_main = "0400"] fn f() { }
791 //~^ WARN unused attribute
792 //~| WARN crate-level attribute should be an inner attribute
794 #[no_main = "0400"] struct S;
795 //~^ WARN unused attribute
796 //~| WARN crate-level attribute should be an inner attribute
798 #[no_main = "0400"] type T = S;
799 //~^ WARN unused attribute
800 //~| WARN crate-level attribute should be an inner attribute
802 #[no_main = "0400"] impl S { }
803 //~^ WARN unused attribute
804 //~| WARN crate-level attribute should be an inner attribute
807 #[no_builtins = "0300"]
809 mod inner { #![no_builtins="0200"] }
811 #[no_builtins = "0300"] fn f() { }
813 #[no_builtins = "0300"] struct S;
815 #[no_builtins = "0300"] type T = S;
817 #[no_builtins = "0300"] impl S { }
820 #[recursion_limit="0200"]
821 //~^ WARN unused attribute
822 //~| WARN crate-level attribute should be an inner attribute
823 mod recursion_limit {
824 mod inner { #![recursion_limit="0200"] }
825 //~^ WARN unused attribute
826 //~| WARN crate-level attribute should be in the root module
828 #[recursion_limit="0200"] fn f() { }
829 //~^ WARN unused attribute
830 //~| WARN crate-level attribute should be an inner attribute
832 #[recursion_limit="0200"] struct S;
833 //~^ WARN unused attribute
834 //~| WARN crate-level attribute should be an inner attribute
836 #[recursion_limit="0200"] type T = S;
837 //~^ WARN unused attribute
838 //~| WARN crate-level attribute should be an inner attribute
840 #[recursion_limit="0200"] impl S { }
841 //~^ WARN unused attribute
842 //~| WARN crate-level attribute should be an inner attribute
845 #[type_length_limit="0100"]
846 //~^ WARN unused attribute
847 //~| WARN crate-level attribute should be an inner attribute
848 mod type_length_limit {
849 mod inner { #![type_length_limit="0100"] }
850 //~^ WARN unused attribute
851 //~| WARN crate-level attribute should be in the root module
853 #[type_length_limit="0100"] fn f() { }
854 //~^ WARN unused attribute
855 //~| WARN crate-level attribute should be an inner attribute
857 #[type_length_limit="0100"] struct S;
858 //~^ WARN unused attribute
859 //~| WARN crate-level attribute should be an inner attribute
861 #[type_length_limit="0100"] type T = S;
862 //~^ WARN unused attribute
863 //~| WARN crate-level attribute should be an inner attribute
865 #[type_length_limit="0100"] impl S { }
866 //~^ WARN unused attribute
867 //~| WARN crate-level attribute should be an inner attribute
870 // Since we expect for the mix of attributes used here to compile
871 // successfully, and we are just testing for the expected warnings of
872 // various (mis)uses of attributes, we use the `rustc_error` attribute
873 // on the `fn main()`.
876 fn main() { //~ ERROR compilation successful
877 println!("Hello World");