Skip to content

Commit

Permalink
Forbid !Sized types and references
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxyUwU committed Jul 17, 2024
1 parent f431b51 commit 857ed93
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions core/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,13 +995,22 @@ marker_impls! {
isize, i8, i16, i32, i64, i128,
bool,
char,
str /* Technically requires `[u8]: ConstParamTy` */,
(),
{T: ConstParamTy, const N: usize} [T; N],
{T: ConstParamTy} [T],
{T: ?Sized + ConstParamTy} &T,
}

#[unstable(feature = "adt_const_params", issue = "95174")]
#[rustc_reservation_impl = "types that are not `Sized` are not supported as the type of a const generic parameter"]
impl<T> ConstParamTy for [T] {}

#[unstable(feature = "adt_const_params", issue = "95174")]
#[rustc_reservation_impl = "types that are not `Sized` are not supported as the type of a const generic parameter"]
impl ConstParamTy for str {}

#[unstable(feature = "adt_const_params", issue = "95174")]
#[rustc_reservation_impl = "references are not supported as the type of a const generic parameter"]
impl<T: ?Sized> ConstParamTy for &T {}

/// A common trait implemented by all function pointers.
#[unstable(
feature = "fn_ptr_trait",
Expand Down

0 comments on commit 857ed93

Please sign in to comment.