Skip to content

Commit 3e2b5a4

Browse files
committed
librustc_data_structures => 2018
1 parent 43e04fb commit 3e2b5a4

File tree

25 files changed

+86
-107
lines changed

25 files changed

+86
-107
lines changed

src/librustc_data_structures/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "rustc_data_structures"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[lib]
78
name = "rustc_data_structures"
@@ -16,8 +17,8 @@ serialize = { path = "../libserialize" }
1617
graphviz = { path = "../libgraphviz" }
1718
cfg-if = "0.1.2"
1819
stable_deref_trait = "1.0.0"
19-
rustc-rayon = "0.1.1"
20-
rustc-rayon-core = "0.1.1"
20+
rayon = { version = "0.1.1", package = "rustc-rayon" }
21+
rayon-core = { version = "0.1.1", package = "rustc-rayon-core" }
2122
rustc-hash = "1.0.1"
2223
smallvec = { version = "0.6.7", features = ["union", "may_dangle"] }
2324

src/librustc_data_structures/bit_set.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use indexed_vec::{Idx, IndexVec};
1+
use crate::indexed_vec::{Idx, IndexVec};
22
use smallvec::SmallVec;
33
use std::fmt;
44
use std::iter;
@@ -208,7 +208,7 @@ impl<T: Idx> SubtractFromBitSet<T> for BitSet<T> {
208208
}
209209

210210
impl<T: Idx> fmt::Debug for BitSet<T> {
211-
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
211+
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
212212
w.debug_list()
213213
.entries(self.iter())
214214
.finish()
@@ -366,7 +366,7 @@ impl<T: Idx> SparseBitSet<T> {
366366
dense
367367
}
368368

369-
fn iter(&self) -> slice::Iter<T> {
369+
fn iter(&self) -> slice::Iter<'_, T> {
370370
self.elems.iter()
371371
}
372372
}
@@ -536,7 +536,7 @@ impl<T: Idx> HybridBitSet<T> {
536536
}
537537
}
538538

539-
pub fn iter(&self) -> HybridIter<T> {
539+
pub fn iter(&self) -> HybridIter<'_, T> {
540540
match self {
541541
HybridBitSet::Sparse(sparse) => HybridIter::Sparse(sparse.iter()),
542542
HybridBitSet::Dense(dense) => HybridIter::Dense(dense.iter()),

src/librustc_data_structures/fingerprint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
use crate::stable_hasher;
12
use std::mem;
2-
use stable_hasher;
33
use serialize;
44
use serialize::opaque::{EncodeResult, Encoder, Decoder};
55

@@ -70,7 +70,7 @@ impl Fingerprint {
7070
}
7171

7272
impl ::std::fmt::Display for Fingerprint {
73-
fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
73+
fn fmt(&self, formatter: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
7474
write!(formatter, "{:x}-{:x}", self.0, self.1)
7575
}
7676
}

src/librustc_data_structures/flock.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@ cfg_if! {
1414
if #[cfg(unix)] {
1515
use std::ffi::{CString, OsStr};
1616
use std::os::unix::prelude::*;
17-
use libc;
1817

1918
#[cfg(any(target_os = "linux", target_os = "android"))]
2019
mod os {
21-
use libc;
22-
2320
#[repr(C)]
2421
pub struct flock {
2522
pub l_type: libc::c_short,
@@ -35,8 +32,6 @@ cfg_if! {
3532

3633
#[cfg(target_os = "freebsd")]
3734
mod os {
38-
use libc;
39-
4035
#[repr(C)]
4136
pub struct flock {
4237
pub l_start: libc::off_t,
@@ -53,8 +48,6 @@ cfg_if! {
5348
target_os = "netbsd",
5449
target_os = "openbsd"))]
5550
mod os {
56-
use libc;
57-
5851
#[repr(C)]
5952
pub struct flock {
6053
pub l_start: libc::off_t,
@@ -70,8 +63,6 @@ cfg_if! {
7063

7164
#[cfg(target_os = "haiku")]
7265
mod os {
73-
use libc;
74-
7566
#[repr(C)]
7667
pub struct flock {
7768
pub l_type: libc::c_short,
@@ -87,8 +78,6 @@ cfg_if! {
8778

8879
#[cfg(any(target_os = "macos", target_os = "ios"))]
8980
mod os {
90-
use libc;
91-
9281
#[repr(C)]
9382
pub struct flock {
9483
pub l_start: libc::off_t,
@@ -104,8 +93,6 @@ cfg_if! {
10493

10594
#[cfg(target_os = "solaris")]
10695
mod os {
107-
use libc;
108-
10996
#[repr(C)]
11097
pub struct flock {
11198
pub l_type: libc::c_short,

src/librustc_data_structures/graph/dominators/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<Node: Idx> Dominators<Node> {
117117
self.immediate_dominators[node].unwrap()
118118
}
119119

120-
pub fn dominators(&self, node: Node) -> Iter<Node> {
120+
pub fn dominators(&self, node: Node) -> Iter<'_, Node> {
121121
assert!(self.is_reachable(node), "node {:?} is not reachable", node);
122122
Iter {
123123
dominators: self,
@@ -136,7 +136,7 @@ impl<Node: Idx> Dominators<Node> {
136136
}
137137
}
138138

139-
pub struct Iter<'dom, Node: Idx + 'dom> {
139+
pub struct Iter<'dom, Node: Idx> {
140140
dominators: &'dom Dominators<Node>,
141141
node: Option<Node>,
142142
}
@@ -171,7 +171,7 @@ impl<Node: Idx> DominatorTree<Node> {
171171
}
172172

173173
impl<Node: Idx> fmt::Debug for DominatorTree<Node> {
174-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
174+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
175175
fmt::Debug::fmt(
176176
&DominatorTreeNode {
177177
tree: self,
@@ -188,7 +188,7 @@ struct DominatorTreeNode<'tree, Node: Idx> {
188188
}
189189

190190
impl<'tree, Node: Idx> fmt::Debug for DominatorTreeNode<'tree, Node> {
191-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
191+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
192192
let subtrees: Vec<_> = self.tree
193193
.children(self.node)
194194
.iter()

src/librustc_data_structures/graph/implementation/mod.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
//! the field `next_edge`). Each of those fields is an array that should
2121
//! be indexed by the direction (see the type `Direction`).
2222
23-
use bit_set::BitSet;
23+
use crate::bit_set::BitSet;
24+
use crate::snapshot_vec::{SnapshotVec, SnapshotVecDelegate};
2425
use std::fmt::Debug;
2526
use std::usize;
26-
use snapshot_vec::{SnapshotVec, SnapshotVecDelegate};
2727

2828
#[cfg(test)]
2929
mod tests;
@@ -212,15 +212,19 @@ impl<N: Debug, E: Debug> Graph<N, E> {
212212
.all(|(edge_idx, edge)| f(edge_idx, edge))
213213
}
214214

215-
pub fn outgoing_edges(&self, source: NodeIndex) -> AdjacentEdges<N, E> {
215+
pub fn outgoing_edges(&self, source: NodeIndex) -> AdjacentEdges<'_, N, E> {
216216
self.adjacent_edges(source, OUTGOING)
217217
}
218218

219-
pub fn incoming_edges(&self, source: NodeIndex) -> AdjacentEdges<N, E> {
219+
pub fn incoming_edges(&self, source: NodeIndex) -> AdjacentEdges<'_, N, E> {
220220
self.adjacent_edges(source, INCOMING)
221221
}
222222

223-
pub fn adjacent_edges(&self, source: NodeIndex, direction: Direction) -> AdjacentEdges<N, E> {
223+
pub fn adjacent_edges(
224+
&self,
225+
source: NodeIndex,
226+
direction: Direction
227+
) -> AdjacentEdges<'_, N, E> {
224228
let first_edge = self.node(source).first_edge[direction.repr];
225229
AdjacentEdges {
226230
graph: self,
@@ -291,11 +295,7 @@ impl<N: Debug, E: Debug> Graph<N, E> {
291295

292296
// # Iterators
293297

294-
pub struct AdjacentEdges<'g, N, E>
295-
where
296-
N: 'g,
297-
E: 'g,
298-
{
298+
pub struct AdjacentEdges<'g, N, E> {
299299
graph: &'g Graph<N, E>,
300300
direction: Direction,
301301
next: EdgeIndex,
@@ -331,11 +331,7 @@ impl<'g, N: Debug, E: Debug> Iterator for AdjacentEdges<'g, N, E> {
331331
}
332332
}
333333

334-
pub struct DepthFirstTraversal<'g, N, E>
335-
where
336-
N: 'g,
337-
E: 'g,
338-
{
334+
pub struct DepthFirstTraversal<'g, N, E> {
339335
graph: &'g Graph<N, E>,
340336
stack: Vec<NodeIndex>,
341337
visited: BitSet<usize>,

src/librustc_data_structures/graph/implementation/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use graph::implementation::*;
1+
use crate::graph::implementation::*;
22
use std::fmt::Debug;
33

44
type TestGraph = Graph<&'static str, &'static str>;

src/librustc_data_structures/graph/scc/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
//! node in the graph. This uses Tarjan's algorithm that completes in
44
//! O(n) time.
55
6-
use fx::FxHashSet;
7-
use graph::{DirectedGraph, WithNumNodes, WithSuccessors};
8-
use indexed_vec::{Idx, IndexVec};
6+
use crate::fx::FxHashSet;
7+
use crate::graph::{DirectedGraph, WithNumNodes, WithSuccessors};
8+
use crate::indexed_vec::{Idx, IndexVec};
99
use std::ops::Range;
1010

1111
mod test;
@@ -93,7 +93,7 @@ impl<S: Idx> SccData<S> {
9393
}
9494
}
9595

96-
struct SccsConstruction<'c, G: DirectedGraph + WithNumNodes + WithSuccessors + 'c, S: Idx> {
96+
struct SccsConstruction<'c, G: DirectedGraph + WithNumNodes + WithSuccessors, S: Idx> {
9797
graph: &'c G,
9898

9999
/// The state of each node; used during walk to record the stack

src/librustc_data_structures/graph/scc/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![cfg(test)]
22

3-
use graph::test::TestGraph;
3+
use crate::graph::test::TestGraph;
44
use super::*;
55

66
#[test]

src/librustc_data_structures/graph/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use fx::FxHashMap;
1+
use crate::fx::FxHashMap;
22
use std::cmp::max;
33
use std::slice;
44
use std::iter;

0 commit comments

Comments
 (0)