Skip to content

Commit

Permalink
Requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mendess committed Nov 24, 2020
1 parent b7593e5 commit af978e3
Show file tree
Hide file tree
Showing 30 changed files with 59 additions and 41 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/diagnostics.rs
Expand Up @@ -480,8 +480,8 @@ impl<'a> Resolver<'a> {
"const parameters may only be used as standalone arguments, i.e. `{}`",
name
));
err.note("use feature(const_generics) and feature(const_evaluatable_checked) to enable this");
}
err.note("use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions");

err
}
Expand Down
Expand Up @@ -5,7 +5,7 @@ LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/array-size-in-generic-struct-param.rs:20:15
Expand All @@ -14,7 +14,7 @@ LL | arr: [u8; CFG.arr_size],
| ^^^ cannot perform const operation using `CFG`
|
= help: const parameters may only be used as standalone arguments, i.e. `CFG`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: `Config` is forbidden as the type of a const generic parameter
--> $DIR/array-size-in-generic-struct-param.rs:18:21
Expand Down
11 changes: 7 additions & 4 deletions src/test/ui/const-generics/const-arg-in-const-arg.min.stderr
Expand Up @@ -5,6 +5,7 @@ LL | let _: [u8; foo::<T>()];
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:15:23
Expand All @@ -13,7 +14,7 @@ LL | let _: [u8; bar::<N>()];
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:25:23
Expand All @@ -22,7 +23,7 @@ LL | let _ = [0; bar::<N>()];
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:30:24
Expand All @@ -31,6 +32,7 @@ LL | let _: Foo<{ foo::<T>() }>;
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:31:24
Expand All @@ -39,7 +41,7 @@ LL | let _: Foo<{ bar::<N>() }>;
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:36:27
Expand All @@ -48,6 +50,7 @@ LL | let _ = Foo::<{ foo::<T>() }>;
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:37:27
Expand All @@ -56,7 +59,7 @@ LL | let _ = Foo::<{ bar::<N>() }>;
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error[E0658]: a non-static lifetime is not allowed in a `const`
--> $DIR/const-arg-in-const-arg.rs:16:23
Expand Down
Expand Up @@ -5,6 +5,7 @@ LL | pad: [u8; is_zst::<T>()],
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/const-argument-if-length.rs:17:12
Expand Down
Expand Up @@ -5,7 +5,7 @@ LL | type Arr<const N: usize> = [u8; N - 1];
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to previous error

Expand Up @@ -5,7 +5,7 @@ LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/simple.rs:8:35
Expand All @@ -14,7 +14,7 @@ LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to 2 previous errors

Expand Up @@ -5,7 +5,7 @@ LL | type Arr<const N: usize> = [u8; N - 1];
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to previous error

Expand Up @@ -5,7 +5,7 @@ LL | fn bar<const N: usize>() -> [u32; foo(N)] {
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/generic-function-call-in-array-length.rs:12:13
Expand All @@ -14,7 +14,7 @@ LL | [0; foo(N)]
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to 2 previous errors

Expand Up @@ -5,7 +5,7 @@ LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
| ^ cannot perform const operation using `A`
|
= help: const parameters may only be used as standalone arguments, i.e. `A`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/generic-sum-in-array-length.rs:7:57
Expand All @@ -14,7 +14,7 @@ LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
| ^ cannot perform const operation using `B`
|
= help: const parameters may only be used as standalone arguments, i.e. `B`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to 2 previous errors

Expand Up @@ -5,6 +5,7 @@ LL | T: Trait<{std::intrinsics::type_name::<T>()}>
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: `&'static str` is forbidden as the type of a const generic parameter
--> $DIR/intrinsics-type_name-as-const-argument.rs:10:22
Expand Down
Expand Up @@ -5,7 +5,7 @@ LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
| ^^^^^ cannot perform const operation using `COUNT`
|
= help: const parameters may only be used as standalone arguments, i.e. `COUNT`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/issue-61522-array-len-succ.rs:12:30
Expand All @@ -14,7 +14,7 @@ LL | fn inner(&self) -> &[u8; COUNT + 1] {
| ^^^^^ cannot perform const operation using `COUNT`
|
= help: const parameters may only be used as standalone arguments, i.e. `COUNT`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to 2 previous errors

1 change: 1 addition & 0 deletions src/test/ui/const-generics/issue-67375.min.stderr
Expand Up @@ -5,6 +5,7 @@ LL | inner: [(); { [|_: &T| {}; 0].len() }],
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error[E0392]: parameter `T` is never used
--> $DIR/issue-67375.rs:7:12
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/const-generics/issue-67945-1.min.stderr
Expand Up @@ -5,6 +5,7 @@ LL | let x: S = MaybeUninit::uninit();
| ^ cannot perform const operation using `S`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/issue-67945-1.rs:17:45
Expand All @@ -13,6 +14,7 @@ LL | let b = &*(&x as *const _ as *const S);
| ^ cannot perform const operation using `S`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error[E0392]: parameter `S` is never used
--> $DIR/issue-67945-1.rs:11:12
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/const-generics/issue-67945-2.min.stderr
Expand Up @@ -5,6 +5,7 @@ LL | let x: S = MaybeUninit::uninit();
| ^ cannot perform const operation using `S`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/issue-67945-2.rs:15:45
Expand All @@ -13,6 +14,7 @@ LL | let b = &*(&x as *const _ as *const S);
| ^ cannot perform const operation using `S`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error[E0392]: parameter `S` is never used
--> $DIR/issue-67945-2.rs:9:12
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/const-generics/issues/issue-61747.min.stderr
Expand Up @@ -5,7 +5,7 @@ LL | fn successor() -> Const<{C + 1}> {
| ^ cannot perform const operation using `C`
|
= help: const parameters may only be used as standalone arguments, i.e. `C`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to previous error

2 changes: 1 addition & 1 deletion src/test/ui/const-generics/issues/issue-61935.min.stderr
Expand Up @@ -5,7 +5,7 @@ LL | Self:FooImpl<{N==0}>
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to previous error

2 changes: 1 addition & 1 deletion src/test/ui/const-generics/issues/issue-62220.min.stderr
Expand Up @@ -5,7 +5,7 @@ LL | pub type TruncatedVector<T, const N: usize> = Vector<T, { N - 1 }>;
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to previous error

2 changes: 1 addition & 1 deletion src/test/ui/const-generics/issues/issue-62456.min.stderr
Expand Up @@ -5,7 +5,7 @@ LL | let _ = [0u64; N + 1];
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to previous error

2 changes: 2 additions & 0 deletions src/test/ui/const-generics/issues/issue-64494.min.stderr
Expand Up @@ -5,6 +5,7 @@ LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
| ^^^^^^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/issue-64494.rs:19:38
Expand All @@ -13,6 +14,7 @@ LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
| ^^^^^^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error[E0119]: conflicting implementations of trait `MyTrait`:
--> $DIR/issue-64494.rs:19:1
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/const-generics/issues/issue-66205.min.stderr
Expand Up @@ -5,7 +5,7 @@ LL | fact::<{ N - 1 }>();
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to previous error

2 changes: 1 addition & 1 deletion src/test/ui/const-generics/issues/issue-68366.min.stderr
Expand Up @@ -5,7 +5,7 @@ LL | impl <const N: usize> Collatz<{Some(N)}> {}
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
--> $DIR/issue-68366.rs:12:13
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/const-generics/issues/issue-68977.min.stderr
Expand Up @@ -5,7 +5,7 @@ LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
| ^^^^^^^^ cannot perform const operation using `INT_BITS`
|
= help: const parameters may only be used as standalone arguments, i.e. `INT_BITS`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: generic parameters may not be used in const operations
--> $DIR/issue-68977.rs:29:28
Expand All @@ -14,7 +14,7 @@ LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
| ^^^^^^^^^ cannot perform const operation using `FRAC_BITS`
|
= help: const parameters may only be used as standalone arguments, i.e. `FRAC_BITS`
= note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this
= note: use #![feature(const_generics)] and #![feature(const_evaluatable_checked)] to allow generic const expressions

error: aborting due to 2 previous errors

0 comments on commit af978e3

Please sign in to comment.