Auto merge of #28406 - petrochenkov:primitive, r=eddyb
This was missing from https://github.com/rust-lang/rust/pull/27451 r? @eddyb
This commit is contained in:
commit
7161530fc4
@ -2211,13 +2211,27 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
|
||||
ItemUse(ref view_path) => {
|
||||
// check for imports shadowing primitive types
|
||||
if let hir::ViewPathSimple(ident, _) = view_path.node {
|
||||
match self.def_map.borrow().get(&item.id).map(|d| d.full_def()) {
|
||||
let check_rename = |id, ident: Ident| {
|
||||
match self.def_map.borrow().get(&id).map(|d| d.full_def()) {
|
||||
Some(DefTy(..)) | Some(DefStruct(..)) | Some(DefTrait(..)) | None => {
|
||||
self.check_if_primitive_type_name(ident.name, item.span);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
};
|
||||
|
||||
match view_path.node {
|
||||
hir::ViewPathSimple(ident, _) => {
|
||||
check_rename(item.id, ident);
|
||||
}
|
||||
hir::ViewPathList(_, ref items) => {
|
||||
for item in items {
|
||||
if let Some(ident) = item.node.rename() {
|
||||
check_rename(item.node.id(), ident);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,8 @@ mod char {
|
||||
//~^ ERROR user-defined types or type parameters cannot shadow the primitive types
|
||||
use super::bool_ as bool;
|
||||
//~^ ERROR user-defined types or type parameters cannot shadow the primitive types
|
||||
use super::{bool_ as str};
|
||||
//~^ ERROR user-defined types or type parameters cannot shadow the primitive types
|
||||
use super::char_ as char;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user