Skip to content

Implicit trait object coercion doesn't work through arrays #11205

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

Closed
sfackler opened this issue Dec 30, 2013 · 2 comments · Fixed by #15069
Closed

Implicit trait object coercion doesn't work through arrays #11205

sfackler opened this issue Dec 30, 2013 · 2 comments · Fixed by #15069
Labels
A-trait-system Area: Trait system

Comments

@sfackler
Copy link
Member

trait Foo {}

impl Foo for int {}

fn foo(_: &[&Foo]) {}

fn main() {
    foo([&1i, &2i]);
}

fails to compile:

test.rs:8:8: 8:18 error: mismatched types: expected `&[&Foo<no-bounds>]` but found `[&int, .. 2]` (expected trait Foo but found &-ptr)
test.rs:8     foo([&1i, &2i]);
                  ^~~~~~~~~~
error: aborting due to previous error
task 'rustc' failed at 'explicit failure', /Users/sfackler/rust/rust/src/libsyntax/diagnostic.rs:102
task '<main>' failed at 'explicit failure', /Users/sfackler/rust/rust/src/librustc/lib.rs:441

cc @luqmana, @pcwalton

@jeff-davis
Copy link

What does the l-wrong label mean here?

@sfackler
Copy link
Member Author

sfackler commented May 4, 2014

It means that the current behavior of the compiler is incorrect.

@luqmana luqmana changed the title Implicit trait object coercion doesn't work through vectors Implicit trait object coercion doesn't work through arrays Jun 21, 2014
bors added a commit that referenced this issue Jul 2, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 31, 2023
[`inherent_to_string`]: Don't lint `unsafe` or `extern` fns

Fixes rust-lang#11201

changelog: [`inherent_to_string`]: No longer lints `unsafe` or `extern` fns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants