Skip to content

Commit 2f9fff2

Browse files
committed
Auto merge of #154693 - GuillaumeGomez:rollup-4KpJ9MV, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - #153105 (Compute the result of a projection type with region errors) - #153960 (Make `layout_of` cycles fatal errors) - #154666 (Remove `StableHashContext` impls) - #154669 (Introduce #[diagnostic::on_move] on `Arc`) - #154442 (Export `derive` at the crate root: `core::derive` and `std::derive`) - #154660 (Avoid creating async return opaques for foreign async fns) - #154680 ([rustdoc] Replace `DocContext` with `TyCtxt` wherever possible)
2 parents 7e46c5f + 14b4011 commit 2f9fff2

File tree

65 files changed

+355
-321
lines changed

Some content is hidden

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

65 files changed

+355
-321
lines changed

compiler/rustc_abi/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ pub use layout::{FIRST_VARIANT, FieldIdx, LayoutCalculator, LayoutCalculatorErro
6767
#[cfg(feature = "nightly")]
6868
pub use layout::{Layout, TyAbiInterface, TyAndLayout};
6969

70-
/// Requirements for a `StableHashingContext` to be used in this crate.
71-
/// This is a hack to allow using the `HashStable_Generic` derive macro
72-
/// instead of implementing everything in `rustc_middle`.
73-
#[cfg(feature = "nightly")]
74-
pub trait HashStableContext {}
75-
7670
#[derive(Clone, Copy, PartialEq, Eq, Default)]
7771
#[cfg_attr(
7872
feature = "nightly",

compiler/rustc_ast/src/ast.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ use rustc_data_structures::tagged_ptr::Tag;
3131
use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable};
3232
pub use rustc_span::AttrId;
3333
use rustc_span::{
34-
ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, respan, sym,
34+
ByteSymbol, DUMMY_SP, ErrorGuaranteed, HashStableContext, Ident, Span, Spanned, Symbol, kw,
35+
respan, sym,
3536
};
3637
use thin_vec::{ThinVec, thin_vec};
3738

@@ -120,7 +121,7 @@ impl PartialEq<&[Symbol]> for Path {
120121
}
121122
}
122123

123-
impl<Hcx: rustc_span::HashStableContext> HashStable<Hcx> for Path {
124+
impl<Hcx: HashStableContext> HashStable<Hcx> for Path {
124125
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
125126
self.segments.len().hash_stable(hcx, hasher);
126127
for segment in &self.segments {

compiler/rustc_ast/src/lib.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,3 @@ pub mod visit;
3636

3737
pub use self::ast::*;
3838
pub use self::ast_traits::{AstNodeWrapper, HasAttrs, HasNodeId, HasTokens};
39-
40-
/// Requirements for a `StableHashingContext` to be used in this crate.
41-
/// This is a hack to allow using the `HashStable_Generic` derive macro
42-
/// instead of implementing everything in `rustc_middle`.
43-
pub trait HashStableContext: rustc_span::HashStableContext {}

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
1414
use rustc_data_structures::sync;
1515
use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable};
1616
use rustc_serialize::{Decodable, Encodable};
17-
use rustc_span::{DUMMY_SP, Span, SpanDecoder, SpanEncoder, Symbol, sym};
17+
use rustc_span::{DUMMY_SP, HashStableContext, Span, SpanDecoder, SpanEncoder, Symbol, sym};
1818
use thin_vec::ThinVec;
1919

2020
use crate::ast::AttrStyle;
@@ -826,7 +826,7 @@ impl FromIterator<TokenTree> for TokenStream {
826826

827827
impl<Hcx> HashStable<Hcx> for TokenStream
828828
where
829-
Hcx: crate::HashStableContext,
829+
Hcx: HashStableContext,
830830
{
831831
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
832832
for sub_tt in self.iter() {

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,11 +1134,7 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'_, 'tcx> {
11341134
fn_abi_request: FnAbiRequest<'tcx>,
11351135
) -> ! {
11361136
match err {
1137-
FnAbiError::Layout(
1138-
LayoutError::SizeOverflow(_)
1139-
| LayoutError::Cycle(_)
1140-
| LayoutError::InvalidSimd { .. },
1141-
) => {
1137+
FnAbiError::Layout(LayoutError::SizeOverflow(_) | LayoutError::InvalidSimd { .. }) => {
11421138
self.tcx.dcx().emit_fatal(Spanned { span, node: err });
11431139
}
11441140
_ => match fn_abi_request {

compiler/rustc_const_eval/src/interpret/eval_context.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ impl<'tcx, M: Machine<'tcx>> LayoutOfHelpers<'tcx> for InterpCx<'tcx, M> {
107107
| LayoutError::SizeOverflow(_)
108108
| LayoutError::InvalidSimd { .. }
109109
| LayoutError::TooGeneric(_)
110-
| LayoutError::ReferencesError(_)
111-
| LayoutError::Cycle(_) => {}
110+
| LayoutError::ReferencesError(_) => {}
112111
}
113112
err_inval!(Layout(err))
114113
}

compiler/rustc_hir/src/def.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use rustc_data_structures::stable_hasher::ToStableHashKey;
88
use rustc_data_structures::unord::UnordMap;
99
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
1010
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
11-
use rustc_span::Symbol;
1211
use rustc_span::def_id::{DefId, LocalDefId};
1312
use rustc_span::hygiene::MacroKind;
13+
use rustc_span::{HashStableContext, Symbol};
1414

1515
use crate::definitions::DefPathData;
1616
use crate::hir;
@@ -712,7 +712,7 @@ impl IntoDiagArg for Namespace {
712712
}
713713
}
714714

715-
impl<Hcx: crate::HashStableContext> ToStableHashKey<Hcx> for Namespace {
715+
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for Namespace {
716716
type KeyType = Namespace;
717717

718718
#[inline]

compiler/rustc_hir/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ pub use hir::*;
4343
pub use lang_items::{LangItem, LanguageItems};
4444
pub use rustc_ast::attr::version::*;
4545
pub use stability::*;
46-
pub use stable_hash_impls::HashStableContext;
4746
pub use target::{MethodKind, Target};
4847

4948
arena_types!(rustc_arena::declare_arena);
Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
2+
use rustc_span::HashStableContext;
23
use rustc_span::def_id::DefPathHash;
34

45
use crate::HashIgnoredAttrId;
@@ -8,53 +9,48 @@ use crate::hir::{
89
use crate::hir_id::ItemLocalId;
910
use crate::lints::DelayedLints;
1011

11-
/// Requirements for a `StableHashingContext` to be used in this crate.
12-
/// This is a hack to allow using the `HashStable_Generic` derive macro
13-
/// instead of implementing everything in `rustc_middle`.
14-
pub trait HashStableContext: rustc_ast::HashStableContext + rustc_abi::HashStableContext {}
15-
16-
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for BodyId {
12+
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for BodyId {
1713
type KeyType = (DefPathHash, ItemLocalId);
1814

1915
#[inline]
20-
fn to_stable_hash_key(&self, hcx: &HirCtx) -> (DefPathHash, ItemLocalId) {
16+
fn to_stable_hash_key(&self, hcx: &Hcx) -> (DefPathHash, ItemLocalId) {
2117
let BodyId { hir_id } = *self;
2218
hir_id.to_stable_hash_key(hcx)
2319
}
2420
}
2521

26-
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ItemId {
22+
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ItemId {
2723
type KeyType = DefPathHash;
2824

2925
#[inline]
30-
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
26+
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
3127
self.owner_id.def_id.to_stable_hash_key(hcx)
3228
}
3329
}
3430

35-
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for TraitItemId {
31+
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for TraitItemId {
3632
type KeyType = DefPathHash;
3733

3834
#[inline]
39-
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
35+
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
4036
self.owner_id.def_id.to_stable_hash_key(hcx)
4137
}
4238
}
4339

44-
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ImplItemId {
40+
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ImplItemId {
4541
type KeyType = DefPathHash;
4642

4743
#[inline]
48-
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
44+
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
4945
self.owner_id.def_id.to_stable_hash_key(hcx)
5046
}
5147
}
5248

53-
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ForeignItemId {
49+
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ForeignItemId {
5450
type KeyType = DefPathHash;
5551

5652
#[inline]
57-
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
53+
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
5854
self.owner_id.def_id.to_stable_hash_key(hcx)
5955
}
6056
}
@@ -66,8 +62,8 @@ impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ForeignItemId
6662
// want to pick up on a reference changing its target, so we hash the NodeIds
6763
// in "DefPath Mode".
6864

69-
impl<'tcx, HirCtx: crate::HashStableContext> HashStable<HirCtx> for OwnerNodes<'tcx> {
70-
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
65+
impl<'tcx, Hcx: HashStableContext> HashStable<Hcx> for OwnerNodes<'tcx> {
66+
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
7167
// We ignore the `nodes` and `bodies` fields since these refer to information included in
7268
// `hash` which is hashed in the collector and used for the crate hash.
7369
// `local_id_to_def_id` is also ignored because is dependent on the body, then just hashing
@@ -78,24 +74,24 @@ impl<'tcx, HirCtx: crate::HashStableContext> HashStable<HirCtx> for OwnerNodes<'
7874
}
7975
}
8076

81-
impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for DelayedLints {
82-
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
77+
impl<Hcx: HashStableContext> HashStable<Hcx> for DelayedLints {
78+
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
8379
let DelayedLints { opt_hash, .. } = *self;
8480
opt_hash.unwrap().hash_stable(hcx, hasher);
8581
}
8682
}
8783

88-
impl<'tcx, HirCtx: crate::HashStableContext> HashStable<HirCtx> for AttributeMap<'tcx> {
89-
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
84+
impl<'tcx, Hcx: HashStableContext> HashStable<Hcx> for AttributeMap<'tcx> {
85+
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
9086
// We ignore the `map` since it refers to information included in `opt_hash` which is
9187
// hashed in the collector and used for the crate hash.
9288
let AttributeMap { opt_hash, define_opaque: _, map: _ } = *self;
9389
opt_hash.unwrap().hash_stable(hcx, hasher);
9490
}
9591
}
9692

97-
impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for HashIgnoredAttrId {
98-
fn hash_stable(&self, _hcx: &mut HirCtx, _hasher: &mut StableHasher) {
93+
impl<Hcx: HashStableContext> HashStable<Hcx> for HashIgnoredAttrId {
94+
fn hash_stable(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) {
9995
/* we don't hash HashIgnoredAttrId, we ignore them */
10096
}
10197
}

compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ fn should_emit_layout_error<'tcx>(abi: ExternAbi, layout_err: &'tcx LayoutError<
194194
| SizeOverflow(..)
195195
| InvalidSimd { .. }
196196
| NormalizationFailure(..)
197-
| ReferencesError(..)
198-
| Cycle(..) => {
197+
| ReferencesError(..) => {
199198
false // not our job to report these
200199
}
201200
}

0 commit comments

Comments
 (0)