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 #53194

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c70eb4b
Automatically expand section if url id point to one of its component
GuillaumeGomez Aug 5, 2018
70cafec
improper_ctypes lint for individual foreign items
VPashkov Aug 6, 2018
e8bb7bf
Account for --remap-path-prefix in save-analysis
Xanewok Aug 6, 2018
b011b09
NetBSD: fix signedess of char
jakllsch Aug 5, 2018
2403d91
remove `let x = baz` which was obscuring the real error
nikomatsakis Aug 6, 2018
44d32d4
Avoid unnecessary pattern matching against Option and Result
ljedrz Jul 27, 2018
43850e0
Special case error message for thread-local statics.
davidtwco Aug 6, 2018
6608552
Re-enable drop-locations debuginfo tests.
michaelwoerister Aug 7, 2018
4eb52ff
Re-enable a bunch of debuginfo tests.
michaelwoerister Aug 7, 2018
efda9f8
Added some debug logging.
davidtwco Aug 7, 2018
0e5bda1
Label definition of captured variables in errors.
davidtwco Aug 7, 2018
56232c6
Improved how upvars are detected when presenting errors using prefixes.
davidtwco Aug 7, 2018
5ce865e
Add wasm32 simd128 target feature
gnzlbg Aug 7, 2018
020b073
add wasm_target_feature feature gate
gnzlbg Aug 7, 2018
877c469
Avoid increased alignment of TLS segments on Fuchsia
cramertj Aug 7, 2018
2cdaf3b
add feature-gate test
gnzlbg Aug 8, 2018
f4039af
Suggest comma when missing in macro call
estebank Aug 8, 2018
9876e38
Move SmallVec and ThinVec out of libsyntax
ljedrz Aug 5, 2018
1d436cf
Rollup merge of #52773 - ljedrz:unncecessary_patterns, r=nikomatsakis
cramertj Aug 8, 2018
88c74ef
Rollup merge of #53085 - ljedrz:cleanup_syntax_structures, r=Mark-Sim…
cramertj Aug 8, 2018
556995e
Rollup merge of #53094 - GuillaumeGomez:automatic-expand, r=nrc
cramertj Aug 8, 2018
6420186
Rollup merge of #53100 - VPashkov:issue-52456-improper_ctypes, r=eddyb
cramertj Aug 8, 2018
7683e1b
Rollup merge of #53110 - Xanewok:save-analysis-remap-path, r=nrc
cramertj Aug 8, 2018
b178548
Rollup merge of #53116 - jakllsch:netbsd-unsigned-char, r=alexcrichton
cramertj Aug 8, 2018
132b0b3
Rollup merge of #53129 - nikomatsakis:issue-51172-tweak-test, r=pnkfelix
cramertj Aug 8, 2018
e08561e
Rollup merge of #53131 - davidtwco:issue-52663-thread-local-static, r…
cramertj Aug 8, 2018
ae04dcc
Rollup merge of #53152 - michaelwoerister:reenable-drop-location-debu…
cramertj Aug 8, 2018
1480844
Rollup merge of #53154 - michaelwoerister:reenable-some-debuginfo-tes…
cramertj Aug 8, 2018
e4bc35e
Rollup merge of #53164 - davidtwco:issue-52663-span-decl-captured-var…
cramertj Aug 8, 2018
8f1ca0f
Rollup merge of #53179 - gnzlbg:patch-3, r=alexcrichton
cramertj Aug 8, 2018
51f3003
Rollup merge of #53180 - cramertj:tls-align, r=alexcrichton
cramertj Aug 8, 2018
8e477f4
Rollup merge of #53183 - estebank:println-comma, r=oli-obk
cramertj Aug 8, 2018
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
1 change: 1 addition & 0 deletions src/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2048,6 +2048,7 @@ version = "0.0.0"
dependencies = [
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_errors 0.0.0",
"rustc_target 0.0.0",
"syntax 0.0.0",
Expand Down
25 changes: 13 additions & 12 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ use lint::builtin::{self, PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES,
ELIDED_LIFETIMES_IN_PATHS};
use middle::cstore::CrateStore;
use rustc_data_structures::indexed_vec::IndexVec;
use rustc_data_structures::small_vec::OneVector;
use rustc_data_structures::thin_vec::ThinVec;
use session::Session;
use util::common::FN_OUTPUT_NAME;
use util::nodemap::{DefIdMap, NodeMap};
Expand All @@ -71,7 +73,6 @@ use syntax::std_inject;
use syntax::symbol::{keywords, Symbol};
use syntax::tokenstream::{Delimited, TokenStream, TokenTree};
use syntax::parse::token::Token;
use syntax::util::small_vector::SmallVector;
use syntax::visit::{self, Visitor};
use syntax_pos::{Span, MultiSpan};

Expand Down Expand Up @@ -3136,12 +3137,12 @@ impl<'a> LoweringContext<'a> {
&mut self,
decl: &FnDecl,
header: &FnHeader,
ids: &mut SmallVector<hir::ItemId>,
ids: &mut OneVector<hir::ItemId>,
) {
if let Some(id) = header.asyncness.opt_return_id() {
ids.push(hir::ItemId { id });
}
struct IdVisitor<'a> { ids: &'a mut SmallVector<hir::ItemId> }
struct IdVisitor<'a> { ids: &'a mut OneVector<hir::ItemId> }
impl<'a, 'b> Visitor<'a> for IdVisitor<'b> {
fn visit_ty(&mut self, ty: &'a Ty) {
match ty.node {
Expand Down Expand Up @@ -3174,36 +3175,36 @@ impl<'a> LoweringContext<'a> {
}
}

fn lower_item_id(&mut self, i: &Item) -> SmallVector<hir::ItemId> {
fn lower_item_id(&mut self, i: &Item) -> OneVector<hir::ItemId> {
match i.node {
ItemKind::Use(ref use_tree) => {
let mut vec = SmallVector::one(hir::ItemId { id: i.id });
let mut vec = OneVector::one(hir::ItemId { id: i.id });
self.lower_item_id_use_tree(use_tree, i.id, &mut vec);
vec
}
ItemKind::MacroDef(..) => SmallVector::new(),
ItemKind::MacroDef(..) => OneVector::new(),
ItemKind::Fn(ref decl, ref header, ..) => {
let mut ids = SmallVector::one(hir::ItemId { id: i.id });
let mut ids = OneVector::one(hir::ItemId { id: i.id });
self.lower_impl_trait_ids(decl, header, &mut ids);
ids
},
ItemKind::Impl(.., None, _, ref items) => {
let mut ids = SmallVector::one(hir::ItemId { id: i.id });
let mut ids = OneVector::one(hir::ItemId { id: i.id });
for item in items {
if let ImplItemKind::Method(ref sig, _) = item.node {
self.lower_impl_trait_ids(&sig.decl, &sig.header, &mut ids);
}
}
ids
},
_ => SmallVector::one(hir::ItemId { id: i.id }),
_ => OneVector::one(hir::ItemId { id: i.id }),
}
}

fn lower_item_id_use_tree(&mut self,
tree: &UseTree,
base_id: NodeId,
vec: &mut SmallVector<hir::ItemId>)
vec: &mut OneVector<hir::ItemId>)
{
match tree.kind {
UseTreeKind::Nested(ref nested_vec) => for &(ref nested, id) in nested_vec {
Expand Down Expand Up @@ -4295,8 +4296,8 @@ impl<'a> LoweringContext<'a> {
}
}

fn lower_stmt(&mut self, s: &Stmt) -> SmallVector<hir::Stmt> {
SmallVector::one(match s.node {
fn lower_stmt(&mut self, s: &Stmt) -> OneVector<hir::Stmt> {
OneVector::one(match s.node {
StmtKind::Local(ref l) => Spanned {
node: hir::StmtKind::Decl(
P(Spanned {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ use syntax::ext::hygiene::SyntaxContext;
use syntax::ptr::P;
use syntax::symbol::{Symbol, keywords};
use syntax::tokenstream::TokenStream;
use syntax::util::ThinVec;
use syntax::util::parser::ExprPrecedence;
use ty::AdtKind;
use ty::query::Providers;

use rustc_data_structures::indexed_vec;
use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync, scope};
use rustc_data_structures::thin_vec::ThinVec;

use serialize::{self, Encoder, Encodable, Decoder, Decodable};
use std::collections::BTreeMap;
Expand Down
14 changes: 8 additions & 6 deletions src/librustc/mir/tcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,29 +127,31 @@ impl<'tcx> Place<'tcx> {
/// of a closure type.
pub fn is_upvar_field_projection<'cx, 'gcx>(&self, mir: &'cx Mir<'tcx>,
tcx: &TyCtxt<'cx, 'gcx, 'tcx>) -> Option<Field> {
let place = if let Place::Projection(ref proj) = self {
let (place, by_ref) = if let Place::Projection(ref proj) = self {
if let ProjectionElem::Deref = proj.elem {
&proj.base
(&proj.base, true)
} else {
self
(self, false)
}
} else {
self
(self, false)
};

match place {
Place::Projection(ref proj) => match proj.elem {
ProjectionElem::Field(field, _ty) => {
let base_ty = proj.base.ty(mir, *tcx).to_ty(*tcx);

if base_ty.is_closure() || base_ty.is_generator() {
if (base_ty.is_closure() || base_ty.is_generator()) &&
(!by_ref || mir.upvar_decls[field.index()].by_ref)
{
Some(field)
} else {
None
}
},
_ => None,
},
}
_ => None,
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/librustc/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
}
}
&ty::Predicate::RegionOutlives(ref binder) => {
if let Err(_) = select
.infcx()
.region_outlives_predicate(&dummy_cause, binder)
{
if select.infcx().region_outlives_predicate(&dummy_cause, binder).is_err() {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
// Eventually I'll need to implement param-env-aware
// `Γ₁ ⊦ φ₁ => Γ₂ ⊦ φ₂` logic.
let param_env = ty::ParamEnv::empty();
if let Ok(_) = self.can_sub(param_env, error, implication) {
if self.can_sub(param_env, error, implication).is_ok() {
debug!("error_implies: {:?} -> {:?} -> {:?}", cond, error, implication);
return true
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/query/outlives_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
// variables. Process these constraints.
let mut fulfill_cx = FulfillmentContext::new();
fulfill_cx.register_predicate_obligations(self, result.obligations);
if let Err(_) = fulfill_cx.select_all_or_error(self) {
if fulfill_cx.select_all_or_error(self).is_err() {
self.tcx.sess.delay_span_bug(
span,
"implied_outlives_bounds failed to solve obligations from instantiation"
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1587,8 +1587,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
-> bool
{
assert!(!skol_trait_ref.has_escaping_regions());
if let Err(_) = self.infcx.at(&obligation.cause, obligation.param_env)
.sup(ty::Binder::dummy(skol_trait_ref), trait_bound) {
if self.infcx.at(&obligation.cause, obligation.param_env)
.sup(ty::Binder::dummy(skol_trait_ref), trait_bound).is_err() {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ fn resolve_associated_item<'a, 'tcx>(
})
}
traits::VtableBuiltin(..) => {
if let Some(_) = tcx.lang_items().clone_trait() {
if tcx.lang_items().clone_trait().is_some() {
Some(Instance {
def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
substs: rcvr_substs
Expand Down
1 change: 1 addition & 0 deletions src/librustc_allocator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test = false

[dependencies]
rustc = { path = "../librustc" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_errors = { path = "../librustc_errors" }
rustc_target = { path = "../librustc_target" }
syntax = { path = "../libsyntax" }
Expand Down
14 changes: 7 additions & 7 deletions src/librustc_allocator/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

use rustc::middle::allocator::AllocatorKind;
use rustc_data_structures::small_vec::OneVector;
use rustc_errors;
use syntax::{
ast::{
Expand All @@ -28,8 +29,7 @@ use syntax::{
fold::{self, Folder},
parse::ParseSess,
ptr::P,
symbol::Symbol,
util::small_vector::SmallVector,
symbol::Symbol
};
use syntax_pos::Span;

Expand Down Expand Up @@ -65,7 +65,7 @@ struct ExpandAllocatorDirectives<'a> {
}

impl<'a> Folder for ExpandAllocatorDirectives<'a> {
fn fold_item(&mut self, item: P<Item>) -> SmallVector<P<Item>> {
fn fold_item(&mut self, item: P<Item>) -> OneVector<P<Item>> {
debug!("in submodule {}", self.in_submod);

let name = if attr::contains_name(&item.attrs, "global_allocator") {
Expand All @@ -78,20 +78,20 @@ impl<'a> Folder for ExpandAllocatorDirectives<'a> {
_ => {
self.handler
.span_err(item.span, "allocators must be statics");
return SmallVector::one(item);
return OneVector::one(item);
}
}

if self.in_submod > 0 {
self.handler
.span_err(item.span, "`global_allocator` cannot be used in submodules");
return SmallVector::one(item);
return OneVector::one(item);
}

if self.found {
self.handler
.span_err(item.span, "cannot define more than one #[global_allocator]");
return SmallVector::one(item);
return OneVector::one(item);
}
self.found = true;

Expand Down Expand Up @@ -152,7 +152,7 @@ impl<'a> Folder for ExpandAllocatorDirectives<'a> {
let module = f.cx.monotonic_expander().fold_item(module).pop().unwrap();

// Return the item and new submodule
let mut ret = SmallVector::with_capacity(2);
let mut ret = OneVector::with_capacity(2);
ret.push(item);
ret.push(module);

Expand Down
1 change: 1 addition & 0 deletions src/librustc_allocator/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#[macro_use] extern crate log;
extern crate rustc;
extern crate rustc_data_structures;
extern crate rustc_errors;
extern crate rustc_target;
extern crate syntax;
Expand Down
10 changes: 8 additions & 2 deletions src/librustc_codegen_llvm/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ pub fn codegen_static<'a, 'tcx>(
if attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL) {
llvm::set_thread_local_mode(g, cx.tls_model);

// Do not allow LLVM to change the alignment of a TLS on macOS.
// Do not allow LLVM to change the alignment of a TLS on macOS and Fuchsia.
//
// By default a global's alignment can be freely increased.
// This allows LLVM to generate more performant instructions
Expand All @@ -361,6 +361,10 @@ pub fn codegen_static<'a, 'tcx>(
// respect any alignment given on the TLS (radar 24221680).
// This will violate the alignment assumption, and causing segfault at runtime.
//
// Fuchsia's libc currently does not support greater than 16-byte alignment
// of TLS segments, so this hack is also enabled temporarily for Fuchsia targets
// until libc is fixed.
//
// This bug is very easy to trigger. In `println!` and `panic!`,
// the `LOCAL_STDOUT`/`LOCAL_STDERR` handles are stored in a TLS,
// which the values would be `mem::replace`d on initialization.
Expand All @@ -380,7 +384,9 @@ pub fn codegen_static<'a, 'tcx>(
// will use load-unaligned instructions instead, and thus avoiding the crash.
//
// We could remove this hack whenever we decide to drop macOS 10.10 support.
if cx.tcx.sess.target.target.options.is_like_osx {
if cx.tcx.sess.target.target.options.is_like_osx ||
(cx.tcx.sess.target.target.target_os == "fuchsia")
{
let sect_name = if alloc.bytes.iter().all(|b| *b == 0) {
CStr::from_bytes_with_nul_unchecked(b"__DATA,__thread_bss\0")
} else {
Expand Down
6 changes: 6 additions & 0 deletions src/librustc_codegen_llvm/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ const MIPS_WHITELIST: &[(&str, Option<&str>)] = &[
("msa", Some("mips_target_feature")),
];

const WASM_WHITELIST: &[(&str, Option<&str>)] = &[
("simd128", Some("wasm_target_feature")),
];

/// When rustdoc is running, provide a list of all known features so that all their respective
/// primtives may be documented.
///
Expand All @@ -181,6 +185,7 @@ pub fn all_known_features() -> impl Iterator<Item=(&'static str, Option<&'static
.chain(HEXAGON_WHITELIST.iter().cloned())
.chain(POWERPC_WHITELIST.iter().cloned())
.chain(MIPS_WHITELIST.iter().cloned())
.chain(WASM_WHITELIST.iter().cloned())
}

pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str {
Expand Down Expand Up @@ -228,6 +233,7 @@ pub fn target_feature_whitelist(sess: &Session)
"hexagon" => HEXAGON_WHITELIST,
"mips" | "mips64" => MIPS_WHITELIST,
"powerpc" | "powerpc64" => POWERPC_WHITELIST,
"wasm32" => WASM_WHITELIST,
_ => &[],
}
}
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 @@ -74,6 +74,7 @@ pub mod sorted_map;
pub mod stable_hasher;
pub mod sync;
pub mod tiny_list;
pub mod thin_vec;
pub mod transitive_relation;
pub mod tuple_slice;
pub use ena::unify;
Expand Down
Loading