Skip to content

The trait object Foo+Copy implements the trait Copy #32963

Closed
@arielb1

Description

@arielb1

select considers the trait object type Foo+Copy to implement the trait Copy, and therefore its supertraits Clone and Sized. This is totally bogus, as the trait object type is not Sized.

For example:

use std::{fmt, mem};

fn size_of_copy<T: Copy+?Sized>() -> usize { mem::size_of::<T>() }

fn main() {
    println!("{}", size_of_copy::<fmt::Debug+Copy>());
}

This obviously should not compile, but it does (and prints 16, because of the size_of unsized hack).

Metadata

Metadata

Assignees

Labels

I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions