Skip to content

Commit cc0bbf4

Browse files
committed
Update these tests to use update error messages and type const syntax.
1 parent 9c36893 commit cc0bbf4

25 files changed

+114
-126
lines changed

tests/ui/attributes/malformed-attrs.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ struct Test;
145145
#[diagnostic::on_unimplemented = 1]
146146
//~^ WARN malformed
147147
trait Hey {
148-
#[type_const = 1]
149-
//~^ ERROR malformed
150-
const HEY: usize = 5;
148+
type const HEY: usize = 5;
151149
}
152150

153151
struct Empty;

tests/ui/attributes/malformed-attrs.stderr

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ LL | #[cfg_attr]
2121
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
2222

2323
error[E0463]: can't find crate for `wloop`
24-
--> $DIR/malformed-attrs.rs:217:1
24+
--> $DIR/malformed-attrs.rs:215:1
2525
|
2626
LL | extern crate wloop;
2727
| ^^^^^^^^^^^^^^^^^^^ can't find crate
2828

2929
error: malformed `allow` attribute input
30-
--> $DIR/malformed-attrs.rs:183:1
30+
--> $DIR/malformed-attrs.rs:181:1
3131
|
3232
LL | #[allow]
3333
| ^^^^^^^^
@@ -43,7 +43,7 @@ LL | #[allow(lint1, lint2, lint3, reason = "...")]
4343
| +++++++++++++++++++++++++++++++++++++
4444

4545
error: malformed `expect` attribute input
46-
--> $DIR/malformed-attrs.rs:185:1
46+
--> $DIR/malformed-attrs.rs:183:1
4747
|
4848
LL | #[expect]
4949
| ^^^^^^^^^
@@ -59,7 +59,7 @@ LL | #[expect(lint1, lint2, lint3, reason = "...")]
5959
| +++++++++++++++++++++++++++++++++++++
6060

6161
error: malformed `warn` attribute input
62-
--> $DIR/malformed-attrs.rs:187:1
62+
--> $DIR/malformed-attrs.rs:185:1
6363
|
6464
LL | #[warn]
6565
| ^^^^^^^
@@ -75,7 +75,7 @@ LL | #[warn(lint1, lint2, lint3, reason = "...")]
7575
| +++++++++++++++++++++++++++++++++++++
7676

7777
error: malformed `deny` attribute input
78-
--> $DIR/malformed-attrs.rs:189:1
78+
--> $DIR/malformed-attrs.rs:187:1
7979
|
8080
LL | #[deny]
8181
| ^^^^^^^
@@ -91,7 +91,7 @@ LL | #[deny(lint1, lint2, lint3, reason = "...")]
9191
| +++++++++++++++++++++++++++++++++++++
9292

9393
error: malformed `forbid` attribute input
94-
--> $DIR/malformed-attrs.rs:191:1
94+
--> $DIR/malformed-attrs.rs:189:1
9595
|
9696
LL | #[forbid]
9797
| ^^^^^^^^^
@@ -125,7 +125,7 @@ LL | #[proc_macro_derive]
125125
| ^^^^^^^^^^^^^^^^^^^^
126126

127127
error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint
128-
--> $DIR/malformed-attrs.rs:222:1
128+
--> $DIR/malformed-attrs.rs:220:1
129129
|
130130
LL | #[allow_internal_unsafe = 1]
131131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -541,7 +541,7 @@ LL | #[cfi_encoding = ""]
541541
| help: must be of the form: `#[cfi_encoding = "encoding"]`
542542

543543
error[E0565]: malformed `marker` attribute input
544-
--> $DIR/malformed-attrs.rs:160:1
544+
--> $DIR/malformed-attrs.rs:158:1
545545
|
546546
LL | #[marker = 3]
547547
| ^^^^^^^^^---^
@@ -550,7 +550,7 @@ LL | #[marker = 3]
550550
| help: must be of the form: `#[marker]`
551551

552552
error[E0565]: malformed `fundamental` attribute input
553-
--> $DIR/malformed-attrs.rs:162:1
553+
--> $DIR/malformed-attrs.rs:160:1
554554
|
555555
LL | #[fundamental()]
556556
| ^^^^^^^^^^^^^--^
@@ -559,7 +559,7 @@ LL | #[fundamental()]
559559
| help: must be of the form: `#[fundamental]`
560560

561561
error[E0565]: malformed `ffi_pure` attribute input
562-
--> $DIR/malformed-attrs.rs:170:5
562+
--> $DIR/malformed-attrs.rs:168:5
563563
|
564564
LL | #[unsafe(ffi_pure = 1)]
565565
| ^^^^^^^^^^^^^^^^^^---^^
@@ -568,7 +568,7 @@ LL | #[unsafe(ffi_pure = 1)]
568568
| help: must be of the form: `#[ffi_pure]`
569569

570570
error[E0539]: malformed `link_ordinal` attribute input
571-
--> $DIR/malformed-attrs.rs:172:5
571+
--> $DIR/malformed-attrs.rs:170:5
572572
|
573573
LL | #[link_ordinal]
574574
| ^^^^^^^^^^^^^^^
@@ -579,7 +579,7 @@ LL | #[link_ordinal]
579579
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
580580

581581
error[E0565]: malformed `ffi_const` attribute input
582-
--> $DIR/malformed-attrs.rs:176:5
582+
--> $DIR/malformed-attrs.rs:174:5
583583
|
584584
LL | #[unsafe(ffi_const = 1)]
585585
| ^^^^^^^^^^^^^^^^^^^---^^
@@ -588,13 +588,13 @@ LL | #[unsafe(ffi_const = 1)]
588588
| help: must be of the form: `#[ffi_const]`
589589

590590
error[E0539]: malformed `linkage` attribute input
591-
--> $DIR/malformed-attrs.rs:178:5
591+
--> $DIR/malformed-attrs.rs:176:5
592592
|
593593
LL | #[linkage]
594594
| ^^^^^^^^^^ expected this to be of the form `linkage = "..."`
595595

596596
error[E0539]: malformed `debugger_visualizer` attribute input
597-
--> $DIR/malformed-attrs.rs:193:1
597+
--> $DIR/malformed-attrs.rs:191:1
598598
|
599599
LL | #[debugger_visualizer]
600600
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -605,7 +605,7 @@ LL | #[debugger_visualizer]
605605
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute>
606606

607607
error[E0565]: malformed `automatically_derived` attribute input
608-
--> $DIR/malformed-attrs.rs:195:1
608+
--> $DIR/malformed-attrs.rs:193:1
609609
|
610610
LL | #[automatically_derived = 18]
611611
| ^^^^^^^^^^^^^^^^^^^^^^^^----^
@@ -614,7 +614,7 @@ LL | #[automatically_derived = 18]
614614
| help: must be of the form: `#[automatically_derived]`
615615

616616
error[E0565]: malformed `non_exhaustive` attribute input
617-
--> $DIR/malformed-attrs.rs:203:1
617+
--> $DIR/malformed-attrs.rs:201:1
618618
|
619619
LL | #[non_exhaustive = 1]
620620
| ^^^^^^^^^^^^^^^^^---^
@@ -623,7 +623,7 @@ LL | #[non_exhaustive = 1]
623623
| help: must be of the form: `#[non_exhaustive]`
624624

625625
error[E0565]: malformed `thread_local` attribute input
626-
--> $DIR/malformed-attrs.rs:209:1
626+
--> $DIR/malformed-attrs.rs:207:1
627627
|
628628
LL | #[thread_local()]
629629
| ^^^^^^^^^^^^^^--^
@@ -632,7 +632,7 @@ LL | #[thread_local()]
632632
| help: must be of the form: `#[thread_local]`
633633

634634
error[E0565]: malformed `no_link` attribute input
635-
--> $DIR/malformed-attrs.rs:213:1
635+
--> $DIR/malformed-attrs.rs:211:1
636636
|
637637
LL | #[no_link()]
638638
| ^^^^^^^^^--^
@@ -641,7 +641,7 @@ LL | #[no_link()]
641641
| help: must be of the form: `#[no_link]`
642642

643643
error[E0539]: malformed `macro_use` attribute input
644-
--> $DIR/malformed-attrs.rs:215:1
644+
--> $DIR/malformed-attrs.rs:213:1
645645
|
646646
LL | #[macro_use = 1]
647647
| ^^^^^^^^^^^^---^
@@ -659,7 +659,7 @@ LL + #[macro_use]
659659
|
660660

661661
error[E0539]: malformed `macro_export` attribute input
662-
--> $DIR/malformed-attrs.rs:220:1
662+
--> $DIR/malformed-attrs.rs:218:1
663663
|
664664
LL | #[macro_export = 18]
665665
| ^^^^^^^^^^^^^^^----^
@@ -676,23 +676,14 @@ LL + #[macro_export]
676676
|
677677

678678
error[E0565]: malformed `allow_internal_unsafe` attribute input
679-
--> $DIR/malformed-attrs.rs:222:1
679+
--> $DIR/malformed-attrs.rs:220:1
680680
|
681681
LL | #[allow_internal_unsafe = 1]
682682
| ^^^^^^^^^^^^^^^^^^^^^^^^---^
683683
| | |
684684
| | didn't expect any arguments here
685685
| help: must be of the form: `#[allow_internal_unsafe]`
686686

687-
error[E0565]: malformed `type_const` attribute input
688-
--> $DIR/malformed-attrs.rs:148:5
689-
|
690-
LL | #[type_const = 1]
691-
| ^^^^^^^^^^^^^---^
692-
| | |
693-
| | didn't expect any arguments here
694-
| help: must be of the form: `#[type_const]`
695-
696687
error: attribute should be applied to `const fn`
697688
--> $DIR/malformed-attrs.rs:32:1
698689
|
@@ -820,13 +811,13 @@ LL | #[no_implicit_prelude = 23]
820811
= help: `#[no_implicit_prelude]` can be applied to crates and modules
821812

822813
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
823-
--> $DIR/malformed-attrs.rs:154:1
814+
--> $DIR/malformed-attrs.rs:152:1
824815
|
825816
LL | #[diagnostic::do_not_recommend()]
826817
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
827818

828819
warning: `#[automatically_derived]` attribute cannot be used on modules
829-
--> $DIR/malformed-attrs.rs:195:1
820+
--> $DIR/malformed-attrs.rs:193:1
830821
|
831822
LL | #[automatically_derived = 18]
832823
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -835,7 +826,7 @@ LL | #[automatically_derived = 18]
835826
= help: `#[automatically_derived]` can only be applied to trait impl blocks
836827

837828
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
838-
--> $DIR/malformed-attrs.rs:229:1
829+
--> $DIR/malformed-attrs.rs:227:1
839830
|
840831
LL | #[ignore = 1]
841832
| ^^^^^^^^^^^^^
@@ -854,7 +845,7 @@ LL | #[coroutine = 63] || {}
854845
= note: expected unit type `()`
855846
found coroutine `{coroutine@$DIR/malformed-attrs.rs:116:23: 116:25}`
856847

857-
error: aborting due to 76 previous errors; 8 warnings emitted
848+
error: aborting due to 75 previous errors; 8 warnings emitted
858849

859850
Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805.
860851
For more information about an error, try `rustc --explain E0308`.
@@ -882,7 +873,7 @@ LL | #[ignore()]
882873

883874
Future breakage diagnostic:
884875
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
885-
--> $DIR/malformed-attrs.rs:229:1
876+
--> $DIR/malformed-attrs.rs:227:1
886877
|
887878
LL | #[ignore = 1]
888879
| ^^^^^^^^^^^^^

tests/ui/const-generics/associated-const-bindings/dyn-compat-non-type-assoc-const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
trait Trait {
99
const K: usize;
10-
//~^ NOTE it contains associated const `K` that's not marked `#[type_const]`
10+
//~^ NOTE it contains associated const `K` that's not defined as `type const`
1111
}
1212

1313
fn main() {
@@ -16,5 +16,5 @@ fn main() {
1616
// Check that specifying the non-type assoc const doesn't "magically make it work".
1717
let _: dyn Trait<K = 0>;
1818
//~^ ERROR the trait `Trait` is not dyn compatible
19-
//~| ERROR use of trait associated const without `#[type_const]`
19+
//~| ERROR use of trait associated const not defined as `type const`
2020
}

tests/ui/const-generics/associated-const-bindings/dyn-compat-non-type-assoc-const.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ note: for a trait to be dyn compatible it needs to allow building a vtable
1111
LL | trait Trait {
1212
| ----- this trait is not dyn compatible...
1313
LL | const K: usize;
14-
| ^ ...because it contains associated const `K` that's not marked `#[type_const]`
14+
| ^ ...because it contains associated const `K` that's not defined as `type const`
1515
= help: consider moving `K` to another trait
1616

17-
error: use of trait associated const without `#[type_const]`
17+
error: use of trait associated const not defined as `type const`
1818
--> $DIR/dyn-compat-non-type-assoc-const.rs:17:22
1919
|
2020
LL | let _: dyn Trait<K = 0>;
2121
| ^^^^^
2222
|
23-
= note: the declaration in the trait must be marked with `#[type_const]`
23+
= note: the declaration in the trait must begin with `type const` not just `const` alone
2424

2525
error[E0038]: the trait `Trait` is not dyn compatible
2626
--> $DIR/dyn-compat-non-type-assoc-const.rs:17:16
@@ -35,7 +35,7 @@ note: for a trait to be dyn compatible it needs to allow building a vtable
3535
LL | trait Trait {
3636
| ----- this trait is not dyn compatible...
3737
LL | const K: usize;
38-
| ^ ...because it contains associated const `K` that's not marked `#[type_const]`
38+
| ^ ...because it contains associated const `K` that's not defined as `type const`
3939
= help: consider moving `K` to another trait
4040

4141
error: aborting due to 3 previous errors

tests/ui/const-generics/mgca/assoc-const-without-type_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ pub trait Tr {
66
}
77

88
fn mk_array<T: Tr>(_x: T) -> [(); T::SIZE] {
9-
//~^ ERROR type_const
9+
//~^ ERROR: use of `const` in the type system not defined as `type const`
1010
[(); T::SIZE]
11-
//~^ ERROR type_const
11+
//~^ ERROR: use of `const` in the type system not defined as `type const`
1212
}
1313

1414
fn main() {}

tests/ui/const-generics/mgca/assoc-const-without-type_const.stderr

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
error: use of `const` in the type system without `#[type_const]`
1+
error: use of `const` in the type system not defined as `type const`
22
--> $DIR/assoc-const-without-type_const.rs:8:35
33
|
44
LL | fn mk_array<T: Tr>(_x: T) -> [(); T::SIZE] {
55
| ^^^^^^^
66
|
7-
help: add `#[type_const]` attribute to `Tr::SIZE`
7+
help: add `type` before `const` for `Tr::SIZE`
88
|
9-
LL + #[type_const]
10-
LL | const SIZE: usize;
9+
LL + type const
1110
|
1211

13-
error: use of `const` in the type system without `#[type_const]`
12+
error: use of `const` in the type system not defined as `type const`
1413
--> $DIR/assoc-const-without-type_const.rs:10:10
1514
|
1615
LL | [(); T::SIZE]
1716
| ^^^^^^^
1817
|
19-
help: add `#[type_const]` attribute to `Tr::SIZE`
18+
help: add `type` before `const` for `Tr::SIZE`
2019
|
21-
LL + #[type_const]
22-
LL | const SIZE: usize;
20+
LL + type const
2321
|
2422

2523
error: aborting due to 2 previous errors
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
trait Tr {
2-
#[type_const()]
3-
//~^ ERROR malformed
4-
//~| ERROR experimental
5-
const N: usize;
2+
type const N: usize;
3+
//~^ ERROR: `type const` syntax is experimental [E0658]
4+
//~| ERROR: associated `type const` are unstable [E0658]
65
}
76

87
struct S;
98

109
impl Tr for S {
11-
#[type_const]
12-
//~^ ERROR experimental
13-
const N: usize = 0;
10+
11+
type const N: usize = 0;
12+
//~^ ERROR: `type const` syntax is experimental [E0658]
13+
//~| ERROR: associated `type const` are unstable [E0658]
1414
}
1515

1616
fn main() {}

0 commit comments

Comments
 (0)