Skip to content

Trait object coercions do not distribute over pattern bindings #9951

Closed
@Kimundi

Description

@Kimundi

This works:

trait Bar{} 
impl Bar for uint {}; 
let (a, b) = (~5u as ~Bar, ~9u as ~Bar); 

let c: &Bar = a; 
let d: &Bar = b; 

This doesn't:

trait Bar{} 
impl Bar for uint {}

fn main() {
    let (a, b) = (~5u as ~Bar, ~9u as ~Bar); 
    let (c, d): (&Bar, &Bar) = (a, b);
}


error: mismatched types: expected `(&main::Bar<no-bounds>,&main::Bar<no-bounds>)` but found `(~main::Bar:Send,~main::Bar:Send)` (trait storage differs: expected & but found ~)

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions