Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
897d278
libstd: Fix typos in doc
rick68 Sep 10, 2019
00d9db1
Added doc about behavior of extend on HashMap
Kixunil Oct 3, 2019
70c14dd
Move const generic regression tests to their old folder
varkor Oct 7, 2019
5e65e2b
Add a regression test for issue 62187
varkor Oct 7, 2019
2328a7e
Move stray issue tests into src/test/ui/issues
varkor Oct 7, 2019
4eba21e
Add regression test for #64792
varkor Oct 7, 2019
85b7aa2
Add a regression test for #57399
varkor Oct 7, 2019
c990744
Add a regression test for #57271
varkor Oct 7, 2019
5808971
Add ?Sized bound to a supertrait listing in E0038 error documentation
sugar700 Oct 8, 2019
2afd277
Fix calling function pointer const parameters. Also fixes inference of
skinnyBat Oct 1, 2019
a59eb6d
Pretty print function pointer const values.
skinnyBat Oct 2, 2019
cf3b561
Gate use of raw and function pointers in const generics behind
skinnyBat Oct 4, 2019
43badf9
Substitute and normalize all types of consts within collect const
skinnyBat Oct 4, 2019
9677cbe
Refactor pretty print const to use a big match statement
skinnyBat Oct 4, 2019
50ea5f4
Fix reify_fn_ptr test as we now pretty print const function pointers.
skinnyBat Oct 5, 2019
16b7f44
Update feature gate error message
skinnyBat Oct 7, 2019
5986fe2
Update ui tests
skinnyBat Oct 8, 2019
7dc4bf4
Change incorrect trait name in E0038 error documentation
sugar700 Oct 8, 2019
3f9d834
Add failing example for Self in supertrait listing in E0038 documenta…
sugar700 Oct 9, 2019
9dbd7be
Cache the DepNodeIndex of upstream crates in order to avoid multiple …
michaelwoerister Oct 9, 2019
003d5a6
self-profiling: Add events for tracking crate metadata loading relate…
michaelwoerister Oct 9, 2019
0ee6a96
Remove some outdated comments about dependency tracking from cstore_i…
michaelwoerister Oct 9, 2019
89cc046
Pretty print raw pointers in consts as '{pointer}'.
skinnyBat Oct 9, 2019
4bb1592
Suggest `if let` on `let` refutable binding
estebank Oct 9, 2019
af3f8de
Delegate is_{freeze,copy,sized}_raw to is_item_raw
mbStavola Oct 10, 2019
ee08114
Qualify LangItem
mbStavola Oct 10, 2019
a9853fc
Add 'unlikely' annotation to branch in crate DepNodeIndex caching.
michaelwoerister Oct 10, 2019
a185061
Sort long error code explanation by error code
GuillaumeGomez Oct 10, 2019
019fba8
Uncomment E0386 to let users have access to its old definition
GuillaumeGomez Oct 10, 2019
8569dd1
Preserve output of raw pointers in mir dump.
skinnyBat Oct 10, 2019
19bc0a8
Mark Path::join as must_use
matklad Oct 10, 2019
847ad6a
Add long error explanation for E0568
GuillaumeGomez Oct 8, 2019
3c62bdc
Update ui tests
GuillaumeGomez Oct 8, 2019
fb392c5
Don't cc rust-lang/compiler for toolstate changes
varkor Oct 10, 2019
9f69420
query generator kind for error reporting
csmoe Oct 10, 2019
e8af4c1
resolve: Mark macros starting with an underscore as used
petrochenkov Oct 9, 2019
1270140
expand: Simplify expansion of derives
petrochenkov Oct 9, 2019
ceb4c3f
stability: Do not use `buffer_lint` after lowering to HIR
petrochenkov Oct 10, 2019
06a02b5
Unification and cleanup of librustc_mir error codes
GuillaumeGomez Oct 10, 2019
c97d715
Fix issue 65284
varkor Oct 10, 2019
4fde07d
Rollup merge of #64337 - rick68:patch-17, r=Dylan-DPC
tmandry Oct 11, 2019
54769b0
Rollup merge of #64986 - skinny121:fn-ptr-const-generics, r=varkor
tmandry Oct 11, 2019
a12b9c0
Rollup merge of #65048 - Kixunil:patch-1, r=KodrAus
tmandry Oct 11, 2019
ece23fc
Rollup merge of #65191 - varkor:const-generics-test-cases, r=nikomats…
tmandry Oct 11, 2019
c4a9302
Rollup merge of #65200 - xfix:patch-20, r=GuillaumeGomez
tmandry Oct 11, 2019
b37301a
Rollup merge of #65205 - GuillaumeGomez:long-err-explanation-E0568, r…
tmandry Oct 11, 2019
5d55d46
Rollup merge of #65240 - michaelwoerister:sp-review-3, r=Mark-Simulacrum
tmandry Oct 11, 2019
f0dbdd6
Rollup merge of #65248 - estebank:mention-if-let, r=cramertj
tmandry Oct 11, 2019
4180187
Rollup merge of #65252 - petrochenkov:deriveholders2, r=matthewjasper
tmandry Oct 11, 2019
4e7633d
Rollup merge of #65263 - mbStavola:dedup-raw-item-fns, r=Centril
tmandry Oct 11, 2019
1d70283
Rollup merge of #65265 - GuillaumeGomez:cleanup-librustc_mir-err-code…
tmandry Oct 11, 2019
8be5481
Rollup merge of #65266 - rust-lang:must-use-join, r=dtolnay
tmandry Oct 11, 2019
f1d2d95
Rollup merge of #65276 - varkor:toolstate-no-ping, r=Mark-Simulacrum
tmandry Oct 11, 2019
2252ea1
Rollup merge of #65277 - csmoe:fix-move, r=estebank
tmandry Oct 11, 2019
1cecbff
Rollup merge of #65283 - petrochenkov:softstab2, r=estebank
tmandry Oct 11, 2019
9f143a7
Rollup merge of #65289 - varkor:issue-65284, r=estebank
tmandry Oct 11, 2019
1f8aa05
Rollup merge of #64337 - rick68:patch-17, r=Dylan-DPC
tmandry Oct 11, 2019
5670c7f
Rollup merge of #64986 - skinny121:fn-ptr-const-generics, r=varkor
tmandry Oct 11, 2019
b851efb
Rollup merge of #65048 - Kixunil:patch-1, r=KodrAus
tmandry Oct 11, 2019
c2e7af5
Rollup merge of #65191 - varkor:const-generics-test-cases, r=nikomats…
tmandry Oct 11, 2019
873f251
Rollup merge of #65200 - xfix:patch-20, r=GuillaumeGomez
tmandry Oct 11, 2019
b5c4a82
Rollup merge of #65205 - GuillaumeGomez:long-err-explanation-E0568, r…
tmandry Oct 11, 2019
f55e9b9
Rollup merge of #65263 - mbStavola:dedup-raw-item-fns, r=Centril
tmandry Oct 11, 2019
d26439d
Rollup merge of #65266 - rust-lang:must-use-join, r=dtolnay
tmandry Oct 11, 2019
7ed57bb
Rollup merge of #65276 - varkor:toolstate-no-ping, r=Mark-Simulacrum
tmandry Oct 11, 2019
d2501c2
Rollup merge of #65277 - csmoe:fix-move, r=estebank
tmandry Oct 11, 2019
1346802
Rollup merge of #65283 - petrochenkov:softstab2, r=estebank
tmandry Oct 11, 2019
c7c6cbf
Rollup merge of #65297 - tmandry:rollup-pe7a2i2, r=tmandry
tmandry Oct 11, 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
Prev Previous commit
Next Next commit
Cache the DepNodeIndex of upstream crates in order to avoid multiple …
…locks and table lookups on each access of crate metadata.
  • Loading branch information
michaelwoerister committed Oct 9, 2019
commit 9dbd7be70f8b09aad232d5c4eda684cff622102d
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rustc_index::newtype_index! {
}

impl DepNodeIndex {
const INVALID: DepNodeIndex = DepNodeIndex::MAX;
pub const INVALID: DepNodeIndex = DepNodeIndex::MAX;
}

#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
Expand Down
6 changes: 4 additions & 2 deletions src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
use crate::cstore::{self, CStore, CrateSource, MetadataBlob};
use crate::locator::{self, CratePaths};
use crate::schema::{CrateRoot, CrateDep};
use rustc_data_structures::sync::{Lrc, RwLock, Lock};
use rustc_data_structures::sync::{Lrc, RwLock, Lock, AtomicCell};

use rustc::hir::def_id::CrateNum;
use rustc_data_structures::svh::Svh;
use rustc::dep_graph::DepNodeIndex;
use rustc::middle::cstore::DepKind;
use rustc::mir::interpret::AllocDecodingState;
use rustc::session::{Session, CrateDisambiguator};
Expand Down Expand Up @@ -271,7 +272,8 @@ impl<'a> CrateLoader<'a> {
},
private_dep,
span,
raw_proc_macros
raw_proc_macros,
dep_node_index: AtomicCell::new(DepNodeIndex::INVALID),
};

let cmeta = Lrc::new(cmeta);
Expand Down
10 changes: 9 additions & 1 deletion src/librustc_metadata/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
// crates and libraries

use crate::schema;
use rustc::dep_graph::DepNodeIndex;
use rustc::hir::def_id::{CrateNum, DefIndex};
use rustc::hir::map::definitions::DefPathTable;
use rustc::middle::cstore::{DepKind, ExternCrate, MetadataLoader};
use rustc::mir::interpret::AllocDecodingState;
use rustc_index::vec::IndexVec;
use rustc::util::nodemap::{FxHashMap, NodeMap};

use rustc_data_structures::sync::{Lrc, RwLock, Lock};
use rustc_data_structures::sync::{Lrc, RwLock, Lock, AtomicCell};
use syntax::ast;
use syntax::ext::base::SyntaxExtension;
use syntax_pos;
Expand Down Expand Up @@ -83,6 +84,13 @@ pub struct CrateMetadata {
pub span: Span,

pub raw_proc_macros: Option<&'static [ProcMacro]>,

/// The `DepNodeIndex` of the `DepNode` representing this upstream crate.
/// It is initialized on the first access in `get_crate_dep_node_index()`.
/// Do not access the value directly, as it might not have been initialized
/// yet.
/// The field must always be initialized to `DepNodeIndex::INVALID`.
pub(super) dep_node_index: AtomicCell<DepNodeIndex>,
}

pub struct CStore {
Expand Down
16 changes: 6 additions & 10 deletions src/librustc_metadata/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,15 @@ macro_rules! provide {
let ($def_id, $other) = def_id_arg.into_args();
assert!(!$def_id.is_local());

let def_path_hash = $tcx.def_path_hash(DefId {
krate: $def_id.krate,
index: CRATE_DEF_INDEX
});
let dep_node = def_path_hash
.to_dep_node(rustc::dep_graph::DepKind::CrateMetadata);
// The DepNodeIndex of the DepNode::CrateMetadata should be
// cached somewhere, so that we can use read_index().
$tcx.dep_graph.read(dep_node);

let $cdata = $tcx.crate_data_as_rc_any($def_id.krate);
let $cdata = $cdata.downcast_ref::<cstore::CrateMetadata>()
.expect("CrateStore created data is not a CrateMetadata");

if $tcx.dep_graph.is_fully_enabled() {
let crate_dep_node_index = $cdata.get_crate_dep_node_index($tcx);
$tcx.dep_graph.read_index(crate_dep_node_index);
}

$compute
})*

Expand Down
25 changes: 25 additions & 0 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use rustc::hir::def::{self, Res, DefKind, CtorOf, CtorKind};
use rustc::hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap;
use rustc::dep_graph::{DepNodeIndex, DepKind};
use rustc::middle::lang_items;
use rustc::mir::{self, interpret};
use rustc::mir::interpret::AllocDecodingSession;
Expand Down Expand Up @@ -1365,6 +1366,30 @@ impl<'a, 'tcx> CrateMetadata {
// This shouldn't borrow twice, but there is no way to downgrade RefMut to Ref.
self.source_map_import_info.borrow()
}

/// Get the `DepNodeIndex` corresponding this crate. The result of this
/// method is cached in the `dep_node_index` field.
pub(super) fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex {
let mut dep_node_index = self.dep_node_index.load();

if dep_node_index == DepNodeIndex::INVALID {
// We have not cached the DepNodeIndex for this upstream crate yet,
// so use the dep-graph to find it out and cache it.
// Note that multiple threads can enter this block concurrently.
// That is fine because the DepNodeIndex remains constant
// throughout the whole compilation session, and multiple stores
// would always write the same value.

let def_path_hash = self.def_path_hash(CRATE_DEF_INDEX);
let dep_node = def_path_hash.to_dep_node(DepKind::CrateMetadata);

dep_node_index = tcx.dep_graph.dep_node_index_of(&dep_node);
assert!(dep_node_index != DepNodeIndex::INVALID);
self.dep_node_index.store(dep_node_index);
}

dep_node_index
}
}

// Cannot be implemented on 'ProcMacro', as libproc_macro
Expand Down