Skip to content

Commit 63a7d4a

Browse files
---
yaml --- r: 193786 b: refs/heads/beta c: 7130c75 h: refs/heads/master v: v3
1 parent 4391add commit 63a7d4a

File tree

23 files changed

+215
-256
lines changed

23 files changed

+215
-256
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 09e5a7a04ef6500d44efa55c32ee2956f629133f
34+
refs/heads/beta: 7130c75e4612f9c91652e4472a66fe7573224df8
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/configure

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,11 +823,11 @@ then
823823
LLVM_VERSION=$($LLVM_CONFIG --version)
824824

825825
case $LLVM_VERSION in
826-
(3.[5-6]*)
826+
(3.[2-6]*)
827827
msg "found ok version of LLVM: $LLVM_VERSION"
828828
;;
829829
(*)
830-
err "bad LLVM version: $LLVM_VERSION, need >=3.5"
830+
err "bad LLVM version: $LLVM_VERSION, need >=3.0svn"
831831
;;
832832
esac
833833
fi

branches/beta/mk/main.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
290290
LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
291291
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
292292
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
293-
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
294293
LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
295294
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
296295
# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),

branches/beta/mk/target.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
8484
$$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) \
8585
$$(RUST_LIB_FLAGS_ST$(1)) \
8686
-L "$$(RT_OUTPUT_DIR_$(2))" \
87-
$$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
87+
-L "$$(LLVM_LIBDIR_$(2))" \
8888
$$(LLVM_STDCPP_RUSTFLAGS_$(2)) \
8989
$$(RUSTFLAGS_$(4)) \
9090
--out-dir $$(@D) \

branches/beta/mk/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
372372
$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(3)) \
373373
$$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) -o $$@ $$< --test \
374374
-L "$$(RT_OUTPUT_DIR_$(2))" \
375-
$$(LLVM_LIBDIR_RUSTFLAGS_$(2)) \
375+
-L "$$(LLVM_LIBDIR_$(2))" \
376376
$$(RUSTFLAGS_$(4))
377377

378378
endef

branches/beta/src/doc/trpl/closures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ is that a moving closure always takes ownership of all variables that
6868
it uses. Ordinary closures, in contrast, just create a reference into
6969
the enclosing stack frame. Moving closures are most useful with Rust's
7070
concurrency features, and so we'll just leave it at this for
71-
now. We'll talk about them more in the "Threads" section of the guide.
71+
now. We'll talk about them more in the "Concurrency" chapter of the book.
7272

7373
## Accepting closures as arguments
7474

branches/beta/src/doc/trpl/concurrency.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ fn main() {
339339
});
340340
}
341341
342-
rx.recv().ok().expect("Could not receive answer");
342+
rx.recv().ok().expect("Could not recieve answer");
343343
}
344344
```
345345

branches/beta/src/doc/trpl/method-syntax.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ impl CircleBuilder {
187187
}
188188
189189
fn coordinate(&mut self, coordinate: f64) -> &mut CircleBuilder {
190-
self.coordinate = coordinate;
191-
self
190+
self.coordinate = coordinate;
191+
self
192192
}
193193
194194
fn radius(&mut self, radius: f64) -> &mut CircleBuilder {
195-
self.radius = radius;
196-
self
195+
self.radius = radius;
196+
self
197197
}
198198
199199
fn finalize(&self) -> Circle {

branches/beta/src/librustc/middle/check_match.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,6 @@ fn is_useful(cx: &MatchCheckCtxt,
646646
if rows[0].len() == 0 {
647647
return NotUseful;
648648
}
649-
assert!(rows.iter().all(|r| r.len() == v.len()));
650649
let real_pat = match rows.iter().find(|r| (*r)[0].id != DUMMY_NODE_ID) {
651650
Some(r) => raw_pat(r[0]),
652651
None if v.len() == 0 => return NotUseful,
@@ -655,12 +654,7 @@ fn is_useful(cx: &MatchCheckCtxt,
655654
let left_ty = if real_pat.id == DUMMY_NODE_ID {
656655
ty::mk_nil(cx.tcx)
657656
} else {
658-
let left_ty = ty::pat_ty(cx.tcx, &*real_pat);
659-
660-
match real_pat.node {
661-
ast::PatIdent(ast::BindByRef(..), _, _) => ty::deref(left_ty, false).unwrap().ty,
662-
_ => left_ty,
663-
}
657+
ty::pat_ty(cx.tcx, &*real_pat)
664658
};
665659

666660
let max_slice_length = rows.iter().filter_map(|row| match row[0].node {

branches/beta/src/librustc/middle/dead.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct MarkSymbolVisitor<'a, 'tcx: 'a> {
4747
struct_has_extern_repr: bool,
4848
ignore_non_const_paths: bool,
4949
inherited_pub_visibility: bool,
50+
ignore_variant_stack: Vec<ast::NodeId>,
5051
}
5152

5253
impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
@@ -59,6 +60,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
5960
struct_has_extern_repr: false,
6061
ignore_non_const_paths: false,
6162
inherited_pub_visibility: false,
63+
ignore_variant_stack: vec![],
6264
}
6365
}
6466

@@ -79,7 +81,9 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
7981
def::DefPrimTy(_) => (),
8082
def::DefVariant(enum_id, variant_id, _) => {
8183
self.check_def_id(enum_id);
82-
self.check_def_id(variant_id);
84+
if !self.ignore_variant_stack.contains(&variant_id.node) {
85+
self.check_def_id(variant_id);
86+
}
8387
}
8488
_ => {
8589
self.check_def_id(def.def_id());
@@ -278,6 +282,23 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MarkSymbolVisitor<'a, 'tcx> {
278282
visit::walk_expr(self, expr);
279283
}
280284

285+
fn visit_arm(&mut self, arm: &ast::Arm) {
286+
if arm.pats.len() == 1 {
287+
let pat = &*arm.pats[0];
288+
let variants = pat_util::necessary_variants(&self.tcx.def_map, pat);
289+
290+
// Inside the body, ignore constructions of variants
291+
// necessary for the pattern to match. Those construction sites
292+
// can't be reached unless the variant is constructed elsewhere.
293+
let len = self.ignore_variant_stack.len();
294+
self.ignore_variant_stack.push_all(&*variants);
295+
visit::walk_arm(self, arm);
296+
self.ignore_variant_stack.truncate(len);
297+
} else {
298+
visit::walk_arm(self, arm);
299+
}
300+
}
301+
281302
fn visit_pat(&mut self, pat: &ast::Pat) {
282303
let def_map = &self.tcx.def_map;
283304
match pat.node {
@@ -397,6 +418,11 @@ fn create_and_seed_worklist(tcx: &ty::ctxt,
397418
worklist.push(*id);
398419
}
399420
for id in reachable_symbols {
421+
// Reachable variants can be dead, because we warn about
422+
// variants never constructed, not variants never used.
423+
if let Some(ast_map::NodeVariant(..)) = tcx.map.find(*id) {
424+
continue;
425+
}
400426
worklist.push(*id);
401427
}
402428

branches/beta/src/librustc/middle/pat_util.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,27 @@ pub fn def_to_path(tcx: &ty::ctxt, id: ast::DefId) -> ast::Path {
155155
span: DUMMY_SP,
156156
})
157157
}
158+
159+
/// Return variants that are necessary to exist for the pattern to match.
160+
pub fn necessary_variants(dm: &DefMap, pat: &ast::Pat) -> Vec<ast::NodeId> {
161+
let mut variants = vec![];
162+
walk_pat(pat, |p| {
163+
match p.node {
164+
ast::PatEnum(_, _) |
165+
ast::PatIdent(_, _, None) |
166+
ast::PatStruct(..) => {
167+
match dm.borrow().get(&p.id) {
168+
Some(&PathResolution {base_def: DefVariant(_, id, _), ..}) => {
169+
variants.push(id.node);
170+
}
171+
_ => ()
172+
}
173+
}
174+
_ => ()
175+
}
176+
true
177+
});
178+
variants.sort();
179+
variants.dedup();
180+
variants
181+
}

branches/beta/src/librustc/session/search_paths.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use std::slice;
1212
use std::path::{Path, PathBuf};
13-
use session::early_error;
1413

1514
#[derive(Clone, Debug)]
1615
pub struct SearchPaths {
@@ -51,9 +50,6 @@ impl SearchPaths {
5150
} else {
5251
(PathKind::All, path)
5352
};
54-
if path.is_empty() {
55-
early_error("empty search path given via `-L`");
56-
}
5753
self.paths.push((kind, PathBuf::new(path)));
5854
}
5955

branches/beta/src/librustc_lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ impl NonCamelCaseTypes {
811811
if i == 0 {
812812
c.to_uppercase().collect::<String>()
813813
} else {
814-
c.to_lowercase().collect()
814+
c.to_string()
815815
}
816816
)).collect::<Vec<_>>().concat()
817817
}

branches/beta/src/librustc_trans/trans/tvec.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ pub fn write_content<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
293293
}
294294
SaveIn(lldest) => {
295295
match ty::eval_repeat_count(bcx.tcx(), &**count_expr) {
296-
0 => expr::trans_into(bcx, &**element, Ignore),
296+
0 => bcx,
297297
1 => expr::trans_into(bcx, &**element, SaveIn(lldest)),
298298
count => {
299299
let elem = unpack_datum!(bcx, expr::trans(bcx, &**element));
@@ -410,12 +410,8 @@ pub fn iter_vec_loop<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
410410
F: FnOnce(Block<'blk, 'tcx>, ValueRef, Ty<'tcx>) -> Block<'blk, 'tcx>,
411411
{
412412
let _icx = push_ctxt("tvec::iter_vec_loop");
413-
414-
if bcx.unreachable.get() {
415-
return bcx;
416-
}
417-
418413
let fcx = bcx.fcx;
414+
419415
let loop_bcx = fcx.new_temp_block("expr_repeat");
420416
let next_bcx = fcx.new_temp_block("expr_repeat: next");
421417

0 commit comments

Comments
 (0)