Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fold
MethodOrigin
s to resolve inference variables they may contain.
Fixes #17662.
- Loading branch information
Showing
4 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2014 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. | ||
|
||
#![crate_type = "lib"] | ||
|
||
pub trait Foo<'a, T> { | ||
fn foo(&self) -> T; | ||
} | ||
|
||
pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T { | ||
let x: &'a Foo<T> = x; | ||
// ^ the lifetime parameter of Foo is left to be infered. | ||
x.foo() | ||
// ^ encoding this method call in metadata triggers an ICE. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2014 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. | ||
|
||
// aux-build:issue-17662.rs | ||
|
||
extern crate "issue-17662" as i; | ||
|
||
struct Bar<'a>; | ||
|
||
impl<'a> i::Foo<'a, uint> for Bar<'a> { | ||
fn foo(&self) -> uint { 5u } | ||
} | ||
|
||
pub fn main() { | ||
assert_eq!(i::foo(&Bar), 5); | ||
} |
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r+
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from nikomatsakis
at eddyb@79d4540
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging eddyb/rust/method-origin-subst = 79d4540 into auto
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eddyb/rust/method-origin-subst = 79d4540 merged ok, testing candidate = 7f1dbe81
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/1271
exception: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/1623
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/1620
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/1620
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/1617
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/1616
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/1616
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/1620
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/1614
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/1613
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/1616
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1269
exception: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/1273
exception: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/106
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/104
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-c/builds/104
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from nikomatsakis
at eddyb@79d4540
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging eddyb/rust/method-origin-subst = 79d4540 into auto
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eddyb/rust/method-origin-subst = 79d4540 merged ok, testing candidate = ee55a446
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1271
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/1619
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/1618
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/1618
exception: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/1273
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from nikomatsakis
at eddyb@79d4540
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging eddyb/rust/method-origin-subst = 79d4540 into auto
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eddyb/rust/method-origin-subst = 79d4540 merged ok, testing candidate = b419e9e
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/1627
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/1624
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/1618
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/1624
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/1621
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/1620
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/1620
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/1624
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/1618
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/1617
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/1620
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/1275
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1273
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/1277
success: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/110
success: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/108
success: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-c/builds/108
79d4540
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = b419e9e