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

Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
f4c59b3
Use `drop_in_place` in `array::IntoIter::drop`
SimonSapin Oct 25, 2019
7550b61
Fix documentation for `Iterator::count()`.
ArturKovacs Nov 4, 2019
6ce3e1d
Fixed trailing whitespace.
ArturKovacs Nov 4, 2019
23be25c
Improve wording in the documentation of `Iterator::count()`.
ArturKovacs Nov 4, 2019
0282c27
rename cfg(rustdoc) into cfg(doc)
GuillaumeGomez Nov 6, 2019
b7c0e46
Add long error explanation for E0623
GuillaumeGomez Nov 7, 2019
ffc1c5a
Update ui tests
GuillaumeGomez Nov 7, 2019
413ab57
docs: Fix link to BufWriter::flush
bryanburgers Nov 8, 2019
1b8b2ee
add raw ptr variant of UnsafeCell::get
RalfJung Nov 9, 2019
8d56bcc
download .tar.xz if python3 is used
Oct 29, 2019
0019371
bootstrap: don't call support_xz in hot-path
Nov 11, 2019
f9f5a88
Add a callback that allows compiler consumers to override queries.
vakaras Nov 11, 2019
e1cf38a
Move injected_panic_runtime to CrateStore
Mark-Simulacrum Nov 11, 2019
2c6d609
Move allocator_kind to CrateStore
Mark-Simulacrum Nov 11, 2019
1aee3e4
Use a relative bindir for rustdoc to find rustc
cuviper Nov 11, 2019
db5fc10
[mir-opt] Turn on the `ConstProp` pass by default
wesleywiser Oct 28, 2019
e8f3a9f
add Result::map_or
tesuji Nov 11, 2019
eb99c73
Match constructor first in Constructor methods
Nadrieril Nov 12, 2019
357d53c
Introduce Constructor::NonExhaustive
Nadrieril Nov 12, 2019
e398d89
Move NonExhaustive checks to the relevant match branches
Nadrieril Nov 12, 2019
ec45882
Add test for issue-30904
JohnTitor Nov 12, 2019
bae9832
Add test for issue-40231
JohnTitor Nov 12, 2019
412f000
Add test for issue-52432
JohnTitor Nov 12, 2019
74d45af
Add test for issue-63279
JohnTitor Nov 12, 2019
bfa5e5f
Fallback to the unmodified path in bindir_relative
cuviper Nov 12, 2019
f696b21
Move self-profile infrastructure to data structures
Mark-Simulacrum Nov 11, 2019
8c29b74
Remove dead code for encoding/decoding lint IDs
Mark-Simulacrum Nov 12, 2019
2fd5454
Register queries with self profiler in rustc_interface
Mark-Simulacrum Nov 12, 2019
6a3a055
Update error_codes.rs
Dylan-DPC Nov 13, 2019
1de094a
Update error_codes.rs
Dylan-DPC Nov 13, 2019
fd868d4
tidy up!
Dylan-DPC Nov 13, 2019
aba385a
Trailing full stop
RalfJung Nov 13, 2019
19ebe2f
clarify why we can do the ptr cast
RalfJung Nov 13, 2019
5b5ae01
expand docs
RalfJung Nov 13, 2019
861698a
make things ugly
RalfJung Nov 13, 2019
c309266
Rollup merge of #65821 - SimonSapin:in-place, r=Amanieu
JohnTitor Nov 13, 2019
36b0aeb
Rollup merge of #65932 - guanqun:download-xz, r=alexcrichton
JohnTitor Nov 13, 2019
bfcf7f6
Rollup merge of #66074 - wesleywiser:test_run_const_prop, r=oli-obk
JohnTitor Nov 13, 2019
7c666a7
Rollup merge of #66094 - ArturKovacs:fix-count-doc, r=Dylan-DPC
JohnTitor Nov 13, 2019
1d89492
Rollup merge of #66166 - GuillaumeGomez:rename-rustdoc-to-doc, r=Quie…
JohnTitor Nov 13, 2019
0395fc7
Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r…
JohnTitor Nov 13, 2019
7c3562c
Rollup merge of #66227 - bryanburgers:bufwriter-docs-fix-flush-link, …
JohnTitor Nov 13, 2019
0310708
Rollup merge of #66248 - RalfJung:unsafe_cell_raw_get, r=SimonSapin
JohnTitor Nov 13, 2019
4a00361
Rollup merge of #66292 - lzutao:result-map_or, r=SimonSapin
JohnTitor Nov 13, 2019
891c054
Rollup merge of #66297 - vakaras:edit-queries, r=oli-obk
JohnTitor Nov 13, 2019
606c2ab
Rollup merge of #66317 - cuviper:bindir_relative, r=Mark-Simulacrum
JohnTitor Nov 13, 2019
92f3558
Rollup merge of #66330 - Nadrieril:nonexhaustive-constructor, r=varkor
JohnTitor Nov 13, 2019
9091d50
Rollup merge of #66331 - JohnTitor:add-tests, r=Centril
JohnTitor Nov 13, 2019
f037024
Rollup merge of #66334 - Mark-Simulacrum:sess-cstore, r=petrochenkov
JohnTitor Nov 13, 2019
23b4fba
Rollup merge of #66335 - Mark-Simulacrum:self-profile-to-data, r=mich…
JohnTitor Nov 13, 2019
96a9511
Rollup merge of #66337 - Mark-Simulacrum:no-decode-lint-id, r=Dylan-DPC
JohnTitor Nov 13, 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
3 changes: 2 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,6 @@ dependencies = [
"graphviz",
"jobserver",
"log",
"measureme",
"num_cpus",
"parking_lot 0.9.0",
"polonius-engine",
Expand Down Expand Up @@ -3470,6 +3469,7 @@ dependencies = [
name = "rustc_data_structures"
version = "0.0.0"
dependencies = [
"bitflags",
"cfg-if",
"crossbeam-utils 0.6.5",
"ena",
Expand All @@ -3478,6 +3478,7 @@ dependencies = [
"jobserver",
"lazy_static 1.3.0",
"log",
"measureme",
"parking_lot 0.9.0",
"rustc-hash",
"rustc-rayon 0.3.0",
Expand Down
1 change: 0 additions & 1 deletion src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ byteorder = { version = "1.3" }
chalk-engine = { version = "0.9.0", default-features=false }
rustc_fs_util = { path = "../librustc_fs_util" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "0.4"
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ pub mod util {
pub mod captures;
pub mod common;
pub mod nodemap;
pub mod profiling;
pub mod bug;
}

Expand Down
3 changes: 1 addition & 2 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ use syntax::source_map;
use syntax::sess::{ParseSess, ProcessCfgMod};
use syntax::symbol::Symbol;
use syntax_pos::{MultiSpan, Span};
use crate::util::profiling::{SelfProfiler, SelfProfilerRef};

use rustc_target::spec::{PanicStrategy, RelroLevel, Target, TargetTriple};
use rustc_data_structures::flock;
use rustc_data_structures::jobserver;
use rustc_data_structures::profiling::{SelfProfiler, SelfProfilerRef};
use ::jobserver::Client;

use std;
Expand Down Expand Up @@ -1091,7 +1091,6 @@ fn build_session_(
);
match profiler {
Ok(profiler) => {
crate::ty::query::QueryName::register_with_profiler(&profiler);
Some(Arc::new(profiler))
},
Err(e) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ use crate::ty::CanonicalPolyFnSig;
use crate::util::common::ErrorReported;
use crate::util::nodemap::{DefIdMap, DefIdSet, ItemLocalMap, ItemLocalSet, NodeMap};
use crate::util::nodemap::{FxHashMap, FxHashSet};
use crate::util::profiling::SelfProfilerRef;

use errors::DiagnosticBuilder;
use arena::SyncDroplessArena;
use smallvec::SmallVec;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_data_structures::stable_hasher::{
HashStable, StableHasher, StableVec, hash_stable_hashmap,
};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/query/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::ty::query::queries;
use crate::ty::query::{Query, QueryName};
use crate::ty::query::QueryCache;
use crate::ty::query::plumbing::CycleError;
use crate::util::profiling::ProfileCategory;
use rustc_data_structures::profiling::ProfileCategory;

use std::borrow::Cow;
use std::hash::Hash;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use crate::ty::util::NeedsDrop;
use crate::ty::subst::SubstsRef;
use crate::util::nodemap::{DefIdSet, DefIdMap};
use crate::util::common::ErrorReported;
use crate::util::profiling::ProfileCategory::*;
use rustc_data_structures::profiling::ProfileCategory::*;

use rustc_data_structures::svh::Svh;
use rustc_index::vec::IndexVec;
Expand Down
16 changes: 14 additions & 2 deletions src/librustc/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ macro_rules! define_queries_inner {
rustc_data_structures::stable_hasher::StableHasher,
ich::StableHashingContext
};
use crate::util::profiling::ProfileCategory;
use rustc_data_structures::profiling::ProfileCategory;

define_queries_struct! {
tcx: $tcx,
Expand Down Expand Up @@ -816,8 +816,20 @@ macro_rules! define_queries_inner {
$($name),*
}

impl rustc_data_structures::profiling::QueryName for QueryName {
fn discriminant(self) -> std::mem::Discriminant<QueryName> {
std::mem::discriminant(&self)
}

fn as_str(self) -> &'static str {
QueryName::as_str(&self)
}
}

impl QueryName {
pub fn register_with_profiler(profiler: &crate::util::profiling::SelfProfiler) {
pub fn register_with_profiler(
profiler: &rustc_data_structures::profiling::SelfProfiler,
) {
$(profiler.register_query_name(QueryName::$name);)*
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc::util::nodemap::FxHashMap;
use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc::ty::TyCtxt;
use rustc::util::common::{time_depth, set_time_depth, print_time_passes_entry};
use rustc::util::profiling::SelfProfilerRef;
use rustc_data_structures::profiling::SelfProfilerRef;
use rustc_fs_util::link_or_copy;
use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::Lrc;
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ rayon-core = { version = "0.3.0", package = "rustc-rayon-core" }
rustc-hash = "1.0.1"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_index = { path = "../librustc_index", package = "rustc_index" }
bitflags = "1.2.1"
measureme = "0.4"

[dependencies.parking_lot]
version = "0.9"
Expand Down
1 change: 1 addition & 0 deletions src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ pub use ena::unify;
pub mod vec_linked_list;
pub mod work_queue;
pub mod fingerprint;
pub mod profiling;

pub struct OnDrop<F: Fn()>(pub F);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use std::sync::Arc;
use std::thread::ThreadId;
use std::u32;

use crate::ty::query::QueryName;

use measureme::{StringId, TimestampKind};

/// MmapSerializatioSink is faster on macOS and Linux
Expand All @@ -20,6 +18,10 @@ type SerializationSink = measureme::FileSerializationSink;

type Profiler = measureme::Profiler<SerializationSink>;

pub trait QueryName: Sized + Copy {
fn discriminant(self) -> Discriminant<Self>;
fn as_str(self) -> &'static str;
}

#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord, PartialOrd)]
pub enum ProfileCategory {
Expand All @@ -32,7 +34,7 @@ pub enum ProfileCategory {
Other,
}

bitflags! {
bitflags::bitflags! {
struct EventFilter: u32 {
const GENERIC_ACTIVITIES = 1 << 0;
const QUERY_PROVIDERS = 1 << 1;
Expand Down Expand Up @@ -137,7 +139,7 @@ impl SelfProfilerRef {
/// Start profiling a query provider. Profiling continues until the
/// TimingGuard returned from this call is dropped.
#[inline(always)]
pub fn query_provider(&self, query_name: QueryName) -> TimingGuard<'_> {
pub fn query_provider(&self, query_name: impl QueryName) -> TimingGuard<'_> {
self.exec(EventFilter::QUERY_PROVIDERS, |profiler| {
let event_id = SelfProfiler::get_query_name_string_id(query_name);
TimingGuard::start(profiler, profiler.query_event_kind, event_id)
Expand All @@ -146,7 +148,7 @@ impl SelfProfilerRef {

/// Record a query in-memory cache hit.
#[inline(always)]
pub fn query_cache_hit(&self, query_name: QueryName) {
pub fn query_cache_hit(&self, query_name: impl QueryName) {
self.non_guard_query_event(
|profiler| profiler.query_cache_hit_event_kind,
query_name,
Expand All @@ -159,7 +161,7 @@ impl SelfProfilerRef {
/// Profiling continues until the TimingGuard returned from this call is
/// dropped.
#[inline(always)]
pub fn query_blocked(&self, query_name: QueryName) -> TimingGuard<'_> {
pub fn query_blocked(&self, query_name: impl QueryName) -> TimingGuard<'_> {
self.exec(EventFilter::QUERY_BLOCKED, |profiler| {
let event_id = SelfProfiler::get_query_name_string_id(query_name);
TimingGuard::start(profiler, profiler.query_blocked_event_kind, event_id)
Expand All @@ -170,7 +172,7 @@ impl SelfProfilerRef {
/// incremental compilation on-disk cache. Profiling continues until the
/// TimingGuard returned from this call is dropped.
#[inline(always)]
pub fn incr_cache_loading(&self, query_name: QueryName) -> TimingGuard<'_> {
pub fn incr_cache_loading(&self, query_name: impl QueryName) -> TimingGuard<'_> {
self.exec(EventFilter::INCR_CACHE_LOADS, |profiler| {
let event_id = SelfProfiler::get_query_name_string_id(query_name);
TimingGuard::start(
Expand All @@ -185,7 +187,7 @@ impl SelfProfilerRef {
fn non_guard_query_event(
&self,
event_kind: fn(&SelfProfiler) -> StringId,
query_name: QueryName,
query_name: impl QueryName,
event_filter: EventFilter,
timestamp_kind: TimestampKind
) {
Expand All @@ -203,6 +205,12 @@ impl SelfProfilerRef {
TimingGuard::none()
}));
}

pub fn register_queries(&self, f: impl FnOnce(&SelfProfiler)) {
if let Some(profiler) = &self.profiler {
f(&profiler)
}
}
}

pub struct SelfProfiler {
Expand Down Expand Up @@ -274,15 +282,15 @@ impl SelfProfiler {
})
}

fn get_query_name_string_id(query_name: QueryName) -> StringId {
fn get_query_name_string_id(query_name: impl QueryName) -> StringId {
let discriminant = unsafe {
mem::transmute::<Discriminant<QueryName>, u64>(mem::discriminant(&query_name))
mem::transmute::<Discriminant<_>, u64>(query_name.discriminant())
};

StringId::reserved(discriminant as u32)
}

pub fn register_query_name(&self, query_name: QueryName) {
pub fn register_query_name(&self, query_name: impl QueryName) {
let id = SelfProfiler::get_query_name_string_id(query_name);
self.profiler.alloc_string_with_reserved_id(id, query_name.as_str());
}
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_interface/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ pub fn create_session(
process_configure_mod,
);

sess.prof.register_queries(|profiler| {
rustc::ty::query::QueryName::register_with_profiler(&profiler);
});

let codegen_backend = get_codegen_backend(&sess);

let mut cfg = config::build_configuration(&sess, config::to_crate_config(cfg));
Expand Down