Closed
Description
The following variation on default-method-simple dies with an ICE:
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(default_methods)];
fn boop<'a, T>(x: &'a T) -> &'a T { x }
trait Foo {
fn f(&self) {
io::println("Hello!");
boop(self).g();
}
fn g(&self);
}
struct A {
x: int
}
impl Foo for A {
fn g(&self) {
io::println("Goodbye!");
}
}
pub fn main() {
let a = A { x: 1 };
a.f();
}
the reason for this is that the call to boop
requires an auto-ref, and when we evaluate a def_self
we get back ty_self
, which never gets substititued. I have some theories on how best to fix this :) but for now I am just tagging it and adding some workarounds to the patch on the borrow checker (search for FIXMEs)