Skip to content

Autoderef on trait methods in a monomorphized caller doesn't work #3305

Closed
@nikomatsakis

Description

@nikomatsakis

The following crashes:

trait double {
    fn double() -> uint;
}

impl uint: double {
    fn double() -> uint { self * 2u }
}

fn is_equal<D: double>(x: @D, exp: uint) {
    assert x.double() == exp;
}

fn main() {
    let x = @(3u as double);
    is_equal(x, 6);
}

This is because the autoderef code is not being used if the call occurs in a monomorphized context. My trans refactoring should fix this.

Metadata

Metadata

Assignees

Labels

A-codegenArea: Code generationI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions