mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-21 03:14:11 +00:00
Rollup merge of #85251 - BoxyUwU:constparamdefaultsany%, r=lcnr
Make `const_generics_defaults` not an incomplete feature r? `@lcnr`
This commit is contained in:
commit
aa10380f3b
@ -698,7 +698,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,
|
||||
|
@ -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> {
|
||||
|
@ -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> {
|
||||
|
@ -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() {}
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(const_generics_defaults)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
trait Foo<const KIND: bool = true> {}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#![feature(const_generics_defaults)]
|
||||
#![allow(incomplete_features)]
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
#[macro_use]
|
||||
|
@ -3,7 +3,6 @@
|
||||
// run-pass
|
||||
|
||||
#![feature(const_generics_defaults)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
#[repr(C)]
|
||||
pub struct Loaf<T: Sized, const N: usize = 1> {
|
||||
|
@ -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
|
||||
|
@ -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>() {}
|
||||
| ^^^^
|
||||
|
@ -1,5 +1,4 @@
|
||||
// check-pass
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(const_generics_defaults)]
|
||||
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
|
Loading…
Reference in New Issue
Block a user