Also use outermost const-anon for impl items in non_local_defs
lint
This commit is contained in:
parent
2aa26d8a72
commit
b5e91a00c8
3 changed files with 27 additions and 3 deletions
|
@ -301,9 +301,13 @@ fn did_has_local_parent(
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
peel_parent_while(tcx, parent_did, |tcx, did| tcx.def_kind(did) == DefKind::Mod)
|
peel_parent_while(tcx, parent_did, |tcx, did| {
|
||||||
.map(|parent_did| parent_did == impl_parent || Some(parent_did) == outermost_impl_parent)
|
tcx.def_kind(did) == DefKind::Mod
|
||||||
.unwrap_or(false)
|
|| (tcx.def_kind(did) == DefKind::Const
|
||||||
|
&& tcx.opt_item_name(did) == Some(kw::Underscore))
|
||||||
|
})
|
||||||
|
.map(|parent_did| parent_did == impl_parent || Some(parent_did) == outermost_impl_parent)
|
||||||
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given a `DefId` checks if it satisfies `f` if it does check with it's parent and continue
|
/// Given a `DefId` checks if it satisfies `f` if it does check with it's parent and continue
|
||||||
|
|
|
@ -31,4 +31,15 @@ const _: () = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// https://github.com/rust-lang/rust/issues/131643
|
||||||
|
const _: () = {
|
||||||
|
const _: () = {
|
||||||
|
impl tmp::InnerTest {}
|
||||||
|
};
|
||||||
|
|
||||||
|
mod tmp {
|
||||||
|
pub(super) struct InnerTest;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -21,4 +21,13 @@ const _: () = {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// https://github.com/rust-lang/rust/issues/131643
|
||||||
|
const _: () = {
|
||||||
|
const _: () = {
|
||||||
|
impl InnerTest {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct InnerTest;
|
||||||
|
};
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue