Skip to content

Commit 02df9f3

Browse files
committed
Remove idempotent lowering test
1 parent 0649942 commit 02df9f3

File tree

1 file changed

+0
-114
lines changed

1 file changed

+0
-114
lines changed

src/librustc/hir/lowering.rs

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,117 +2116,3 @@ fn signal_block_expr(lctx: &LoweringContext,
21162116
}),
21172117
attrs)
21182118
}
2119-
2120-
2121-
2122-
#[cfg(test)]
2123-
mod test {
2124-
use super::*;
2125-
use syntax::ast::{self, NodeId, NodeIdAssigner};
2126-
use syntax::{parse, codemap};
2127-
use syntax::fold::Folder;
2128-
use std::cell::Cell;
2129-
2130-
struct MockAssigner {
2131-
next_id: Cell<NodeId>,
2132-
}
2133-
2134-
impl MockAssigner {
2135-
fn new() -> MockAssigner {
2136-
MockAssigner { next_id: Cell::new(0) }
2137-
}
2138-
}
2139-
2140-
trait FakeExtCtxt {
2141-
fn call_site(&self) -> codemap::Span;
2142-
fn cfg(&self) -> ast::CrateConfig;
2143-
fn ident_of(&self, st: &str) -> ast::Ident;
2144-
fn name_of(&self, st: &str) -> ast::Name;
2145-
fn parse_sess(&self) -> &parse::ParseSess;
2146-
}
2147-
2148-
impl FakeExtCtxt for parse::ParseSess {
2149-
fn call_site(&self) -> codemap::Span {
2150-
codemap::Span {
2151-
lo: codemap::BytePos(0),
2152-
hi: codemap::BytePos(0),
2153-
expn_id: codemap::NO_EXPANSION,
2154-
}
2155-
}
2156-
fn cfg(&self) -> ast::CrateConfig {
2157-
Vec::new()
2158-
}
2159-
fn ident_of(&self, st: &str) -> ast::Ident {
2160-
parse::token::str_to_ident(st)
2161-
}
2162-
fn name_of(&self, st: &str) -> ast::Name {
2163-
parse::token::intern(st)
2164-
}
2165-
fn parse_sess(&self) -> &parse::ParseSess {
2166-
self
2167-
}
2168-
}
2169-
2170-
impl NodeIdAssigner for MockAssigner {
2171-
fn next_node_id(&self) -> NodeId {
2172-
let result = self.next_id.get();
2173-
self.next_id.set(result + 1);
2174-
result
2175-
}
2176-
2177-
fn peek_node_id(&self) -> NodeId {
2178-
self.next_id.get()
2179-
}
2180-
}
2181-
2182-
impl Folder for MockAssigner {
2183-
fn new_id(&mut self, old_id: NodeId) -> NodeId {
2184-
assert_eq!(old_id, ast::DUMMY_NODE_ID);
2185-
self.next_node_id()
2186-
}
2187-
}
2188-
2189-
#[test]
2190-
fn test_preserves_ids() {
2191-
let cx = parse::ParseSess::new();
2192-
let mut assigner = MockAssigner::new();
2193-
2194-
let ast_if_let = quote_expr!(&cx,
2195-
if let Some(foo) = baz {
2196-
bar(foo);
2197-
});
2198-
let ast_if_let = assigner.fold_expr(ast_if_let);
2199-
let ast_while_let = quote_expr!(&cx,
2200-
while let Some(foo) = baz {
2201-
bar(foo);
2202-
});
2203-
let ast_while_let = assigner.fold_expr(ast_while_let);
2204-
let ast_for = quote_expr!(&cx,
2205-
for i in 0..10 {
2206-
for j in 0..10 {
2207-
foo(i, j);
2208-
}
2209-
});
2210-
let ast_for = assigner.fold_expr(ast_for);
2211-
let ast_in = quote_expr!(&cx, in HEAP { foo() });
2212-
let ast_in = assigner.fold_expr(ast_in);
2213-
2214-
let lctx = LoweringContext::testing_context(&assigner);
2215-
2216-
let hir1 = lower_expr(&lctx, &ast_if_let);
2217-
let hir2 = lower_expr(&lctx, &ast_if_let);
2218-
assert!(hir1 == hir2);
2219-
2220-
let hir1 = lower_expr(&lctx, &ast_while_let);
2221-
let hir2 = lower_expr(&lctx, &ast_while_let);
2222-
assert!(hir1 == hir2);
2223-
2224-
let hir1 = lower_expr(&lctx, &ast_for);
2225-
let hir2 = lower_expr(&lctx, &ast_for);
2226-
assert!(hir1 == hir2);
2227-
2228-
let hir1 = lower_expr(&lctx, &ast_in);
2229-
let hir2 = lower_expr(&lctx, &ast_in);
2230-
assert!(hir1 == hir2);
2231-
}
2232-
}

0 commit comments

Comments
 (0)