|
1 | 1 | //~ NOTE not a function
|
2 |
| -//~^ NOTE not a foreign function or static |
3 |
| -//~^^ NOTE not a function or static |
| 2 | +//~| NOTE not a foreign function or static |
| 3 | +//~| NOTE not a function or static |
| 4 | +//~| NOTE not an `extern` block |
4 | 5 | // This test enumerates as many compiler-builtin ungated attributes as
|
5 | 6 | // possible (that is, all the mutually compatible ones), and checks
|
6 | 7 | // that we get "expected" (*) warnings for each in the various weird
|
|
59 | 60 | #![proc_macro_derive()] //~ WARN `#[proc_macro_derive]` only has an effect
|
60 | 61 | #![doc = "2400"]
|
61 | 62 | #![cold] //~ WARN attribute should be applied to a function
|
62 |
| -//~^ WARN |
63 |
| -// see issue-43106-gating-of-builtin-attrs-error.rs |
64 |
| -#![link()] |
| 63 | +//~^ WARN this was previously accepted |
| 64 | +#![link()] //~ WARN attribute should be applied to an `extern` block |
| 65 | +//~^ WARN this was previously accepted |
65 | 66 | #![link_name = "1900"]
|
66 | 67 | //~^ WARN attribute should be applied to a foreign function
|
67 | 68 | //~^^ WARN this was previously accepted by the compiler
|
@@ -547,22 +548,38 @@ mod link_section {
|
547 | 548 | }
|
548 | 549 |
|
549 | 550 |
|
550 |
| -// Note that this is a `check-pass` test, so it |
551 |
| -// will never invoke the linker. These are here nonetheless to point |
552 |
| -// out that we allow them at non-crate-level (though I do not know |
553 |
| -// whether they have the same effect here as at crate-level). |
| 551 | +// Note that this is a `check-pass` test, so it will never invoke the linker. |
554 | 552 |
|
555 | 553 | #[link()]
|
| 554 | +//~^ WARN attribute should be applied to an `extern` block |
| 555 | +//~| WARN this was previously accepted |
556 | 556 | mod link {
|
| 557 | + //~^ NOTE not an `extern` block |
| 558 | + |
557 | 559 | mod inner { #![link()] }
|
| 560 | + //~^ WARN attribute should be applied to an `extern` block |
| 561 | + //~| WARN this was previously accepted |
| 562 | + //~| NOTE not an `extern` block |
558 | 563 |
|
559 | 564 | #[link()] fn f() { }
|
| 565 | + //~^ WARN attribute should be applied to an `extern` block |
| 566 | + //~| WARN this was previously accepted |
| 567 | + //~| NOTE not an `extern` block |
560 | 568 |
|
561 | 569 | #[link()] struct S;
|
| 570 | + //~^ WARN attribute should be applied to an `extern` block |
| 571 | + //~| WARN this was previously accepted |
| 572 | + //~| NOTE not an `extern` block |
562 | 573 |
|
563 | 574 | #[link()] type T = S;
|
| 575 | + //~^ WARN attribute should be applied to an `extern` block |
| 576 | + //~| WARN this was previously accepted |
| 577 | + //~| NOTE not an `extern` block |
564 | 578 |
|
565 | 579 | #[link()] impl S { }
|
| 580 | + //~^ WARN attribute should be applied to an `extern` block |
| 581 | + //~| WARN this was previously accepted |
| 582 | + //~| NOTE not an `extern` block |
566 | 583 | }
|
567 | 584 |
|
568 | 585 | struct StructForDeprecated;
|
@@ -594,16 +611,22 @@ mod must_use {
|
594 | 611 | }
|
595 | 612 |
|
596 | 613 | #[windows_subsystem = "windows"]
|
| 614 | +//~^ WARN crate-level attribute should be an inner attribute |
597 | 615 | mod windows_subsystem {
|
598 | 616 | mod inner { #![windows_subsystem="windows"] }
|
| 617 | + //~^ WARN crate-level attribute should be in the root module |
599 | 618 |
|
600 | 619 | #[windows_subsystem = "windows"] fn f() { }
|
| 620 | + //~^ WARN crate-level attribute should be an inner attribute |
601 | 621 |
|
602 | 622 | #[windows_subsystem = "windows"] struct S;
|
| 623 | + //~^ WARN crate-level attribute should be an inner attribute |
603 | 624 |
|
604 | 625 | #[windows_subsystem = "windows"] type T = S;
|
| 626 | + //~^ WARN crate-level attribute should be an inner attribute |
605 | 627 |
|
606 | 628 | #[windows_subsystem = "windows"] impl S { }
|
| 629 | + //~^ WARN crate-level attribute should be an inner attribute |
607 | 630 | }
|
608 | 631 |
|
609 | 632 | // BROKEN USES OF CRATE-LEVEL BUILT-IN ATTRIBUTES
|
@@ -686,16 +709,22 @@ mod no_main_1 {
|
686 | 709 | }
|
687 | 710 |
|
688 | 711 | #[no_builtins]
|
| 712 | +//~^ WARN crate-level attribute should be an inner attribute |
689 | 713 | mod no_builtins {
|
690 | 714 | mod inner { #![no_builtins] }
|
| 715 | + //~^ WARN crate-level attribute should be in the root module |
691 | 716 |
|
692 | 717 | #[no_builtins] fn f() { }
|
| 718 | + //~^ WARN crate-level attribute should be an inner attribute |
693 | 719 |
|
694 | 720 | #[no_builtins] struct S;
|
| 721 | + //~^ WARN crate-level attribute should be an inner attribute |
695 | 722 |
|
696 | 723 | #[no_builtins] type T = S;
|
| 724 | + //~^ WARN crate-level attribute should be an inner attribute |
697 | 725 |
|
698 | 726 | #[no_builtins] impl S { }
|
| 727 | + //~^ WARN crate-level attribute should be an inner attribute |
699 | 728 | }
|
700 | 729 |
|
701 | 730 | #[recursion_limit="0200"]
|
|
0 commit comments