Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #57747

Merged
merged 27 commits into from
Jan 19, 2019
Merged
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
284f0d3
Document that `-C opt-level=0` implies `-C debug-assertions`.
daxpedda Dec 26, 2018
11b0fa2
docs(rustc): Link to the book's source in rustc
phansch Dec 30, 2018
6bae4a7
Fix unused_assignments false positive
sinkuu Jan 3, 2019
069b0c4
Cleanup
sinkuu Jan 3, 2019
c120199
Show suggestion to use .char().nth() and link to The Book on unimplem…
folex Jan 5, 2019
f4ded5b
Add a regression test for mutating a non-mut #[thread_local]
mjbshaw Dec 24, 2018
e5e9867
Pass a default value when unwrapping a span
Jan 15, 2019
93b5536
use structured macro and path resolve suggestions
euclio Jan 15, 2019
ae4b14e
Use `Lit` rather than `P<Lit>` in `hir::ExprKind`.
nnethercote Jan 16, 2019
dc45528
Remove `hir::Label`.
nnethercote Jan 16, 2019
193809e
Add regression test to close #53787
Jan 16, 2019
3f0a75d
Remove trailing whitespace
Jan 16, 2019
0edc5c9
Fix error template
Jan 16, 2019
1e3f475
Add test for linking non-existent static library
Jan 17, 2019
e3ba6ed
Fix suggestions given mulitple bad lifetimes
dlrobertson Jan 17, 2019
ec3c5b0
Use structured suggestion to surround struct literal with parenthesis
estebank Jan 18, 2019
b9cb5db
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
Centril Jan 18, 2019
04a2cbd
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
Centril Jan 18, 2019
bb683b9
Rollup merge of #57212 - phansch:improve_rustc_book_contributing, r=s…
Centril Jan 18, 2019
0dd4bfa
Rollup merge of #57302 - sinkuu:unused_assignments_fp, r=estebank
Centril Jan 18, 2019
49c74e4
Rollup merge of #57350 - folex:master, r=estebank
Centril Jan 18, 2019
f63e3d2
Rollup merge of #57635 - euclio:path-separators, r=michaelwoerister
Centril Jan 18, 2019
d2300af
Rollup merge of #57650 - AB1908:master, r=petrochenkov
Centril Jan 18, 2019
0eb4bdc
Rollup merge of #57657 - AB1908:regression-test-case, r=nikomatsakis
Centril Jan 18, 2019
857d27f
Rollup merge of #57658 - nnethercote:rm-hir-P-Lit, r=michaelwoerister
Centril Jan 18, 2019
42accf0
Rollup merge of #57720 - dlrobertson:fix_57521, r=estebank
Centril Jan 18, 2019
2a830e4
Rollup merge of #57725 - estebank:parens, r=michaelwoerister
Centril Jan 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 6 additions & 23 deletions src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
@@ -911,17 +911,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
}

fn compute(&mut self, body: &hir::Expr) -> LiveNode {
// if there is a `break` or `again` at the top level, then it's
// effectively a return---this only occurs in `for` loops,
// where the body is really a closure.

debug!("compute: using id for body, {}", self.ir.tcx.hir().node_to_pretty_string(body.id));

let exit_ln = self.s.exit_ln;

self.break_ln.insert(body.id, exit_ln);
self.cont_ln.insert(body.id, exit_ln);

// the fallthrough exit is only for those cases where we do not
// explicitly return:
let s = self.s;
@@ -1024,19 +1015,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
self.propagate_through_expr(&e, succ)
}

hir::ExprKind::Closure(.., blk_id, _, _) => {
hir::ExprKind::Closure(..) => {
debug!("{} is an ExprKind::Closure",
self.ir.tcx.hir().node_to_pretty_string(expr.id));

// The next-node for a break is the successor of the entire
// loop. The next-node for a continue is the top of this loop.
let node = self.live_node(expr.hir_id, expr.span);

let break_ln = succ;
let cont_ln = node;
self.break_ln.insert(blk_id.node_id, break_ln);
self.cont_ln.insert(blk_id.node_id, cont_ln);

// the construction of a closure itself is not important,
// but we have to consider the closed over variables.
let caps = self.ir.capture_info_map.get(&expr.id).cloned().unwrap_or_else(||
@@ -1407,15 +1389,16 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
debug!("propagate_through_loop: using id for loop body {} {}",
expr.id, self.ir.tcx.hir().node_to_pretty_string(body.id));

let break_ln = succ;
let cont_ln = ln;
self.break_ln.insert(expr.id, break_ln);
self.cont_ln.insert(expr.id, cont_ln);

self.break_ln.insert(expr.id, succ);

let cond_ln = match kind {
LoopLoop => ln,
WhileLoop(ref cond) => self.propagate_through_expr(&cond, ln),
};

self.cont_ln.insert(expr.id, cond_ln);

let body_ln = self.propagate_through_block(body, cond_ln);

// repeat until fixed point is reached:
9 changes: 9 additions & 0 deletions src/test/ui/liveness/liveness-dead.rs
Original file line number Diff line number Diff line change
@@ -27,4 +27,13 @@ fn f5(mut x: i32) {
x = 4; //~ ERROR: value assigned to `x` is never read
}

// #22630
fn f6() {
let mut done = false;
while !done {
done = true; // no error
continue;
}
}

fn main() {}