Skip to content

Commit 4994d2a

Browse files
committed
---
yaml --- r: 15720 b: refs/heads/try c: f112963 h: refs/heads/master v: v3
1 parent 514877b commit 4994d2a

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: f4cc5ff226177009cbb7f9d0a9a9bf4264857500
5+
refs/heads/try: f1129635ee5fc595c3638626884e49e6dd9356d9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/middle/typeck.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2738,6 +2738,25 @@ impl methods for lookup {
27382738
self.tcx().sess.span_err(
27392739
self.expr.span,
27402740
"multiple applicable methods in scope");
2741+
2742+
// I would like to print out how each impl was imported,
2743+
// but I cannot for the life of me figure out how to
2744+
// annotate resolve to preserve this information.
2745+
for results.eachi { |i, result|
2746+
let (_, _, did) = result;
2747+
let span = if did.crate == ast::local_crate {
2748+
alt check self.tcx().items.get(did.node) {
2749+
ast_map::node_method(m, _, _) { m.span }
2750+
}
2751+
} else {
2752+
self.expr.span
2753+
};
2754+
self.tcx().sess.span_note(
2755+
span,
2756+
#fmt["candidate #%u is %s",
2757+
(i+1u),
2758+
ty::item_path_str(self.tcx(), did)]);
2759+
}
27412760
}
27422761

27432762
let (self_substs, n_tps, did) = results[0];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
impl methods1 for uint { fn me() -> uint { self } }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
impl methods1 for uint { fn me() -> uint { self } } //! NOTE candidate #1 is methods1::me
2+
impl methods2 for uint { fn me() -> uint { self } } //! NOTE candidate #2 is methods2::me
3+
fn main() { 1u.me(); } //! ERROR multiple applicable methods in scope
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// xfail-fast aux-build
2+
// aux-build:ambig_impl_2_lib.rs
3+
use ambig_impl_2_lib;
4+
import ambig_impl_2_lib::methods1;
5+
impl methods2 for uint { fn me() -> uint { self } } //! NOTE candidate #2 is methods2::me
6+
fn main() { 1u.me(); } //! ERROR multiple applicable methods in scope
7+
//!^ NOTE candidate #1 is ambig_impl_2_lib::methods1::me

0 commit comments

Comments
 (0)