Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,12 @@ impl<'a> Resolver<'a> {
if is_exported {
self.external_exports.insert(def.def_id());
}

let kind = match def {
DefStruct(..) | DefTy(..) => ImplModuleKind,
_ => NormalModuleKind
};

match def {
DefMod(def_id) | DefForeignMod(def_id) | DefStruct(def_id) |
DefTy(def_id) => {
Expand All @@ -1617,7 +1623,7 @@ impl<'a> Resolver<'a> {

child_name_bindings.define_module(parent_link,
Some(def_id),
NormalModuleKind,
kind,
true,
is_public,
DUMMY_SP);
Expand Down
10 changes: 10 additions & 0 deletions src/test/auxiliary/use_from_trait_xc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

pub use self::sub::Bar;

pub trait Trait {
fn foo();
}
Expand All @@ -17,3 +19,11 @@ struct Foo;
impl Foo {
pub fn new() {}
}

mod sub {
pub struct Bar;

impl Bar {
pub fn new() {}
}
}
3 changes: 3 additions & 0 deletions src/test/compile-fail/use-from-trait-xc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ use use_from_trait_xc::Trait::foo;
use use_from_trait_xc::Foo::new;
//~^ ERROR unresolved import `use_from_trait_xc::Foo::new`. Cannot import from a trait or type imple

use use_from_trait_xc::Bar::new;
//~^ ERROR unresolved import `use_from_trait_xc::Bar::new`. Cannot import from a trait or type

fn main() {}