Auto merge of #44878 - Nashenas88:master, r=nikomatsakis

Store a new Region value every time we create a new region variable

Paired with @spastorino to walk through this and implement #44870.
This commit is contained in:
bors 2017-10-05 17:14:12 +00:00
commit 4531131bf3
10 changed files with 62 additions and 59 deletions

View file

@ -406,7 +406,7 @@ impl DepGraph {
for (current_dep_node_index, edges) in current_dep_graph.edges.iter_enumerated() {
let start = edge_list_data.len() as u32;
// This should really just be a memcpy :/
edge_list_data.extend(edges.iter().map(|i| SerializedDepNodeIndex(i.index)));
edge_list_data.extend(edges.iter().map(|i| SerializedDepNodeIndex::new(i.index())));
let end = edge_list_data.len() as u32;
debug_assert_eq!(current_dep_node_index.index(), edge_list_indices.len());

View file

@ -14,23 +14,7 @@ use dep_graph::DepNode;
use ich::Fingerprint;
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
/// The index of a DepNode in the SerializedDepGraph::nodes array.
#[derive(Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, Debug,
RustcEncodable, RustcDecodable)]
pub struct SerializedDepNodeIndex(pub u32);
impl Idx for SerializedDepNodeIndex {
#[inline]
fn new(idx: usize) -> Self {
assert!(idx <= ::std::u32::MAX as usize);
SerializedDepNodeIndex(idx as u32)
}
#[inline]
fn index(self) -> usize {
self.0 as usize
}
}
newtype_index!(SerializedDepNodeIndex);
/// Data for use when recompiling the **current crate**.
#[derive(Debug, RustcEncodable, RustcDecodable)]

View file

@ -43,6 +43,7 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(conservative_impl_trait)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(i128_type)]
#![cfg_attr(windows, feature(libc))]
@ -71,7 +72,7 @@ extern crate graphviz;
extern crate libc;
extern crate owning_ref;
extern crate rustc_back;
extern crate rustc_data_structures;
#[macro_use] extern crate rustc_data_structures;
extern crate serialize;
extern crate rustc_const_math;
extern crate rustc_errors as errors;

View file

@ -43,30 +43,6 @@ pub mod visit;
pub mod transform;
pub mod traversal;
macro_rules! newtype_index {
($name:ident, $debug_name:expr) => (
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord,
RustcEncodable, RustcDecodable)]
pub struct $name(u32);
impl Idx for $name {
fn new(value: usize) -> Self {
assert!(value < (u32::MAX) as usize);
$name(value as u32)
}
fn index(self) -> usize {
self.0 as usize
}
}
impl Debug for $name {
fn fmt(&self, fmt: &mut Formatter) -> fmt::Result {
write!(fmt, "{}{}", $debug_name, self.0)
}
}
)
}
/// Types for locals
type LocalDecls<'tcx> = IndexVec<Local, LocalDecl<'tcx>>;