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 14 pull requests #66366

Merged
merged 47 commits into from
Nov 13, 2019
Merged
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
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
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
4ac230a
Rollup merge of #65932 - guanqun:download-xz, r=alexcrichton
JohnTitor Nov 13, 2019
e365d5a
Rollup merge of #66094 - ArturKovacs:fix-count-doc, r=Dylan-DPC
JohnTitor Nov 13, 2019
6eea500
Rollup merge of #66166 - GuillaumeGomez:rename-rustdoc-to-doc, r=Quie…
JohnTitor Nov 13, 2019
be3fcf4
Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r…
JohnTitor Nov 13, 2019
fac0982
Rollup merge of #66227 - bryanburgers:bufwriter-docs-fix-flush-link, …
JohnTitor Nov 13, 2019
689cc04
Rollup merge of #66248 - RalfJung:unsafe_cell_raw_get, r=SimonSapin
JohnTitor Nov 13, 2019
961d51d
Rollup merge of #66292 - lzutao:result-map_or, r=SimonSapin
JohnTitor Nov 13, 2019
c75a48a
Rollup merge of #66297 - vakaras:edit-queries, r=oli-obk
JohnTitor Nov 13, 2019
1cbd34f
Rollup merge of #66317 - cuviper:bindir_relative, r=Mark-Simulacrum
JohnTitor Nov 13, 2019
60ba5c7
Rollup merge of #66330 - Nadrieril:nonexhaustive-constructor, r=varkor
JohnTitor Nov 13, 2019
5683fe5
Rollup merge of #66331 - JohnTitor:add-tests, r=Centril
JohnTitor Nov 13, 2019
f735cd2
Rollup merge of #66334 - Mark-Simulacrum:sess-cstore, r=petrochenkov
JohnTitor Nov 13, 2019
fab583b
Rollup merge of #66335 - Mark-Simulacrum:self-profile-to-data, r=mich…
JohnTitor Nov 13, 2019
d52dafd
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
Prev Previous commit
Next Next commit
Move allocator_kind to CrateStore
Similarly to the previous commit, there's no need for this to be in
Session and have a Once around it.
Mark-Simulacrum committed Nov 11, 2019
commit 2c6d6094840cd88422f50b2c7972199a00578319
2 changes: 2 additions & 0 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ use std::path::{Path, PathBuf};
use syntax::ast;
use syntax::symbol::Symbol;
use syntax_pos::Span;
use syntax::expand::allocator::AllocatorKind;
use rustc_target::spec::Target;
use rustc_data_structures::sync::{self, MetadataRef};
use rustc_macros::HashStable;
@@ -228,6 +229,7 @@ pub trait CrateStore {
fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata;
fn metadata_encoding_version(&self) -> &[u8];
fn injected_panic_runtime(&self) -> Option<CrateNum>;
fn allocator_kind(&self) -> Option<AllocatorKind>;
}

pub type CrateStoreDyn = dyn CrateStore + sync::Sync;
7 changes: 0 additions & 7 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@ use errors::emitter::{Emitter, EmitterWriter};
use errors::emitter::HumanReadableErrorType;
use errors::annotate_snippet_emitter_writer::{AnnotateSnippetEmitterWriter};
use syntax::edition::Edition;
use syntax::expand::allocator::AllocatorKind;
use syntax::feature_gate::{self, AttributeType};
use syntax::json::JsonEmitter;
use syntax::source_map;
@@ -100,11 +99,6 @@ pub struct Session {
/// The maximum number of stackframes allowed in const eval.
pub const_eval_stack_frame_limit: usize,

/// The `metadata::creader` module may inject an allocator/`panic_runtime`
/// dependency if it didn't already find one, and this tracks what was
/// injected.
pub allocator_kind: Once<Option<AllocatorKind>>,

/// Map from imported macro spans (which consist of
/// the localized span for the macro body) to the
/// macro name and definition span in the source crate.
@@ -1179,7 +1173,6 @@ fn build_session_(
recursion_limit: Once::new(),
type_length_limit: Once::new(),
const_eval_stack_frame_limit: 100,
allocator_kind: Once::new(),
imported_macro_spans: OneThread::new(RefCell::new(FxHashMap::default())),
incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)),
cgu_reuse_tracker,
5 changes: 5 additions & 0 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
@@ -75,6 +75,7 @@ use syntax::source_map::MultiSpan;
use syntax::feature_gate;
use syntax::symbol::{Symbol, kw, sym};
use syntax_pos::Span;
use syntax::expand::allocator::AllocatorKind;

pub struct AllArenas {
pub interner: SyncDroplessArena,
@@ -1342,6 +1343,10 @@ impl<'tcx> TyCtxt<'tcx> {
self.cstore.injected_panic_runtime()
}

pub fn allocator_kind(self) -> Option<AllocatorKind> {
self.cstore.allocator_kind()
}

pub fn features(self) -> &'tcx feature_gate::Features {
self.features_query(LOCAL_CRATE)
}
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/back/symbol_export.rs
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ fn exported_symbols_provider_local(
symbols.push((exported_symbol, SymbolExportLevel::C));
}

if tcx.sess.allocator_kind.get().is_some() {
if tcx.allocator_kind().is_some() {
for method in ALLOCATOR_METHODS {
let symbol_name = format!("__rust_{}", method.name);
let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(&symbol_name));
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/base.rs
Original file line number Diff line number Diff line change
@@ -549,7 +549,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
});
let allocator_module = if any_dynamic_crate {
None
} else if let Some(kind) = *tcx.sess.allocator_kind.get() {
} else if let Some(kind) = tcx.allocator_kind() {
let llmod_id = cgu_name_builder.build_cgu_name(LOCAL_CRATE,
&["crate"],
Some("allocator")).to_string();
10 changes: 5 additions & 5 deletions src/librustc_metadata/creader.rs
Original file line number Diff line number Diff line change
@@ -722,7 +722,7 @@ impl<'a> CrateLoader<'a> {
}
}

fn inject_allocator_crate(&self, krate: &ast::Crate) {
fn inject_allocator_crate(&mut self, krate: &ast::Crate) {
let has_global_allocator = match &*global_allocator_spans(krate) {
[span1, span2, ..] => {
self.sess.struct_span_err(*span2, "cannot define multiple global allocators")
@@ -742,7 +742,7 @@ impl<'a> CrateLoader<'a> {
needs_allocator = needs_allocator || data.root.needs_allocator;
});
if !needs_allocator {
self.sess.allocator_kind.set(None);
self.cstore.allocator_kind = None;
return
}

@@ -758,7 +758,7 @@ impl<'a> CrateLoader<'a> {
}
});
if all_rlib {
self.sess.allocator_kind.set(None);
self.cstore.allocator_kind = None;
return
}

@@ -795,7 +795,7 @@ impl<'a> CrateLoader<'a> {
}
});
if global_allocator.is_some() {
self.sess.allocator_kind.set(Some(AllocatorKind::Global));
self.cstore.allocator_kind = Some(AllocatorKind::Global);
return
}

@@ -816,7 +816,7 @@ impl<'a> CrateLoader<'a> {
add `#[global_allocator]` to a static item \
that implements the GlobalAlloc trait.");
}
self.sess.allocator_kind.set(Some(AllocatorKind::DefaultLib));
self.cstore.allocator_kind = Some(AllocatorKind::DefaultLib);
}

fn inject_dependency_if(&self,
3 changes: 3 additions & 0 deletions src/librustc_metadata/cstore.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ use rustc_data_structures::svh::Svh;
use syntax::ast;
use syntax::edition::Edition;
use syntax_expand::base::SyntaxExtension;
use syntax::expand::allocator::AllocatorKind;
use syntax_pos;
use proc_macro::bridge::client::ProcMacro;

@@ -102,6 +103,7 @@ crate struct CrateMetadata {
pub struct CStore {
metas: IndexVec<CrateNum, Option<Lrc<CrateMetadata>>>,
pub(crate) injected_panic_runtime: Option<CrateNum>,
pub(crate) allocator_kind: Option<AllocatorKind>,
}

pub enum LoadedMacro {
@@ -118,6 +120,7 @@ impl Default for CStore {
// `None`.
metas: IndexVec::from_elem_n(None, 1),
injected_panic_runtime: None,
allocator_kind: None,
}
}
}
5 changes: 5 additions & 0 deletions src/librustc_metadata/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ use syntax::attr;
use syntax::source_map;
use syntax::source_map::Spanned;
use syntax::symbol::Symbol;
use syntax::expand::allocator::AllocatorKind;
use syntax_pos::{Span, FileName};

macro_rules! provide {
@@ -531,4 +532,8 @@ impl CrateStore for cstore::CStore {
fn injected_panic_runtime(&self) -> Option<CrateNum> {
self.injected_panic_runtime
}

fn allocator_kind(&self) -> Option<AllocatorKind> {
self.allocator_kind
}
}