Skip to content

Commit a294923

Browse files
author
Keegan McAllister
committed
---
yaml --- r: 120742 b: refs/heads/dist-snap c: 5fdd0e4 h: refs/heads/master v: v3
1 parent 2495281 commit a294923

File tree

13 files changed

+37
-3
lines changed

13 files changed

+37
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 1813e5aa1a03b0596b8de7abd1af31edf5d6098f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 28a4ee5eeb6a7450f5c16b902504992e990c7042
9+
refs/heads/dist-snap: 5fdd0e4b05979a0a01ca6c14e0510880d320250c
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/middle/cfg/construct.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ impl<'a> CFGBuilder<'a> {
142142
self.pats_all(post.iter().map(|p| *p), vec_exit);
143143
self.add_node(pat.id, [post_exit])
144144
}
145+
146+
ast::PatMac(_) => {
147+
self.tcx.sess.span_bug(pat.span, "unexpanded macro");
148+
}
145149
}
146150
}
147151

branches/dist-snap/src/librustc/middle/check_match.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ fn pat_ctor_id(cx: &MatchCheckCtxt, p: @Pat) -> Option<ctor> {
392392
None => Some(vec(before.len() + after.len()))
393393
}
394394
}
395+
PatMac(_) => cx.tcx.sess.bug("unexpanded macro"),
395396
}
396397
}
397398

@@ -849,6 +850,10 @@ fn specialize(cx: &MatchCheckCtxt,
849850
_ => None
850851
}
851852
}
853+
PatMac(_) => {
854+
cx.tcx.sess.span_err(pat_span, "unexpanded macro");
855+
None
856+
}
852857
}
853858
}
854859
}
@@ -947,6 +952,7 @@ fn find_refutable(cx: &MatchCheckCtxt, pat: &Pat, spans: &mut Vec<Span>) {
947952
}
948953
PatEnum(_,_) => {}
949954
PatVec(..) => { this_pattern!() }
955+
PatMac(_) => cx.tcx.sess.bug("unexpanded macro"),
950956
}
951957
}
952958

branches/dist-snap/src/librustc/middle/mem_categorization.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,10 @@ impl<'t,TYPER:Typer> MemCategorizationContext<'t,TYPER> {
10881088
ast::PatLit(_) | ast::PatRange(_, _) => {
10891089
/*always ok*/
10901090
}
1091+
1092+
ast::PatMac(_) => {
1093+
self.tcx().sess.span_bug(pat.span, "unexpanded macro");
1094+
}
10911095
}
10921096

10931097
Ok(())

branches/dist-snap/src/librustc/middle/trans/_match.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,6 +2282,9 @@ fn bind_irrefutable_pat<'a>(
22822282
bcx.sess().span_bug(pat.span,
22832283
"vector patterns are never irrefutable!");
22842284
}
2285+
ast::PatMac(..) => {
2286+
bcx.sess().span_bug(pat.span, "unexpanded macro");
2287+
}
22852288
ast::PatWild | ast::PatWildMulti | ast::PatLit(_) | ast::PatRange(_, _) => ()
22862289
}
22872290
return bcx;

branches/dist-snap/src/librustc/middle/trans/debuginfo.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2664,6 +2664,11 @@ fn populate_scope_map(cx: &CrateContext,
26642664
walk_pattern(cx, sub_pat, scope_stack, scope_map);
26652665
}
26662666
}
2667+
2668+
ast::PatMac(_) => {
2669+
cx.sess().span_bug(pat.span, "debuginfo::populate_scope_map() - \
2670+
Found unexpanded macro.");
2671+
}
26672672
}
26682673
}
26692674

branches/dist-snap/src/librustc/middle/typeck/check/_match.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,8 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) {
722722
}
723723
fcx.write_ty(pat.id, expected);
724724
}
725+
726+
ast::PatMac(_) => tcx.sess.bug("unexpanded macro"),
725727
}
726728
}
727729

branches/dist-snap/src/librustdoc/clean/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,12 @@ fn name_from_pat(p: &ast::Pat) -> String {
17311731
PatRange(..) => fail!("tried to get argument name from PatRange, \
17321732
which is not allowed in function arguments"),
17331733
PatVec(..) => fail!("tried to get argument name from pat_vec, \
1734-
which is not allowed in function arguments")
1734+
which is not allowed in function arguments"),
1735+
PatMac(..) => {
1736+
warn!("can't document the name of a function argument \
1737+
produced by a pattern macro");
1738+
"(argument produced by macro)".to_string()
1739+
}
17351740
}
17361741
}
17371742

branches/dist-snap/src/libsyntax/ast.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ pub enum Pat_ {
353353
PatRange(@Expr, @Expr),
354354
// [a, b, ..i, y, z] is represented as
355355
// PatVec(~[a, b], Some(i), ~[y, z])
356-
PatVec(Vec<@Pat> , Option<@Pat>, Vec<@Pat> )
356+
PatVec(Vec<@Pat> , Option<@Pat>, Vec<@Pat> ),
357+
PatMac(Mac),
357358
}
358359

359360
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash, Show)]

branches/dist-snap/src/libsyntax/ast_util.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@ pub fn walk_pat(pat: &Pat, it: |&Pat| -> bool) -> bool {
665665
slice.iter().advance(|&p| walk_pat(p, |p| it(p))) &&
666666
after.iter().advance(|&p| walk_pat(p, |p| it(p)))
667667
}
668+
PatMac(_) => fail!("attempted to analyze unexpanded pattern"),
668669
PatWild | PatWildMulti | PatLit(_) | PatRange(_, _) | PatIdent(_, _, _) |
669670
PatEnum(_, _) => {
670671
true

branches/dist-snap/src/libsyntax/fold.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ pub fn noop_fold_pat<T: Folder>(p: @Pat, folder: &mut T) -> @Pat {
770770
slice.map(|x| folder.fold_pat(x)),
771771
after.iter().map(|x| folder.fold_pat(*x)).collect())
772772
}
773+
PatMac(ref mac) => PatMac(folder.fold_mac(mac)),
773774
};
774775

775776
@Pat {

branches/dist-snap/src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,7 @@ impl<'a> State<'a> {
17571757
|s, &p| s.print_pat(p)));
17581758
try!(word(&mut self.s, "]"));
17591759
}
1760+
ast::PatMac(ref m) => try!(self.print_mac(m)),
17601761
}
17611762
self.ann.post(self, NodePat(pat))
17621763
}

branches/dist-snap/src/libsyntax/visit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ pub fn walk_pat<E: Clone, V: Visitor<E>>(visitor: &mut V, pattern: &Pat, env: E)
457457
visitor.visit_pat(*postpattern, env.clone())
458458
}
459459
}
460+
PatMac(ref macro) => visitor.visit_mac(macro, env),
460461
}
461462
}
462463

0 commit comments

Comments
 (0)