Skip to content

Rollup of 6 pull requests #41702

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

Merged
merged 23 commits into from
May 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
04e4d42
Rename os variable in bootstrap.py to avoid shadowing os module.
barik Apr 30, 2017
eff39b7
On-demandify region mapping
cramertj Mar 28, 2017
119c38e
Remove RefCells from RegionMaps
cramertj Apr 5, 2017
55d6066
remove ROOT_CODE_EXTENT and DUMMY_CODE_EXTENT
nikomatsakis Apr 19, 2017
c7dc39d
intern CodeExtents
nikomatsakis Apr 20, 2017
73cd9bd
introduce per-fn RegionMaps
cramertj Apr 10, 2017
6c2f64b
modify `ExprUseVisitor` and friends to take region-maps, not def-id
nikomatsakis Apr 29, 2017
1dd082f
Add simple `[repr(align)]` codegen test.
bitshifter May 1, 2017
d4d74da
remove unused `is_fn`
nikomatsakis May 1, 2017
c0434e2
pacify the mercilous tidy
nikomatsakis May 1, 2017
3438cda
use `closure_base_def_id` rather than walking up HIR
nikomatsakis May 1, 2017
b393d64
kill regr test using ad-hoc lint
nikomatsakis May 1, 2017
c008f05
patch the `librustc_driver` unit tests
nikomatsakis May 2, 2017
7423966
Fix incorrect hex value in doc comment example.
frewsxcv May 2, 2017
6cc765d
Add a lint to disallow anonymous parameters
est31 May 2, 2017
d290849
Removal pass for anonymous parameters
est31 May 2, 2017
14bbd0a
Address review
est31 May 2, 2017
5b4e8d0
Rollup merge of #41661 - barik:master, r=alexcrichton
frewsxcv May 2, 2017
1376607
Rollup merge of #41662 - nikomatsakis:on-demandify-region-mapping, r=…
frewsxcv May 2, 2017
b8fc516
Rollup merge of #41673 - bitshifter:repr-align-codegen-test, r=arielb1
frewsxcv May 2, 2017
7dbb93a
Rollup merge of #41688 - rust-lang:hex-value-process-exit, r=sfackler
frewsxcv May 2, 2017
4733ee7
Rollup merge of #41692 - est31:anon_params, r=eddyb
frewsxcv May 2, 2017
e0bfd19
Rollup merge of #41693 - est31:anon_params_removal, r=eddyb
frewsxcv May 2, 2017
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
4 changes: 2 additions & 2 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ def build_triple(self):
# The goal here is to come up with the same triple as LLVM would,
# at least for the subset of platforms we're willing to target.
if ostype == 'Linux':
os = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
if os == 'Android':
os_from_sp = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
if os_from_sp == 'Android':
ostype = 'linux-android'
else:
ostype = 'unknown-linux-gnu'
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub trait Into<T>: Sized {
pub trait From<T>: Sized {
/// Performs the conversion.
#[stable(feature = "rust1", since = "1.0.0")]
fn from(T) -> Self;
fn from(_: T) -> Self;
}

/// An attempted conversion that consumes `self`, which may or may not be
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/hash/sip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ impl<S: Sip> Default for Hasher<S> {

#[doc(hidden)]
trait Sip {
fn c_rounds(&mut State);
fn d_rounds(&mut State);
fn c_rounds(_: &mut State);
fn d_rounds(_: &mut State);
}

#[derive(Debug, Clone, Default)]
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2878,10 +2878,10 @@ pub trait Carrier {
type Error;

/// Create a `Carrier` from a success value.
fn from_success(Self::Success) -> Self;
fn from_success(_: Self::Success) -> Self;

/// Create a `Carrier` from an error value.
fn from_error(Self::Error) -> Self;
fn from_error(_: Self::Error) -> Self;

/// Translate this `Carrier` to another implementation of `Carrier` with the
/// same associated types.
Expand Down
2 changes: 1 addition & 1 deletion src/librand/distributions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub trait Sample<Support> {
// trait called `Sample` and the other should be `DependentSample`.
pub trait IndependentSample<Support>: Sample<Support> {
/// Generate a random value.
fn ind_sample<R: Rng>(&self, &mut R) -> Support;
fn ind_sample<R: Rng>(&self, _: &mut R) -> Support;
}

/// A wrapper for generating types that implement `Rand` via the
Expand Down
2 changes: 1 addition & 1 deletion src/librand/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl<'a, R: fmt::Debug> fmt::Debug for AsciiGenerator<'a, R> {
/// the same stream of randomness multiple times.
pub trait SeedableRng<Seed>: Rng {
/// Reseed an RNG with the given seed.
fn reseed(&mut self, Seed);
fn reseed(&mut self, _: Seed);

/// Create a new RNG with the given seed.
fn from_seed(seed: Seed) -> Self;
Expand Down
12 changes: 8 additions & 4 deletions src/librustc/cfg/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ use syntax::ast;
use syntax::ptr::P;

use hir::{self, PatKind};
use hir::def_id::DefId;

struct CFGBuilder<'a, 'tcx: 'a> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
owner_def_id: DefId,
tables: &'a ty::TypeckTables<'tcx>,
graph: CFGGraph,
fn_exit: CFGIndex,
Expand Down Expand Up @@ -56,6 +58,7 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,

let mut cfg_builder = CFGBuilder {
tcx: tcx,
owner_def_id,
tables: tables,
graph: graph,
fn_exit: fn_exit,
Expand Down Expand Up @@ -583,11 +586,12 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
scope_id: ast::NodeId,
to_index: CFGIndex) {
let mut data = CFGEdgeData { exiting_scopes: vec![] };
let mut scope = self.tcx.region_maps.node_extent(from_expr.id);
let target_scope = self.tcx.region_maps.node_extent(scope_id);
let mut scope = self.tcx.node_extent(from_expr.id);
let target_scope = self.tcx.node_extent(scope_id);
let region_maps = self.tcx.region_maps(self.owner_def_id);
while scope != target_scope {
data.exiting_scopes.push(scope.node_id(&self.tcx.region_maps));
scope = self.tcx.region_maps.encl_scope(scope);
data.exiting_scopes.push(scope.node_id());
scope = region_maps.encl_scope(scope);
}
self.graph.add_edge(from_index, to_index, data);
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub enum DepNode<D: Clone + Debug> {
WorkProduct(Arc<WorkProductId>),

// Represents different phases in the compiler.
RegionResolveCrate,
RegionMaps(D),
Coherence,
Resolve,
CoherenceCheckTrait(D),
Expand Down Expand Up @@ -197,7 +197,6 @@ impl<D: Clone + Debug> DepNode<D> {
BorrowCheckKrate => Some(BorrowCheckKrate),
MirKrate => Some(MirKrate),
TypeckBodiesKrate => Some(TypeckBodiesKrate),
RegionResolveCrate => Some(RegionResolveCrate),
Coherence => Some(Coherence),
Resolve => Some(Resolve),
Variance => Some(Variance),
Expand All @@ -223,6 +222,7 @@ impl<D: Clone + Debug> DepNode<D> {
def_ids.map(MirShim)
}
BorrowCheck(ref d) => op(d).map(BorrowCheck),
RegionMaps(ref d) => op(d).map(RegionMaps),
RvalueCheck(ref d) => op(d).map(RvalueCheck),
TransCrateItem(ref d) => op(d).map(TransCrateItem),
TransInlinedItem(ref d) => op(d).map(TransInlinedItem),
Expand Down
19 changes: 18 additions & 1 deletion src/librustc/hir/intravisit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use syntax::codemap::Spanned;
use syntax_pos::Span;
use hir::*;
use hir::def::Def;
use hir::map::Map;
use hir::map::{self, Map};
use super::itemlikevisit::DeepVisitor;

use std::cmp;
Expand Down Expand Up @@ -140,6 +140,23 @@ impl<'this, 'tcx> NestedVisitorMap<'this, 'tcx> {
/// to monitor future changes to `Visitor` in case a new method with a
/// new default implementation gets introduced.)
pub trait Visitor<'v> : Sized {
/// Invokes the suitable visitor method for the given `Node`
/// extracted from the hir map.
fn visit_hir_map_node(&mut self, node: map::Node<'v>) {
match node {
map::NodeItem(a) => self.visit_item(a),
map::NodeForeignItem(a) => self.visit_foreign_item(a),
map::NodeTraitItem(a) => self.visit_trait_item(a),
map::NodeImplItem(a) => self.visit_impl_item(a),
map::NodeExpr(a) => self.visit_expr(a),
map::NodeStmt(a) => self.visit_stmt(a),
map::NodeTy(a) => self.visit_ty(a),
map::NodePat(a) => self.visit_pat(a),
map::NodeBlock(a) => self.visit_block(a),
_ => bug!("Visitor::visit_hir_map_node() not yet impl for node `{:?}`", node)
}
}

///////////////////////////////////////////////////////////////////////////
// Nested items.

Expand Down
15 changes: 2 additions & 13 deletions src/librustc/ich/impls_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ty::subst::Kind<'t
}
}

impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ty::Region {
impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ty::RegionKind<'tcx> {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'tcx>,
hasher: &mut StableHasher<W>) {
Expand Down Expand Up @@ -432,17 +432,6 @@ impl_stable_hash_for!(enum ty::cast::CastKind {
FnPtrAddrCast
});

impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ::middle::region::CodeExtent
{
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'tcx>,
hasher: &mut StableHasher<W>) {
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
hcx.tcx().region_maps.code_extent_data(*self).hash_stable(hcx, hasher);
});
}
}

impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ::middle::region::CodeExtentData
{
fn hash_stable<W: StableHasherResult>(&self,
Expand Down Expand Up @@ -477,7 +466,7 @@ impl_stable_hash_for!(struct ty::adjustment::CoerceUnsizedInfo {
custom_kind
});

impl_stable_hash_for!(struct ty::FreeRegion {
impl_stable_hash_for!(struct ty::FreeRegion<'tcx> {
scope,
bound_region
});
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl<'cx, 'gcx, 'tcx> ty::fold::TypeFolder<'gcx, 'tcx> for Generalizer<'cx, 'gcx
}
}

fn fold_region(&mut self, r: &'tcx ty::Region) -> &'tcx ty::Region {
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
match *r {
// Never make variables for regions bound within the type itself,
// nor for erased regions.
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/equate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
}
}

fn regions(&mut self, a: &'tcx ty::Region, b: &'tcx ty::Region)
-> RelateResult<'tcx, &'tcx ty::Region> {
fn regions(&mut self, a: ty::Region<'tcx>, b: ty::Region<'tcx>)
-> RelateResult<'tcx, ty::Region<'tcx>> {
debug!("{}.regions({:?}, {:?})",
self.tag(),
a,
Expand Down
20 changes: 11 additions & 9 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ use traits::{ObligationCause, ObligationCauseCode};
use ty::{self, TyCtxt, TypeFoldable};
use ty::{Region, Issue32330};
use ty::error::TypeError;
use syntax::ast::DUMMY_NODE_ID;
use syntax_pos::{Pos, Span};
use errors::{DiagnosticBuilder, DiagnosticStyledString};

Expand All @@ -78,7 +79,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn note_and_explain_region(self,
err: &mut DiagnosticBuilder,
prefix: &str,
region: &'tcx ty::Region,
region: ty::Region<'tcx>,
suffix: &str) {
fn item_scope_tag(item: &hir::Item) -> &'static str {
match item.node {
Expand Down Expand Up @@ -123,14 +124,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
format!("{}unknown scope: {:?}{}. Please report a bug.",
prefix, scope, suffix)
};
let span = match scope.span(&self.region_maps, &self.hir) {
let span = match scope.span(&self.hir) {
Some(s) => s,
None => {
err.note(&unknown_scope());
return;
}
};
let tag = match self.hir.find(scope.node_id(&self.region_maps)) {
let tag = match self.hir.find(scope.node_id()) {
Some(hir_map::NodeBlock(_)) => "block",
Some(hir_map::NodeExpr(expr)) => match expr.node {
hir::ExprCall(..) => "call",
Expand All @@ -150,7 +151,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
return;
}
};
let scope_decorated_tag = match self.region_maps.code_extent_data(scope) {
let scope_decorated_tag = match *scope {
region::CodeExtentData::Misc(_) => tag,
region::CodeExtentData::CallSiteScope { .. } => {
"scope of call-site for function"
Expand Down Expand Up @@ -183,7 +184,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
}
};

let node = fr.scope.node_id(&self.region_maps);
let node = fr.scope.map(|s| s.node_id())
.unwrap_or(DUMMY_NODE_ID);
let unknown;
let tag = match self.hir.find(node) {
Some(hir_map::NodeBlock(_)) |
Expand Down Expand Up @@ -515,7 +517,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
values.1.push_normal("<");
}

fn lifetime_display(lifetime: &Region) -> String {
fn lifetime_display(lifetime: Region) -> String {
let s = format!("{}", lifetime);
if s.is_empty() {
"'_".to_string()
Expand Down Expand Up @@ -767,7 +769,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
fn report_generic_bound_failure(&self,
origin: SubregionOrigin<'tcx>,
bound_kind: GenericKind<'tcx>,
sub: &'tcx Region)
sub: Region<'tcx>)
{
// FIXME: it would be better to report the first error message
// with the span of the parameter itself, rather than the span
Expand Down Expand Up @@ -846,9 +848,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
fn report_sub_sup_conflict(&self,
var_origin: RegionVariableOrigin,
sub_origin: SubregionOrigin<'tcx>,
sub_region: &'tcx Region,
sub_region: Region<'tcx>,
sup_origin: SubregionOrigin<'tcx>,
sup_region: &'tcx Region) {
sup_region: Region<'tcx>) {
let mut err = self.report_inference_failure(var_origin);

self.tcx.note_and_explain_region(&mut err,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/error_reporting/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {

pub(super) fn report_concrete_failure(&self,
origin: SubregionOrigin<'tcx>,
sub: &'tcx Region,
sup: &'tcx Region)
sub: Region<'tcx>,
sup: Region<'tcx>)
-> DiagnosticBuilder<'tcx> {
match origin {
infer::Subtype(trace) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/freshen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
self.infcx.tcx
}

fn fold_region(&mut self, r: &'tcx ty::Region) -> &'tcx ty::Region {
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
match *r {
ty::ReEarlyBound(..) |
ty::ReLateBound(..) => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/fudge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFudger<'a, 'gcx, 'tcx> {
}
}

fn fold_region(&mut self, r: &'tcx ty::Region) -> &'tcx ty::Region {
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
match *r {
ty::ReVar(v) if self.region_vars.contains(&v) => {
self.infcx.next_region_var(self.origin.clone())
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/glb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
lattice::super_lattice_tys(self, a, b)
}

fn regions(&mut self, a: &'tcx ty::Region, b: &'tcx ty::Region)
-> RelateResult<'tcx, &'tcx ty::Region> {
fn regions(&mut self, a: ty::Region<'tcx>, b: ty::Region<'tcx>)
-> RelateResult<'tcx, ty::Region<'tcx>> {
debug!("{}.regions({:?}, {:?})",
self.tag(),
a,
Expand Down
Loading