Skip to content

Rollup of 14 pull requests #53194

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

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
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
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
65 changes: 65 additions & 0 deletions src/librustc_data_structures/small_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ use array_vec::Array;

pub struct SmallVec<A: Array>(AccumulateVec<A>);

pub type OneVector<T> = SmallVec<[T; 1]>;

impl<A> Clone for SmallVec<A>
where A: Array,
A::Element: Clone {
Expand Down Expand Up @@ -222,6 +224,69 @@ mod tests {

use super::*;

#[test]
fn test_len() {
let v: OneVector<isize> = OneVector::new();
assert_eq!(0, v.len());

assert_eq!(1, OneVector::one(1).len());
assert_eq!(5, OneVector::many(vec![1, 2, 3, 4, 5]).len());
}

#[test]
fn test_push_get() {
let mut v = OneVector::new();
v.push(1);
assert_eq!(1, v.len());
assert_eq!(1, v[0]);
v.push(2);
assert_eq!(2, v.len());
assert_eq!(2, v[1]);
v.push(3);
assert_eq!(3, v.len());
assert_eq!(3, v[2]);
}

#[test]
fn test_from_iter() {
let v: OneVector<isize> = (vec![1, 2, 3]).into_iter().collect();
assert_eq!(3, v.len());
assert_eq!(1, v[0]);
assert_eq!(2, v[1]);
assert_eq!(3, v[2]);
}

#[test]
fn test_move_iter() {
let v = OneVector::new();
let v: Vec<isize> = v.into_iter().collect();
assert_eq!(v, Vec::new());

let v = OneVector::one(1);
assert_eq!(v.into_iter().collect::<Vec<_>>(), [1]);

let v = OneVector::many(vec![1, 2, 3]);
assert_eq!(v.into_iter().collect::<Vec<_>>(), [1, 2, 3]);
}

#[test]
#[should_panic]
fn test_expect_one_zero() {
let _: isize = OneVector::new().expect_one("");
}

#[test]
#[should_panic]
fn test_expect_one_many() {
OneVector::many(vec![1, 2]).expect_one("");
}

#[test]
fn test_expect_one_one() {
assert_eq!(1, OneVector::one(1).expect_one(""));
assert_eq!(1, OneVector::many(vec![1]).expect_one(""));
}

#[bench]
fn fill_small_vec_1_10_with_cap(b: &mut Bencher) {
b.iter(|| {
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_driver/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ use rustc::session::Session;
use rustc::session::config::{Input, OutputFilenames};
use rustc_borrowck as borrowck;
use rustc_borrowck::graphviz as borrowck_dot;
use rustc_data_structures::small_vec::OneVector;
use rustc_data_structures::thin_vec::ThinVec;
use rustc_metadata::cstore::CStore;

use rustc_mir::util::{write_mir_pretty, write_mir_graphviz};
Expand All @@ -33,8 +35,6 @@ use syntax::fold::{self, Folder};
use syntax::print::{pprust};
use syntax::print::pprust::PrintState;
use syntax::ptr::P;
use syntax::util::ThinVec;
use syntax::util::small_vector::SmallVector;
use syntax_pos::{self, FileName};

use graphviz as dot;
Expand Down Expand Up @@ -727,7 +727,7 @@ impl<'a> fold::Folder for ReplaceBodyWithLoop<'a> {
self.run(is_const, |s| fold::noop_fold_item_kind(i, s))
}

fn fold_trait_item(&mut self, i: ast::TraitItem) -> SmallVector<ast::TraitItem> {
fn fold_trait_item(&mut self, i: ast::TraitItem) -> OneVector<ast::TraitItem> {
let is_const = match i.node {
ast::TraitItemKind::Const(..) => true,
ast::TraitItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
Expand All @@ -737,7 +737,7 @@ impl<'a> fold::Folder for ReplaceBodyWithLoop<'a> {
self.run(is_const, |s| fold::noop_fold_trait_item(i, s))
}

fn fold_impl_item(&mut self, i: ast::ImplItem) -> SmallVector<ast::ImplItem> {
fn fold_impl_item(&mut self, i: ast::ImplItem) -> OneVector<ast::ImplItem> {
let is_const = match i.node {
ast::ImplItemKind::Const(..) => true,
ast::ImplItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
Expand Down Expand Up @@ -785,7 +785,7 @@ impl<'a> fold::Folder for ReplaceBodyWithLoop<'a> {
node: ast::ExprKind::Loop(P(empty_block), None),
id: self.sess.next_node_id(),
span: syntax_pos::DUMMY_SP,
attrs: ast::ThinVec::new(),
attrs: ThinVec::new(),
});

let loop_stmt = ast::Stmt {
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
pub use self::UnsafeSource::*;
pub use self::GenericArgs::*;
pub use symbol::{Ident, Symbol as Name};
pub use util::ThinVec;
pub use util::parser::ExprPrecedence;

use syntax_pos::{Span, DUMMY_SP};
Expand All @@ -25,6 +24,7 @@ use ptr::P;
use rustc_data_structures::indexed_vec;
use rustc_data_structures::indexed_vec::Idx;
use symbol::{Symbol, keywords};
use ThinVec;
use tokenstream::{ThinTokenStream, TokenStream};

use serialize::{self, Encoder, Decoder};
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/attr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ use parse::{self, ParseSess, PResult};
use parse::token::{self, Token};
use ptr::P;
use symbol::Symbol;
use ThinVec;
use tokenstream::{TokenStream, TokenTree, Delimited};
use util::ThinVec;
use GLOBALS;

use std::iter;
Expand Down
12 changes: 6 additions & 6 deletions src/libsyntax/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ use ast;
use codemap::Spanned;
use edition::Edition;
use parse::{token, ParseSess};
use OneVector;

use ptr::P;
use util::small_vector::SmallVector;

/// A folder that strips out items that do not belong in the current configuration.
pub struct StripUnconfigured<'a> {
Expand Down Expand Up @@ -319,22 +319,22 @@ impl<'a> fold::Folder for StripUnconfigured<'a> {
Some(P(fold::noop_fold_expr(expr, self)))
}

fn fold_stmt(&mut self, stmt: ast::Stmt) -> SmallVector<ast::Stmt> {
fn fold_stmt(&mut self, stmt: ast::Stmt) -> OneVector<ast::Stmt> {
match self.configure_stmt(stmt) {
Some(stmt) => fold::noop_fold_stmt(stmt, self),
None => return SmallVector::new(),
None => return OneVector::new(),
}
}

fn fold_item(&mut self, item: P<ast::Item>) -> SmallVector<P<ast::Item>> {
fn fold_item(&mut self, item: P<ast::Item>) -> OneVector<P<ast::Item>> {
fold::noop_fold_item(configure!(self, item), self)
}

fn fold_impl_item(&mut self, item: ast::ImplItem) -> SmallVector<ast::ImplItem> {
fn fold_impl_item(&mut self, item: ast::ImplItem) -> OneVector<ast::ImplItem> {
fold::noop_fold_impl_item(configure!(self, item), self)
}

fn fold_trait_item(&mut self, item: ast::TraitItem) -> SmallVector<ast::TraitItem> {
fn fold_trait_item(&mut self, item: ast::TraitItem) -> OneVector<ast::TraitItem> {
fold::noop_fold_trait_item(configure!(self, item), self)
}

Expand Down
Loading