Skip to content

compile error with BoxAny::downcast::<str> #20545

@mandel59

Description

@mandel59
use std::any::Any;
use std::boxed::BoxAny;

fn main() {
    let x: Box<Any> = box "rust";
    match x.downcast::<str>() {
        Ok(s) => println!("str: {}", s),
        Err(x) => println!("{}", x)
    }
}

on rustc 0.13.0-dev (260e46115 2015-01-04 16:36:41 +0000) this yields:

issue.rs:6:13: 6:30 error: the trait `core::kinds::Sized` is not implemented for the type `str`
issue.rs:6     match x.downcast::<str>() {
                       ^~~~~~~~~~~~~~~~~
error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions