Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods that return unsized types can be (uselessly) codegened #26376

Open
arielb1 opened this Issue Jun 17, 2015 · 3 comments

Comments

Projects
None yet
6 participants
@arielb1
Copy link
Contributor

arielb1 commented Jun 17, 2015

trait Foo {
    fn foo(&self) -> [u8];
}

fn foo(f: Option<&Foo>) {
    if let Some(f) = f {
        let _ = f.foo();
    }
}

fn main() { foo(None) }

This does generate code that calls foo in the vtable, but is not particularly useful.

cc @nikomatsakis

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Jan 12, 2017

Still a problem?

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Jan 12, 2017

It's still true, but I'm not especially worried about it.

@durka

This comment has been minimized.

Copy link
Contributor

durka commented Aug 29, 2018

Isn't it a bug that you can declare such a trait at all? There's no way to implement it, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.