Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make const_generics_defaults not an incomplete feature #85251

Merged
merged 2 commits into from
May 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/rustc_feature/src/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,6 @@ pub const INCOMPLETE_FEATURES: &[Symbol] = &[
sym::repr128,
sym::unsized_locals,
sym::capture_disjoint_fields,
sym::const_generics_defaults,
sym::inherent_associated_types,
sym::type_alias_impl_trait,
sym::native_link_modifiers,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// run-pass
#![feature(const_generics_defaults)]
#![allow(incomplete_features)]
struct Foo<const N: usize, const M: usize = N>([u8; N], [u8; M]);

fn foo<const N: usize>() -> Foo<N> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// run-pass
#![feature(const_generics_defaults)]
#![allow(incomplete_features)]
struct Foo<const N: usize, T = [u8; N]>(T);

impl<const N: usize> Foo<N> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(const_generics_defaults)]
#![allow(incomplete_features)]
struct Foo<const N: u8 = { 255 + 1 }>;
//~^ ERROR evaluation of constant value failed
fn main() {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
--> $DIR/default-param-wf-concrete.rs:3:28
--> $DIR/default-param-wf-concrete.rs:2:28
|
LL | struct Foo<const N: u8 = { 255 + 1 }>;
| ^^^^^^^ attempt to compute `u8::MAX + 1_u8`, which would overflow
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/defaults/pretty-printing-ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#![crate_type = "lib"]
#![feature(const_generics_defaults)]
#![allow(incomplete_features)]

trait Foo<const KIND: bool = true> {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#![crate_type = "lib"]
#![feature(const_generics_defaults)]
#![allow(incomplete_features)]
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/const-generics/defaults/repr-c-issue-82792.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// run-pass

#![feature(const_generics_defaults)]
#![allow(incomplete_features)]

#[repr(C)]
pub struct Loaf<T: Sized, const N: usize = 1> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![crate_type = "lib"]
#![feature(const_generics_defaults)]
#![allow(incomplete_features)]

fn foo<const SIZE: usize = 5usize>() {}
//~^ ERROR defaults for const parameters are
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
--> $DIR/default_function_param.rs:5:14
--> $DIR/default_function_param.rs:4:14
|
LL | fn foo<const SIZE: usize = 5usize>() {}
| ^^^^
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/derives/derive-macro-const-default.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// check-pass
#![allow(incomplete_features)]
#![feature(const_generics_defaults)]

#[derive(Clone, PartialEq, Debug)]
Expand Down