diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 6fa33f4b5aa03..cb437e08e17ba 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -1417,12 +1417,27 @@ impl<'a> Resolver<'a> { } } } - _ => { - self.resolve_error(ty.span, - "inherent implementations may \ - only be implemented in the same \ - module as the type they are \ - implemented for") + _ => for impl_item in impl_items.iter() { + // Forbid static methods and associated items. + match *impl_item { + MethodImplItem(ref method) => { + match method.pe_explicit_self().node { + SelfStatic => { + self.resolve_error(method.span, + "inherent implementations in a different \ + module than the type they are implemented \ + for may not contain static methods") + } + _ => {} + } + } + TypeImplItem(ref typedef) => { + self.resolve_error(typedef.span, + "inherent implementations in a different \ + module than the type they are implemented \ + for may not contain associated items") + } + } } }