Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Rollup const generics-related PRs #601

Merged
merged 46 commits into from
Dec 30, 2020

Conversation

JohnTitor
Copy link
Member

@JohnTitor JohnTitor commented Dec 30, 2020

Closes #572
Closes #573
Closes #574
Closes #575
Closes #576
Closes #577
Closes #578
Closes #579
Closes #580
Closes #581
Closes #582
Closes #583
Closes #584
Closes #585
Closes #586
Closes #587
Closes #588
Closes #589
Closes #590
Closes #591
Closes #592
Closes #593
Closes #594
Closes #595
Closes #596

rustbot and others added 30 commits December 28, 2020 12:25
=== stdout ===
=== stderr ===
error[E0601]: `main` function not found in crate `46511`
 --> /home/runner/work/glacier/glacier/ices/46511.rs:1:1
  |
1 | / struct Foo<'a>
2 | | {
3 | |     a: [u8; std::mem::size_of::<&'a mut u8>()]
4 | | }
  | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/46511.rs`

error[E0658]: a non-static lifetime is not allowed in a `const`
 --> /home/runner/work/glacier/glacier/ices/46511.rs:3:34
  |
3 |     a: [u8; std::mem::size_of::<&'a mut u8>()]
  |                                  ^^
  |
  = note: see issue #44580 <rust-lang/rust#44580> for more information
  = help: add `#![feature(const_generics)]` to the crate attributes to enable

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0601, E0658.
For more information about an error, try `rustc --explain E0601`.
==============
=== stdout ===
=== stderr ===
error: generic `Self` types are currently not permitted in anonymous constants
 --> /home/runner/work/glacier/glacier/ices/47814.rs:8:32
  |
8 |     pub fn to_buffer() -> [u8; Self::LENGTH] {
  |                                ^^^^^^^^^^^^
  |
note: not a concrete type
 --> /home/runner/work/glacier/glacier/ices/47814.rs:5:10
  |
5 | impl<'a> ArpIPv4<'a> {
  |          ^^^^^^^^^^^

error: aborting due to previous error

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
  --> /home/runner/work/glacier/glacier/ices/51892.rs:12:41
   |
12 |   type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
   |                                         ^ cannot perform const operation using `T`
   |
   = note: type parameters may not be used in const expressions
   = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /home/runner/work/glacier/glacier/ices/51892.rs:1:12
  |
1 | #![feature(specialization)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #31844 <rust-lang/rust#31844> for more information
  = help: consider using `min_specialization` instead, which is more stable and complete

error[E0601]: `main` function not found in crate `51892`
  --> /home/runner/work/glacier/glacier/ices/51892.rs:1:1
   |
1  | / #![feature(specialization)]
2  | |
3  | | pub trait Trait {
4  | |   type Type;
...  |
12 | |   type Type = [u8; std::mem::size_of::<<T as Trait>::Type>()];
13 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/51892.rs`

error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0601`.
==============
=== stdout ===
=== stderr ===
error: generic `Self` types are currently not permitted in anonymous constants
 --> /home/runner/work/glacier/glacier/ices/52808.rs:6:20
  |
6 |     fn foo(_: [u8; Self::X]) {}
  |                    ^^^^^^^
  |
note: not a concrete type
 --> /home/runner/work/glacier/glacier/ices/52808.rs:3:10
  |
3 | impl<'a> Foo<'a> {
  |          ^^^^^^^

error: aborting due to previous error

==============
=== stdout ===
=== stderr ===
error[E0601]: `main` function not found in crate `54038`
  --> /home/runner/work/glacier/glacier/ices/54038.rs:1:1
   |
1  | / struct Foo<'a> {
2  | |     data: &'a [u8],
3  | | }
4  | |
...  |
9  | |     }
10 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/54038.rs`

error: generic `Self` types are currently not permitted in anonymous constants
 --> /home/runner/work/glacier/glacier/ices/54038.rs:7:27
  |
7 |     fn bar(buf: &mut [u8; Self::LEN]) {
  |                           ^^^^^^^^^
  |
note: not a concrete type
 --> /home/runner/work/glacier/glacier/ices/54038.rs:5:10
  |
5 | impl<'a> Foo<'a> {
  |          ^^^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0601`.
==============
=== stdout ===
=== stderr ===
error: generic `Self` types are currently not permitted in anonymous constants
 --> /home/runner/work/glacier/glacier/ices/56445-1.rs:6:38
  |
6 |     fn lfn_contents(&self) -> [char; Self::LFN_FRAGMENT_LEN] { loop { } }
  |                                      ^^^^^^^^^^^^^^^^^^^^^^
  |
note: not a concrete type
 --> /home/runner/work/glacier/glacier/ices/56445-1.rs:3:10
  |
3 | impl<'a> OnDiskDirEntry<'a> {
  |          ^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

==============
=== stdout ===
=== stderr ===
error: generic `Self` types are currently not permitted in anonymous constants
 --> /home/runner/work/glacier/glacier/ices/56445-3.rs:5:15
  |
5 |     ram: [u8; Self::SIZE],
  |               ^^^^^^^^^^

error: aborting due to previous error

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
  --> /home/runner/work/glacier/glacier/ices/57739.rs:11:17
   |
11 |     array: [u8; T::SIZE],
   |                 ^^^^^^^ cannot perform const operation using `T`
   |
   = note: type parameters may not be used in const expressions
   = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: aborting due to previous error

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/58987-4.rs:2:16
  |
2 |     inner: [T; R * C]
  |                ^ cannot perform const operation using `R`
  |
  = help: const parameters may only be used as standalone arguments, i.e. `R`
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/58987-4.rs:2:20
  |
2 |     inner: [T; R * C]
  |                    ^ cannot perform const operation using `C`
  |
  = help: const parameters may only be used as standalone arguments, i.e. `C`
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: aborting due to 2 previous errors

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/60619.rs:2:16
  |
2 |     buf: [u8; {LEN * 2}]
  |                ^^^ cannot perform const operation using `LEN`
  |
  = help: const parameters may only be used as standalone arguments, i.e. `LEN`
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

warning: unnecessary braces around const expression
 --> /home/runner/work/glacier/glacier/ices/60619.rs:2:15
  |
2 |     buf: [u8; {LEN * 2}]
  |               ^^^^^^^^^ help: remove these braces
  |
  = note: `#[warn(unused_braces)]` on by default

error: aborting due to previous error; 1 warning emitted

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/62708.rs:2:52
  |
2 |     d: [std::marker::PhantomData<D>; MultiDriver::<D>::MAX_DRIVERS],
  |                                                    ^ cannot perform const operation using `D`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error[E0601]: `main` function not found in crate `62708`
 --> /home/runner/work/glacier/glacier/ices/62708.rs:1:1
  |
1 | / pub struct MultiDriver<D: ?Sized> {
2 | |     d: [std::marker::PhantomData<D>; MultiDriver::<D>::MAX_DRIVERS],
3 | | }
4 | |
5 | | impl<D: ?Sized> MultiDriver<D> {
6 | |     const MAX_DRIVERS: usize = 10;
7 | | }
  | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/62708.rs`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0601`.
==============
=== stdout ===
=== stderr ===
error: generic `Self` types are currently not permitted in anonymous constants
 --> /home/runner/work/glacier/glacier/ices/64173.rs:4:28
  |
4 |     array: [(); size_of::<&Self>()],
  |                            ^^^^

error[E0392]: parameter `'s` is never used
 --> /home/runner/work/glacier/glacier/ices/64173.rs:3:12
  |
3 | struct Bug<'s> {
  |            ^^ unused parameter
  |
  = help: consider removing `'s`, referring to it in a field, or using a marker such as `PhantomData`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0392`.
==============
=== stdout ===
=== stderr ===
error[E0658]: a non-static lifetime is not allowed in a `const`
 --> /home/runner/work/glacier/glacier/ices/66152.rs:6:23
  |
6 |     beta: [(); foo::<&'a ()>()],
  |                       ^^
  |
  = note: see issue #44580 <rust-lang/rust#44580> for more information
  = help: add `#![feature(const_generics)]` to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/67375.rs:2:25
  |
2 |     inner: [(); { [|_: &T| {}; 0].len() }],
  |                         ^ cannot perform const operation using `T`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

warning: unnecessary braces around const expression
 --> /home/runner/work/glacier/glacier/ices/67375.rs:2:17
  |
2 |     inner: [(); { [|_: &T| {}; 0].len() }],
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these braces
  |
  = note: `#[warn(unused_braces)]` on by default

error[E0392]: parameter `T` is never used
 --> /home/runner/work/glacier/glacier/ices/67375.rs:1:12
  |
1 | struct Bug<T> {
  |            ^ unused parameter
  |
  = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`

error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0392`.
==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:8:16
  |
8 |         let x: S = MaybeUninit::uninit();
  |                ^ cannot perform const operation using `S`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:9:45
  |
9 |         let b = &*(&x as *const _ as *const S);
  |                                             ^ cannot perform const operation using `S`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

warning: unused import: `std::marker::PhantomData`
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:2:5
  |
2 | use std::marker::PhantomData;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `self`
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:4:16
  |
4 | use std::mem::{self, MaybeUninit};
  |                ^^^^

error[E0601]: `main` function not found in crate `67945_1`
  --> /home/runner/work/glacier/glacier/ices/67945-1.rs:2:1
   |
2  | / use std::marker::PhantomData;
3  | |
4  | | use std::mem::{self, MaybeUninit};
5  | |
...  |
11 | |     }],
12 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/67945-1.rs`

error[E0392]: parameter `S` is never used
 --> /home/runner/work/glacier/glacier/ices/67945-1.rs:6:12
  |
6 | struct Bug<S> {
  |            ^ unused parameter
  |
  = help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData`

error: aborting due to 4 previous errors; 2 warnings emitted

Some errors have detailed explanations: E0392, E0601.
For more information about an error, try `rustc --explain E0392`.
==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/67945-4.rs:8:27
  |
8 |         let x: Option<Box<S>> = None;
  |                           ^ cannot perform const operation using `S`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

warning: unused import: `std::marker::PhantomData`
 --> /home/runner/work/glacier/glacier/ices/67945-4.rs:2:5
  |
2 | use std::marker::PhantomData;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused imports: `MaybeUninit`, `self`
 --> /home/runner/work/glacier/glacier/ices/67945-4.rs:4:16
  |
4 | use std::mem::{self, MaybeUninit};
  |                ^^^^  ^^^^^^^^^^^

error[E0601]: `main` function not found in crate `67945_4`
  --> /home/runner/work/glacier/glacier/ices/67945-4.rs:2:1
   |
2  | / use std::marker::PhantomData;
3  | |
4  | | use std::mem::{self, MaybeUninit};
5  | |
...  |
10 | |     }],
11 | | }
   | |_^ consider adding a `main` function to `/home/runner/work/glacier/glacier/ices/67945-4.rs`

error[E0392]: parameter `S` is never used
 --> /home/runner/work/glacier/glacier/ices/67945-4.rs:6:12
  |
6 | struct Bug<S> {
  |            ^ unused parameter
  |
  = help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData`

error: aborting due to 3 previous errors; 2 warnings emitted

Some errors have detailed explanations: E0392, E0601.
For more information about an error, try `rustc --explain E0392`.
==============
=== stdout ===
=== stderr ===
error: generic `Self` types are currently not permitted in anonymous constants
 --> /home/runner/work/glacier/glacier/ices/68875.rs:2:20
  |
2 |     data: &'a [u8; Self::SIZE],
  |                    ^^^^^^^^^^

error: aborting due to previous error

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/69296.rs:4:50
  |
4 |     let mut parts: [*mut u8; mem::size_of::<*mut T>() / mem::size_of::<*mut u8>()] =
  |                                                  ^ cannot perform const operation using `T`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: aborting due to previous error

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/69913.rs:1:53
  |
1 | 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`
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/69913.rs:1:57
  |
1 | 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`
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: aborting due to 2 previous errors

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
  --> /home/runner/work/glacier/glacier/ices/71202.rs:24:17
   |
24 |         <IsCopy<T>>::VALUE
   |                 ^ cannot perform const operation using `T`
   |
   = note: type parameters may not be used in const expressions
   = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: aborting due to previous error

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/71922.rs:2:39
  |
2 | 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`
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/71922.rs:3:13
  |
3 |     [0; foo(N)]
  |             ^ cannot perform const operation using `N`
  |
  = help: const parameters may only be used as standalone arguments, i.e. `N`
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: aborting due to 2 previous errors

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
 --> /home/runner/work/glacier/glacier/ices/73980.rs:8:21
  |
8 | impl<T> X<T,[u8;L::<T>::S]> {}
  |                     ^ cannot perform const operation using `T`
  |
  = note: type parameters may not be used in const expressions
  = help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions

error: aborting due to previous error

==============
=== stdout ===
=== stderr ===
error: generic parameters may not be used in const operations
  --> /home/runner/work/glacier/glacier/ices/75153.rs:11:24
   |
11 |     pad: [u8; is_zst::<T>()],
   |                        ^ cannot perform const operation using `T`
   |
   = note: type parameters may not be used in const expressions
   = help: 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
  --> /home/runner/work/glacier/glacier/ices/75153.rs:10:12
   |
9  | pub struct AtLeastByte<T: ?Sized> {
   |                        - this type parameter needs to be `Sized`
10 |     value: T,
   |            ^ doesn't have a size known at compile-time
   |
   = note: only the last field of a struct may have a dynamically sized type
   = help: change the field's type to have a statically known size
help: borrowed types always have a statically known size
   |
10 |     value: &T,
   |            ^
help: the `Box` type always has a statically known size and allocates its contents in the heap
   |
10 |     value: Box<T>,
   |            ^^^^ ^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
==============
@JohnTitor JohnTitor merged commit c3fd058 into rust-lang:master Dec 30, 2020
@JohnTitor JohnTitor deleted the rollup-const-generics branch December 30, 2020 12:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants