Skip to content

Commit a8100c3

Browse files
committed
---
yaml --- r: 277891 b: refs/heads/auto c: 02df9f3 h: refs/heads/master i: 277889: bda99cb 277887: fa165a9
1 parent 8ebb094 commit a8100c3

File tree

2 files changed

+1
-115
lines changed

2 files changed

+1
-115
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 0649942a46d29a4782b4bfcce1c6fe006ad63dc6
11+
refs/heads/auto: 02df9f32b1947fe194e2844a11db454b9763ea92
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/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)