Skip to content

Commit 2363852

Browse files
committed
fixes
1 parent 3082a7f commit 2363852

File tree

9 files changed

+32
-20
lines changed

9 files changed

+32
-20
lines changed

Cargo.lock

+14
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ name = "arena"
4747
version = "0.0.0"
4848
dependencies = [
4949
"rustc_data_structures 0.0.0",
50+
"smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
5051
]
5152

5253
[[package]]
@@ -2081,6 +2082,7 @@ dependencies = [
20812082
"rustc_data_structures 0.0.0",
20822083
"rustc_errors 0.0.0",
20832084
"rustc_fs_util 0.0.0",
2085+
"rustc_macros 0.1.0",
20842086
"rustc_target 0.0.0",
20852087
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
20862088
"serialize 0.0.0",
@@ -2328,6 +2330,7 @@ dependencies = [
23282330
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
23292331
"rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
23302332
"rustc_llvm 0.0.0",
2333+
"rustc_macros 0.1.0",
23312334
]
23322335

23332336
[[package]]
@@ -2499,6 +2502,16 @@ dependencies = [
24992502
"core 0.0.0",
25002503
]
25012504

2505+
[[package]]
2506+
name = "rustc_macros"
2507+
version = "0.1.0"
2508+
dependencies = [
2509+
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
2510+
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
2511+
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
2512+
"synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
2513+
]
2514+
25022515
[[package]]
25032516
name = "rustc_metadata"
25042517
version = "0.0.0"
@@ -2700,6 +2713,7 @@ dependencies = [
27002713
"minifier 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
27012714
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
27022715
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
2716+
"rustc_macros 0.1.0",
27032717
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
27042718
]
27052719

src/librustc/hir/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ mod item_local_id_inner {
125125
/// an "item-like" to something else can be implement by a `Vec` instead of a
126126
/// tree or hash map.
127127
newtype_index! {
128-
pub struct ItemLocalId { .. }
128+
pub struct ItemLocalId {
129+
derive [HashStable]
130+
}
129131
}
130132
}
131133

src/librustc/ich/impls_hir.rs

-9
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,6 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for CrateNum {
6969
}
7070
}
7171

72-
impl<'a> HashStable<StableHashingContext<'a>> for hir::ItemLocalId {
73-
#[inline]
74-
fn hash_stable<W: StableHasherResult>(&self,
75-
hcx: &mut StableHashingContext<'a>,
76-
hasher: &mut StableHasher<W>) {
77-
self.as_u32().hash_stable(hcx, hasher);
78-
}
79-
}
80-
8172
impl<'a> ToStableHashKey<StableHashingContext<'a>>
8273
for hir::ItemLocalId {
8374
type KeyType = hir::ItemLocalId;

src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
2525
&self,
2626
region: Region<'tcx>,
2727
br: &ty::BoundRegion,
28-
) -> Option<(&hir::Ty, &hir::FnDecl)> {
28+
) -> Option<(&'gcx hir::Ty<'gcx>, &'gcx hir::FnDecl<'gcx>)> {
2929
if let Some(anon_reg) = self.tcx.is_suitable_region(region) {
3030
let def_id = anon_reg.def_id;
3131
if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) {
@@ -62,7 +62,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
6262
&self,
6363
arg: &'gcx hir::Ty,
6464
br: &ty::BoundRegion,
65-
) -> Option<(&'gcx hir::Ty)> {
65+
) -> Option<(&'gcx hir::Ty<'gcx>)> {
6666
let mut nested_visitor = FindNestedTypeVisitor {
6767
tcx: self.tcx,
6868
bound_region: *br,

src/librustc/ty/context.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for TypeckTables<'gcx> {
789789

790790
newtype_index! {
791791
pub struct UserTypeAnnotationIndex {
792+
derive [HashStable]
792793
DEBUG_FORMAT = "UserTypeAnnotation({})",
793794
const START_INDEX = 0,
794795
}
@@ -841,7 +842,7 @@ impl CanonicalUserTypeAnnotation<'gcx> {
841842
/// A user-given type annotation attached to a constant. These arise
842843
/// from constants that are named via paths, like `Foo::<A>::new` and
843844
/// so forth.
844-
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
845+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, HashStable)]
845846
pub enum UserTypeAnnotation<'tcx> {
846847
Ty(Ty<'tcx>),
847848

src/librustc/ty/sty.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
20662066
}
20672067
}
20682068

2069-
#[derive(Copy, Clone, Debug, Hash, RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)]
2069+
#[derive(Copy, Clone, Debug, Hash, HashStable,
2070+
RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)]
20702071
/// Used in the HIR by using `Unevaluated` everywhere and later normalizing to `Evaluated` if the
20712072
/// code is monomorphic enough for that.
20722073
pub enum LazyConst<'tcx> {

src/librustc_typeck/astconv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
14441444
pub fn prohibit_generics<'a, T: IntoIterator<Item = &'a hir::PathSegment<'gcx>>>(
14451445
&self,
14461446
segments: T
1447-
)
1447+
) -> bool
14481448
where
14491449
'gcx: 'a
14501450
{

src/librustc_typeck/check/method/suggest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
676676

677677
#[derive(Copy, Clone)]
678678
pub enum SelfSource<'a> {
679-
QPath(&'a hir::Ty),
680-
MethodCall(&'a hir::Expr /* rcvr */),
679+
QPath(&'a hir::Ty<'a>),
680+
MethodCall(&'a hir::Expr<'a> /* rcvr */),
681681
}
682682

683683
#[derive(Copy, Clone)]

src/librustc_typeck/check/mod.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -4930,13 +4930,16 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
49304930
}
49314931

49324932
/// Given a function block's `NodeId`, return its `FnDecl` if it exists, or `None` otherwise.
4933-
fn get_parent_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl, ast::Ident)> {
4933+
fn get_parent_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl<'gcx>, ast::Ident)> {
49344934
let parent = self.tcx.hir().get(self.tcx.hir().get_parent(blk_id));
49354935
self.get_node_fn_decl(parent).map(|(fn_decl, ident, _)| (fn_decl, ident))
49364936
}
49374937

49384938
/// Given a function `Node`, return its `FnDecl` if it exists, or `None` otherwise.
4939-
fn get_node_fn_decl(&self, node: Node) -> Option<(hir::FnDecl, ast::Ident, bool)> {
4939+
fn get_node_fn_decl<'hir>(
4940+
&self,
4941+
node: Node<'hir>
4942+
) -> Option<(hir::FnDecl<'hir>, ast::Ident, bool)> {
49404943
match node {
49414944
Node::Item(&hir::Item {
49424945
ident, node: hir::ItemKind::Fn(ref decl, ..), ..
@@ -4962,7 +4965,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
49624965

49634966
/// Given a `NodeId`, return the `FnDecl` of the method it is enclosed by and whether a
49644967
/// suggestion can be made, `None` otherwise.
4965-
pub fn get_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl, bool)> {
4968+
pub fn get_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl<'gcx>, bool)> {
49664969
// Get enclosing Fn, if it is a function or a trait method, unless there's a `loop` or
49674970
// `while` before reaching it, as block tail returns are not available in them.
49684971
self.tcx.hir().get_return_block(blk_id).and_then(|blk_id| {

0 commit comments

Comments
 (0)