Skip to content

Commit ed1f26d

Browse files
committed
Auto merge of rust-lang#41702 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests - Successful merges: rust-lang#41661, rust-lang#41662, rust-lang#41673, rust-lang#41688, rust-lang#41692, rust-lang#41693 - Failed merges:
2 parents 96e2c34 + e0bfd19 commit ed1f26d

File tree

108 files changed

+1387
-1232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1387
-1232
lines changed

src/bootstrap/bootstrap.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ def build_triple(self):
414414
# The goal here is to come up with the same triple as LLVM would,
415415
# at least for the subset of platforms we're willing to target.
416416
if ostype == 'Linux':
417-
os = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
418-
if os == 'Android':
417+
os_from_sp = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
418+
if os_from_sp == 'Android':
419419
ostype = 'linux-android'
420420
else:
421421
ostype = 'unknown-linux-gnu'

src/libcore/convert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ pub trait Into<T>: Sized {
276276
pub trait From<T>: Sized {
277277
/// Performs the conversion.
278278
#[stable(feature = "rust1", since = "1.0.0")]
279-
fn from(T) -> Self;
279+
fn from(_: T) -> Self;
280280
}
281281

282282
/// An attempted conversion that consumes `self`, which may or may not be

src/libcore/hash/sip.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,8 @@ impl<S: Sip> Default for Hasher<S> {
403403

404404
#[doc(hidden)]
405405
trait Sip {
406-
fn c_rounds(&mut State);
407-
fn d_rounds(&mut State);
406+
fn c_rounds(_: &mut State);
407+
fn d_rounds(_: &mut State);
408408
}
409409

410410
#[derive(Debug, Clone, Default)]

src/libcore/ops.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2878,10 +2878,10 @@ pub trait Carrier {
28782878
type Error;
28792879

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

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

28862886
/// Translate this `Carrier` to another implementation of `Carrier` with the
28872887
/// same associated types.

src/librand/distributions/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub trait Sample<Support> {
5353
// trait called `Sample` and the other should be `DependentSample`.
5454
pub trait IndependentSample<Support>: Sample<Support> {
5555
/// Generate a random value.
56-
fn ind_sample<R: Rng>(&self, &mut R) -> Support;
56+
fn ind_sample<R: Rng>(&self, _: &mut R) -> Support;
5757
}
5858

5959
/// A wrapper for generating types that implement `Rand` via the

src/librand/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl<'a, R: fmt::Debug> fmt::Debug for AsciiGenerator<'a, R> {
329329
/// the same stream of randomness multiple times.
330330
pub trait SeedableRng<Seed>: Rng {
331331
/// Reseed an RNG with the given seed.
332-
fn reseed(&mut self, Seed);
332+
fn reseed(&mut self, _: Seed);
333333

334334
/// Create a new RNG with the given seed.
335335
fn from_seed(seed: Seed) -> Self;

src/librustc/cfg/construct.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ use syntax::ast;
1515
use syntax::ptr::P;
1616

1717
use hir::{self, PatKind};
18+
use hir::def_id::DefId;
1819

1920
struct CFGBuilder<'a, 'tcx: 'a> {
2021
tcx: TyCtxt<'a, 'tcx, 'tcx>,
22+
owner_def_id: DefId,
2123
tables: &'a ty::TypeckTables<'tcx>,
2224
graph: CFGGraph,
2325
fn_exit: CFGIndex,
@@ -56,6 +58,7 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
5658

5759
let mut cfg_builder = CFGBuilder {
5860
tcx: tcx,
61+
owner_def_id,
5962
tables: tables,
6063
graph: graph,
6164
fn_exit: fn_exit,
@@ -583,11 +586,12 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
583586
scope_id: ast::NodeId,
584587
to_index: CFGIndex) {
585588
let mut data = CFGEdgeData { exiting_scopes: vec![] };
586-
let mut scope = self.tcx.region_maps.node_extent(from_expr.id);
587-
let target_scope = self.tcx.region_maps.node_extent(scope_id);
589+
let mut scope = self.tcx.node_extent(from_expr.id);
590+
let target_scope = self.tcx.node_extent(scope_id);
591+
let region_maps = self.tcx.region_maps(self.owner_def_id);
588592
while scope != target_scope {
589-
data.exiting_scopes.push(scope.node_id(&self.tcx.region_maps));
590-
scope = self.tcx.region_maps.encl_scope(scope);
593+
data.exiting_scopes.push(scope.node_id());
594+
scope = region_maps.encl_scope(scope);
591595
}
592596
self.graph.add_edge(from_index, to_index, data);
593597
}

src/librustc/dep_graph/dep_node.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub enum DepNode<D: Clone + Debug> {
5656
WorkProduct(Arc<WorkProductId>),
5757

5858
// Represents different phases in the compiler.
59-
RegionResolveCrate,
59+
RegionMaps(D),
6060
Coherence,
6161
Resolve,
6262
CoherenceCheckTrait(D),
@@ -197,7 +197,6 @@ impl<D: Clone + Debug> DepNode<D> {
197197
BorrowCheckKrate => Some(BorrowCheckKrate),
198198
MirKrate => Some(MirKrate),
199199
TypeckBodiesKrate => Some(TypeckBodiesKrate),
200-
RegionResolveCrate => Some(RegionResolveCrate),
201200
Coherence => Some(Coherence),
202201
Resolve => Some(Resolve),
203202
Variance => Some(Variance),
@@ -223,6 +222,7 @@ impl<D: Clone + Debug> DepNode<D> {
223222
def_ids.map(MirShim)
224223
}
225224
BorrowCheck(ref d) => op(d).map(BorrowCheck),
225+
RegionMaps(ref d) => op(d).map(RegionMaps),
226226
RvalueCheck(ref d) => op(d).map(RvalueCheck),
227227
TransCrateItem(ref d) => op(d).map(TransCrateItem),
228228
TransInlinedItem(ref d) => op(d).map(TransInlinedItem),

src/librustc/hir/intravisit.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use syntax::codemap::Spanned;
3939
use syntax_pos::Span;
4040
use hir::*;
4141
use hir::def::Def;
42-
use hir::map::Map;
42+
use hir::map::{self, Map};
4343
use super::itemlikevisit::DeepVisitor;
4444

4545
use std::cmp;
@@ -140,6 +140,23 @@ impl<'this, 'tcx> NestedVisitorMap<'this, 'tcx> {
140140
/// to monitor future changes to `Visitor` in case a new method with a
141141
/// new default implementation gets introduced.)
142142
pub trait Visitor<'v> : Sized {
143+
/// Invokes the suitable visitor method for the given `Node`
144+
/// extracted from the hir map.
145+
fn visit_hir_map_node(&mut self, node: map::Node<'v>) {
146+
match node {
147+
map::NodeItem(a) => self.visit_item(a),
148+
map::NodeForeignItem(a) => self.visit_foreign_item(a),
149+
map::NodeTraitItem(a) => self.visit_trait_item(a),
150+
map::NodeImplItem(a) => self.visit_impl_item(a),
151+
map::NodeExpr(a) => self.visit_expr(a),
152+
map::NodeStmt(a) => self.visit_stmt(a),
153+
map::NodeTy(a) => self.visit_ty(a),
154+
map::NodePat(a) => self.visit_pat(a),
155+
map::NodeBlock(a) => self.visit_block(a),
156+
_ => bug!("Visitor::visit_hir_map_node() not yet impl for node `{:?}`", node)
157+
}
158+
}
159+
143160
///////////////////////////////////////////////////////////////////////////
144161
// Nested items.
145162

src/librustc/ich/impls_ty.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ty::subst::Kind<'t
3939
}
4040
}
4141

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

435-
impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ::middle::region::CodeExtent
436-
{
437-
fn hash_stable<W: StableHasherResult>(&self,
438-
hcx: &mut StableHashingContext<'a, 'tcx>,
439-
hasher: &mut StableHasher<W>) {
440-
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
441-
hcx.tcx().region_maps.code_extent_data(*self).hash_stable(hcx, hasher);
442-
});
443-
}
444-
}
445-
446435
impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ::middle::region::CodeExtentData
447436
{
448437
fn hash_stable<W: StableHasherResult>(&self,
@@ -477,7 +466,7 @@ impl_stable_hash_for!(struct ty::adjustment::CoerceUnsizedInfo {
477466
custom_kind
478467
});
479468

480-
impl_stable_hash_for!(struct ty::FreeRegion {
469+
impl_stable_hash_for!(struct ty::FreeRegion<'tcx> {
481470
scope,
482471
bound_region
483472
});

src/librustc/infer/combine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ impl<'cx, 'gcx, 'tcx> ty::fold::TypeFolder<'gcx, 'tcx> for Generalizer<'cx, 'gcx
315315
}
316316
}
317317

318-
fn fold_region(&mut self, r: &'tcx ty::Region) -> &'tcx ty::Region {
318+
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
319319
match *r {
320320
// Never make variables for regions bound within the type itself,
321321
// nor for erased regions.

src/librustc/infer/equate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
7878
}
7979
}
8080

81-
fn regions(&mut self, a: &'tcx ty::Region, b: &'tcx ty::Region)
82-
-> RelateResult<'tcx, &'tcx ty::Region> {
81+
fn regions(&mut self, a: ty::Region<'tcx>, b: ty::Region<'tcx>)
82+
-> RelateResult<'tcx, ty::Region<'tcx>> {
8383
debug!("{}.regions({:?}, {:?})",
8484
self.tag(),
8585
a,

src/librustc/infer/error_reporting/mod.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ use traits::{ObligationCause, ObligationCauseCode};
6969
use ty::{self, TyCtxt, TypeFoldable};
7070
use ty::{Region, Issue32330};
7171
use ty::error::TypeError;
72+
use syntax::ast::DUMMY_NODE_ID;
7273
use syntax_pos::{Pos, Span};
7374
use errors::{DiagnosticBuilder, DiagnosticStyledString};
7475

@@ -78,7 +79,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
7879
pub fn note_and_explain_region(self,
7980
err: &mut DiagnosticBuilder,
8081
prefix: &str,
81-
region: &'tcx ty::Region,
82+
region: ty::Region<'tcx>,
8283
suffix: &str) {
8384
fn item_scope_tag(item: &hir::Item) -> &'static str {
8485
match item.node {
@@ -123,14 +124,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
123124
format!("{}unknown scope: {:?}{}. Please report a bug.",
124125
prefix, scope, suffix)
125126
};
126-
let span = match scope.span(&self.region_maps, &self.hir) {
127+
let span = match scope.span(&self.hir) {
127128
Some(s) => s,
128129
None => {
129130
err.note(&unknown_scope());
130131
return;
131132
}
132133
};
133-
let tag = match self.hir.find(scope.node_id(&self.region_maps)) {
134+
let tag = match self.hir.find(scope.node_id()) {
134135
Some(hir_map::NodeBlock(_)) => "block",
135136
Some(hir_map::NodeExpr(expr)) => match expr.node {
136137
hir::ExprCall(..) => "call",
@@ -150,7 +151,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
150151
return;
151152
}
152153
};
153-
let scope_decorated_tag = match self.region_maps.code_extent_data(scope) {
154+
let scope_decorated_tag = match *scope {
154155
region::CodeExtentData::Misc(_) => tag,
155156
region::CodeExtentData::CallSiteScope { .. } => {
156157
"scope of call-site for function"
@@ -183,7 +184,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
183184
}
184185
};
185186

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

518-
fn lifetime_display(lifetime: &Region) -> String {
520+
fn lifetime_display(lifetime: Region) -> String {
519521
let s = format!("{}", lifetime);
520522
if s.is_empty() {
521523
"'_".to_string()
@@ -767,7 +769,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
767769
fn report_generic_bound_failure(&self,
768770
origin: SubregionOrigin<'tcx>,
769771
bound_kind: GenericKind<'tcx>,
770-
sub: &'tcx Region)
772+
sub: Region<'tcx>)
771773
{
772774
// FIXME: it would be better to report the first error message
773775
// with the span of the parameter itself, rather than the span
@@ -846,9 +848,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
846848
fn report_sub_sup_conflict(&self,
847849
var_origin: RegionVariableOrigin,
848850
sub_origin: SubregionOrigin<'tcx>,
849-
sub_region: &'tcx Region,
851+
sub_region: Region<'tcx>,
850852
sup_origin: SubregionOrigin<'tcx>,
851-
sup_region: &'tcx Region) {
853+
sup_region: Region<'tcx>) {
852854
let mut err = self.report_inference_failure(var_origin);
853855

854856
self.tcx.note_and_explain_region(&mut err,

src/librustc/infer/error_reporting/note.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
146146

147147
pub(super) fn report_concrete_failure(&self,
148148
origin: SubregionOrigin<'tcx>,
149-
sub: &'tcx Region,
150-
sup: &'tcx Region)
149+
sub: Region<'tcx>,
150+
sup: Region<'tcx>)
151151
-> DiagnosticBuilder<'tcx> {
152152
match origin {
153153
infer::Subtype(trace) => {

src/librustc/infer/freshen.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
8383
self.infcx.tcx
8484
}
8585

86-
fn fold_region(&mut self, r: &'tcx ty::Region) -> &'tcx ty::Region {
86+
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
8787
match *r {
8888
ty::ReEarlyBound(..) |
8989
ty::ReLateBound(..) => {

src/librustc/infer/fudge.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFudger<'a, 'gcx, 'tcx> {
147147
}
148148
}
149149

150-
fn fold_region(&mut self, r: &'tcx ty::Region) -> &'tcx ty::Region {
150+
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
151151
match *r {
152152
ty::ReVar(v) if self.region_vars.contains(&v) => {
153153
self.infcx.next_region_var(self.origin.clone())

src/librustc/infer/glb.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
5959
lattice::super_lattice_tys(self, a, b)
6060
}
6161

62-
fn regions(&mut self, a: &'tcx ty::Region, b: &'tcx ty::Region)
63-
-> RelateResult<'tcx, &'tcx ty::Region> {
62+
fn regions(&mut self, a: ty::Region<'tcx>, b: ty::Region<'tcx>)
63+
-> RelateResult<'tcx, ty::Region<'tcx>> {
6464
debug!("{}.regions({:?}, {:?})",
6565
self.tag(),
6666
a,

0 commit comments

Comments
 (0)