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

Add support for PowerPC64 on FreeBSD #57615

Merged
merged 36 commits into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f9f71cc
Fix poor worst case performance of set intersection (and union, somew…
ssomers Dec 21, 2018
ccba43d
Merge remote-tracking branch 'upstream/master'
ssomers Jan 9, 2019
60d1db6
Clean up and fix a bug in query plumbing
Zoxc Jan 9, 2019
8823bf0
Fix poor worst case performance of is_disjoint
ssomers Jan 9, 2019
565c39d
provide suggestion for invalid boolean cast
euclio Jan 9, 2019
cef2e2f
Merge remote-tracking branch 'upstream/master'
ssomers Jan 10, 2019
5c67ba6
Continue parser after trailing type argument attribute
estebank Jan 12, 2019
fc4b541
Continue parsing after lifetime in incorrect location
estebank Jan 12, 2019
d8610b3
Continue evaluating after parsing incorrect binary literal
estebank Jan 12, 2019
5d2f31c
Continue evaluating after missing `for` in `impl Trait for Foo`
estebank Jan 12, 2019
57f17e9
Continue evaluating after type argument in where clause
estebank Jan 12, 2019
65a8d7b
fix tests
estebank Jan 12, 2019
8bede50
Continue evaluating after incorrect float literal
estebank Jan 12, 2019
975f8b5
fix test
estebank Jan 12, 2019
8119017
Continue evaluating after finding incorrect .. in pattern
estebank Jan 12, 2019
de3c4be
Tweak type argument after assoc type error
estebank Jan 12, 2019
7feb802
Small tweaks to parser errors
estebank Jan 12, 2019
3ead6de
Tweak incorrect discriminator value variant error
estebank Jan 12, 2019
1550787
Add label for invalid literal suffix
estebank Jan 12, 2019
db74031
Remove unrelated errors from parse stderr tests
estebank Jan 13, 2019
28ea03e
Suggest correct location for lifetime parameters in use
estebank Jan 13, 2019
c4f6ef2
remove extern_in_paths.
Centril Jan 13, 2019
fb60400
Querify local proc_macro_decls_static
Xanewok Jan 12, 2019
59d7d7d
Querify local plugin_registrar_fn
Xanewok Jan 13, 2019
707a9a0
Retain original pass order
Xanewok Jan 13, 2019
3874c77
Recover from item trailing semicolon
estebank Jan 14, 2019
1fd971c
Add a debug_assert to Vec::set_len
scottmcm Dec 15, 2018
5bc95de
Rollup merge of #57043 - ssomers:master, r=alexcrichton
Centril Jan 14, 2019
8c001b1
Rollup merge of #57480 - Zoxc:query-fix, r=michaelwoerister
Centril Jan 14, 2019
816e31b
Rollup merge of #57481 - euclio:bool-cast-suggestion, r=estebank
Centril Jan 14, 2019
2f7a226
Rollup merge of #57540 - estebank:eval-more, r=petrochenkov
Centril Jan 14, 2019
2e10944
Rollup merge of #57570 - Xanewok:querify-some, r=Zoxc
Centril Jan 14, 2019
feb48f3
Rollup merge of #57572 - Centril:unaccept-extern-in-path, r=petrochenkov
Centril Jan 14, 2019
b03d414
Rollup merge of #57585 - estebank:trailing-semicolon, r=petrochenkov
Centril Jan 14, 2019
8a62e39
Rollup merge of #57589 - scottmcm:vec-set_len-debug_assert, r=alexcri…
Centril Jan 14, 2019
aea9f0a
Auto merge of #57607 - Centril:rollup, r=Centril
bors Jan 14, 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
40 changes: 0 additions & 40 deletions src/doc/unstable-book/src/language-features/extern-in-paths.md

This file was deleted.

2 changes: 2 additions & 0 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,8 @@ impl<T> Vec<T> {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn set_len(&mut self, new_len: usize) {
debug_assert!(new_len <= self.capacity());

self.len = new_len;
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub enum ExternCrateSource {
),
// Crate is loaded by `use`.
Use,
/// Crate is implicitly loaded by an absolute or an `extern::` path.
/// Crate is implicitly loaded by an absolute path.
Path,
}

Expand Down
4 changes: 0 additions & 4 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ pub struct Session {
pub parse_sess: ParseSess,
/// For a library crate, this is always none
pub entry_fn: Once<Option<(NodeId, Span, config::EntryFnType)>>,
pub plugin_registrar_fn: Once<Option<ast::NodeId>>,
pub proc_macro_decls_static: Once<Option<ast::NodeId>>,
pub sysroot: PathBuf,
/// The name of the root source file of the crate, in the local file system.
/// `None` means that there is no source file.
Expand Down Expand Up @@ -1177,8 +1175,6 @@ pub fn build_session_(
parse_sess: p_s,
// For a library crate, this is always none
entry_fn: Once::new(),
plugin_registrar_fn: Once::new(),
proc_macro_decls_static: Once::new(),
sysroot,
local_crate_source_file,
working_dir,
Expand Down
41 changes: 21 additions & 20 deletions src/librustc/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
// expensive for some DepKinds.
if !self.dep_graph.is_fully_enabled() {
let null_dep_node = DepNode::new_no_params(::dep_graph::DepKind::Null);
return self.force_query_with_job::<Q>(key, job, null_dep_node).map(|(v, _)| v);
return Ok(self.force_query_with_job::<Q>(key, job, null_dep_node).0);
}

let dep_node = Q::to_dep_node(self, &key);
Expand Down Expand Up @@ -436,20 +436,18 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

if !dep_node.kind.is_input() {
if let Some(dep_node_index) = self.try_mark_green_and_read(&dep_node) {
return self.load_from_disk_and_cache_in_memory::<Q>(key,
job,
dep_node_index,
&dep_node)
return Ok(self.load_from_disk_and_cache_in_memory::<Q>(
key,
job,
dep_node_index,
&dep_node
))
}
}

match self.force_query_with_job::<Q>(key, job, dep_node) {
Ok((result, dep_node_index)) => {
self.dep_graph.read_index(dep_node_index);
Ok(result)
}
Err(e) => Err(e)
}
let (result, dep_node_index) = self.force_query_with_job::<Q>(key, job, dep_node);
self.dep_graph.read_index(dep_node_index);
Ok(result)
}

fn load_from_disk_and_cache_in_memory<Q: QueryDescription<'gcx>>(
Expand All @@ -458,7 +456,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
job: JobOwner<'a, 'gcx, Q>,
dep_node_index: DepNodeIndex,
dep_node: &DepNode
) -> Result<Q::Value, Box<CycleError<'gcx>>>
) -> Q::Value
{
// Note this function can be called concurrently from the same query
// We must ensure that this is handled correctly
Expand Down Expand Up @@ -523,7 +521,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

job.complete(&result, dep_node_index);

Ok(result)
result
}

#[inline(never)]
Expand Down Expand Up @@ -563,7 +561,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
key: Q::Key,
job: JobOwner<'_, 'gcx, Q>,
dep_node: DepNode)
-> Result<(Q::Value, DepNodeIndex), Box<CycleError<'gcx>>> {
-> (Q::Value, DepNodeIndex) {
// If the following assertion triggers, it can have two reasons:
// 1. Something is wrong with DepNode creation, either here or
// in DepGraph::try_mark_green()
Expand Down Expand Up @@ -610,7 +608,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

job.complete(&result, dep_node_index);

Ok((result, dep_node_index))
(result, dep_node_index)
}

/// Ensure that either this query has all green inputs or been executed.
Expand Down Expand Up @@ -657,11 +655,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
// Ensure that only one of them runs the query
let job = match JobOwner::try_get(self, span, &key) {
TryGetJob::NotYetStarted(job) => job,
TryGetJob::JobCompleted(_) => return,
TryGetJob::JobCompleted(result) => {
if let Err(e) = result {
self.report_cycle(e).emit();
}
return
}
};
if let Err(e) = self.force_query_with_job::<Q>(key, job, dep_node) {
self.report_cycle(e).emit();
}
self.force_query_with_job::<Q>(key, job, dep_node);
}

pub(super) fn try_get_query<Q: QueryDescription<'gcx>>(
Expand Down
10 changes: 4 additions & 6 deletions src/librustc_codegen_ssa/back/symbol_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,12 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
})
.collect();

if let Some(id) = *tcx.sess.proc_macro_decls_static.get() {
let def_id = tcx.hir().local_def_id(id);
reachable_non_generics.insert(def_id, SymbolExportLevel::C);
if let Some(id) = tcx.proc_macro_decls_static(LOCAL_CRATE) {
reachable_non_generics.insert(id, SymbolExportLevel::C);
}

if let Some(id) = *tcx.sess.plugin_registrar_fn.get() {
let def_id = tcx.hir().local_def_id(id);
reachable_non_generics.insert(def_id, SymbolExportLevel::C);
if let Some(id) = tcx.plugin_registrar_fn(LOCAL_CRATE) {
reachable_non_generics.insert(id, SymbolExportLevel::C);
}

Lrc::new(reachable_non_generics)
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_utils/symbol_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance

let node_id = tcx.hir().as_local_node_id(def_id);

if let Some(id) = node_id {
if *tcx.sess.plugin_registrar_fn.get() == Some(id) {
if def_id.is_local() {
if tcx.plugin_registrar_fn(LOCAL_CRATE) == Some(def_id) {
let disambiguator = tcx.sess.local_crate_disambiguator();
return tcx.sess.generate_plugin_registrar_symbol(disambiguator);
}
if *tcx.sess.proc_macro_decls_static.get() == Some(id) {
if tcx.proc_macro_decls_static(LOCAL_CRATE) == Some(def_id) {
let disambiguator = tcx.sess.local_crate_disambiguator();
return tcx.sess.generate_proc_macro_decls_symbol(disambiguator);
}
Expand Down
17 changes: 10 additions & 7 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,8 @@ where
}

pub fn default_provide(providers: &mut ty::query::Providers) {
proc_macro_decls::provide(providers);
plugin::build::provide(providers);
hir::provide(providers);
borrowck::provide(providers);
mir::provide(providers);
Expand Down Expand Up @@ -1212,13 +1214,6 @@ where
middle::entry::find_entry_point(sess, &hir_map, name)
});

sess.plugin_registrar_fn
.set(time(sess, "looking for plugin registrar", || {
plugin::build::find_plugin_registrar(sess.diagnostic(), &hir_map)
}));
sess.proc_macro_decls_static
.set(proc_macro_decls::find(&hir_map));

let mut local_providers = ty::query::Providers::default();
default_provide(&mut local_providers);
codegen_backend.provide(&mut local_providers);
Expand Down Expand Up @@ -1248,6 +1243,14 @@ where
// tcx available.
time(sess, "dep graph tcx init", || rustc_incremental::dep_graph_tcx_init(tcx));

time(sess, "looking for plugin registrar", || {
plugin::build::find_plugin_registrar(tcx)
});

time(sess, "looking for derive registrar", || {
proc_macro_decls::find(tcx)
});

time(sess, "loop checking", || loops::check_crate(tcx));

time(sess, "attribute checking", || {
Expand Down
26 changes: 21 additions & 5 deletions src/librustc_driver/proc_macro_decls.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir::map::Map;
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc::hir;
use rustc::ty::TyCtxt;
use rustc::ty::query::Providers;
use syntax::ast;
use syntax::attr;

pub fn find(hir_map: &Map) -> Option<ast::NodeId> {
let krate = hir_map.krate();
pub fn find<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> Option<DefId> {
tcx.proc_macro_decls_static(LOCAL_CRATE)
}

fn proc_macro_decls_static<'tcx>(
tcx: TyCtxt<'_, 'tcx, 'tcx>,
cnum: CrateNum,
) -> Option<DefId> {
assert_eq!(cnum, LOCAL_CRATE);

let mut finder = Finder { decls: None };
krate.visit_all_item_likes(&mut finder);
finder.decls
tcx.hir().krate().visit_all_item_likes(&mut finder);

finder.decls.map(|id| tcx.hir().local_def_id(id))
}

struct Finder {
Expand All @@ -30,3 +40,9 @@ impl<'v> ItemLikeVisitor<'v> for Finder {
}
}

pub(crate) fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
proc_macro_decls_static,
..*providers
};
}
4 changes: 2 additions & 2 deletions src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
//! a `pub fn new()`.

use rustc::hir::def::Def;
use rustc::hir::def_id::DefId;
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
use rustc::ty::{self, Ty};
use hir::Node;
use util::nodemap::NodeSet;
Expand Down Expand Up @@ -860,7 +860,7 @@ impl LintPass for PluginAsLibrary {

impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PluginAsLibrary {
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
if cx.sess().plugin_registrar_fn.get().is_some() {
if cx.tcx.plugin_registrar_fn(LOCAL_CRATE).is_some() {
// We're compiling a plugin; it's fine to link other plugins.
return;
}
Expand Down
9 changes: 3 additions & 6 deletions src/librustc_metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,10 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
has_global_allocator: has_global_allocator,
has_panic_handler: has_panic_handler,
has_default_lib_allocator: has_default_lib_allocator,
plugin_registrar_fn: tcx.sess
.plugin_registrar_fn
.get()
.map(|id| tcx.hir().local_def_id(id).index),
plugin_registrar_fn: tcx.plugin_registrar_fn(LOCAL_CRATE).map(|id| id.index),
proc_macro_decls_static: if is_proc_macro {
let id = tcx.sess.proc_macro_decls_static.get().unwrap();
Some(tcx.hir().local_def_id(id).index)
let id = tcx.proc_macro_decls_static(LOCAL_CRATE).unwrap();
Some(id.index)
} else {
None
},
Expand Down
31 changes: 23 additions & 8 deletions src/librustc_plugin/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

use syntax::ast;
use syntax::attr;
use errors;
use syntax_pos::Span;
use rustc::hir::map::Map;
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir;
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc::ty::TyCtxt;
use rustc::ty::query::Providers;

struct RegistrarFinder {
registrars: Vec<(ast::NodeId, Span)> ,
Expand All @@ -30,21 +31,27 @@ impl<'v> ItemLikeVisitor<'v> for RegistrarFinder {
}

/// Find the function marked with `#[plugin_registrar]`, if any.
pub fn find_plugin_registrar(diagnostic: &errors::Handler,
hir_map: &Map)
-> Option<ast::NodeId> {
let krate = hir_map.krate();
pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> Option<DefId> {
tcx.plugin_registrar_fn(LOCAL_CRATE)
}

fn plugin_registrar_fn<'tcx>(
tcx: TyCtxt<'_, 'tcx, 'tcx>,
cnum: CrateNum,
) -> Option<DefId> {
assert_eq!(cnum, LOCAL_CRATE);

let mut finder = RegistrarFinder { registrars: Vec::new() };
krate.visit_all_item_likes(&mut finder);
tcx.hir().krate().visit_all_item_likes(&mut finder);

match finder.registrars.len() {
0 => None,
1 => {
let (node_id, _) = finder.registrars.pop().unwrap();
Some(node_id)
Some(tcx.hir().local_def_id(node_id))
},
_ => {
let diagnostic = tcx.sess.diagnostic();
let mut e = diagnostic.struct_err("multiple plugin registration functions found");
for &(_, span) in &finder.registrars {
e.span_note(span, "one is here");
Expand All @@ -55,3 +62,11 @@ pub fn find_plugin_registrar(diagnostic: &errors::Handler,
}
}
}


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