Skip to content

Rollup of 14 pull requests #45674

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

Merged
merged 33 commits into from
Nov 1, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
becd45b
Fix title heading overlap in rust doc
GuillaumeGomez Oct 22, 2017
237ad82
Remove useless top margin on first heading
GuillaumeGomez Oct 22, 2017
7047979
Document that call expressions also represent ADT constructors.
leoyvens Oct 27, 2017
06f7f1f
Optimize some span operations
petrochenkov Oct 21, 2017
aa4726c
Support Dragonfly when building Openssl
mneumann Oct 29, 2017
42ef3f1
edit and fix bad spacing of inner-attribute-not-allowed note
zackmdavis Oct 30, 2017
b67d72b
Count type aliases in patterns
sinkuu Oct 31, 2017
afc7106
Update doc comment for the Unix extension module
tbu- Oct 31, 2017
66268e8
Add a hint what `BufRead` functions do on EOF
tbu- Oct 31, 2017
c13e35e
Take crate-type into account when computing symbol export list.
michaelwoerister Oct 31, 2017
d3951ff
Add regression test for symbol visibility when compiling rlib+cdylib …
michaelwoerister Oct 31, 2017
40edecc
Bump libc to 0.2.33
malbarbo Oct 31, 2017
8e96243
Fix NR_GETRANDOM for linux x32
malbarbo Oct 31, 2017
ff83240
Suggest renaming import if names clash
Cldfire Oct 31, 2017
d7dec7c
bootstrap: Add missing cputype matching for sparc64
glaubitz Oct 29, 2017
351f7b0
Fix incorrect error type in Read::byte docs
mbrubeck Oct 31, 2017
911e476
Tidy: track rustc_const_unstable feature gates as well
est31 Oct 31, 2017
6a16a7c
Also support macro generated atomic types
est31 Oct 31, 2017
61396a8
Add UI test
Cldfire Oct 31, 2017
07df45d
Rollup merge of #45450 - GuillaumeGomez:overlap-link, r=QuietMisdreavus
kennytm Nov 1, 2017
59c9d03
Rollup merge of #45579 - leodasvacas:document-that-call-can-be-adt-co…
kennytm Nov 1, 2017
e01dcf4
Rollup merge of #45602 - petrochenkov:ospan, r=michaelwoerister
kennytm Nov 1, 2017
18fa54f
Rollup merge of #45619 - mneumann:fix-bootstrap-dragonfly, r=alexcric…
kennytm Nov 1, 2017
28b1879
Rollup merge of #45624 - glaubitz:bootstrap-sparc64, r=kennytm
kennytm Nov 1, 2017
26af3e1
Rollup merge of #45644 - zackmdavis:edit_disallowed_inner_attr_note, …
kennytm Nov 1, 2017
cf0fe06
Rollup merge of #45646 - sinkuu:dead-code-alias-in-pat, r=arielb1
kennytm Nov 1, 2017
e9b5c86
Rollup merge of #45648 - tbu-:pr_doc_unix_ext, r=estebank
kennytm Nov 1, 2017
57b4658
Rollup merge of #45649 - tbu-:pr_doc_bufread_eof, r=estebank
kennytm Nov 1, 2017
2d53d94
Rollup merge of #45650 - michaelwoerister:per-crate-type-symbol-thres…
kennytm Nov 1, 2017
63ad129
Rollup merge of #45652 - malbarbo:x32-2, r=alexcrichton
kennytm Nov 1, 2017
0ec40c1
Rollup merge of #45660 - Cldfire:suggest-rename-import, r=estebank
kennytm Nov 1, 2017
e2554b3
Rollup merge of #45664 - mbrubeck:docs, r=estebank
kennytm Nov 1, 2017
0284550
Rollup merge of #45671 - est31:master, r=alexcrichton
kennytm Nov 1, 2017
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
12 changes: 6 additions & 6 deletions src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct MarkSymbolVisitor<'a, 'tcx: 'a> {
tables: &'a ty::TypeckTables<'tcx>,
live_symbols: Box<FxHashSet<ast::NodeId>>,
struct_has_extern_repr: bool,
ignore_non_const_paths: bool,
in_pat: bool,
inherited_pub_visibility: bool,
ignore_variant_stack: Vec<DefId>,
}
Expand All @@ -75,10 +75,10 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {

fn handle_definition(&mut self, def: Def) {
match def {
Def::Const(_) | Def::AssociatedConst(..) => {
Def::Const(_) | Def::AssociatedConst(..) | Def::TyAlias(_) => {
self.check_def_id(def.def_id());
}
_ if self.ignore_non_const_paths => (),
_ if self.in_pat => (),
Def::PrimTy(..) | Def::SelfTy(..) |
Def::Local(..) | Def::Upvar(..) => {}
Def::Variant(variant_id) | Def::VariantCtor(variant_id, ..) => {
Expand Down Expand Up @@ -289,9 +289,9 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
_ => ()
}

self.ignore_non_const_paths = true;
self.in_pat = true;
intravisit::walk_pat(self, pat);
self.ignore_non_const_paths = false;
self.in_pat = false;
}

fn visit_path(&mut self, path: &'tcx hir::Path, _: ast::NodeId) {
Expand Down Expand Up @@ -429,7 +429,7 @@ fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
tables: &ty::TypeckTables::empty(None),
live_symbols: box FxHashSet(),
struct_has_extern_repr: false,
ignore_non_const_paths: false,
in_pat: false,
inherited_pub_visibility: false,
ignore_variant_stack: vec![],
};
Expand Down
18 changes: 18 additions & 0 deletions src/test/run-pass/dead-code-alias-in-pat.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deny(dead_code)]

fn main() {
struct Foo<T> { x: T }
type Bar = Foo<u32>;
let spam = |Bar { x }| x != 0;
println!("{}", spam(Foo { x: 10 }));
}