A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rust-lang/rust/issues/100041 below:

Normalization can skip WF · Issue #100041 · rust-lang/rust · GitHub

I tried this code: [playground]

trait WellUnformed {
    type RequestNormalize;
}

impl<T: ?Sized> WellUnformed for T {
    type RequestNormalize = ();
}

const _: <[[[[[[u8]]]]]] as WellUnformed>::RequestNormalize = ();
const _: <Vec<str> as WellUnformed>::RequestNormalize = ();

I expected this to error; [[[[[[u8]]]]]] is clearly not a well-formed type, as

error[E0277]: the size for values of type [u8] cannot be known at compilation time
= help: the trait Sized is not implemented for [u8]
= note: slice and array elements must have Sized type

Vec<str> is perhaps even more cursed.

Instead: it compiles.

This is especially relevant for blanket/builtin traits which have associated types, such as marker::DiscriminantKind and ptr::Pointee.

Meta

1.64.0-nightly (2022-07-31 f9cba63)

@rustbot label +A-associated-items

cc @eddyb who said this was
@rustbot label +I-unsound

Noratriebjyn514 and fmease


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4