Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
043bd76
Make `layout_of` cycles fatal errors
Zoxc Feb 27, 2026
4fd1d97
Skip ICE message for fatal errors
Zoxc Mar 16, 2026
db30a36
Update tests
Zoxc Mar 16, 2026
8277043
Avoid creating async return opaques for foreign async fns
mu001999 Apr 1, 2026
910677f
Rename `HirCtx` as `Hcx`.
nnethercote Apr 1, 2026
d9a8a55
Reorder `use`/`mod` items in `rustc_session`.
nnethercote Apr 1, 2026
1a9a284
Simplify `HashStableContext`.
nnethercote Apr 1, 2026
e18dd4a
add `TypeFlags::HAS_NON_REGION_ERROR` and `TypeFlags::HAS_RE_ERROR`
makai410 Mar 16, 2026
339fb64
skip early return for region-only errors in projection types
makai410 Mar 16, 2026
fec0998
Export `derive` at `core::derive` and `std::derive`
nik-rev Mar 26, 2026
12f8364
Introduce #[diagnostic::on_move] on `Arc`
rperier Apr 1, 2026
a7a7938
Replace `DocContext` argument with `TyCtxt` in rustdoc `inline::load_…
GuillaumeGomez Apr 1, 2026
65fbfa4
Replace `DocContext` argument with `TyCtxt` in rustdoc `inline::merge…
GuillaumeGomez Apr 1, 2026
9f95c38
Replace `DocContext` argument with `TyCtxt` in rustdoc `utils::displa…
GuillaumeGomez Apr 1, 2026
f3ba2c4
Replace `DocContext` argument with `TyCtxt` in rustdoc `inline::build…
GuillaumeGomez Apr 1, 2026
58077cc
Replace `DocContext` argument with `TyCtxt` in rustdoc `clean::clean_…
GuillaumeGomez Apr 1, 2026
5a48d5e
Replace `DocContext` argument with `TyCtxt` in rustdoc `clean::clean_…
GuillaumeGomez Apr 1, 2026
d77a2ea
Replace `DocContext` argument with `TyCtxt` in rustdoc `clean::clean_…
GuillaumeGomez Apr 1, 2026
3520351
Replace `DocContext` argument with `TyCtxt` in rustdoc `Type::from_de…
GuillaumeGomez Apr 1, 2026
509a444
Replace `DocContext` argument with `TyCtxt` in rustdoc `clean::clean_…
GuillaumeGomez Apr 1, 2026
822579e
Replace `DocContext` argument with `TyCtxt` in rustdoc `types::Generi…
GuillaumeGomez Apr 1, 2026
e2f3f78
Replace `DocContext` argument with `TyCtxt` in rustdoc `clean::clean_…
GuillaumeGomez Apr 1, 2026
28ca36d
Replace `DocContext` argument with `TyCtxt` in rustdoc `simplify` fun…
GuillaumeGomez Apr 1, 2026
14aa3a9
Remove unused `DocContext` argument in `clean_middle_const`
GuillaumeGomez Apr 1, 2026
4b39934
Replace `DocContext` argument with `TyCtxt` in rustdoc `utils::print_…
GuillaumeGomez Apr 1, 2026
0b941ed
Last `DocContext`/`TyCtxt` cleanup
GuillaumeGomez Apr 1, 2026
3edc8d7
Rollup merge of #153105 - makai410:erase-if-error, r=lcnr
GuillaumeGomez Apr 1, 2026
dbc2bf6
Rollup merge of #153960 - Zoxc:fatal-layout-of-cycles, r=TaKO8Ki
GuillaumeGomez Apr 1, 2026
2395137
Rollup merge of #154666 - nnethercote:rm-StableHashContext-impls, r=p…
GuillaumeGomez Apr 1, 2026
800f338
Rollup merge of #154669 - rperier:diagnostic_on_move_for_the_arc_type…
GuillaumeGomez Apr 1, 2026
7ee62ee
Rollup merge of #154442 - nik-contrib:derive-root, r=jhpratt
GuillaumeGomez Apr 1, 2026
b52f667
Rollup merge of #154660 - mu001999-contrib:fix/146754, r=Kivooeo
GuillaumeGomez Apr 1, 2026
14b4011
Rollup merge of #154680 - GuillaumeGomez:doccontext-cleanup, r=Urgau
GuillaumeGomez Apr 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ pub use layout::{FIRST_VARIANT, FieldIdx, LayoutCalculator, LayoutCalculatorErro
#[cfg(feature = "nightly")]
pub use layout::{Layout, TyAbiInterface, TyAndLayout};

/// Requirements for a `StableHashingContext` to be used in this crate.
/// This is a hack to allow using the `HashStable_Generic` derive macro
/// instead of implementing everything in `rustc_middle`.
#[cfg(feature = "nightly")]
pub trait HashStableContext {}

#[derive(Clone, Copy, PartialEq, Eq, Default)]
#[cfg_attr(
feature = "nightly",
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ use rustc_data_structures::tagged_ptr::Tag;
use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable};
pub use rustc_span::AttrId;
use rustc_span::{
ByteSymbol, DUMMY_SP, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, respan, sym,
ByteSymbol, DUMMY_SP, ErrorGuaranteed, HashStableContext, Ident, Span, Spanned, Symbol, kw,
respan, sym,
};
use thin_vec::{ThinVec, thin_vec};

Expand Down Expand Up @@ -120,7 +121,7 @@ impl PartialEq<&[Symbol]> for Path {
}
}

impl<Hcx: rustc_span::HashStableContext> HashStable<Hcx> for Path {
impl<Hcx: HashStableContext> HashStable<Hcx> for Path {
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
self.segments.len().hash_stable(hcx, hasher);
for segment in &self.segments {
Expand Down
5 changes: 0 additions & 5 deletions compiler/rustc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,3 @@ pub mod visit;

pub use self::ast::*;
pub use self::ast_traits::{AstNodeWrapper, HasAttrs, HasNodeId, HasTokens};

/// Requirements for a `StableHashingContext` to be used in this crate.
/// This is a hack to allow using the `HashStable_Generic` derive macro
/// instead of implementing everything in `rustc_middle`.
pub trait HashStableContext: rustc_span::HashStableContext {}
4 changes: 2 additions & 2 deletions compiler/rustc_ast/src/tokenstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::sync;
use rustc_macros::{Decodable, Encodable, HashStable_Generic, Walkable};
use rustc_serialize::{Decodable, Encodable};
use rustc_span::{DUMMY_SP, Span, SpanDecoder, SpanEncoder, Symbol, sym};
use rustc_span::{DUMMY_SP, HashStableContext, Span, SpanDecoder, SpanEncoder, Symbol, sym};
use thin_vec::ThinVec;

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

impl<Hcx> HashStable<Hcx> for TokenStream
where
Hcx: crate::HashStableContext,
Hcx: HashStableContext,
{
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
for sub_tt in self.iter() {
Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,11 +1134,7 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for CodegenCx<'_, 'tcx> {
fn_abi_request: FnAbiRequest<'tcx>,
) -> ! {
match err {
FnAbiError::Layout(
LayoutError::SizeOverflow(_)
| LayoutError::Cycle(_)
| LayoutError::InvalidSimd { .. },
) => {
FnAbiError::Layout(LayoutError::SizeOverflow(_) | LayoutError::InvalidSimd { .. }) => {
self.tcx.dcx().emit_fatal(Spanned { span, node: err });
}
_ => match fn_abi_request {
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_const_eval/src/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ impl<'tcx, M: Machine<'tcx>> LayoutOfHelpers<'tcx> for InterpCx<'tcx, M> {
| LayoutError::SizeOverflow(_)
| LayoutError::InvalidSimd { .. }
| LayoutError::TooGeneric(_)
| LayoutError::ReferencesError(_)
| LayoutError::Cycle(_) => {}
| LayoutError::ReferencesError(_) => {}
}
err_inval!(Layout(err))
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir/src/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use rustc_data_structures::stable_hasher::ToStableHashKey;
use rustc_data_structures::unord::UnordMap;
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_span::Symbol;
use rustc_span::def_id::{DefId, LocalDefId};
use rustc_span::hygiene::MacroKind;
use rustc_span::{HashStableContext, Symbol};

use crate::definitions::DefPathData;
use crate::hir;
Expand Down Expand Up @@ -712,7 +712,7 @@ impl IntoDiagArg for Namespace {
}
}

impl<Hcx: crate::HashStableContext> ToStableHashKey<Hcx> for Namespace {
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for Namespace {
type KeyType = Namespace;

#[inline]
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pub use hir::*;
pub use lang_items::{LangItem, LanguageItems};
pub use rustc_ast::attr::version::*;
pub use stability::*;
pub use stable_hash_impls::HashStableContext;
pub use target::{MethodKind, Target};

arena_types!(rustc_arena::declare_arena);
42 changes: 19 additions & 23 deletions compiler/rustc_hir/src/stable_hash_impls.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
use rustc_span::HashStableContext;
use rustc_span::def_id::DefPathHash;

use crate::HashIgnoredAttrId;
Expand All @@ -8,53 +9,48 @@ use crate::hir::{
use crate::hir_id::ItemLocalId;
use crate::lints::DelayedLints;

/// Requirements for a `StableHashingContext` to be used in this crate.
/// This is a hack to allow using the `HashStable_Generic` derive macro
/// instead of implementing everything in `rustc_middle`.
pub trait HashStableContext: rustc_ast::HashStableContext + rustc_abi::HashStableContext {}

impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for BodyId {
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for BodyId {
type KeyType = (DefPathHash, ItemLocalId);

#[inline]
fn to_stable_hash_key(&self, hcx: &HirCtx) -> (DefPathHash, ItemLocalId) {
fn to_stable_hash_key(&self, hcx: &Hcx) -> (DefPathHash, ItemLocalId) {
let BodyId { hir_id } = *self;
hir_id.to_stable_hash_key(hcx)
}
}

impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ItemId {
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ItemId {
type KeyType = DefPathHash;

#[inline]
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
self.owner_id.def_id.to_stable_hash_key(hcx)
}
}

impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for TraitItemId {
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for TraitItemId {
type KeyType = DefPathHash;

#[inline]
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
self.owner_id.def_id.to_stable_hash_key(hcx)
}
}

impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ImplItemId {
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ImplItemId {
type KeyType = DefPathHash;

#[inline]
fn to_stable_hash_key(&self, hcx: &HirCtx) -> DefPathHash {
fn to_stable_hash_key(&self, hcx: &Hcx) -> DefPathHash {
self.owner_id.def_id.to_stable_hash_key(hcx)
}
}

impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ForeignItemId {
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for ForeignItemId {
type KeyType = DefPathHash;

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

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

impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for DelayedLints {
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
impl<Hcx: HashStableContext> HashStable<Hcx> for DelayedLints {
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
let DelayedLints { opt_hash, .. } = *self;
opt_hash.unwrap().hash_stable(hcx, hasher);
}
}

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

impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for HashIgnoredAttrId {
fn hash_stable(&self, _hcx: &mut HirCtx, _hasher: &mut StableHasher) {
impl<Hcx: HashStableContext> HashStable<Hcx> for HashIgnoredAttrId {
fn hash_stable(&self, _hcx: &mut Hcx, _hasher: &mut StableHasher) {
/* we don't hash HashIgnoredAttrId, we ignore them */
}
}
3 changes: 1 addition & 2 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/cmse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ fn should_emit_layout_error<'tcx>(abi: ExternAbi, layout_err: &'tcx LayoutError<
| SizeOverflow(..)
| InvalidSimd { .. }
| NormalizationFailure(..)
| ReferencesError(..)
| Cycle(..) => {
| ReferencesError(..) => {
false // not our job to report these
}
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir_id/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::fmt::{self, Debug};

use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
pub use rustc_span::HashStableContext;
use rustc_span::HashStableContext;
use rustc_span::def_id::{CRATE_DEF_ID, DefId, DefIndex, DefPathHash, LocalDefId};

#[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)]
Expand Down Expand Up @@ -176,7 +176,7 @@ pub const CRATE_HIR_ID: HirId =

pub const CRATE_OWNER_ID: OwnerId = OwnerId { def_id: CRATE_DEF_ID };

impl<Hcx: rustc_span::HashStableContext> ToStableHashKey<Hcx> for HirId {
impl<Hcx: HashStableContext> ToStableHashKey<Hcx> for HirId {
type KeyType = (DefPathHash, ItemLocalId);

#[inline]
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_lint_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use rustc_data_structures::stable_hasher::{
HashStable, StableCompare, StableHasher, ToStableHashKey,
};
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
use rustc_hir_id::{HashStableContext, HirId, ItemLocalId};
use rustc_hir_id::{HirId, ItemLocalId};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_span::def_id::DefPathHash;
pub use rustc_span::edition::Edition;
use rustc_span::{Ident, Span, Symbol, sym};
use rustc_span::{HashStableContext, Ident, Span, Symbol, sym};
use serde::{Deserialize, Serialize};

pub use self::Level::*;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_macros/src/hash_stable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn hash_stable_derive_with_mode(
match mode {
HashStableMode::Normal => {}
HashStableMode::Generic => {
s.add_where_predicate(parse_quote! { __CTX: crate::HashStableContext });
s.add_where_predicate(parse_quote! { __CTX: ::rustc_span::HashStableContext });
}
HashStableMode::NoContext => {}
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use rustc_hir::lints::DelayedLint;
use rustc_hir::*;
use rustc_index::IndexVec;
use rustc_macros::{Decodable, Encodable, HashStable};
use rustc_span::{ErrorGuaranteed, ExpnId, Span};
use rustc_span::{ErrorGuaranteed, ExpnId, HashStableContext, Span};

use crate::query::Providers;
use crate::ty::{ResolverAstLowering, TyCtxt};
Expand Down Expand Up @@ -77,8 +77,8 @@ impl<'hir> Crate<'hir> {
}
}

impl<HirCtx: HashStableContext> HashStable<HirCtx> for Crate<'_> {
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
impl<Hcx: HashStableContext> HashStable<Hcx> for Crate<'_> {
fn hash_stable(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
let Crate { opt_hir_hash, .. } = self;
opt_hir_hash.unwrap().hash_stable(hcx, hasher)
}
Expand Down
9 changes: 2 additions & 7 deletions compiler/rustc_middle/src/ich/hcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_hir::definitions::DefPathHash;
use rustc_session::Session;
use rustc_session::cstore::Untracked;
use rustc_span::source_map::SourceMap;
use rustc_span::{CachingSourceMapView, DUMMY_SP, Pos, Span};
use rustc_span::{CachingSourceMapView, DUMMY_SP, HashStableContext, Pos, Span};

// Very often, we are hashing something that does not need the `CachingSourceMapView`, so we
// initialize it lazily.
Expand Down Expand Up @@ -73,7 +73,7 @@ impl<'a> StableHashingContext<'a> {
}
}

impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
impl<'a> HashStableContext for StableHashingContext<'a> {
/// Hashes a span in a stable way. We can't directly hash the span's `BytePos` fields (that
/// would be similar to hashing pointers, since those are just offsets into the `SourceMap`).
/// Instead, we hash the (file name, line, column) triple, which stays the same even if the
Expand Down Expand Up @@ -189,8 +189,3 @@ impl<'a> rustc_span::HashStableContext for StableHashingContext<'a> {
);
}
}

impl<'a> rustc_abi::HashStableContext for StableHashingContext<'a> {}
impl<'a> rustc_ast::HashStableContext for StableHashingContext<'a> {}
impl<'a> rustc_hir::HashStableContext for StableHashingContext<'a> {}
impl<'a> rustc_session::HashStableContext for StableHashingContext<'a> {}
6 changes: 1 addition & 5 deletions compiler/rustc_middle/src/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ pub enum LayoutError<'tcx> {
NormalizationFailure(Ty<'tcx>, NormalizationError<'tcx>),
/// A non-layout error is reported elsewhere.
ReferencesError(ErrorGuaranteed),
/// A type has cyclic layout, i.e. the type contains itself without indirection.
Cycle(ErrorGuaranteed),
}

impl<'tcx> fmt::Display for LayoutError<'tcx> {
Expand All @@ -286,7 +284,6 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> {
t,
e.get_type_for_failure()
),
LayoutError::Cycle(_) => write!(f, "a cycle occurred during layout computation"),
LayoutError::ReferencesError(_) => write!(f, "the type has an unknown layout"),
}
}
Expand Down Expand Up @@ -358,8 +355,7 @@ impl<'tcx> SizeSkeleton<'tcx> {
Err(err @ LayoutError::TooGeneric(_)) => err,
// We can't extract SizeSkeleton info from other layout errors
Err(
e @ LayoutError::Cycle(_)
| e @ LayoutError::Unknown(_)
e @ LayoutError::Unknown(_)
| e @ LayoutError::SizeOverflow(_)
| e @ LayoutError::InvalidSimd { .. }
| e @ LayoutError::NormalizationFailure(..)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl<'tcx> Region<'tcx> {
}
ty::ReError(_) => {
flags = flags | TypeFlags::HAS_FREE_REGIONS;
flags = flags | TypeFlags::HAS_ERROR;
flags = flags | TypeFlags::HAS_RE_ERROR;
}
}

Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_query_impl/src/handle_cycle_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use rustc_middle::bug;
use rustc_middle::queries::{QueryVTables, TaggedQueryKey};
use rustc_middle::query::Cycle;
use rustc_middle::query::erase::erase_val;
use rustc_middle::ty::layout::LayoutError;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_span::def_id::{DefId, LocalDefId};
use rustc_span::{ErrorGuaranteed, Span};
Expand Down Expand Up @@ -203,8 +202,7 @@ fn layout_of<'tcx>(tcx: TyCtxt<'tcx>, cycle: Cycle<'tcx>) -> &'tcx ty::layout::L
|| create_cycle_error(tcx, &cycle),
);

let guar = diag.emit();
tcx.arena.alloc(LayoutError::Cycle(guar))
diag.emit().raise_fatal()
}

// item_and_field_ids should form a cycle where each field contains the
Expand Down
7 changes: 5 additions & 2 deletions compiler/rustc_resolve/src/def_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,15 @@ impl<'a, 'ra, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'ra, 'tcx> {
fn visit_fn(&mut self, fn_kind: FnKind<'a>, _: &AttrVec, span: Span, _: NodeId) {
match fn_kind {
FnKind::Fn(
_ctxt,
ctxt,
_vis,
Fn {
sig: FnSig { header, decl, span: _ }, ident, generics, contract, body, ..
},
) if let Some(coroutine_kind) = header.coroutine_kind => {
) if let Some(coroutine_kind) = header.coroutine_kind
// Foreign ones are denied, so don't create them here.
&& ctxt != visit::FnCtxt::Foreign =>
{
self.visit_ident(ident);
self.visit_fn_header(header);
self.visit_generics(generics);
Expand Down
Loading
Loading