Skip to content

test case for closed bug now causes ICE #5946

Closed
@jbclements

Description

@jbclements

The test case for issue #3979 was xfailed (and didn't parse), but that issue is closed, so I fixed up the syntax and ran it... and now it causes an ICE. I've committed the updated test, but it may be a while before that winds up in incoming, so I'll paste the text of the test here too:

// xfail-test
trait Positioned<S> {
  fn SetX(&mut self, S);
  fn X(&self) -> S;
}

#[allow(default_methods)]
trait Movable<S, T>: Positioned<T> {
  fn translate(&self, dx: T) {
    self.SetX(self.X() + dx);
  }
}

struct Point { x: int, y: int }

impl Positioned<int> for Point {
    fn SetX(&mut self, x: int) {
        self.x = x;
    }
    fn X(&self) -> int {
        self.x
    }
}

impl Movable<int, int> for Point;

pub fn main() {
    let p = Point{ x: 1, y: 2};
    p.translate(3);
    assert!(p.X() == 4);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions