Skip to content

Commit 74b2783

Browse files
committed
delete dead code
1 parent 2fa1ba3 commit 74b2783

File tree

5 files changed

+3
-427
lines changed

5 files changed

+3
-427
lines changed

src/librustc/ty/maps.rs

Lines changed: 2 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,12 @@ use util::nodemap::{DefIdSet, NodeSet};
2626

2727
use rustc_data_structures::indexed_vec::IndexVec;
2828
use std::cell::{RefCell, RefMut};
29-
use std::option;
3029
use std::fmt::Debug;
3130
use std::hash::Hash;
32-
use std::iter::{self, Once};
3331
use std::mem;
3432
use std::collections::BTreeMap;
3533
use std::ops::Deref;
3634
use std::rc::Rc;
37-
use std::vec;
3835
use syntax_pos::{Span, DUMMY_SP};
3936
use syntax::symbol::Symbol;
4037

@@ -161,67 +158,6 @@ impl<'tcx> Value<'tcx> for ty::SymbolName {
161158
}
162159
}
163160

164-
trait IntoKeyValues<K: Key, V> {
165-
type KeyValues: IntoIterator<Item=(K, V)>;
166-
167-
fn into_key_values(key: &K, value: Self) -> Self::KeyValues;
168-
}
169-
170-
impl<K: Key, V> IntoKeyValues<K, V> for V {
171-
type KeyValues = Once<(K, V)>;
172-
173-
fn into_key_values(key: &K, value: Self) -> Self::KeyValues {
174-
iter::once((key.clone(), value))
175-
}
176-
}
177-
178-
/// Return type for a multi-query, which is a query which may (if it
179-
/// chooses) return more than one (key, value) pair. Construct a
180-
/// `Multi` using `Multi::from(...)`.
181-
pub struct Multi<K: Key, V> {
182-
single: Option<V>,
183-
map: Vec<(K, V)>,
184-
}
185-
186-
impl<K: Key, V> Multi<K, V> {
187-
pub fn iter<'a>(&'a self, key: &'a K) -> impl Iterator<Item = (&'a K, &'a V)> + 'a {
188-
self.single.iter()
189-
.map(move |v| (key, v))
190-
.chain(self.map.iter().map(move |&(ref k, ref v)| (k, v)))
191-
}
192-
}
193-
194-
/// Construct a `Multi` from a single value.
195-
impl<K: Key, V> From<V> for Multi<K, V> {
196-
fn from(value: V) -> Self {
197-
Multi {
198-
single: Some(value),
199-
map: vec![],
200-
}
201-
}
202-
}
203-
204-
/// Construct a `Multi` from a hashmap of (K, V) pairs.
205-
impl<K: Key, V> From<Vec<(K, V)>> for Multi<K, V> {
206-
fn from(value: Vec<(K, V)>) -> Self {
207-
Multi {
208-
single: None,
209-
map: value
210-
}
211-
}
212-
}
213-
214-
impl<K: Key, V> IntoKeyValues<K, V> for Multi<K, V> {
215-
type KeyValues = iter::Chain<option::IntoIter<(K, V)>, vec::IntoIter<(K, V)>>;
216-
217-
fn into_key_values(key: &K, value: Self) -> Self::KeyValues {
218-
value.single
219-
.map(|v| (key.clone(), v))
220-
.into_iter()
221-
.chain(value.map)
222-
}
223-
}
224-
225161
pub struct CycleError<'a, 'tcx: 'a> {
226162
span: Span,
227163
cycle: RefMut<'a, [(Span, Query<'tcx>)]>,
@@ -490,14 +426,7 @@ macro_rules! define_maps {
490426
provider(tcx.global_tcx(), key)
491427
})?;
492428

493-
{
494-
let map = &mut *tcx.maps.$name.borrow_mut();
495-
for (k, v) in IntoKeyValues::<$K, $V>::into_key_values(&key, result) {
496-
map.insert(k, v);
497-
}
498-
}
499-
500-
Ok(f(tcx.maps.$name.borrow().get(&key).expect("value just generated")))
429+
Ok(f(tcx.maps.$name.borrow_mut().entry(key).or_insert(result)))
501430
}
502431

503432
pub fn try_get(tcx: TyCtxt<'a, $tcx, 'lcx>, span: Span, key: $K)
@@ -683,20 +612,6 @@ macro_rules! define_provider_struct {
683612
}
684613
};
685614

686-
// The `multi` modifier indicates a **multiquery**, in which case
687-
// the function returns a `Multi<K,V>` instead of just a value
688-
// `V`.
689-
(tcx: $tcx:tt,
690-
input: (([multi $($other_modifiers:tt)*] $name:tt [$K:ty] [$V:ty]) $($input:tt)*),
691-
output: $output:tt) => {
692-
define_provider_struct! {
693-
tcx: $tcx,
694-
ready: ($name [$K] [Multi<$K,$V>]),
695-
input: ($($input)*),
696-
output: $output
697-
}
698-
};
699-
700615
// Regular queries produce a `V` only.
701616
(tcx: $tcx:tt,
702617
input: (([] $name:tt $K:tt $V:tt) $($input:tt)*),
@@ -709,7 +624,7 @@ macro_rules! define_provider_struct {
709624
}
710625
};
711626

712-
// Skip modifiers other than `multi`.
627+
// Skip modifiers.
713628
(tcx: $tcx:tt,
714629
input: (([$other_modifier:tt $($modifiers:tt)*] $($fields:tt)*) $($input:tt)*),
715630
output: $output:tt) => {

src/librustc_mir/callgraph.rs

Lines changed: 0 additions & 249 deletions
This file was deleted.

src/librustc_mir/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ extern crate rustc_const_eval;
4646

4747
pub mod diagnostics;
4848

49-
pub mod build;
50-
pub mod callgraph;
49+
mod build;
5150
mod hair;
5251
mod shim;
5352
mod queries;

0 commit comments

Comments
 (0)