Skip to content

Commit b918903

Browse files
committed
---
yaml --- r: 81383 b: refs/heads/snap-stage3 c: e44b40c h: refs/heads/master i: 81381: e8a498a 81379: 8a31936 81375: ca7defd v: v3
1 parent ce24505 commit b918903

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: fa411500f969be6131aee62e3885460f90c150bb
4+
refs/heads/snap-stage3: e44b40ca3a1e8e53b485476e7329a0d8e553d29c
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/typeck/check/method.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,13 @@ impl<'self> LookupContext<'self> {
12881288
fn report_candidate(&self, idx: uint, origin: &method_origin) {
12891289
match *origin {
12901290
method_static(impl_did) => {
1291-
self.report_static_candidate(idx, impl_did)
1291+
// If it is an instantiated default method, use the original
1292+
// default method for error reporting.
1293+
let did = match provided_source(self.tcx(), impl_did) {
1294+
None => impl_did,
1295+
Some(did) => did
1296+
};
1297+
self.report_static_candidate(idx, did)
12921298
}
12931299
method_param(ref mp) => {
12941300
self.report_param_candidate(idx, (*mp).trait_id)
@@ -1302,7 +1308,8 @@ impl<'self> LookupContext<'self> {
13021308
fn report_static_candidate(&self, idx: uint, did: DefId) {
13031309
let span = if did.crate == ast::LOCAL_CRATE {
13041310
match self.tcx().items.find(&did.node) {
1305-
Some(&ast_map::node_method(m, _, _)) => m.span,
1311+
Some(&ast_map::node_method(m, _, _))
1312+
| Some(&ast_map::node_trait_method(@ast::provided(m), _, _)) => m.span,
13061313
_ => fail2!("report_static_candidate: bad item {:?}", did)
13071314
}
13081315
} else {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
trait Foo { fn method(&self) {} } //~ NOTE `Foo::method`
12+
trait Bar { fn method(&self) {} } //~ NOTE `Bar::method`
13+
14+
impl Foo for uint {}
15+
impl Bar for uint {}
16+
17+
fn main() {
18+
1u.method(); //~ ERROR multiple applicable methods in scope
19+
}

0 commit comments

Comments
 (0)