Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 507ada1

Browse files
committedOct 20, 2024·
wip on constargkind::path for all paths
lots of ICEs and other bad changes
1 parent 979edcd commit 507ada1

20 files changed

+53
-385
lines changed
 

‎compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,14 +2334,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23342334
} else {
23352335
&anon.value
23362336
};
2337-
let maybe_res =
2338-
self.resolver.get_partial_res(expr.id).and_then(|partial_res| partial_res.full_res());
2339-
debug!("res={:?}", maybe_res);
2340-
// FIXME(min_generic_const_args): for now we only lower params to ConstArgKind::Path
2341-
if let Some(res) = maybe_res
2342-
&& let Res::Def(DefKind::ConstParam, _) = res
2343-
&& let ExprKind::Path(qself, path) = &expr.kind
2344-
{
2337+
if let ExprKind::Path(qself, path) = &expr.kind {
23452338
let qpath = self.lower_qpath(
23462339
expr.id,
23472340
qself,
Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,36 @@
1-
error[E0308]: mismatched types
2-
--> $DIR/bad-generic-in-copy-impl.rs:3:13
1+
error: the constant `1` is not of type `usize`
2+
--> $DIR/bad-generic-in-copy-impl.rs:3:8
33
|
44
LL | x: [u8; SIZE],
5-
| ^^^^ expected `usize`, found `u32`
5+
| ^^^^^^^^^^ expected `usize`, found `u32`
66

7-
error[E0308]: mismatched types
8-
--> $DIR/bad-generic-in-copy-impl.rs:3:13
7+
error[E0204]: the trait `Copy` cannot be implemented for this type
8+
--> $DIR/bad-generic-in-copy-impl.rs:1:10
99
|
10+
LL | #[derive(Copy, Clone)]
11+
| ^^^^
12+
LL | pub struct Foo {
1013
LL | x: [u8; SIZE],
11-
| ^^^^ expected `usize`, found `u32`
14+
| ------------- this field does not implement `Copy`
1215
|
13-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
16+
note: the `Copy` impl for `[u8; 1]` requires that `the constant `1` has type `usize``
17+
--> $DIR/bad-generic-in-copy-impl.rs:3:8
18+
|
19+
LL | x: [u8; SIZE],
20+
| ^^^^^^^^^^
21+
= note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
22+
23+
error: the constant `1` is not of type `usize`
24+
--> $DIR/bad-generic-in-copy-impl.rs:3:5
25+
|
26+
LL | #[derive(Copy, Clone)]
27+
| ----- in this derive macro expansion
28+
LL | pub struct Foo {
29+
LL | x: [u8; SIZE],
30+
| ^^^^^^^^^^^^^ expected `usize`, found `u32`
31+
|
32+
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
1433

15-
error: aborting due to 2 previous errors
34+
error: aborting due to 3 previous errors
1635

17-
For more information about this error, try `rustc --explain E0308`.
36+
For more information about this error, try `rustc --explain E0204`.

‎tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,6 @@ LL | pub struct SelfDependent<const N: [u8; N]>;
1414
|
1515
= note: const parameters may not be used in the type of const parameters
1616

17-
error: `[u8; N]` is forbidden as the type of a const generic parameter
18-
--> $DIR/const-param-type-depends-on-const-param.rs:11:47
19-
|
20-
LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
21-
| ^^^^^^^
22-
|
23-
= note: the only supported types are integers, `bool`, and `char`
24-
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
25-
|
26-
LL + #![feature(adt_const_params)]
27-
|
28-
29-
error: `[u8; N]` is forbidden as the type of a const generic parameter
30-
--> $DIR/const-param-type-depends-on-const-param.rs:15:35
31-
|
32-
LL | pub struct SelfDependent<const N: [u8; N]>;
33-
| ^^^^^^^
34-
|
35-
= note: the only supported types are integers, `bool`, and `char`
36-
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
37-
|
38-
LL + #![feature(adt_const_params)]
39-
|
40-
41-
error: aborting due to 4 previous errors
17+
error: aborting due to 2 previous errors
4218

4319
For more information about this error, try `rustc --explain E0770`.

‎tests/ui/const-generics/fn-const-param-infer.adt_const_params.stderr

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ error[E0741]: using function pointers as const generic parameters is forbidden
44
LL | struct Checked<const F: fn(usize) -> bool>;
55
| ^^^^^^^^^^^^^^^^^
66

7-
error[E0308]: mismatched types
8-
--> $DIR/fn-const-param-infer.rs:33:25
9-
|
10-
LL | let _ = Checked::<{ generic_arg::<u32> }>;
11-
| ^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
12-
|
13-
= note: expected fn pointer `fn(usize) -> _`
14-
found fn item `fn(u32) -> _ {generic_arg::<u32>}`
15-
16-
error: aborting due to 2 previous errors
7+
error: aborting due to 1 previous error
178

18-
Some errors have detailed explanations: E0308, E0741.
19-
For more information about an error, try `rustc --explain E0308`.
9+
For more information about this error, try `rustc --explain E0741`.

‎tests/ui/const-generics/fn-const-param-infer.full.stderr

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ error[E0741]: using function pointers as const generic parameters is forbidden
44
LL | struct Checked<const F: fn(usize) -> bool>;
55
| ^^^^^^^^^^^^^^^^^
66

7-
error[E0308]: mismatched types
8-
--> $DIR/fn-const-param-infer.rs:33:25
9-
|
10-
LL | let _ = Checked::<{ generic_arg::<u32> }>;
11-
| ^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
12-
|
13-
= note: expected fn pointer `fn(usize) -> _`
14-
found fn item `fn(u32) -> _ {generic_arg::<u32>}`
15-
16-
error: aborting due to 2 previous errors
7+
error: aborting due to 1 previous error
178

18-
Some errors have detailed explanations: E0308, E0741.
19-
For more information about an error, try `rustc --explain E0308`.
9+
For more information about this error, try `rustc --explain E0741`.

‎tests/ui/const-generics/fn-const-param-infer.min.stderr

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,5 @@ LL | struct Checked<const F: fn(usize) -> bool>;
66
|
77
= note: the only supported types are integers, `bool`, and `char`
88

9-
error[E0308]: mismatched types
10-
--> $DIR/fn-const-param-infer.rs:33:25
11-
|
12-
LL | let _ = Checked::<{ generic_arg::<u32> }>;
13-
| ^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
14-
|
15-
= note: expected fn pointer `fn(usize) -> _`
16-
found fn item `fn(u32) -> _ {generic_arg::<u32>}`
17-
18-
error: aborting due to 2 previous errors
9+
error: aborting due to 1 previous error
1910

20-
For more information about this error, try `rustc --explain E0308`.

‎tests/ui/const-generics/generic_const_exprs/error_in_ty.stderr

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,6 @@ LL | pub struct A<const z: [usize; x]> {}
66
| |
77
| similarly named const parameter `z` defined here
88

9-
error: `[usize; x]` is forbidden as the type of a const generic parameter
10-
--> $DIR/error_in_ty.rs:6:23
11-
|
12-
LL | pub struct A<const z: [usize; x]> {}
13-
| ^^^^^^^^^^
14-
|
15-
= note: the only supported types are integers, `bool`, and `char`
16-
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
17-
|
18-
LL + #![feature(adt_const_params)]
19-
|
20-
21-
error[E0308]: mismatched types
22-
--> $DIR/error_in_ty.rs:10:8
23-
|
24-
LL | impl A<2> {
25-
| ^ expected `[usize; x]`, found integer
26-
27-
error[E0308]: mismatched types
28-
--> $DIR/error_in_ty.rs:16:8
29-
|
30-
LL | impl A<2> {
31-
| ^ expected `[usize; x]`, found integer
32-
339
error[E0592]: duplicate definitions with name `B`
3410
--> $DIR/error_in_ty.rs:12:5
3511
|
@@ -39,7 +15,7 @@ LL | pub const fn B() {}
3915
LL | pub const fn B() {}
4016
| ---------------- other definition for `B`
4117

42-
error: aborting due to 5 previous errors
18+
error: aborting due to 2 previous errors
4319

44-
Some errors have detailed explanations: E0308, E0425, E0592.
45-
For more information about an error, try `rustc --explain E0308`.
20+
Some errors have detailed explanations: E0425, E0592.
21+
For more information about an error, try `rustc --explain E0425`.

‎tests/ui/const-generics/generic_const_exprs/issue-62504.full.stderr

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
1-
error[E0308]: mismatched types
2-
--> $DIR/issue-62504.rs:18:21
3-
|
4-
LL | ArrayHolder([0; Self::SIZE])
5-
| ^^^^^^^^^^^^^^^ expected `X`, found `Self::SIZE`
6-
|
7-
= note: expected constant `X`
8-
found constant `Self::SIZE`
9-
10-
error: unconstrained generic constant
11-
--> $DIR/issue-62504.rs:18:25
12-
|
13-
LL | ArrayHolder([0; Self::SIZE])
14-
| ^^^^^^^^^^
15-
|
16-
help: try adding a `where` bound
17-
|
18-
LL | pub const fn new() -> Self where [(); Self::SIZE]: {
19-
| +++++++++++++++++++++++
20-
211
error[E0284]: type annotations needed for `ArrayHolder<_>`
222
--> $DIR/issue-62504.rs:26:9
233
|
@@ -52,7 +32,6 @@ help: consider giving `array` an explicit type, where the value of const paramet
5232
LL | let mut array: ArrayHolder<X> = ArrayHolder::new();
5333
| ++++++++++++++++
5434

55-
error: aborting due to 4 previous errors
35+
error: aborting due to 2 previous errors
5636

57-
Some errors have detailed explanations: E0284, E0308.
58-
For more information about an error, try `rustc --explain E0284`.
37+
For more information about this error, try `rustc --explain E0284`.
Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
error: constant expression depends on a generic parameter
2-
--> $DIR/issue-62504.rs:18:25
3-
|
4-
LL | ArrayHolder([0; Self::SIZE])
5-
| ^^^^^^^^^^
6-
|
7-
= note: this may fail depending on what value the parameter takes
8-
9-
error[E0308]: mismatched types
10-
--> $DIR/issue-62504.rs:18:21
11-
|
12-
LL | ArrayHolder([0; Self::SIZE])
13-
| ----------- ^^^^^^^^^^^^^^^ expected `X`, found `Self::SIZE`
14-
| |
15-
| arguments to this struct are incorrect
16-
|
17-
= note: expected array `[u32; X]`
18-
found array `[u32; Self::SIZE]`
19-
note: tuple struct defined here
20-
--> $DIR/issue-62504.rs:14:8
21-
|
22-
LL | struct ArrayHolder<const X: usize>([u32; X]);
23-
| ^^^^^^^^^^^
24-
251
error[E0284]: type annotations needed for `ArrayHolder<_>`
262
--> $DIR/issue-62504.rs:26:9
273
|
@@ -56,7 +32,6 @@ help: consider giving `array` an explicit type, where the value of const paramet
5632
LL | let mut array: ArrayHolder<X> = ArrayHolder::new();
5733
| ++++++++++++++++
5834

59-
error: aborting due to 4 previous errors
35+
error: aborting due to 2 previous errors
6036

61-
Some errors have detailed explanations: E0284, E0308.
62-
For more information about an error, try `rustc --explain E0284`.
37+
For more information about this error, try `rustc --explain E0284`.

‎tests/ui/const-generics/issues/issue-62878.min.stderr

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ LL | fn foo<const N: usize, const A: [u8; N]>() {}
66
|
77
= note: const parameters may not be used in the type of const parameters
88

9-
error: `[u8; N]` is forbidden as the type of a const generic parameter
10-
--> $DIR/issue-62878.rs:5:33
11-
|
12-
LL | fn foo<const N: usize, const A: [u8; N]>() {}
13-
| ^^^^^^^
14-
|
15-
= note: the only supported types are integers, `bool`, and `char`
16-
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
17-
|
18-
LL + #![feature(adt_const_params)]
19-
|
20-
219
error[E0747]: type provided when a constant was expected
2210
--> $DIR/issue-62878.rs:10:11
2311
|
@@ -30,7 +18,7 @@ help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable
3018
LL + #![feature(generic_arg_infer)]
3119
|
3220

33-
error: aborting due to 3 previous errors
21+
error: aborting due to 2 previous errors
3422

3523
Some errors have detailed explanations: E0747, E0770.
3624
For more information about an error, try `rustc --explain E0747`.

‎tests/ui/const-generics/issues/issue-71169.min.stderr

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
66
|
77
= note: const parameters may not be used in the type of const parameters
88

9-
error: `[u8; LEN]` is forbidden as the type of a const generic parameter
10-
--> $DIR/issue-71169.rs:5:38
11-
|
12-
LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
13-
| ^^^^^^^^^
14-
|
15-
= note: the only supported types are integers, `bool`, and `char`
16-
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types
17-
|
18-
LL + #![feature(adt_const_params)]
19-
|
20-
21-
error: aborting due to 2 previous errors
9+
error: aborting due to 1 previous error
2210

2311
For more information about this error, try `rustc --explain E0770`.

‎tests/ui/const-generics/not_wf_param_in_rpitit.stderr

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,6 @@ LL | trait Trait<const N: dyn Trait = bar> {
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1919
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
2020

21-
error[E0038]: the trait `Trait` cannot be made into an object
22-
--> $DIR/not_wf_param_in_rpitit.rs:3:22
23-
|
24-
LL | trait Trait<const N: dyn Trait = bar> {
25-
| ^^^^^^^^^ `Trait` cannot be made into an object
26-
|
27-
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
28-
--> $DIR/not_wf_param_in_rpitit.rs:9:14
29-
|
30-
LL | trait Trait<const N: dyn Trait = bar> {
31-
| ----- this trait cannot be made into an object...
32-
...
33-
LL | async fn a() {}
34-
| ^ ...because associated function `a` has no `self` parameter
35-
help: consider turning `a` into a method by giving it a `&self` argument
36-
|
37-
LL | async fn a(&self) {}
38-
| +++++
39-
help: alternatively, consider constraining `a` so it does not apply to trait objects
40-
|
41-
LL | async fn a() where Self: Sized {}
42-
| +++++++++++++++++
43-
4421
error[E0038]: the trait `Trait` cannot be made into an object
4522
--> $DIR/not_wf_param_in_rpitit.rs:3:13
4623
|
@@ -88,7 +65,7 @@ help: alternatively, consider constraining `a` so it does not apply to trait obj
8865
LL | async fn a() where Self: Sized {}
8966
| +++++++++++++++++
9067

91-
error: aborting due to 5 previous errors
68+
error: aborting due to 4 previous errors
9269

9370
Some errors have detailed explanations: E0038, E0391, E0425.
9471
For more information about an error, try `rustc --explain E0038`.

‎tests/ui/consts/const-len-underflow-separate-spans.old.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ error[E0080]: evaluation of constant value failed
44
LL | const LEN: usize = ONE - TWO;
55
| ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow
66

7-
note: erroneous constant encountered
8-
--> $DIR/const-len-underflow-separate-spans.rs:14:17
9-
|
10-
LL | let a: [i8; LEN] = unimplemented!();
11-
| ^^^
12-
137
error: aborting due to 1 previous error
148

159
For more information about this error, try `rustc --explain E0080`.

‎tests/ui/consts/issue-39974.stderr

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ help: use a float literal
99
LL | const LENGTH: f64 = 2.0;
1010
| ++
1111

12-
error[E0308]: mismatched types
13-
--> $DIR/issue-39974.rs:5:19
14-
|
15-
LL | f: [[f64; 2]; LENGTH],
16-
| ^^^^^^ expected `usize`, found `f64`
17-
18-
error: aborting due to 2 previous errors
12+
error: aborting due to 1 previous error
1913

2014
For more information about this error, try `rustc --explain E0308`.

‎tests/ui/extern/extern-static-size-overflow.stderr

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,5 @@ error: extern static is too large for the target architecture
44
LL | static BAZ: [u8; max_size()];
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66

7-
error: extern static is too large for the target architecture
8-
--> $DIR/extern-static-size-overflow.rs:21:5
9-
|
10-
LL | static UWU: [usize; usize::MAX];
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12-
13-
error: extern static is too large for the target architecture
14-
--> $DIR/extern-static-size-overflow.rs:22:5
15-
|
16-
LL | static A: ReallyBig;
17-
| ^^^^^^^^^^^^^^^^^^^
18-
19-
error: aborting due to 3 previous errors
7+
error: aborting due to 1 previous error
208

‎tests/ui/lint/unused/must_use-array.stderr

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ error: unused array of `S` that must be used
1616
LL | many();
1717
| ^^^^^^
1818

19-
error: unused array of `S` in tuple element 0 that must be used
20-
--> $DIR/must_use-array.rs:46:6
21-
|
22-
LL | ([S], 0, ());
23-
| ^^^
24-
2519
error: unused array of implementers of `T` that must be used
2620
--> $DIR/must_use-array.rs:47:5
2721
|
@@ -40,11 +34,5 @@ error: unused array of arrays of arrays of `S` that must be used
4034
LL | array_of_arrays_of_arrays();
4135
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
4236

43-
error: unused array of `S` that must be used
44-
--> $DIR/must_use-array.rs:52:5
45-
|
46-
LL | usize_max();
47-
| ^^^^^^^^^^^
48-
49-
error: aborting due to 7 previous errors
37+
error: aborting due to 5 previous errors
5038

‎tests/ui/simd/array-trait.stderr

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,9 @@
1-
error: unconstrained generic constant
2-
--> $DIR/array-trait.rs:23:23
3-
|
4-
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
5-
| ^^^^^^^^^^^^^^^^^^
6-
|
7-
help: try adding a `where` bound
8-
|
9-
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]) where [(); S::SIZE]:;
10-
| ++++++++++++++++++++
11-
121
error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
132
--> $DIR/array-trait.rs:23:1
143
|
154
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
165
| ^^^^^^^^^^^^^^^^^^^^^
176

18-
error: unconstrained generic constant
19-
--> $DIR/array-trait.rs:23:23
20-
|
21-
LL | #[derive(Copy, Clone)]
22-
| ----- in this derive macro expansion
23-
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
24-
| ^^^^^^^^^^^^^^^^^^
25-
|
26-
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
27-
28-
error: aborting due to 3 previous errors
7+
error: aborting due to 1 previous error
298

309
For more information about this error, try `rustc --explain E0077`.

‎tests/ui/transmutability/arrays/huge-len.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: `()` cannot be safely transmuted into `ExplicitlyPadded`
22
--> $DIR/huge-len.rs:21:41
33
|
44
LL | assert::is_maybe_transmutable::<(), ExplicitlyPadded>();
5-
| ^^^^^^^^^^^^^^^^ values of the type `ExplicitlyPadded` are too big for the target architecture
5+
| ^^^^^^^^^^^^^^^^ `ExplicitlyPadded` has an unknown layout
66
|
77
note: required by a bound in `is_maybe_transmutable`
88
--> $DIR/huge-len.rs:8:14
@@ -17,7 +17,7 @@ error[E0277]: `ExplicitlyPadded` cannot be safely transmuted into `()`
1717
--> $DIR/huge-len.rs:24:55
1818
|
1919
LL | assert::is_maybe_transmutable::<ExplicitlyPadded, ()>();
20-
| ^^ values of the type `ExplicitlyPadded` are too big for the target architecture
20+
| ^^ `ExplicitlyPadded` has an unknown layout
2121
|
2222
note: required by a bound in `is_maybe_transmutable`
2323
--> $DIR/huge-len.rs:8:14
Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,3 @@
1-
error: lifetime may not live long enough
2-
--> $DIR/reject_lifetime_extension.rs:20:18
3-
|
4-
LL | fn extend_bare<'a>(src: &'a u8) -> &'static u8 {
5-
| -- lifetime `'a` defined here
6-
LL | unsafe { transmute(src) }
7-
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
8-
9-
error: lifetime may not live long enough
10-
--> $DIR/reject_lifetime_extension.rs:28:18
11-
|
12-
LL | fn extend_nested<'a>(src: &'a &'a u8) -> &'a &'static u8 {
13-
| -- lifetime `'a` defined here
14-
LL | unsafe { transmute(src) }
15-
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
16-
17-
error: lifetime may not live long enough
18-
--> $DIR/reject_lifetime_extension.rs:36:18
19-
|
20-
LL | fn extend_unit<'a>(src: (&'a u8,)) -> (&'static u8,) {
21-
| -- lifetime `'a` defined here
22-
LL | unsafe { transmute(src) }
23-
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
24-
25-
error: lifetime may not live long enough
26-
--> $DIR/reject_lifetime_extension.rs:40:18
27-
|
28-
LL | fn extend_pair<'a>(src: (&'a u8, u8)) -> (&'static u8, u8) {
29-
| -- lifetime `'a` defined here
30-
LL | unsafe { transmute(src) }
31-
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
32-
33-
error: lifetime may not live long enough
34-
--> $DIR/reject_lifetime_extension.rs:50:18
35-
|
36-
LL | fn extend_struct<'a>(src: Struct<'a>) -> Struct<'static> {
37-
| -- lifetime `'a` defined here
38-
LL | unsafe { transmute(src) }
39-
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
40-
41-
error: lifetime may not live long enough
42-
--> $DIR/reject_lifetime_extension.rs:62:18
43-
|
44-
LL | fn extend_single<'a>(src: Single<'a>) -> Single<'static> {
45-
| -- lifetime `'a` defined here
46-
LL | unsafe { transmute(src) }
47-
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
48-
49-
error: lifetime may not live long enough
50-
--> $DIR/reject_lifetime_extension.rs:72:18
51-
|
52-
LL | fn extend_multi<'a>(src: Multi<'a>) -> Multi<'static> {
53-
| -- lifetime `'a` defined here
54-
LL | unsafe { transmute(src) }
55-
| ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
56-
571
error[E0521]: borrowed data escapes outside of function
582
--> $DIR/reject_lifetime_extension.rs:80:18
593
|
@@ -73,6 +17,6 @@ note: due to current limitations in the borrow checker, this implies a `'static`
7317
LL | for<'b> &'b u8: TransmuteFrom<&'a u8>,
7418
| ^^^^^^^^^^^^^^^^^^^^^
7519

76-
error: aborting due to 8 previous errors
20+
error: aborting due to 1 previous error
7721

7822
For more information about this error, try `rustc --explain E0521`.

‎tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -85,36 +85,6 @@ help: if this is a dyn-compatible trait, use `dyn`
8585
LL | fn fnc<const N: Trait = u32>(&self) -> dyn Trait {
8686
| +++
8787

88-
warning: trait objects without an explicit `dyn` are deprecated
89-
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
90-
|
91-
LL | trait Trait<const N: Trait = bar> {
92-
| ^^^^^
93-
|
94-
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
95-
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
96-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
97-
help: if this is a dyn-compatible trait, use `dyn`
98-
|
99-
LL | trait Trait<const N: dyn Trait = bar> {
100-
| +++
101-
102-
error[E0038]: the trait `Trait` cannot be made into an object
103-
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
104-
|
105-
LL | trait Trait<const N: Trait = bar> {
106-
| ^^^^^ `Trait` cannot be made into an object
107-
|
108-
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
109-
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:8
110-
|
111-
LL | trait Trait<const N: Trait = bar> {
112-
| ----- this trait cannot be made into an object...
113-
...
114-
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
115-
| ^^^ ...because method `fnc` has generic type parameters
116-
= help: consider moving `fnc` to another trait
117-
11888
error[E0038]: the trait `Trait` cannot be made into an object
11989
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
12090
|
@@ -145,36 +115,6 @@ help: you might have meant to use `Self` to refer to the implementing type
145115
LL | fn fnc<const N: Trait = u32>(&self) -> Self {
146116
| ~~~~
147117

148-
warning: trait objects without an explicit `dyn` are deprecated
149-
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:21
150-
|
151-
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
152-
| ^^^^^
153-
|
154-
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
155-
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
156-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
157-
help: if this is a dyn-compatible trait, use `dyn`
158-
|
159-
LL | fn fnc<const N: dyn Trait = u32>(&self) -> Trait {
160-
| +++
161-
162-
error[E0038]: the trait `Trait` cannot be made into an object
163-
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:21
164-
|
165-
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
166-
| ^^^^^ `Trait` cannot be made into an object
167-
|
168-
note: for a trait to be "dyn-compatible" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
169-
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:11:8
170-
|
171-
LL | trait Trait<const N: Trait = bar> {
172-
| ----- this trait cannot be made into an object...
173-
...
174-
LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
175-
| ^^^ ...because method `fnc` has generic type parameters
176-
= help: consider moving `fnc` to another trait
177-
178118
error[E0038]: the trait `Trait` cannot be made into an object
179119
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
180120
|
@@ -192,7 +132,7 @@ LL | fn fnc<const N: Trait = u32>(&self) -> Trait {
192132
= help: consider moving `fnc` to another trait
193133
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
194134

195-
error: aborting due to 11 previous errors; 5 warnings emitted
135+
error: aborting due to 9 previous errors; 3 warnings emitted
196136

197137
Some errors have detailed explanations: E0038, E0391, E0403, E0423, E0425.
198138
For more information about an error, try `rustc --explain E0038`.

0 commit comments

Comments
 (0)
Please sign in to comment.