Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Jan 11, 2019
1 parent 3082a7f commit 2363852
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 20 deletions.
14 changes: 14 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ name = "arena"
version = "0.0.0"
dependencies = [
"rustc_data_structures 0.0.0",
"smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
Expand Down Expand Up @@ -2081,6 +2082,7 @@ dependencies = [
"rustc_data_structures 0.0.0",
"rustc_errors 0.0.0",
"rustc_fs_util 0.0.0",
"rustc_macros 0.1.0",
"rustc_target 0.0.0",
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serialize 0.0.0",
Expand Down Expand Up @@ -2328,6 +2330,7 @@ dependencies = [
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_llvm 0.0.0",
"rustc_macros 0.1.0",
]

[[package]]
Expand Down Expand Up @@ -2499,6 +2502,16 @@ dependencies = [
"core 0.0.0",
]

[[package]]
name = "rustc_macros"
version = "0.1.0"
dependencies = [
"proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "rustc_metadata"
version = "0.0.0"
Expand Down Expand Up @@ -2700,6 +2713,7 @@ dependencies = [
"minifier 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_macros 0.1.0",
"tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
]

Expand Down
4 changes: 3 additions & 1 deletion src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ mod item_local_id_inner {
/// an "item-like" to something else can be implement by a `Vec` instead of a
/// tree or hash map.
newtype_index! {
pub struct ItemLocalId { .. }
pub struct ItemLocalId {
derive [HashStable]
}
}
}

Expand Down
9 changes: 0 additions & 9 deletions src/librustc/ich/impls_hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for CrateNum {
}
}

impl<'a> HashStable<StableHashingContext<'a>> for hir::ItemLocalId {
#[inline]
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {
self.as_u32().hash_stable(hcx, hasher);
}
}

impl<'a> ToStableHashKey<StableHashingContext<'a>>
for hir::ItemLocalId {
type KeyType = hir::ItemLocalId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
&self,
region: Region<'tcx>,
br: &ty::BoundRegion,
) -> Option<(&hir::Ty, &hir::FnDecl)> {
) -> Option<(&'gcx hir::Ty<'gcx>, &'gcx hir::FnDecl<'gcx>)> {
if let Some(anon_reg) = self.tcx.is_suitable_region(region) {
let def_id = anon_reg.def_id;
if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) {
Expand Down Expand Up @@ -62,7 +62,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
&self,
arg: &'gcx hir::Ty,
br: &ty::BoundRegion,
) -> Option<(&'gcx hir::Ty)> {
) -> Option<(&'gcx hir::Ty<'gcx>)> {
let mut nested_visitor = FindNestedTypeVisitor {
tcx: self.tcx,
bound_region: *br,
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for TypeckTables<'gcx> {

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

Expand Down
3 changes: 2 additions & 1 deletion src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
}
}

#[derive(Copy, Clone, Debug, Hash, RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)]
#[derive(Copy, Clone, Debug, Hash, HashStable,
RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)]
/// Used in the HIR by using `Unevaluated` everywhere and later normalizing to `Evaluated` if the
/// code is monomorphic enough for that.
pub enum LazyConst<'tcx> {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
pub fn prohibit_generics<'a, T: IntoIterator<Item = &'a hir::PathSegment<'gcx>>>(
&self,
segments: T
)
) -> bool
where
'gcx: 'a
{
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {

#[derive(Copy, Clone)]
pub enum SelfSource<'a> {
QPath(&'a hir::Ty),
MethodCall(&'a hir::Expr /* rcvr */),
QPath(&'a hir::Ty<'a>),
MethodCall(&'a hir::Expr<'a> /* rcvr */),
}

#[derive(Copy, Clone)]
Expand Down
9 changes: 6 additions & 3 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4930,13 +4930,16 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}

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

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

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

0 comments on commit 2363852

Please sign in to comment.