diff options
| author | bors <bors@rust-lang.org> | 2013-06-03 15:40:29 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-06-03 15:40:29 -0700 |
| commit | 13aa18891c0615f8db193ae61e80fa16f567afd1 (patch) | |
| tree | b1ee5a5b304b10209f443a6de520ab101ee34603 | |
| parent | 846545a6e19745dddcbefb1e690a63eea15a0884 (diff) | |
| parent | 394ac1aae4d8b23b65a2165b2cf00c66936cd437 (diff) | |
| download | rust-13aa18891c0615f8db193ae61e80fa16f567afd1.tar.gz rust-13aa18891c0615f8db193ae61e80fa16f567afd1.zip | |
auto merge of #6910 : Blei/rust/fix-6698, r=pcwalton
Fixes #6698
| -rw-r--r-- | src/librustc/middle/resolve.rs | 25 | ||||
| -rw-r--r-- | src/test/compile-fail/call-extern-trait-as-function.rs | 17 |
2 files changed, 39 insertions, 3 deletions
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index a1eb0726c3d..db98407cc55 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -4595,7 +4595,7 @@ impl Resolver { } let name = *path.idents.last(); - match self.resolve_definition_of_name_in_module(containing_module, + let def = match self.resolve_definition_of_name_in_module(containing_module, name, namespace, xray) { @@ -4604,9 +4604,28 @@ impl Resolver { return None; } ChildNameDefinition(def) | ImportNameDefinition(def) => { - return Some(def); + def } - } + }; + match containing_module.kind { + TraitModuleKind | ImplModuleKind => { + match self.method_map.find(&name) { + Some(s) => { + match containing_module.def_id { + Some(def_id) if s.contains(&def_id) => { + debug!("containing module was a trait or impl \ + and name was a method -> not resolved"); + return None; + }, + _ => (), + } + }, + None => (), + } + }, + _ => (), + }; + return Some(def); } /// Invariant: This must be called only during main resolution, not during diff --git a/src/test/compile-fail/call-extern-trait-as-function.rs b/src/test/compile-fail/call-extern-trait-as-function.rs new file mode 100644 index 00000000000..86ebeedda67 --- /dev/null +++ b/src/test/compile-fail/call-extern-trait-as-function.rs @@ -0,0 +1,17 @@ +// Copyright 2013 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. + +// issue #6698 + +fn V() -> bool { + std::clone::Clone::clone(true) //~ ERROR error: unresolved name `std::clone::Clone::clone`. +} + +fn main() {} |
