Skip to content

Commit 8dddde4

Browse files
authored
Unrolled build for #143171
Rollup merge of #143171 - fmease:fix-span-of-maybe-const-mod, r=compiler-errors Fix the span of trait bound modifier `[const]` r? project-const-traits or anyone
2 parents dddd7ab + f77fead commit 8dddde4

31 files changed

+268
-268
lines changed

compiler/rustc_parse/src/parser/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ impl<'a> Parser<'a> {
10711071
&& self.look_ahead(1, |t| t.is_keyword(kw::Const))
10721072
&& self.look_ahead(2, |t| *t == token::CloseBracket)
10731073
{
1074-
let start = self.prev_token.span;
1074+
let start = self.token.span;
10751075
self.bump();
10761076
self.expect_keyword(exp!(Const)).unwrap();
10771077
self.bump();

tests/ui/consts/fn_trait_refs.stderr

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,145 +5,145 @@ LL | #![feature(const_fn_trait_ref_impls)]
55
| ^^^^^^^^^^^^^^^^^^^^^^^^
66

77
error: `[const]` can only be applied to `#[const_trait]` traits
8-
--> $DIR/fn_trait_refs.rs:14:6
8+
--> $DIR/fn_trait_refs.rs:14:8
99
|
1010
LL | T: [const] Fn<()> + [const] Destruct,
11-
| ^^^^^^^^^ can't be applied to `Fn`
11+
| ^^^^^^^ can't be applied to `Fn`
1212
|
1313
note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1414
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
1515

1616
error: `[const]` can only be applied to `#[const_trait]` traits
17-
--> $DIR/fn_trait_refs.rs:14:6
17+
--> $DIR/fn_trait_refs.rs:14:8
1818
|
1919
LL | T: [const] Fn<()> + [const] Destruct,
20-
| ^^^^^^^^^ can't be applied to `Fn`
20+
| ^^^^^^^ can't be applied to `Fn`
2121
|
2222
note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
2323
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
2424
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
2525

2626
error: `[const]` can only be applied to `#[const_trait]` traits
27-
--> $DIR/fn_trait_refs.rs:14:6
27+
--> $DIR/fn_trait_refs.rs:14:8
2828
|
2929
LL | T: [const] Fn<()> + [const] Destruct,
30-
| ^^^^^^^^^ can't be applied to `Fn`
30+
| ^^^^^^^ can't be applied to `Fn`
3131
|
3232
note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
3333
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
3434
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3535

3636
error: `[const]` can only be applied to `#[const_trait]` traits
37-
--> $DIR/fn_trait_refs.rs:21:6
37+
--> $DIR/fn_trait_refs.rs:21:8
3838
|
3939
LL | T: [const] FnMut<()> + [const] Destruct,
40-
| ^^^^^^^^^ can't be applied to `FnMut`
40+
| ^^^^^^^ can't be applied to `FnMut`
4141
|
4242
note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
4343
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
4444

4545
error: `[const]` can only be applied to `#[const_trait]` traits
46-
--> $DIR/fn_trait_refs.rs:21:6
46+
--> $DIR/fn_trait_refs.rs:21:8
4747
|
4848
LL | T: [const] FnMut<()> + [const] Destruct,
49-
| ^^^^^^^^^ can't be applied to `FnMut`
49+
| ^^^^^^^ can't be applied to `FnMut`
5050
|
5151
note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
5252
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
5353
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5454

5555
error: `[const]` can only be applied to `#[const_trait]` traits
56-
--> $DIR/fn_trait_refs.rs:21:6
56+
--> $DIR/fn_trait_refs.rs:21:8
5757
|
5858
LL | T: [const] FnMut<()> + [const] Destruct,
59-
| ^^^^^^^^^ can't be applied to `FnMut`
59+
| ^^^^^^^ can't be applied to `FnMut`
6060
|
6161
note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
6262
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
6363
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
6464

6565
error: `[const]` can only be applied to `#[const_trait]` traits
66-
--> $DIR/fn_trait_refs.rs:28:6
66+
--> $DIR/fn_trait_refs.rs:28:8
6767
|
6868
LL | T: [const] FnOnce<()>,
69-
| ^^^^^^^^^ can't be applied to `FnOnce`
69+
| ^^^^^^^ can't be applied to `FnOnce`
7070
|
7171
note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
7272
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
7373

7474
error: `[const]` can only be applied to `#[const_trait]` traits
75-
--> $DIR/fn_trait_refs.rs:28:6
75+
--> $DIR/fn_trait_refs.rs:28:8
7676
|
7777
LL | T: [const] FnOnce<()>,
78-
| ^^^^^^^^^ can't be applied to `FnOnce`
78+
| ^^^^^^^ can't be applied to `FnOnce`
7979
|
8080
note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
8181
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
8282
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
8383

8484
error: `[const]` can only be applied to `#[const_trait]` traits
85-
--> $DIR/fn_trait_refs.rs:28:6
85+
--> $DIR/fn_trait_refs.rs:28:8
8686
|
8787
LL | T: [const] FnOnce<()>,
88-
| ^^^^^^^^^ can't be applied to `FnOnce`
88+
| ^^^^^^^ can't be applied to `FnOnce`
8989
|
9090
note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
9191
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
9292
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
9393

9494
error: `[const]` can only be applied to `#[const_trait]` traits
95-
--> $DIR/fn_trait_refs.rs:35:6
95+
--> $DIR/fn_trait_refs.rs:35:8
9696
|
9797
LL | T: [const] Fn<()> + [const] Destruct,
98-
| ^^^^^^^^^ can't be applied to `Fn`
98+
| ^^^^^^^ can't be applied to `Fn`
9999
|
100100
note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
101101
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
102102

103103
error: `[const]` can only be applied to `#[const_trait]` traits
104-
--> $DIR/fn_trait_refs.rs:35:6
104+
--> $DIR/fn_trait_refs.rs:35:8
105105
|
106106
LL | T: [const] Fn<()> + [const] Destruct,
107-
| ^^^^^^^^^ can't be applied to `Fn`
107+
| ^^^^^^^ can't be applied to `Fn`
108108
|
109109
note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
110110
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
111111
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
112112

113113
error: `[const]` can only be applied to `#[const_trait]` traits
114-
--> $DIR/fn_trait_refs.rs:35:6
114+
--> $DIR/fn_trait_refs.rs:35:8
115115
|
116116
LL | T: [const] Fn<()> + [const] Destruct,
117-
| ^^^^^^^^^ can't be applied to `Fn`
117+
| ^^^^^^^ can't be applied to `Fn`
118118
|
119119
note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
120120
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
121121
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
122122

123123
error: `[const]` can only be applied to `#[const_trait]` traits
124-
--> $DIR/fn_trait_refs.rs:49:6
124+
--> $DIR/fn_trait_refs.rs:49:8
125125
|
126126
LL | T: [const] FnMut<()> + [const] Destruct,
127-
| ^^^^^^^^^ can't be applied to `FnMut`
127+
| ^^^^^^^ can't be applied to `FnMut`
128128
|
129129
note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
130130
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
131131

132132
error: `[const]` can only be applied to `#[const_trait]` traits
133-
--> $DIR/fn_trait_refs.rs:49:6
133+
--> $DIR/fn_trait_refs.rs:49:8
134134
|
135135
LL | T: [const] FnMut<()> + [const] Destruct,
136-
| ^^^^^^^^^ can't be applied to `FnMut`
136+
| ^^^^^^^ can't be applied to `FnMut`
137137
|
138138
note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
139139
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
140140
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
141141

142142
error: `[const]` can only be applied to `#[const_trait]` traits
143-
--> $DIR/fn_trait_refs.rs:49:6
143+
--> $DIR/fn_trait_refs.rs:49:8
144144
|
145145
LL | T: [const] FnMut<()> + [const] Destruct,
146-
| ^^^^^^^^^ can't be applied to `FnMut`
146+
| ^^^^^^^ can't be applied to `FnMut`
147147
|
148148
note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
149149
--> $SRC_DIR/core/src/ops/function.rs:LL:COL

tests/ui/consts/unstable-const-fn-in-libcore.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: `[const]` can only be applied to `#[const_trait]` traits
2-
--> $DIR/unstable-const-fn-in-libcore.rs:19:30
2+
--> $DIR/unstable-const-fn-in-libcore.rs:19:32
33
|
44
LL | const fn unwrap_or_else<F: [const] FnOnce() -> T>(self, f: F) -> T {
5-
| ^^^^^^^^^ can't be applied to `FnOnce`
5+
| ^^^^^^^ can't be applied to `FnOnce`
66
|
77
note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
99

1010
error: `[const]` can only be applied to `#[const_trait]` traits
11-
--> $DIR/unstable-const-fn-in-libcore.rs:19:30
11+
--> $DIR/unstable-const-fn-in-libcore.rs:19:32
1212
|
1313
LL | const fn unwrap_or_else<F: [const] FnOnce() -> T>(self, f: F) -> T {
14-
| ^^^^^^^^^ can't be applied to `FnOnce`
14+
| ^^^^^^^ can't be applied to `FnOnce`
1515
|
1616
note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717
--> $SRC_DIR/core/src/ops/function.rs:LL:COL

tests/ui/impl-trait/normalize-tait-in-const.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: `[const]` can only be applied to `#[const_trait]` traits
2-
--> $DIR/normalize-tait-in-const.rs:27:33
2+
--> $DIR/normalize-tait-in-const.rs:27:35
33
|
44
LL | const fn with_positive<F: for<'a> [const] Fn(&'a Alias<'a>) + [const] Destruct>(fun: F) {
5-
| ^^^^^^^^^ can't be applied to `Fn`
5+
| ^^^^^^^ can't be applied to `Fn`
66
|
77
note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
99

1010
error: `[const]` can only be applied to `#[const_trait]` traits
11-
--> $DIR/normalize-tait-in-const.rs:27:33
11+
--> $DIR/normalize-tait-in-const.rs:27:35
1212
|
1313
LL | const fn with_positive<F: for<'a> [const] Fn(&'a Alias<'a>) + [const] Destruct>(fun: F) {
14-
| ^^^^^^^^^ can't be applied to `Fn`
14+
| ^^^^^^^ can't be applied to `Fn`
1515
|
1616
note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717
--> $SRC_DIR/core/src/ops/function.rs:LL:COL

tests/ui/parser/bounds-type.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ LL | T: [const] ?Tr,
2121
| there is not a well-defined meaning for a `[const] ?` trait
2222

2323
error: `[const]` may only modify trait bounds, not lifetime bounds
24-
--> $DIR/bounds-type.rs:16:6
24+
--> $DIR/bounds-type.rs:16:8
2525
|
2626
LL | T: [const] 'a,
27-
| ^^^^^^^^^
27+
| ^^^^^^^
2828

2929
error: `const` may only modify trait bounds, not lifetime bounds
3030
--> $DIR/bounds-type.rs:17:8

tests/ui/specialization/const_trait_impl.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
error: `[const]` can only be applied to `#[const_trait]` traits
2-
--> $DIR/const_trait_impl.rs:34:7
2+
--> $DIR/const_trait_impl.rs:34:9
33
|
44
LL | impl<T: [const] Default> const A for T {
5-
| ^^^^^^^^^ can't be applied to `Default`
5+
| ^^^^^^^ can't be applied to `Default`
66
|
77
note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88
--> $SRC_DIR/core/src/default.rs:LL:COL
99

1010
error: `[const]` can only be applied to `#[const_trait]` traits
11-
--> $DIR/const_trait_impl.rs:40:7
11+
--> $DIR/const_trait_impl.rs:40:9
1212
|
1313
LL | impl<T: [const] Default + [const] Sup> const A for T {
14-
| ^^^^^^^^^ can't be applied to `Default`
14+
| ^^^^^^^ can't be applied to `Default`
1515
|
1616
note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717
--> $SRC_DIR/core/src/default.rs:LL:COL
1818

1919
error: `[const]` can only be applied to `#[const_trait]` traits
20-
--> $DIR/const_trait_impl.rs:46:7
20+
--> $DIR/const_trait_impl.rs:46:9
2121
|
2222
LL | impl<T: [const] Default + [const] Sub> const A for T {
23-
| ^^^^^^^^^ can't be applied to `Default`
23+
| ^^^^^^^ can't be applied to `Default`
2424
|
2525
note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
2626
--> $SRC_DIR/core/src/default.rs:LL:COL
2727

2828
error: `[const]` can only be applied to `#[const_trait]` traits
29-
--> $DIR/const_trait_impl.rs:40:7
29+
--> $DIR/const_trait_impl.rs:40:9
3030
|
3131
LL | impl<T: [const] Default + [const] Sup> const A for T {
32-
| ^^^^^^^^^ can't be applied to `Default`
32+
| ^^^^^^^ can't be applied to `Default`
3333
|
3434
note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
3535
--> $SRC_DIR/core/src/default.rs:LL:COL
3636
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3737

3838
error: `[const]` can only be applied to `#[const_trait]` traits
39-
--> $DIR/const_trait_impl.rs:34:7
39+
--> $DIR/const_trait_impl.rs:34:9
4040
|
4141
LL | impl<T: [const] Default> const A for T {
42-
| ^^^^^^^^^ can't be applied to `Default`
42+
| ^^^^^^^ can't be applied to `Default`
4343
|
4444
note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
4545
--> $SRC_DIR/core/src/default.rs:LL:COL
4646
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
4747

4848
error: `[const]` can only be applied to `#[const_trait]` traits
49-
--> $DIR/const_trait_impl.rs:46:7
49+
--> $DIR/const_trait_impl.rs:46:9
5050
|
5151
LL | impl<T: [const] Default + [const] Sub> const A for T {
52-
| ^^^^^^^^^ can't be applied to `Default`
52+
| ^^^^^^^ can't be applied to `Default`
5353
|
5454
note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
5555
--> $SRC_DIR/core/src/default.rs:LL:COL

tests/ui/traits/const-traits/conditionally-const-and-const-params.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: `[const]` is not allowed here
2-
--> $DIR/conditionally-const-and-const-params.rs:8:13
2+
--> $DIR/conditionally-const-and-const-params.rs:8:15
33
|
44
LL | fn add<A: [const] Add42>(self) -> Foo<{ A::add(N) }> {
5-
| ^^^^^^^^^
5+
| ^^^^^^^
66
|
77
note: this function is not `const`, so it cannot have `[const]` trait bounds
88
--> $DIR/conditionally-const-and-const-params.rs:8:8
@@ -11,10 +11,10 @@ LL | fn add<A: [const] Add42>(self) -> Foo<{ A::add(N) }> {
1111
| ^^^
1212

1313
error: `[const]` is not allowed here
14-
--> $DIR/conditionally-const-and-const-params.rs:26:9
14+
--> $DIR/conditionally-const-and-const-params.rs:26:11
1515
|
1616
LL | fn bar<A: [const] Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
17-
| ^^^^^^^^^
17+
| ^^^^^^^
1818
|
1919
note: this function is not `const`, so it cannot have `[const]` trait bounds
2020
--> $DIR/conditionally-const-and-const-params.rs:26:4

0 commit comments

Comments
 (0)