diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-06-25 18:18:13 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-06-28 11:18:37 -0700 |
| commit | 05e3248a7974f55b64f75a2483b37ff8c001a4ff (patch) | |
| tree | 3f14354a9760db8ab30399f615fda91c6b8f2f7e /src/test/compile-fail/refutable-pattern-errors.rs | |
| parent | afdfe40aa0b7dfc7800dddbc1f55da979abfe486 (diff) | |
| download | rust-05e3248a7974f55b64f75a2483b37ff8c001a4ff.tar.gz rust-05e3248a7974f55b64f75a2483b37ff8c001a4ff.zip | |
librustc: Match trait self types exactly.
This can break code that looked like:
impl Foo for Box<Any> {
fn f(&self) { ... }
}
let x: Box<Any + Send> = ...;
x.f();
Change such code to:
impl Foo for Box<Any> {
fn f(&self) { ... }
}
let x: Box<Any> = ...;
x.f();
That is, upcast before calling methods.
This is a conservative solution to #5781. A more proper treatment (see
the xfail'd `trait-contravariant-self.rs`) would take variance into
account. This change fixes the soundness hole.
Some library changes had to be made to make this work. In particular,
`Box<Any>` is no longer showable, and only `Box<Any+Send>` is showable.
Eventually, this restriction can be lifted; for now, it does not prove
too onerous, because `Any` is only used for propagating the result of
task failure.
This patch also adds a test for the variance inference work in #12828,
which accidentally landed as part of DST.
Closes #5781.
[breaking-change]
Diffstat (limited to 'src/test/compile-fail/refutable-pattern-errors.rs')
0 files changed, 0 insertions, 0 deletions
