File tree Expand file tree Collapse file tree 5 files changed +31
-1
lines changed Expand file tree Collapse file tree 5 files changed +31
-1
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5
- refs/heads/try: f4cc5ff226177009cbb7f9d0a9a9bf4264857500
5
+ refs/heads/try: f1129635ee5fc595c3638626884e49e6dd9356d9
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
Original file line number Diff line number Diff line change @@ -2738,6 +2738,25 @@ impl methods for lookup {
2738
2738
self . tcx( ) . sess. span_err(
2739
2739
self . expr. span,
2740
2740
"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+1 u) ,
2758
+ ty:: item_path_str( self . tcx( ) , did) ] ) ;
2759
+ }
2741
2760
}
2742
2761
2743
2762
let ( self_substs, n_tps, did) = results[ 0 ] ;
Original file line number Diff line number Diff line change
1
+ impl methods1 for uint { fn me ( ) -> uint { self } }
Original file line number Diff line number Diff line change
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 ( ) { 1 u. me ( ) ; } //! ERROR multiple applicable methods in scope
Original file line number Diff line number Diff line change
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 ( ) { 1 u. me ( ) ; } //! ERROR multiple applicable methods in scope
7
+ //!^ NOTE candidate #1 is ambig_impl_2_lib::methods1::me
You can’t perform that action at this time.
0 commit comments