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
359 #[repr = "3900"] type T = S;
360 //~^ WARN unused attribute
362 #[repr = "3900"] impl S { }
363 //~^ WARN unused attribute
368 mod inner { #![path="3800"] }
370 #[path = "3800"] fn f() { }
371 //~^ WARN unused attribute
373 #[path = "3800"] struct S;
374 //~^ WARN unused attribute
376 #[path = "3800"] type T = S;
377 //~^ WARN unused attribute
379 #[path = "3800"] impl S { }
380 //~^ WARN unused attribute
384 //~^ WARN unused attribute
386 mod inner { #![abi="3700"] }
387 //~^ WARN unused attribute
389 #[abi = "3700"] fn f() { }
390 //~^ WARN unused attribute
392 #[abi = "3700"] struct S;
393 //~^ WARN unused attribute
395 #[abi = "3700"] type T = S;
396 //~^ WARN unused attribute
398 #[abi = "3700"] impl S { }
399 //~^ WARN unused attribute
402 #[automatically_derived = "3600"]
403 //~^ WARN unused attribute
404 mod automatically_derived {
405 mod inner { #![automatically_derived="3600"] }
406 //~^ WARN unused attribute
408 #[automatically_derived = "3600"] fn f() { }
409 //~^ WARN unused attribute
411 #[automatically_derived = "3600"] struct S;
412 //~^ WARN unused attribute
414 #[automatically_derived = "3600"] type T = S;
415 //~^ WARN unused attribute
417 #[automatically_derived = "3600"] impl S { }
418 //~^ WARN unused attribute
421 #[no_mangle = "3500"]
423 mod inner { #![no_mangle="3500"] }
425 #[no_mangle = "3500"] fn f() { }
426 //~^ WARN function f is marked #[no_mangle], but not exported
428 #[no_mangle = "3500"] struct S;
430 #[no_mangle = "3500"] type T = S;
432 #[no_mangle = "3500"] impl S { }
436 //~^ WARN unused attribute
438 mod inner { #![no_link="3400"] }
439 //~^ WARN unused attribute
441 #[no_link = "3400"] fn f() { }
442 //~^ WARN unused attribute
444 #[no_link = "3400"] struct S;
445 //~^ WARN unused attribute
447 #[no_link = "3400"]type T = S;
448 //~^ WARN unused attribute
450 #[no_link = "3400"] impl S { }
451 //~^ WARN unused attribute
454 #[should_panic = "3200"]
455 //~^ WARN unused attribute
457 mod inner { #![should_panic="3200"] }
458 //~^ WARN unused attribute
460 #[should_panic = "3200"] fn f() { }
461 //~^ WARN unused attribute
463 #[should_panic = "3200"] struct S;
464 //~^ WARN unused attribute
466 #[should_panic = "3200"] type T = S;
467 //~^ WARN unused attribute
469 #[should_panic = "3200"] impl S { }
470 //~^ WARN unused attribute
474 //~^ WARN unused attribute
476 mod inner { #![ignore="3100"] }
477 //~^ WARN unused attribute
479 #[ignore = "3100"] fn f() { }
480 //~^ WARN unused attribute
482 #[ignore = "3100"] struct S;
483 //~^ WARN unused attribute
485 #[ignore = "3100"] type T = S;
486 //~^ WARN unused attribute
488 #[ignore = "3100"] impl S { }
489 //~^ WARN unused attribute
492 #[no_implicit_prelude = "3000"]
493 //~^ WARN unused attribute
494 mod no_implicit_prelude {
495 mod inner { #![no_implicit_prelude="3000"] }
496 //~^ WARN unused attribute
498 #[no_implicit_prelude = "3000"] fn f() { }
499 //~^ WARN unused attribute
501 #[no_implicit_prelude = "3000"] struct S;
502 //~^ WARN unused attribute
504 #[no_implicit_prelude = "3000"] type T = S;
505 //~^ WARN unused attribute
507 #[no_implicit_prelude = "3000"] impl S { }
508 //~^ WARN unused attribute
511 #[reexport_test_harness_main = "2900"]
512 //~^ WARN unused attribute
513 mod reexport_test_harness_main {
514 mod inner { #![reexport_test_harness_main="2900"] }
515 //~^ WARN unused attribute
517 #[reexport_test_harness_main = "2900"] fn f() { }
518 //~^ WARN unused attribute
520 #[reexport_test_harness_main = "2900"] struct S;
521 //~^ WARN unused attribute
523 #[reexport_test_harness_main = "2900"] type T = S;
524 //~^ WARN unused attribute
526 #[reexport_test_harness_main = "2900"] impl S { }
527 //~^ WARN unused attribute
530 // Cannnot feed "2700" to `#[macro_escape]` without signaling an error.
532 //~^ WARN macro_escape is a deprecated synonym for macro_use
534 mod inner { #![macro_escape] }
535 //~^ WARN macro_escape is a deprecated synonym for macro_use
537 #[macro_escape] fn f() { }
538 //~^ WARN unused attribute
540 #[macro_escape] struct S;
541 //~^ WARN unused attribute
543 #[macro_escape] type T = S;
544 //~^ WARN unused attribute
546 #[macro_escape] impl S { }
547 //~^ WARN unused attribute
551 //~^ WARN unused attribute
552 //~| WARN crate-level attribute should be an inner attribute
554 mod inner { #![no_std="2600"] }
555 //~^ WARN unused attribute
556 //~| WARN crate-level attribute should be in the root module
558 #[no_std = "2600"] fn f() { }
559 //~^ WARN unused attribute
560 //~| WARN crate-level attribute should be an inner attribute
562 #[no_std = "2600"] struct S;
563 //~^ WARN unused attribute
564 //~| WARN crate-level attribute should be an inner attribute
566 #[no_std = "2600"] type T = S;
567 //~^ WARN unused attribute
568 //~| WARN crate-level attribute should be an inner attribute
570 #[no_std = "2600"] impl S { }
571 //~^ WARN unused attribute
572 //~| WARN crate-level attribute should be an inner attribute
575 // At time of authorship, #[proc_macro_derive = "2500"] signals error
576 // when it occurs on a mod (apart from crate-level). Therefore it goes
577 // into its own file; see issue-43106-gating-of-proc_macro_derive.rs
581 mod inner { #![doc="2400"] }
583 #[doc = "2400"] fn f() { }
585 #[doc = "2400"] struct S;
587 #[doc = "2400"] type T = S;
589 #[doc = "2400"] impl S { }
594 mod inner { #![cold="2300"] }
596 #[cold = "2300"] fn f() { }
598 #[cold = "2300"] struct S;
600 #[cold = "2300"] type T = S;
602 #[cold = "2300"] impl S { }
605 #[export_name = "2200"]
607 mod inner { #![export_name="2200"] }
609 #[export_name = "2200"] fn f() { }
611 #[export_name = "2200"] struct S;
613 #[export_name = "2200"] type T = S;
615 #[export_name = "2200"] impl S { }
618 // Note that this test ends with a `#[rustc_error] fn main()`, so it
619 // will never invoke the linker. These are here nonetheless to point
620 // out that we allow them at non-crate-level (though I do not know
621 // whether they have the same effect here as at crate-level).
625 mod inner { #![link="2000"] }
627 #[link = "2000"] fn f() { }
629 #[link = "2000"] struct S;
631 #[link = "2000"] type T = S;
633 #[link = "2000"] impl S { }
636 #[link_name = "1900"]
638 mod inner { #![link_name="1900"] }
640 #[link_name = "1900"] fn f() { }
642 #[link_name = "1900"] struct S;
644 #[link_name = "1900"] type T = S;
646 #[link_name = "1900"] impl S { }
649 #[link_section = "1800"]
651 mod inner { #![link_section="1800"] }
653 #[link_section = "1800"] fn f() { }
655 #[link_section = "1800"] struct S;
657 #[link_section = "1800"] type T = S;
659 #[link_section = "1800"] impl S { }
662 struct StructForDeprecated;
664 #[deprecated = "1500"]
666 mod inner { #![deprecated="1500"] }
668 #[deprecated = "1500"] fn f() { }
670 #[deprecated = "1500"] struct S1;
672 #[deprecated = "1500"] type T = super::StructForDeprecated;
674 #[deprecated = "1500"] impl super::StructForDeprecated { }
679 mod inner { #![must_use="1400"] }
681 #[must_use = "1400"] fn f() { }
682 //~^ WARN `#[must_use]` on functions is experimental
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");