Auto merge of #64886 - Centril:rollup-30dqh8j, r=Centril
Rollup of 5 pull requests Successful merges: - #63492 (Remove redundancy from the implementation of C variadics.) - #64589 (Differentiate AArch64 bare-metal targets between hf and non-hf.) - #64799 (Fix double panic when printing query stack during an ICE) - #64824 (No StableHasherResult everywhere) - #64884 (Add pkg-config to dependency list if building for Linux on Linux) Failed merges: r? @ghost
This commit is contained in:
commit
fe2f7e0e53
82 changed files with 561 additions and 909 deletions
|
|
@ -633,9 +633,6 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
|
|||
TyKind::Typeof(ref expression) => {
|
||||
visitor.visit_anon_const(expression)
|
||||
}
|
||||
TyKind::CVarArgs(ref lt) => {
|
||||
visitor.visit_lifetime(lt)
|
||||
}
|
||||
TyKind::Infer | TyKind::Err => {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1335,13 +1335,8 @@ impl<'a> LoweringContext<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
TyKind::Mac(_) => bug!("`TyMac` should have been expanded by now"),
|
||||
TyKind::CVarArgs => {
|
||||
// Create the implicit lifetime of the "spoofed" `VaListImpl`.
|
||||
let span = self.sess.source_map().next_point(t.span.shrink_to_lo());
|
||||
let lt = self.new_implicit_lifetime(span);
|
||||
hir::TyKind::CVarArgs(lt)
|
||||
},
|
||||
TyKind::Mac(_) => bug!("`TyKind::Mac` should have been expanded by now"),
|
||||
TyKind::CVarArgs => bug!("`TyKind::CVarArgs` should have been handled elsewhere"),
|
||||
};
|
||||
|
||||
hir::Ty {
|
||||
|
|
@ -2093,7 +2088,14 @@ impl<'a> LoweringContext<'a> {
|
|||
}
|
||||
|
||||
fn lower_fn_params_to_names(&mut self, decl: &FnDecl) -> hir::HirVec<Ident> {
|
||||
decl.inputs
|
||||
// Skip the `...` (`CVarArgs`) trailing arguments from the AST,
|
||||
// as they are not explicit in HIR/Ty function signatures.
|
||||
// (instead, the `c_variadic` flag is set to `true`)
|
||||
let mut inputs = &decl.inputs[..];
|
||||
if decl.c_variadic() {
|
||||
inputs = &inputs[..inputs.len() - 1];
|
||||
}
|
||||
inputs
|
||||
.iter()
|
||||
.map(|param| match param.pat.kind {
|
||||
PatKind::Ident(_, ident, _) => ident,
|
||||
|
|
@ -2130,10 +2132,19 @@ impl<'a> LoweringContext<'a> {
|
|||
self.anonymous_lifetime_mode
|
||||
};
|
||||
|
||||
let c_variadic = decl.c_variadic();
|
||||
|
||||
// Remember how many lifetimes were already around so that we can
|
||||
// only look at the lifetime parameters introduced by the arguments.
|
||||
let inputs = self.with_anonymous_lifetime_mode(lt_mode, |this| {
|
||||
decl.inputs
|
||||
// Skip the `...` (`CVarArgs`) trailing arguments from the AST,
|
||||
// as they are not explicit in HIR/Ty function signatures.
|
||||
// (instead, the `c_variadic` flag is set to `true`)
|
||||
let mut inputs = &decl.inputs[..];
|
||||
if c_variadic {
|
||||
inputs = &inputs[..inputs.len() - 1];
|
||||
}
|
||||
inputs
|
||||
.iter()
|
||||
.map(|param| {
|
||||
if let Some((_, ibty)) = &mut in_band_ty_params {
|
||||
|
|
@ -2168,7 +2179,7 @@ impl<'a> LoweringContext<'a> {
|
|||
P(hir::FnDecl {
|
||||
inputs,
|
||||
output,
|
||||
c_variadic: decl.c_variadic,
|
||||
c_variadic,
|
||||
implicit_self: decl.inputs.get(0).map_or(
|
||||
hir::ImplicitSelfKind::None,
|
||||
|arg| {
|
||||
|
|
|
|||
|
|
@ -450,7 +450,6 @@ impl LoweringContext<'_> {
|
|||
let ast_decl = FnDecl {
|
||||
inputs: vec![],
|
||||
output,
|
||||
c_variadic: false
|
||||
};
|
||||
let decl = self.lower_fn_decl(&ast_decl, None, /* impl trait allowed */ false, None);
|
||||
let body_id = self.lower_fn_body(&ast_decl, |this| {
|
||||
|
|
@ -739,7 +738,6 @@ impl LoweringContext<'_> {
|
|||
let outer_decl = FnDecl {
|
||||
inputs: decl.inputs.clone(),
|
||||
output: FunctionRetTy::Default(fn_decl_span),
|
||||
c_variadic: false,
|
||||
};
|
||||
// We need to lower the declaration outside the new scope, because we
|
||||
// have to conserve the state of being inside a loop condition for the
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use syntax_pos::Span;
|
|||
use std::iter::repeat;
|
||||
|
||||
use crate::ich::StableHashingContext;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
|
||||
/// A visitor that walks over the HIR and collects `Node`s into a HIR map.
|
||||
pub(super) struct NodeCollector<'a, 'hir> {
|
||||
|
|
@ -602,9 +602,7 @@ impl<'hir, T> HashStable<StableHashingContext<'hir>> for HirItemLike<T>
|
|||
where
|
||||
T: HashStable<StableHashingContext<'hir>>,
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'hir>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'hir>, hasher: &mut StableHasher) {
|
||||
hcx.while_hashing_hir_bodies(self.hash_bodies, |hcx| {
|
||||
self.item_like.hash_stable(hcx, hasher);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2016,9 +2016,6 @@ pub enum TyKind {
|
|||
Infer,
|
||||
/// Placeholder for a type that has failed to be defined.
|
||||
Err,
|
||||
/// Placeholder for C-variadic arguments. We "spoof" the `VaListImpl` created
|
||||
/// from the variadic arguments. This type is only valid up to typeck.
|
||||
CVarArgs(Lifetime),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
|
||||
|
|
|
|||
|
|
@ -361,9 +361,6 @@ impl<'a> State<'a> {
|
|||
self.s.word("/*ERROR*/");
|
||||
self.pclose();
|
||||
}
|
||||
hir::TyKind::CVarArgs(_) => {
|
||||
self.s.word("...");
|
||||
}
|
||||
}
|
||||
self.end()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@ use std::{slice, vec};
|
|||
|
||||
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
|
||||
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult,
|
||||
HashStable};
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
|
||||
/// An owned smart pointer.
|
||||
#[derive(Hash, PartialEq, Eq)]
|
||||
pub struct P<T: ?Sized> {
|
||||
|
|
@ -133,9 +132,7 @@ impl<T: Decodable> Decodable for P<[T]> {
|
|||
impl<CTX, T> HashStable<CTX> for P<T>
|
||||
where T: ?Sized + HashStable<CTX>
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut CTX,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
|
||||
(**self).hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use syntax_pos::{Span, DUMMY_SP};
|
|||
use syntax_pos::hygiene;
|
||||
|
||||
use rustc_data_structures::stable_hasher::{
|
||||
HashStable, StableHasher, StableHasherResult, ToStableHashKey,
|
||||
HashStable, StableHasher, ToStableHashKey,
|
||||
};
|
||||
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
|
||||
use smallvec::SmallVec;
|
||||
|
|
@ -219,9 +219,7 @@ impl<'a> StableHashingContextProvider<'a> for StableHashingContext<'a> {
|
|||
impl<'a> crate::dep_graph::DepGraphSafe for StableHashingContext<'a> {}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::BodyId {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
if hcx.hash_bodies() {
|
||||
hcx.body_resolver.body(*self).hash_stable(hcx, hasher);
|
||||
}
|
||||
|
|
@ -230,9 +228,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::BodyId {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::HirId {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
match hcx.node_id_hashing_mode {
|
||||
NodeIdHashingMode::Ignore => {
|
||||
// Don't do anything.
|
||||
|
|
@ -263,9 +259,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::HirId {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
match hcx.node_id_hashing_mode {
|
||||
NodeIdHashingMode::Ignore => {
|
||||
// Don't do anything.
|
||||
|
|
@ -298,9 +292,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
|
|||
/// codepoint offsets. For the purpose of the hash that's sufficient.
|
||||
/// Also, hashing filenames is expensive so we avoid doing it twice when the
|
||||
/// span starts and ends in the same file, which is almost always the case.
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
const TAG_VALID_SPAN: u8 = 0;
|
||||
const TAG_INVALID_SPAN: u8 = 1;
|
||||
const TAG_EXPANSION: u8 = 0;
|
||||
|
|
@ -379,24 +371,18 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for DelimSpan {
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.open.hash_stable(hcx, hasher);
|
||||
self.close.hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn hash_stable_trait_impls<'a, W>(
|
||||
pub fn hash_stable_trait_impls<'a>(
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
hasher: &mut StableHasher,
|
||||
blanket_impls: &[DefId],
|
||||
non_blanket_impls: &FxHashMap<fast_reject::SimplifiedType, Vec<DefId>>,
|
||||
) where
|
||||
W: StableHasherResult,
|
||||
{
|
||||
) {
|
||||
{
|
||||
let mut blanket_impls: SmallVec<[_; 8]> = blanket_impls
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@ use crate::hir::map::DefPathHash;
|
|||
use crate::hir::def_id::{DefId, LocalDefId, CrateNum, CRATE_DEF_INDEX};
|
||||
use crate::ich::{StableHashingContext, NodeIdHashingMode, Fingerprint};
|
||||
|
||||
use rustc_data_structures::stable_hasher::{
|
||||
HashStable, ToStableHashKey, StableHasher, StableHasherResult,
|
||||
};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher};
|
||||
use smallvec::SmallVec;
|
||||
use std::mem;
|
||||
use syntax::ast;
|
||||
|
|
@ -16,9 +14,7 @@ use syntax::attr;
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for DefId {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
hcx.def_path_hash(*self).hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
|
@ -34,9 +30,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for DefId {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for LocalDefId {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
hcx.def_path_hash(self.to_def_id()).hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
|
@ -52,9 +46,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for LocalDefId {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for CrateNum {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
hcx.def_path_hash(DefId {
|
||||
krate: *self,
|
||||
index: CRATE_DEF_INDEX
|
||||
|
|
@ -92,9 +84,7 @@ for hir::ItemLocalId {
|
|||
// in "DefPath Mode".
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::ItemId {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let hir::ItemId {
|
||||
id
|
||||
} = *self;
|
||||
|
|
@ -106,9 +96,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::ItemId {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitItemId {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let hir::TraitItemId {
|
||||
hir_id
|
||||
} = * self;
|
||||
|
|
@ -120,9 +108,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitItemId {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItemId {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let hir::ImplItemId {
|
||||
hir_id
|
||||
} = * self;
|
||||
|
|
@ -138,9 +124,7 @@ impl_stable_hash_for!(struct ast::Label {
|
|||
});
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::Ty {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
hcx.while_hashing_hir_bodies(true, |hcx| {
|
||||
let hir::Ty {
|
||||
hir_id: _,
|
||||
|
|
@ -166,9 +150,7 @@ impl_stable_hash_for!(struct hir::Stmt {
|
|||
impl_stable_hash_for_spanned!(ast::Name);
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::Expr {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
hcx.while_hashing_hir_bodies(true, |hcx| {
|
||||
let hir::Expr {
|
||||
hir_id: _,
|
||||
|
|
@ -192,9 +174,7 @@ impl_stable_hash_for!(struct ast::Ident {
|
|||
});
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitItem {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let hir::TraitItem {
|
||||
hir_id: _,
|
||||
ident,
|
||||
|
|
@ -216,9 +196,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitItem {
|
|||
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItem {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let hir::ImplItem {
|
||||
hir_id: _,
|
||||
ident,
|
||||
|
|
@ -248,9 +226,7 @@ impl_stable_hash_for!(enum ast::CrateSugar {
|
|||
});
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::VisibilityKind {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
match *self {
|
||||
hir::VisibilityKind::Public |
|
||||
|
|
@ -273,9 +249,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::VisibilityKind {
|
|||
impl_stable_hash_for_spanned!(hir::VisibilityKind);
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::Mod {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let hir::Mod {
|
||||
inner: ref inner_span,
|
||||
ref item_ids,
|
||||
|
|
@ -305,9 +279,7 @@ impl_stable_hash_for_spanned!(hir::Variant);
|
|||
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::Item {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let hir::Item {
|
||||
ident,
|
||||
ref attrs,
|
||||
|
|
@ -328,9 +300,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::Item {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::Body {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let hir::Body {
|
||||
params,
|
||||
value,
|
||||
|
|
@ -359,9 +329,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::BodyId {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::def_id::DefIndex {
|
||||
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
hcx.local_def_path_hash(*self).hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
|
@ -376,17 +344,13 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::def_id::DefIndex {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for crate::middle::lang_items::LangItem {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
_: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, _: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
::std::hash::Hash::hash(self, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitCandidate {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
|
||||
let hir::TraitCandidate {
|
||||
def_id,
|
||||
|
|
@ -418,17 +382,13 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::TraitCandidate {
|
|||
}
|
||||
|
||||
impl<'hir> HashStable<StableHashingContext<'hir>> for attr::InlineAttr {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'hir>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'hir>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'hir> HashStable<StableHashingContext<'hir>> for attr::OptimizeAttr {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'hir>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'hir>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,14 +16,11 @@ use syntax_pos::SourceFile;
|
|||
use crate::hir::def_id::{DefId, CrateNum, CRATE_DEF_INDEX};
|
||||
|
||||
use smallvec::SmallVec;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
|
||||
StableHasher, StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher};
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for InternedString {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.with(|s| s.hash_stable(hcx, hasher))
|
||||
}
|
||||
}
|
||||
|
|
@ -41,9 +38,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for InternedString {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ast::Name {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.as_str().hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
|
@ -110,9 +105,7 @@ impl_stable_hash_for!(enum ::syntax::edition::Edition {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>>
|
||||
for ::syntax::attr::StabilityLevel {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
match *self {
|
||||
::syntax::attr::StabilityLevel::Unstable { ref reason, ref issue, ref is_soft } => {
|
||||
|
|
@ -172,9 +165,7 @@ impl_stable_hash_for!(enum ::syntax::ast::StrStyle { Cooked, Raw(pounds) });
|
|||
impl_stable_hash_for!(enum ::syntax::ast::AttrStyle { Outer, Inner });
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for [ast::Attribute] {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
if self.len() == 0 {
|
||||
self.len().hash_stable(hcx, hasher);
|
||||
return
|
||||
|
|
@ -197,9 +188,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for [ast::Attribute] {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ast::Path {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.segments.len().hash_stable(hcx, hasher);
|
||||
for segment in &self.segments {
|
||||
segment.ident.name.hash_stable(hcx, hasher);
|
||||
|
|
@ -208,9 +197,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ast::Path {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ast::Attribute {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
// Make sure that these have been filtered out.
|
||||
debug_assert!(!self.ident().map_or(false, |ident| hcx.is_ignored_attr(ident.name)));
|
||||
debug_assert!(!self.is_sugared_doc);
|
||||
|
|
@ -235,9 +222,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ast::Attribute {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>>
|
||||
for tokenstream::TokenTree {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
match *self {
|
||||
tokenstream::TokenTree::Token(ref token) => {
|
||||
|
|
@ -256,9 +241,7 @@ for tokenstream::TokenTree {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>>
|
||||
for tokenstream::TokenStream {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
for sub_tt in self.trees() {
|
||||
sub_tt.hash_stable(hcx, hasher);
|
||||
}
|
||||
|
|
@ -285,9 +268,7 @@ impl_stable_hash_for!(struct token::Lit {
|
|||
});
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for token::TokenKind {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
match *self {
|
||||
token::Eq |
|
||||
|
|
@ -426,9 +407,7 @@ impl_stable_hash_for!(enum ::syntax_pos::FileName {
|
|||
});
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let SourceFile {
|
||||
name: _, // We hash the smaller name_hash instead of this
|
||||
name_hash,
|
||||
|
|
@ -502,11 +481,7 @@ fn stable_non_narrow_char(swc: ::syntax_pos::NonNarrowChar,
|
|||
}
|
||||
|
||||
impl<'tcx> HashStable<StableHashingContext<'tcx>> for feature_gate::Features {
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'tcx>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) {
|
||||
// Unfortunately we cannot exhaustively list fields here, since the
|
||||
// struct is macro generated.
|
||||
self.declared_lang_features.hash_stable(hcx, hasher);
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@
|
|||
|
||||
use crate::ich::{Fingerprint, StableHashingContext, NodeIdHashingMode};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
|
||||
StableHasher, StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher};
|
||||
use std::cell::RefCell;
|
||||
use std::mem;
|
||||
use crate::middle::region;
|
||||
|
|
@ -15,9 +14,7 @@ impl<'a, 'tcx, T> HashStable<StableHashingContext<'a>> for &'tcx ty::List<T>
|
|||
where
|
||||
T: HashStable<StableHashingContext<'a>>,
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
thread_local! {
|
||||
static CACHE: RefCell<FxHashMap<(usize, usize), Fingerprint>> =
|
||||
RefCell::new(Default::default());
|
||||
|
|
@ -57,18 +54,14 @@ where
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::subst::GenericArg<'tcx> {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.unpack().hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>>
|
||||
for ty::RegionKind {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
match *self {
|
||||
ty::ReErased |
|
||||
|
|
@ -112,31 +105,21 @@ for ty::RegionKind {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionVid {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.index().hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::ConstVid<'tcx> {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.index.hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> HashStable<StableHashingContext<'tcx>> for ty::BoundVar {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'tcx>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) {
|
||||
self.index().hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
|
@ -145,20 +128,14 @@ impl<'a, T> HashStable<StableHashingContext<'a>> for ty::Binder<T>
|
|||
where
|
||||
T: HashStable<StableHashingContext<'a>>,
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.skip_binder().hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
// AllocIds get resolved to whatever they point to (to be stable)
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for mir::interpret::AllocId {
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
ty::tls::with_opt(|tcx| {
|
||||
trace!("hashing {:?}", *self);
|
||||
let tcx = tcx.expect("can't hash AllocIds during hir lowering");
|
||||
|
|
@ -174,11 +151,7 @@ for mir::interpret::Relocations<Tag>
|
|||
where
|
||||
Tag: HashStable<StableHashingContext<'a>>,
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.len().hash_stable(hcx, hasher);
|
||||
for reloc in self.iter() {
|
||||
reloc.hash_stable(hcx, hasher);
|
||||
|
|
@ -201,9 +174,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for region::Scope {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ty::TyVid {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
_hcx: &mut StableHashingContext<'a>,
|
||||
_hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, _hcx: &mut StableHashingContext<'a>, _hasher: &mut StableHasher) {
|
||||
// `TyVid` values are confined to an inference context and hence
|
||||
// should not be hashed.
|
||||
bug!("ty::TyKind::hash_stable() - can't hash a TyVid {:?}.", *self)
|
||||
|
|
@ -211,9 +182,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::TyVid {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ty::IntVid {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
_hcx: &mut StableHashingContext<'a>,
|
||||
_hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, _hcx: &mut StableHashingContext<'a>, _hasher: &mut StableHasher) {
|
||||
// `IntVid` values are confined to an inference context and hence
|
||||
// should not be hashed.
|
||||
bug!("ty::TyKind::hash_stable() - can't hash an IntVid {:?}.", *self)
|
||||
|
|
@ -221,9 +190,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::IntVid {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ty::FloatVid {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
_hcx: &mut StableHashingContext<'a>,
|
||||
_hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, _hcx: &mut StableHashingContext<'a>, _hasher: &mut StableHasher) {
|
||||
// `FloatVid` values are confined to an inference context and hence
|
||||
// should not be hashed.
|
||||
bug!("ty::TyKind::hash_stable() - can't hash a FloatVid {:?}.", *self)
|
||||
|
|
@ -234,18 +201,14 @@ impl<'a, T> HashStable<StableHashingContext<'a>> for ty::steal::Steal<T>
|
|||
where
|
||||
T: HashStable<StableHashingContext<'a>>,
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.borrow().hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>>
|
||||
for crate::middle::privacy::AccessLevels {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
|
||||
let crate::middle::privacy::AccessLevels {
|
||||
ref map
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ use crate::lint::{self, Lint, LintId, Level, LintSource};
|
|||
use crate::session::Session;
|
||||
use crate::util::nodemap::FxHashMap;
|
||||
use errors::{Applicability, DiagnosticBuilder};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey,
|
||||
StableHasher, StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, ToStableHashKey, StableHasher};
|
||||
use syntax::ast;
|
||||
use syntax::attr;
|
||||
use syntax::feature_gate;
|
||||
|
|
@ -526,9 +525,7 @@ impl LintLevelMap {
|
|||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for LintLevelMap {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let LintLevelMap {
|
||||
ref sets,
|
||||
ref id_to_set,
|
||||
|
|
@ -567,9 +564,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for LintLevelMap {
|
|||
|
||||
impl<HCX> HashStable<HCX> for LintId {
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut HCX,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut HCX, hasher: &mut StableHasher) {
|
||||
self.lint_name_raw().hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ macro_rules! impl_stable_hash_for {
|
|||
where $($T: ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>),*
|
||||
{
|
||||
#[inline]
|
||||
fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self,
|
||||
__ctx: &mut $crate::ich::StableHashingContext<'a>,
|
||||
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) {
|
||||
fn hash_stable(&self,
|
||||
__ctx: &mut $crate::ich::StableHashingContext<'a>,
|
||||
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) {
|
||||
use $enum_path::*;
|
||||
::std::mem::discriminant(self).hash_stable(__ctx, __hasher);
|
||||
|
||||
|
|
@ -128,9 +128,9 @@ macro_rules! impl_stable_hash_for {
|
|||
where $($T: ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>),*
|
||||
{
|
||||
#[inline]
|
||||
fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self,
|
||||
__ctx: &mut $crate::ich::StableHashingContext<'a>,
|
||||
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) {
|
||||
fn hash_stable(&self,
|
||||
__ctx: &mut $crate::ich::StableHashingContext<'a>,
|
||||
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) {
|
||||
let $struct_name {
|
||||
$(ref $field),*
|
||||
} = *self;
|
||||
|
|
@ -153,9 +153,9 @@ macro_rules! impl_stable_hash_for {
|
|||
where $($T: ::rustc_data_structures::stable_hasher::HashStable<$crate::ich::StableHashingContext<'a>>),*
|
||||
{
|
||||
#[inline]
|
||||
fn hash_stable<W: ::rustc_data_structures::stable_hasher::StableHasherResult>(&self,
|
||||
__ctx: &mut $crate::ich::StableHashingContext<'a>,
|
||||
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher<W>) {
|
||||
fn hash_stable(&self,
|
||||
__ctx: &mut $crate::ich::StableHashingContext<'a>,
|
||||
__hasher: &mut ::rustc_data_structures::stable_hasher::StableHasher) {
|
||||
let $struct_name (
|
||||
$(ref $field),*
|
||||
) = *self;
|
||||
|
|
@ -173,9 +173,9 @@ macro_rules! impl_stable_hash_for_spanned {
|
|||
impl HashStable<StableHashingContext<'a>> for ::syntax::source_map::Spanned<$T>
|
||||
{
|
||||
#[inline]
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher) {
|
||||
self.node.hash_stable(hcx, hasher);
|
||||
self.span.hash_stable(hcx, hasher);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use crate::hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use crate::ich::StableHashingContext;
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, HashStable,
|
||||
StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
|
||||
use std::cmp;
|
||||
use std::mem;
|
||||
use crate::ty::{self, TyCtxt};
|
||||
|
|
@ -94,9 +93,7 @@ pub fn metadata_symbol_name(tcx: TyCtxt<'_>) -> String {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ExportedSymbol<'tcx> {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
match *self {
|
||||
ExportedSymbol::NonGeneric(def_id) => {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use crate::ty::{self, DefIdTree, TyCtxt};
|
|||
use crate::ty::query::Providers;
|
||||
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_macros::HashStable;
|
||||
use syntax::source_map;
|
||||
use syntax_pos::{Span, DUMMY_SP};
|
||||
|
|
@ -1491,9 +1491,7 @@ pub fn provide(providers: &mut Providers<'_>) {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for ScopeTree {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let ScopeTree {
|
||||
root_body,
|
||||
root_parent,
|
||||
|
|
|
|||
|
|
@ -764,13 +764,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
|||
});
|
||||
}
|
||||
}
|
||||
hir::TyKind::CVarArgs(ref lt) => {
|
||||
// Resolve the generated lifetime for the C-variadic arguments.
|
||||
// The lifetime is generated in AST -> HIR lowering.
|
||||
if lt.name.is_elided() {
|
||||
self.resolve_elided_lifetimes(vec![lt])
|
||||
}
|
||||
}
|
||||
_ => intravisit::walk_ty(self, ty),
|
||||
}
|
||||
}
|
||||
|
|
@ -2378,7 +2371,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
|||
self.visit_lifetime(lifetime);
|
||||
}
|
||||
}
|
||||
hir::TyKind::CVarArgs(_) => {}
|
||||
_ => {
|
||||
intravisit::walk_ty(self, ty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use rustc_data_structures::indexed_vec::IndexVec;
|
||||
use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_serialize::{Encodable, Encoder, Decodable, Decoder};
|
||||
use crate::ich::StableHashingContext;
|
||||
use crate::mir::{Body, BasicBlock};
|
||||
|
|
@ -24,9 +24,7 @@ impl rustc_serialize::Decodable for Cache {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for Cache {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
_: &mut StableHashingContext<'a>,
|
||||
_: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, _: &mut StableHashingContext<'a>, _: &mut StableHasher) {
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -682,14 +682,10 @@ impl_stable_hash_for!(enum self::MirPhase {
|
|||
|
||||
mod binding_form_impl {
|
||||
use crate::ich::StableHashingContext;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for super::BindingForm<'tcx> {
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
use super::BindingForm::*;
|
||||
::std::mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ use crate::util::nodemap::FxHashMap;
|
|||
use crate::ty::print::obsolete::DefPathBasedNames;
|
||||
use crate::dep_graph::{WorkProductId, DepNode, WorkProduct, DepConstructor};
|
||||
use rustc_data_structures::base_n;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasherResult,
|
||||
StableHasher};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use crate::ich::{Fingerprint, StableHashingContext, NodeIdHashingMode};
|
||||
use crate::session::config::OptLevel;
|
||||
use std::fmt;
|
||||
|
|
@ -223,9 +222,7 @@ impl<'tcx> MonoItem<'tcx> {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for MonoItem<'tcx> {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
::std::mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
|
||||
match *self {
|
||||
|
|
@ -419,9 +416,7 @@ impl<'tcx> CodegenUnit<'tcx> {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for CodegenUnit<'tcx> {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let CodegenUnit {
|
||||
ref items,
|
||||
name,
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ use crate::traits::query::NoSolution;
|
|||
use crate::ty::{self, Ty, TyCtxt};
|
||||
|
||||
use crate::ich::StableHashingContext;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
|
||||
StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use std::mem;
|
||||
|
||||
/// Outlives bounds are relationships between generic parameters,
|
||||
|
|
@ -43,9 +42,7 @@ EnumTypeFoldableImpl! {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for OutlivesBound<'tcx> {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
match *self {
|
||||
OutlivesBound::RegionSubRegion(ref a, ref b) => {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ use super::OverlapError;
|
|||
|
||||
use crate::hir::def_id::DefId;
|
||||
use crate::ich::{self, StableHashingContext};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
|
||||
StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use crate::traits;
|
||||
use crate::ty::{self, TyCtxt, TypeFoldable};
|
||||
use crate::ty::fast_reject::{self, SimplifiedType};
|
||||
|
|
@ -512,9 +511,7 @@ pub fn ancestors(
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for Children {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let Children {
|
||||
ref nonblanket_impls,
|
||||
ref blanket_impls,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ use errors::DiagnosticBuilder;
|
|||
use arena::SyncDroplessArena;
|
||||
use smallvec::SmallVec;
|
||||
use rustc_data_structures::stable_hasher::{
|
||||
HashStable, StableHasher, StableHasherResult, StableVec, hash_stable_hashmap,
|
||||
HashStable, StableHasher, StableVec, hash_stable_hashmap,
|
||||
};
|
||||
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
|
||||
use rustc_data_structures::sharded::ShardedHashMap;
|
||||
|
|
@ -705,9 +705,7 @@ impl<'tcx> TypeckTables<'tcx> {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TypeckTables<'tcx> {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let ty::TypeckTables {
|
||||
local_id_root,
|
||||
ref type_dependent_defs,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use crate::hir::def_id::DefId;
|
||||
use crate::ich::StableHashingContext;
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult,
|
||||
HashStable};
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
|
||||
use std::fmt::Debug;
|
||||
use std::hash::Hash;
|
||||
use std::mem;
|
||||
|
|
@ -158,9 +157,7 @@ impl<'a, D> HashStable<StableHashingContext<'a>> for SimplifiedTypeGen<D>
|
|||
where
|
||||
D: Copy + Debug + Ord + Eq + Hash + HashStable<StableHashingContext<'a>>,
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
match *self {
|
||||
BoolSimplifiedType |
|
||||
|
|
|
|||
|
|
@ -19,13 +19,12 @@ use crate::ty::GeneratorSubsts;
|
|||
use crate::ty::subst::Subst;
|
||||
use rustc_data_structures::bit_set::BitSet;
|
||||
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
|
||||
StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
|
||||
pub use rustc_target::abi::*;
|
||||
use rustc_target::spec::{HasTargetSpec, abi::Abi as SpecAbi};
|
||||
use rustc_target::abi::call::{
|
||||
ArgAttribute, ArgAttributes, ArgType, Conv, FnType, IgnoreMode, PassMode, Reg, RegKind
|
||||
ArgAttribute, ArgAttributes, ArgType, Conv, FnType, PassMode, Reg, RegKind
|
||||
};
|
||||
|
||||
pub trait IntegerExt {
|
||||
|
|
@ -2323,9 +2322,7 @@ where
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for Variants {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
use crate::ty::layout::Variants::*;
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
|
||||
|
|
@ -2349,9 +2346,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Variants {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for DiscriminantKind {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
use crate::ty::layout::DiscriminantKind::*;
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
|
||||
|
|
@ -2372,9 +2367,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for DiscriminantKind {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for FieldPlacement {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
use crate::ty::layout::FieldPlacement::*;
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
|
||||
|
|
@ -2395,19 +2388,13 @@ impl<'a> HashStable<StableHashingContext<'a>> for FieldPlacement {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for VariantIdx {
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.as_u32().hash_stable(hcx, hasher)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for Abi {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
use crate::ty::layout::Abi::*;
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
|
||||
|
|
@ -2432,9 +2419,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Abi {
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for Scalar {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let Scalar { value, ref valid_range } = *self;
|
||||
value.hash_stable(hcx, hasher);
|
||||
valid_range.start().hash_stable(hcx, hasher);
|
||||
|
|
@ -2476,29 +2461,19 @@ impl_stable_hash_for!(struct crate::ty::layout::AbiAndPrefAlign {
|
|||
});
|
||||
|
||||
impl<'tcx> HashStable<StableHashingContext<'tcx>> for Align {
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'tcx>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) {
|
||||
self.bytes().hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> HashStable<StableHashingContext<'tcx>> for Size {
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'tcx>,
|
||||
hasher: &mut StableHasher<W>,
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) {
|
||||
self.bytes().hash_stable(hcx, hasher);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for LayoutError<'tcx> {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
use crate::ty::layout::LayoutError::*;
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
|
||||
|
|
@ -2722,14 +2697,6 @@ where
|
|||
}
|
||||
};
|
||||
|
||||
// Store the index of the last argument. This is useful for working with
|
||||
// C-compatible variadic arguments.
|
||||
let last_arg_idx = if sig.inputs().is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(sig.inputs().len() - 1)
|
||||
};
|
||||
|
||||
let arg_of = |ty: Ty<'tcx>, arg_idx: Option<usize>| {
|
||||
let is_return = arg_idx.is_none();
|
||||
let mut arg = mk_arg_type(ty, arg_idx);
|
||||
|
|
@ -2739,30 +2706,7 @@ where
|
|||
// The same is true for s390x-unknown-linux-gnu
|
||||
// and sparc64-unknown-linux-gnu.
|
||||
if is_return || rust_abi || (!win_x64_gnu && !linux_s390x && !linux_sparc64) {
|
||||
arg.mode = PassMode::Ignore(IgnoreMode::Zst);
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a C-variadic function, this is not the return value,
|
||||
// and there is one or more fixed arguments; ensure that the `VaListImpl`
|
||||
// is ignored as an argument.
|
||||
if sig.c_variadic {
|
||||
match (last_arg_idx, arg_idx) {
|
||||
(Some(last_idx), Some(cur_idx)) if last_idx == cur_idx => {
|
||||
let va_list_did = match cx.tcx().lang_items().va_list() {
|
||||
Some(did) => did,
|
||||
None => bug!("`va_list` lang item required for C-variadic functions"),
|
||||
};
|
||||
match ty.kind {
|
||||
ty::Adt(def, _) if def.did == va_list_did => {
|
||||
// This is the "spoofed" `VaListImpl`. Set the arguments mode
|
||||
// so that it will be ignored.
|
||||
arg.mode = PassMode::Ignore(IgnoreMode::CVarArgs);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
arg.mode = PassMode::Ignore;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,8 +52,7 @@ use syntax_pos::Span;
|
|||
use smallvec;
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult,
|
||||
HashStable};
|
||||
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
|
||||
|
||||
use crate::hir;
|
||||
|
||||
|
|
@ -577,9 +576,7 @@ impl<'tcx> TyS<'tcx> {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ty::TyS<'tcx> {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let ty::TyS {
|
||||
ref kind,
|
||||
|
||||
|
|
@ -1633,11 +1630,7 @@ impl<'a, T> HashStable<StableHashingContext<'a>> for Placeholder<T>
|
|||
where
|
||||
T: HashStable<StableHashingContext<'a>>,
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(
|
||||
&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>
|
||||
) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
self.universe.hash_stable(hcx, hasher);
|
||||
self.name.hash_stable(hcx, hasher);
|
||||
}
|
||||
|
|
@ -1774,9 +1767,7 @@ impl<'a, 'tcx, T> HashStable<StableHashingContext<'a>> for ParamEnvAnd<'tcx, T>
|
|||
where
|
||||
T: HashStable<StableHashingContext<'a>>,
|
||||
{
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let ParamEnvAnd {
|
||||
ref param_env,
|
||||
ref value
|
||||
|
|
@ -2010,9 +2001,7 @@ impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx AdtDef {}
|
|||
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for AdtDef {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
thread_local! {
|
||||
static CACHE: RefCell<FxHashMap<usize, Fingerprint>> = Default::default();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -334,13 +334,13 @@ fn pick_query<'a, 'tcx, T, F: Fn(&T) -> (Span, Lrc<QueryJob<'tcx>>)>(
|
|||
let mut hcx = tcx.create_stable_hashing_context();
|
||||
queries.iter().min_by_key(|v| {
|
||||
let (span, query) = f(v);
|
||||
let mut stable_hasher = StableHasher::<u64>::new();
|
||||
let mut stable_hasher = StableHasher::new();
|
||||
query.info.query.hash_stable(&mut hcx, &mut stable_hasher);
|
||||
// Prefer entry points which have valid spans for nicer error messages
|
||||
// We add an integer to the tuple ensuring that entry points
|
||||
// with valid spans are picked first
|
||||
let span_cmp = if span == DUMMY_SP { 1 } else { 0 };
|
||||
(span_cmp, stable_hasher.finish())
|
||||
(span_cmp, stable_hasher.finish::<u64>())
|
||||
}).unwrap()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use errors::DiagnosticBuilder;
|
|||
use errors::Level;
|
||||
use errors::Diagnostic;
|
||||
use errors::FatalError;
|
||||
use errors::Handler;
|
||||
use rustc_data_structures::fx::{FxHashMap};
|
||||
use rustc_data_structures::sync::{Lrc, Lock};
|
||||
use rustc_data_structures::sharded::Sharded;
|
||||
|
|
@ -321,9 +322,12 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn try_print_query_stack() {
|
||||
pub fn try_print_query_stack(handler: &Handler) {
|
||||
eprintln!("query stack during panic:");
|
||||
|
||||
// Be careful reyling on global state here: this code is called from
|
||||
// a panic hook, which means that the global `Handler` may be in a weird
|
||||
// state if it was responsible for triggering the panic.
|
||||
tls::with_context_opt(|icx| {
|
||||
if let Some(icx) = icx {
|
||||
let mut current_query = icx.query.clone();
|
||||
|
|
@ -336,7 +340,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
query.info.query.name(),
|
||||
query.info.query.describe(icx.tcx)));
|
||||
diag.span = icx.tcx.sess.source_map().def_span(query.info.span).into();
|
||||
icx.tcx.sess.diagnostic().force_print_diagnostic(diag);
|
||||
handler.force_print_diagnostic(diag);
|
||||
|
||||
current_query = query.parent.clone();
|
||||
i += 1;
|
||||
|
|
@ -716,7 +720,6 @@ macro_rules! define_queries_inner {
|
|||
use rustc_data_structures::sharded::Sharded;
|
||||
use crate::{
|
||||
rustc_data_structures::stable_hasher::HashStable,
|
||||
rustc_data_structures::stable_hasher::StableHasherResult,
|
||||
rustc_data_structures::stable_hasher::StableHasher,
|
||||
ich::StableHashingContext
|
||||
};
|
||||
|
|
@ -925,9 +928,7 @@ macro_rules! define_queries_inner {
|
|||
}
|
||||
|
||||
impl<'a, $tcx> HashStable<StableHashingContext<'a>> for Query<$tcx> {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
match *self {
|
||||
$(Query::$name(key) => key.hash_stable(hcx, hasher),)*
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ use crate::ty::fold::TypeFoldable;
|
|||
use crate::ty::{Ty, TyCtxt};
|
||||
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
|
||||
StableHasherResult};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_macros::HashStable;
|
||||
|
||||
/// A trait's definition with type information.
|
||||
|
|
@ -194,9 +193,7 @@ pub(super) fn trait_impls_of_provider(
|
|||
}
|
||||
|
||||
impl<'a> HashStable<StableHashingContext<'a>> for TraitImpls {
|
||||
fn hash_stable<W: StableHasherResult>(&self,
|
||||
hcx: &mut StableHashingContext<'a>,
|
||||
hasher: &mut StableHasher<W>) {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
let TraitImpls {
|
||||
ref blanket_impls,
|
||||
ref non_blanket_impls,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue