mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 19:53:46 +00:00
Forbid use Trait::*
This commit is contained in:
parent
e2171bff75
commit
1a6092e05c
@ -586,6 +586,10 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
|
||||
target_module: Module<'b>,
|
||||
directive: &'b ImportDirective)
|
||||
-> ResolveResult<()> {
|
||||
if let Some(Def::Trait(_)) = target_module.def {
|
||||
self.resolver.session.span_err(directive.span, "items in traits are not importable.");
|
||||
}
|
||||
|
||||
if module_.def_id() == target_module.def_id() {
|
||||
// This means we are trying to glob import a module into itself, and it is a no-go
|
||||
let msg = "Cannot glob-import a module into itself.".into();
|
||||
|
@ -12,4 +12,7 @@ type Alias = ();
|
||||
use Alias::*; //~ ERROR Not a module
|
||||
use std::io::Result::*; //~ ERROR Not a module
|
||||
|
||||
trait T {}
|
||||
use T::*; //~ ERROR items in traits are not importable
|
||||
|
||||
fn main() {}
|
||||
|
Loading…
Reference in New Issue
Block a user