-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.F-impl_trait_in_bindings`#![feature(impl_trait_in_bindings)]``#![feature(impl_trait_in_bindings)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
I expected impl …
-in-binding to get elaborated to impl Sized + …
unless …
contains ?Sized
because that's what we do for all other kinds of impl-Trait (APIT, RPIT(IT), TAIT, ATPIT). However, we don't seem to do that right now.
I expected the code below to fail but it compiled successfully:
#![feature(impl_trait_in_bindings)]
fn main() {
let _: &impl std::fmt::Debug = &[0u8][..];
}
The &impl std::fmt::Debug
above should actually elaborate to &(impl std::fmt::Debug + Sized)
and therefore the code should fail due to an unfulfilled [u8]: Sized
obligation/goal.
As in other places, users need to actually write &(impl std::fmt::Debug + ?Sized)
if they want the code above to work like on master.
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.F-impl_trait_in_bindings`#![feature(impl_trait_in_bindings)]``#![feature(impl_trait_in_bindings)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.