mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Check that trait_map is not moved twice.
This commit is contained in:
parent
273778086c
commit
c11691b460
@ -910,6 +910,8 @@ pub struct Resolver<'a> {
|
||||
extern_crate_map: FxHashMap<LocalDefId, CrateNum>,
|
||||
export_map: ExportMap<LocalDefId>,
|
||||
trait_map: NodeMap<Vec<TraitCandidate>>,
|
||||
#[cfg(debug_assertions)]
|
||||
took_trait_map: bool,
|
||||
|
||||
/// A map from nodes to anonymous modules.
|
||||
/// Anonymous modules are pseudo-modules that are implicitly created around items
|
||||
@ -1139,6 +1141,11 @@ impl ResolverAstLowering for Resolver<'_> {
|
||||
}
|
||||
|
||||
fn trait_map(&mut self) -> NodeMap<Vec<TraitCandidate>> {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
debug_assert!(!self.took_trait_map);
|
||||
self.took_trait_map = true;
|
||||
}
|
||||
std::mem::take(&mut self.trait_map)
|
||||
}
|
||||
|
||||
@ -1287,6 +1294,8 @@ impl<'a> Resolver<'a> {
|
||||
extern_crate_map: Default::default(),
|
||||
export_map: FxHashMap::default(),
|
||||
trait_map: Default::default(),
|
||||
#[cfg(debug_assertions)]
|
||||
took_trait_map: false,
|
||||
underscore_disambiguator: 0,
|
||||
empty_module,
|
||||
module_map,
|
||||
|
Loading…
Reference in New Issue
Block a user