Skip to content

Commit 8f956ce

Browse files
committed
---
yaml --- r: 83759 b: refs/heads/try c: bed669c h: refs/heads/master i: 83757: e7a43dc 83755: ebf54f1 83751: a9a6b9f 83743: a82ab96 v: v3
1 parent c0aee62 commit 8f956ce

File tree

5 files changed

+44
-10
lines changed

5 files changed

+44
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: b17dc4a946838a7f0a1d8eb752536243e322e8de
5+
refs/heads/try: bed669cba6c20e3bdbe01e87ce4566b60d7bc232
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/trans/glue.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ pub fn trans_struct_drop_flag(bcx: @mut Block, t: ty::t, v0: ValueRef, dtor_did:
423423
bcx = drop_ty(bcx, llfld_a, fld.mt.ty);
424424
}
425425

426+
Store(bcx, C_u8(0), drop_flag);
426427
bcx
427428
}
428429
}
@@ -594,6 +595,23 @@ pub fn make_take_glue(bcx: @mut Block, v: ValueRef, t: ty::t) -> @mut Block {
594595
bcx
595596
}
596597
ty::ty_opaque_closure_ptr(_) => bcx,
598+
ty::ty_struct(did, _) => {
599+
let tcx = bcx.tcx();
600+
let bcx = iter_structural_ty(bcx, v, t, take_ty);
601+
602+
match ty::ty_dtor(tcx, did) {
603+
ty::TraitDtor(_, false) => {
604+
// Zero out the struct
605+
unsafe {
606+
let ty = Type::from_ref(llvm::LLVMTypeOf(v));
607+
memzero(&B(bcx), v, ty);
608+
}
609+
610+
}
611+
_ => { }
612+
}
613+
bcx
614+
}
597615
_ if ty::type_is_structural(t) => {
598616
iter_structural_ty(bcx, v, t, take_ty)
599617
}

branches/try/src/libsyntax/parse/parser.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ pub fn Parser(sess: @mut ParseSess,
308308
quote_depth: @mut 0,
309309
obsolete_set: @mut HashSet::new(),
310310
mod_path_stack: @mut ~[],
311+
open_braces: @mut ~[]
311312
}
312313
}
313314

@@ -336,6 +337,8 @@ pub struct Parser {
336337
obsolete_set: @mut HashSet<ObsoleteSyntax>,
337338
/// Used to determine the path to externally loaded source files
338339
mod_path_stack: @mut ~[@str],
340+
/// Stack of spans of open delimiters. Used for error message.
341+
open_braces: @mut ~[@Span]
339342
}
340343

341344
#[unsafe_destructor]
@@ -2022,12 +2025,18 @@ impl Parser {
20222025

20232026
match *self.token {
20242027
token::EOF => {
2025-
self.fatal("file ended with unbalanced delimiters");
2028+
for sp in self.open_braces.iter() {
2029+
self.span_note(**sp, "Did you mean to close this delimiter?");
2030+
}
2031+
// There shouldn't really be a span, but it's easier for the test runner
2032+
// if we give it one
2033+
self.fatal("This file contains an un-closed delimiter ");
20262034
}
20272035
token::LPAREN | token::LBRACE | token::LBRACKET => {
20282036
let close_delim = token::flip_delimiter(&*self.token);
20292037

20302038
// Parse the open delimiter.
2039+
(*self.open_braces).push(@*self.span);
20312040
let mut result = ~[parse_any_tt_tok(self)];
20322041

20332042
let trees =
@@ -2038,6 +2047,7 @@ impl Parser {
20382047

20392048
// Parse the close delimiter.
20402049
result.push(parse_any_tt_tok(self));
2050+
self.open_braces.pop();
20412051

20422052
tt_delim(@mut result)
20432053
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
static foo: int = 2; } //~ ERROR incorrect close delimiter:
12+

branches/try/src/test/compile-fail/issue-2354.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// xfail-test
12-
/*
13-
Ideally, the error about the missing close brace in foo would be reported
14-
near the corresponding open brace. But currently it's reported at the end.
15-
xfailed for now (see Issue #2354)
16-
*/
17-
fn foo() { //~ ERROR this open brace is not closed
11+
fn foo() { //~ NOTE Did you mean to close this delimiter?
1812
match Some(x) {
1913
Some(y) { fail!(); }
2014
None { fail!(); }
@@ -25,4 +19,4 @@ fn bar() {
2519
while (i < 1000) {}
2620
}
2721

28-
fn main() {}
22+
fn main() {} //~ ERROR This file contains an un-closed delimiter

0 commit comments

Comments
 (0)