Auto merge of #49939 - kennytm:rollup, r=kennytm

Rollup of 14 pull requests

Successful merges: #49908, #49876, #49916, #49951, #49465, #49922, #49866, #49915, #49886, #49913, #49852, #49958, #49871, #49864

Failed merges:
This commit is contained in:
bors 2018-04-14 13:11:24 +00:00
commit 21dae950be
42 changed files with 369 additions and 89 deletions

View file

@ -35,6 +35,7 @@ use std::fmt;
use syntax::ast;
use errors::DiagnosticBuilder;
use syntax_pos::{self, Span};
use syntax_pos::symbol::InternedString;
use util::nodemap::FxHashMap;
use arena::DroplessArena;
@ -343,7 +344,7 @@ pub enum RegionVariableOrigin {
Coercion(Span),
// Region variables created as the values for early-bound regions
EarlyBoundRegion(Span, ast::Name),
EarlyBoundRegion(Span, InternedString),
// Region variables created for bound regions
// in a function or method that is called

View file

@ -1227,8 +1227,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"print some statistics about MIR"),
always_encode_mir: bool = (false, parse_bool, [TRACKED],
"encode MIR of all functions into the crate metadata"),
miri: bool = (false, parse_bool, [TRACKED],
"check the miri const evaluator against the old ctfe"),
osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
"pass `-install_name @rpath/...` to the macOS linker"),
sanitizer: Option<Sanitizer> = (None, parse_sanitizer, [TRACKED],

View file

@ -728,7 +728,7 @@ pub struct TypeParameterDef {
#[derive(Copy, Clone, RustcEncodable, RustcDecodable)]
pub struct RegionParameterDef {
pub name: Name,
pub name: InternedString,
pub def_id: DefId,
pub index: u32,

View file

@ -58,7 +58,7 @@ pub enum BoundRegion {
///
/// The def-id is needed to distinguish free regions in
/// the event of shadowing.
BrNamed(DefId, Name),
BrNamed(DefId, InternedString),
/// Fresh bound identifiers created during GLB computations.
BrFresh(u32),
@ -1058,7 +1058,7 @@ impl<'tcx> serialize::UseSpecializedDecodable for Region<'tcx> {}
pub struct EarlyBoundRegion {
pub def_id: DefId,
pub index: u32,
pub name: Name,
pub name: InternedString,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]

View file

@ -30,7 +30,7 @@ use std::usize;
use rustc_data_structures::indexed_vec::Idx;
use syntax::abi::Abi;
use syntax::ast::CRATE_NODE_ID;
use syntax::symbol::Symbol;
use syntax::symbol::{Symbol, InternedString};
use hir;
macro_rules! gen_display_debug_body {
@ -130,7 +130,7 @@ macro_rules! print {
}
struct LateBoundRegionNameCollector(FxHashSet<Symbol>);
struct LateBoundRegionNameCollector(FxHashSet<InternedString>);
impl<'tcx> ty::fold::TypeVisitor<'tcx> for LateBoundRegionNameCollector {
fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
match *r {
@ -148,7 +148,7 @@ pub struct PrintContext {
is_debug: bool,
is_verbose: bool,
identify_regions: bool,
used_region_names: Option<FxHashSet<Symbol>>,
used_region_names: Option<FxHashSet<InternedString>>,
region_index: usize,
binder_depth: usize,
}
@ -440,12 +440,12 @@ impl PrintContext {
lifted: Option<ty::Binder<U>>) -> fmt::Result
where T: Print, U: Print + TypeFoldable<'tcx>, F: fmt::Write
{
fn name_by_region_index(index: usize) -> Symbol {
fn name_by_region_index(index: usize) -> InternedString {
match index {
0 => Symbol::intern("'r"),
1 => Symbol::intern("'s"),
i => Symbol::intern(&format!("'t{}", i-2)),
}
}.as_str()
}
// Replace any anonymous late-bound regions with named
@ -493,8 +493,7 @@ impl PrintContext {
}
};
let _ = write!(f, "{}", name);
ty::BrNamed(tcx.hir.local_def_id(CRATE_NODE_ID),
name)
ty::BrNamed(tcx.hir.local_def_id(CRATE_NODE_ID), name)
}
};
tcx.mk_region(ty::ReLateBound(ty::DebruijnIndex::new(1), br))
@ -510,7 +509,7 @@ impl PrintContext {
result
}
fn is_name_used(&self, name: &Symbol) -> bool {
fn is_name_used(&self, name: &InternedString) -> bool {
match self.used_region_names {
Some(ref names) => names.contains(name),
None => false,
@ -697,7 +696,7 @@ define_print! {
BrAnon(n) => write!(f, "BrAnon({:?})", n),
BrFresh(n) => write!(f, "BrFresh({:?})", n),
BrNamed(did, name) => {
write!(f, "BrNamed({:?}:{:?}, {:?})",
write!(f, "BrNamed({:?}:{:?}, {})",
did.krate, did.index, name)
}
BrEnv => write!(f, "BrEnv"),