diff options
| author | bors <bors@rust-lang.org> | 2019-09-15 20:06:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-09-15 20:06:49 +0000 |
| commit | 06c94ee79b7baa8bebd039a019ce6adb5ea6a24f (patch) | |
| tree | f01be2bf8919ec224ce79a891326534a3048f0fd /src/librustc | |
| parent | 96d07e0ac9f0c56b95a2561c6cedac0b23a5d2a3 (diff) | |
| parent | 0592d137574189e500438aa300da64f0b1089a60 (diff) | |
| download | rust-06c94ee79b7baa8bebd039a019ce6adb5ea6a24f.tar.gz rust-06c94ee79b7baa8bebd039a019ce6adb5ea6a24f.zip | |
Auto merge of #64491 - Centril:rollup-21wkl69, r=Centril
Rollup of 3 pull requests Successful merges: - #63872 (Document platform-specific behavior of the iterator returned by std::fs::read_dir) - #64250 (save-analysis: Nest typeck tables when processing functions/methods) - #64472 (Don't mark expression with attributes as not needing parentheses) Failed merges: r? @ghost
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/ty/context.rs | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 25d921b7cea..0155803e305 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -205,26 +205,24 @@ pub struct LocalTableInContext<'a, V> { fn validate_hir_id_for_typeck_tables(local_id_root: Option<DefId>, hir_id: hir::HirId, mut_access: bool) { - if cfg!(debug_assertions) { - if let Some(local_id_root) = local_id_root { - if hir_id.owner != local_id_root.index { - ty::tls::with(|tcx| { - bug!("node {} with HirId::owner {:?} cannot be placed in \ - TypeckTables with local_id_root {:?}", - tcx.hir().node_to_string(hir_id), - DefId::local(hir_id.owner), - local_id_root) - }); - } - } else { - // We use "Null Object" TypeckTables in some of the analysis passes. - // These are just expected to be empty and their `local_id_root` is - // `None`. Therefore we cannot verify whether a given `HirId` would - // be a valid key for the given table. Instead we make sure that - // nobody tries to write to such a Null Object table. - if mut_access { - bug!("access to invalid TypeckTables") - } + if let Some(local_id_root) = local_id_root { + if hir_id.owner != local_id_root.index { + ty::tls::with(|tcx| { + bug!("node {} with HirId::owner {:?} cannot be placed in \ + TypeckTables with local_id_root {:?}", + tcx.hir().node_to_string(hir_id), + DefId::local(hir_id.owner), + local_id_root) + }); + } + } else { + // We use "Null Object" TypeckTables in some of the analysis passes. + // These are just expected to be empty and their `local_id_root` is + // `None`. Therefore we cannot verify whether a given `HirId` would + // be a valid key for the given table. Instead we make sure that + // nobody tries to write to such a Null Object table. + if mut_access { + bug!("access to invalid TypeckTables") } } } |
