Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5eafae2
Remove confusing comment about ideally using `!` for `c_void`
sdroege Dec 7, 2018
8de8880
Update code comments of `c_void` to explain the reasoning for its cur…
sdroege Dec 10, 2018
96678df
Cleanup PartialEq docs.
frewsxcv Jan 5, 2019
b91d211
Add a target option "merge-functions" taking values in ("disabled",
peterhj Dec 31, 2018
0d3dfdf
Fix compile error
frewsxcv Jan 6, 2019
319a2c1
add missing derive to fix compile error
frewsxcv Jan 6, 2019
bbbabdf
Update cmp.rs
frewsxcv Jan 6, 2019
6c60662
Use correct tracking issue for c_variadic
eqrion Jan 4, 2019
423a5bb
add comment explaining what the derive does
frewsxcv Jan 12, 2019
1445a06
bring back the example i removed, also add symmetry and simplify impl
frewsxcv Jan 12, 2019
0394dce
whitespace
frewsxcv Jan 12, 2019
ebdd072
resolve: Add a test for issue #57539
petrochenkov Jan 12, 2019
c663272
Support passing cflags/cxxflags/ldflags to LLVM build
petrhosek Nov 14, 2018
f4ded5b
Add a regression test for mutating a non-mut #[thread_local]
mjbshaw Dec 24, 2018
e459000
Make privacy checking, intrinsic checking and liveness checking incre…
Zoxc Jun 8, 2018
e301f90
Address comments
Zoxc Jan 14, 2019
8ef7413
Optimize try_mark_green and eliminate the lock on dep node colors
Zoxc Dec 22, 2018
1313678
Address comments
Zoxc Jan 15, 2019
93b5536
use structured macro and path resolve suggestions
euclio Jan 15, 2019
ed717f3
Fix sources sidebar not showing up
GuillaumeGomez Jan 15, 2019
6046be4
fix nested matchers with ?
mark-i-m Jan 14, 2019
dabe86d
update/add tests
mark-i-m Jan 15, 2019
24ca530
Move spin_loop_hint to core::hint module
Dec 19, 2018
feda604
Fixes text becoming invisible when element targetted
GuillaumeGomez Jan 15, 2019
aa1ce32
update test output
mark-i-m Jan 15, 2019
32b2834
demonstrate symmetry
frewsxcv Jan 16, 2019
bd8ee51
Add some links in std::fs.
ehuss Jan 16, 2019
1a51bb8
OSX: fix #57534 registering thread dtors while running thread dtors
mtak- Jan 16, 2019
0772dbb
Fix release manifest generation
Jan 16, 2019
01d0ae9
Prioritize variants as inherent associated items during name resolution
petrochenkov Jan 10, 2019
4d6bd05
Rollup merge of #56594 - sdroege:c_void-is-not-never, r=TimNN
Centril Jan 17, 2019
621b0dd
Rollup merge of #56996 - clarcharr:spin_loop_hint, r=KodrAus
Centril Jan 17, 2019
d552d34
Rollup merge of #57065 - Zoxc:graph-tweaks, r=michaelwoerister
Centril Jan 17, 2019
adf7163
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
Centril Jan 17, 2019
51cfa49
Rollup merge of #57253 - Zoxc:incr-passes2, r=michaelwoerister
Centril Jan 17, 2019
2fb815c
Rollup merge of #57268 - peterhj:peterhj-optmergefunc, r=nagisa
Centril Jan 17, 2019
9ba024b
Rollup merge of #57340 - eqrion:doc/c_variadic, r=Mark-Simulacrum
Centril Jan 17, 2019
2e4392e
Rollup merge of #57357 - frewsxcv:frewsxcv-partial-eq, r=QuietMisdreavus
Centril Jan 17, 2019
8b38c28
Rollup merge of #57370 - petrhosek:llvm-flags, r=alexcrichton
Centril Jan 17, 2019
fb4ba9a
Rollup merge of #57501 - petrochenkov:highvar, r=alexreg
Centril Jan 17, 2019
f941a92
Rollup merge of #57551 - petrochenkov:regrtest, r=nikomatsakis
Centril Jan 17, 2019
02a1295
Rollup merge of #57610 - mark-i-m:nested-matchers, r=petrochenkov
Centril Jan 17, 2019
d35b6e2
Rollup merge of #57635 - euclio:path-separators, r=michaelwoerister
Centril Jan 17, 2019
bf39858
Rollup merge of #57636 - GuillaumeGomez:fix-sources-sidebar, r=QuietM…
Centril Jan 17, 2019
ff03bcd
Rollup merge of #57646 - GuillaumeGomez:fix-css, r=QuietMisdreavus
Centril Jan 17, 2019
4c9a7c5
Rollup merge of #57654 - ehuss:fs-links, r=alexcrichton
Centril Jan 17, 2019
38a0a02
Rollup merge of #57655 - mtak-:fix-tls-dtors-macos, r=alexcrichton
Centril Jan 17, 2019
a9c7eb4
Rollup merge of #57659 - jethrogb:jb/release-manifest, r=alexcrichton
Centril Jan 17, 2019
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ define_dep_nodes!( <'tcx>
[] CheckModLoops(DefId),
[] CheckModUnstableApiUsage(DefId),
[] CheckModItemTypes(DefId),
[] CheckModPrivacy(DefId),
[] CheckModIntrinsics(DefId),
[] CheckModLiveness(DefId),
[] CollectModItemTypes(DefId),

[] Reachability,
Expand Down
15 changes: 15 additions & 0 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,21 @@ impl<'hir> Map<'hir> {
&self.forest.krate.attrs
}

pub fn get_module(&self, module: DefId) -> (&'hir Mod, Span, NodeId)
{
let node_id = self.as_local_node_id(module).unwrap();
self.read(node_id);
match self.find_entry(node_id).unwrap().node {
Node::Item(&Item {
span,
node: ItemKind::Mod(ref m),
..
}) => (m, span, node_id),
Node::Crate => (&self.forest.krate.module, self.forest.krate.span, node_id),
_ => panic!("not a module")
}
}

pub fn visit_item_likes_in_module<V>(&self, module: DefId, visitor: &mut V)
where V: ItemLikeVisitor<'hir>
{
Expand Down
20 changes: 17 additions & 3 deletions src/librustc/middle/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use hir::def::Def;
use hir::def_id::DefId;
use ty::{self, Ty, TyCtxt};
use ty::layout::{LayoutError, Pointer, SizeSkeleton, VariantIdx};
use ty::query::{Providers, queries};

use rustc_target::spec::abi::Abi::RustIntrinsic;
use rustc_data_structures::indexed_vec::Idx;
Expand All @@ -10,10 +11,23 @@ use hir::intravisit::{self, Visitor, NestedVisitorMap};
use hir;

pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
let mut visitor = ItemVisitor {
tcx,
for &module in tcx.hir().krate().modules.keys() {
queries::check_mod_intrinsics::ensure(tcx, tcx.hir().local_def_id(module));
}
}

fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module(
module_def_id,
&mut ItemVisitor { tcx }.as_deep_visitor()
);
}

pub fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
check_mod_intrinsics,
..*providers
};
tcx.hir().krate().visit_all_item_likes(&mut visitor.as_deep_visitor());
}

struct ItemVisitor<'a, 'tcx: 'a> {
Expand Down
19 changes: 17 additions & 2 deletions src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ use self::VarKind::*;
use hir::def::*;
use hir::Node;
use ty::{self, TyCtxt};
use ty::query::{Providers, queries};
use lint;
use errors::Applicability;
use util::nodemap::{NodeMap, HirIdMap, HirIdSet};
Expand All @@ -114,8 +115,9 @@ use syntax::ptr::P;
use syntax::symbol::keywords;
use syntax_pos::Span;

use hir::{Expr, HirId};
use hir;
use hir::{Expr, HirId};
use hir::def_id::DefId;
use hir::intravisit::{self, Visitor, FnKind, NestedVisitorMap};

/// For use with `propagate_through_loop`.
Expand Down Expand Up @@ -179,11 +181,24 @@ impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'a, 'tcx> {
fn visit_arm(&mut self, a: &'tcx hir::Arm) { visit_arm(self, a); }
}

fn check_mod_liveness<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module(module_def_id, &mut IrMaps::new(tcx).as_deep_visitor());
}

pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
tcx.hir().krate().visit_all_item_likes(&mut IrMaps::new(tcx).as_deep_visitor());
for &module in tcx.hir().krate().modules.keys() {
queries::check_mod_liveness::ensure(tcx, tcx.hir().local_def_id(module));
}
tcx.sess.abort_if_errors();
}

pub fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
check_mod_liveness,
..*providers
};
}

impl fmt::Debug for LiveNode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ln({})", self.get())
Expand Down
27 changes: 27 additions & 0 deletions src/librustc/ty/query/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,33 @@ impl<'tcx> QueryDescription<'tcx> for queries::check_mod_item_types<'tcx> {
}
}

impl<'tcx> QueryDescription<'tcx> for queries::check_mod_privacy<'tcx> {
fn describe(
tcx: TyCtxt<'_, '_, '_>,
key: DefId,
) -> Cow<'static, str> {
format!("checking privacy in {}", key.describe_as_module(tcx)).into()
}
}

impl<'tcx> QueryDescription<'tcx> for queries::check_mod_intrinsics<'tcx> {
fn describe(
tcx: TyCtxt<'_, '_, '_>,
key: DefId,
) -> Cow<'static, str> {
format!("checking intrinsics in {}", key.describe_as_module(tcx)).into()
}
}

impl<'tcx> QueryDescription<'tcx> for queries::check_mod_liveness<'tcx> {
fn describe(
tcx: TyCtxt<'_, '_, '_>,
key: DefId,
) -> Cow<'static, str> {
format!("checking liveness of variables in {}", key.describe_as_module(tcx)).into()
}
}

impl<'tcx> QueryDescription<'tcx> for queries::collect_mod_item_types<'tcx> {
fn describe(
tcx: TyCtxt<'_, '_, '_>,
Expand Down
6 changes: 6 additions & 0 deletions src/librustc/ty/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ define_queries! { <'tcx>

[] fn check_mod_item_types: CheckModItemTypes(DefId) -> (),

[] fn check_mod_privacy: CheckModPrivacy(DefId) -> (),

[] fn check_mod_intrinsics: CheckModIntrinsics(DefId) -> (),

[] fn check_mod_liveness: CheckModLiveness(DefId) -> (),

[] fn collect_mod_item_types: CollectModItemTypes(DefId) -> (),

/// Caches CoerceUnsized kinds for impls on custom types.
Expand Down
3 changes: 3 additions & 0 deletions src/librustc/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,9 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
DepKind::CheckModLoops => { force!(check_mod_loops, def_id!()); }
DepKind::CheckModUnstableApiUsage => { force!(check_mod_unstable_api_usage, def_id!()); }
DepKind::CheckModItemTypes => { force!(check_mod_item_types, def_id!()); }
DepKind::CheckModPrivacy => { force!(check_mod_privacy, def_id!()); }
DepKind::CheckModIntrinsics => { force!(check_mod_intrinsics, def_id!()); }
DepKind::CheckModLiveness => { force!(check_mod_liveness, def_id!()); }
DepKind::CollectModItemTypes => { force!(collect_mod_item_types, def_id!()); }
DepKind::Reachability => { force!(reachable_set, LOCAL_CRATE); }
DepKind::MirKeys => { force!(mir_keys, LOCAL_CRATE); }
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,8 @@ pub fn default_provide(providers: &mut ty::query::Providers) {
ty::provide(providers);
traits::provide(providers);
stability::provide(providers);
middle::intrinsicck::provide(providers);
middle::liveness::provide(providers);
reachable::provide(providers);
rustc_passes::provide(providers);
rustc_traits::provide(providers);
Expand Down
46 changes: 33 additions & 13 deletions src/librustc_privacy/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ use rustc::lint;
use rustc::middle::privacy::{AccessLevel, AccessLevels};
use rustc::ty::{self, TyCtxt, Ty, TraitRef, TypeFoldable, GenericParamDefKind};
use rustc::ty::fold::TypeVisitor;
use rustc::ty::query::Providers;
use rustc::ty::query::{Providers, queries};
use rustc::ty::subst::Substs;
use rustc::util::nodemap::NodeSet;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync::Lrc;
use syntax::ast::{self, CRATE_NODE_ID, Ident};
use syntax::ast::{self, DUMMY_NODE_ID, Ident};
use syntax::attr;
use syntax::symbol::keywords;
use syntax_pos::Span;
Expand Down Expand Up @@ -782,6 +782,11 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> {
NestedVisitorMap::All(&self.tcx.hir())
}

fn visit_mod(&mut self, _m: &'tcx hir::Mod, _s: Span, _n: ast::NodeId) {
// Don't visit nested modules, since we run a separate visitor walk
// for each module in `privacy_access_levels`
}

fn visit_nested_body(&mut self, body: hir::BodyId) {
let orig_tables = mem::replace(&mut self.tables, self.tcx.body_tables(body));
let body = self.tcx.hir().body(body);
Expand Down Expand Up @@ -917,6 +922,11 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
NestedVisitorMap::All(&self.tcx.hir())
}

fn visit_mod(&mut self, _m: &'tcx hir::Mod, _s: Span, _n: ast::NodeId) {
// Don't visit nested modules, since we run a separate visitor walk
// for each module in `privacy_access_levels`
}

fn visit_nested_body(&mut self, body: hir::BodyId) {
let orig_tables = mem::replace(&mut self.tables, self.tcx.body_tables(body));
let orig_in_body = mem::replace(&mut self.in_body, true);
Expand Down Expand Up @@ -1659,6 +1669,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx>
pub fn provide(providers: &mut Providers) {
*providers = Providers {
privacy_access_levels,
check_mod_privacy,
..*providers
};
}
Expand All @@ -1667,34 +1678,43 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Lrc<AccessLevels> {
tcx.privacy_access_levels(LOCAL_CRATE)
}

fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
krate: CrateNum)
-> Lrc<AccessLevels> {
assert_eq!(krate, LOCAL_CRATE);

let krate = tcx.hir().krate();
fn check_mod_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
let empty_tables = ty::TypeckTables::empty(None);

// Check privacy of names not checked in previous compilation stages.
let mut visitor = NamePrivacyVisitor {
tcx,
tables: &empty_tables,
current_item: CRATE_NODE_ID,
current_item: DUMMY_NODE_ID,
empty_tables: &empty_tables,
};
intravisit::walk_crate(&mut visitor, krate);
let (module, span, node_id) = tcx.hir().get_module(module_def_id);
intravisit::walk_mod(&mut visitor, module, node_id);

// Check privacy of explicitly written types and traits as well as
// inferred types of expressions and patterns.
let mut visitor = TypePrivacyVisitor {
tcx,
tables: &empty_tables,
current_item: DefId::local(CRATE_DEF_INDEX),
current_item: module_def_id,
in_body: false,
span: krate.span,
span,
empty_tables: &empty_tables,
};
intravisit::walk_crate(&mut visitor, krate);
intravisit::walk_mod(&mut visitor, module, node_id);
}

fn privacy_access_levels<'tcx>(
tcx: TyCtxt<'_, 'tcx, 'tcx>,
krate: CrateNum,
) -> Lrc<AccessLevels> {
assert_eq!(krate, LOCAL_CRATE);

let krate = tcx.hir().krate();

for &module in krate.modules.keys() {
queries::check_mod_privacy::ensure(tcx, tcx.hir().local_def_id(module));
}

// Build up a set of all exported items in the AST. This is a set of all
// items which are reachable from external crates based on visibility.
Expand Down