mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-17 22:46:50 +00:00
Generate DepNodeIndexNew using newtype_index macro
This commit is contained in:
parent
3502bec032
commit
b5a5556dd4
@ -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(i.index() as u32)));
|
||||
let end = edge_list_data.len() as u32;
|
||||
|
||||
debug_assert_eq!(current_dep_node_index.index(), edge_list_indices.len());
|
||||
|
@ -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))]
|
||||
|
@ -49,6 +49,13 @@ macro_rules! newtype_index {
|
||||
RustcEncodable, RustcDecodable)]
|
||||
pub struct $name(u32);
|
||||
|
||||
impl $name {
|
||||
// HACK use for constants
|
||||
pub const fn const_new(x: u32) -> Self {
|
||||
$name(x)
|
||||
}
|
||||
}
|
||||
|
||||
impl Idx for $name {
|
||||
fn new(value: usize) -> Self {
|
||||
assert!(value < (::std::u32::MAX) as usize);
|
||||
|
@ -18,6 +18,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
|
||||
|
||||
#![feature(box_patterns)]
|
||||
#![feature(box_syntax)]
|
||||
#![feature(const_fn)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(i128_type)]
|
||||
#![feature(rustc_diagnostic_macros)]
|
||||
|
Loading…
Reference in New Issue
Block a user