Auto merge of #139552 - matthiaskrgr:rollup-b194mk8, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #139494 (Restrict some queries by def-kind more) - #139496 (Revert r-a changes of rust-lang/rust#139455) - #139506 (add missing word in doc comment (part 2)) - #139515 (Improve presentation of closure signature mismatch from `Fn` trait goal) - #139520 (compiletest maintenance: sort deps and drop dep on `anyhow`) - #139523 (Rustc dev guide subtree update) - #139526 (Fix deprecation note for std::intrinsics) - #139528 (compiletest: Remove the `--logfile` flag) - #139541 (Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations) - #139547 (Update library tracking issue template to set S-tracking-unimplemented) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
97c966bb40
37 changed files with 207 additions and 113 deletions
|
@ -4,9 +4,9 @@ use rustc_data_structures::fx::FxHashMap;
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, fold_regions};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub(crate) fn provide(providers: &mut Providers) {
|
||||
|
@ -21,7 +21,8 @@ pub(crate) fn provide(providers: &mut Providers) {
|
|||
}
|
||||
|
||||
fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'tcx>, Span)] {
|
||||
match tcx.def_kind(def_id) {
|
||||
let kind = tcx.def_kind(def_id);
|
||||
match kind {
|
||||
DefKind::Fn => {
|
||||
let sig = tcx.fn_sig(def_id).instantiate_identity();
|
||||
let liberated_sig = tcx.liberate_late_bound_regions(def_id.to_def_id(), sig);
|
||||
|
@ -121,32 +122,38 @@ fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'
|
|||
}
|
||||
}
|
||||
DefKind::AssocConst | DefKind::AssocTy => tcx.assumed_wf_types(tcx.local_parent(def_id)),
|
||||
DefKind::OpaqueTy => bug!("implied bounds are not defined for opaques"),
|
||||
DefKind::Mod
|
||||
DefKind::Static { .. }
|
||||
| DefKind::Const
|
||||
| DefKind::AnonConst
|
||||
| DefKind::InlineConst
|
||||
| DefKind::Struct
|
||||
| DefKind::Union
|
||||
| DefKind::Enum
|
||||
| DefKind::Variant
|
||||
| DefKind::Trait
|
||||
| DefKind::TyAlias
|
||||
| DefKind::ForeignTy
|
||||
| DefKind::TraitAlias
|
||||
| DefKind::TyAlias => ty::List::empty(),
|
||||
DefKind::OpaqueTy
|
||||
| DefKind::Mod
|
||||
| DefKind::Variant
|
||||
| DefKind::ForeignTy
|
||||
| DefKind::TyParam
|
||||
| DefKind::Const
|
||||
| DefKind::ConstParam
|
||||
| DefKind::Static { .. }
|
||||
| DefKind::Ctor(_, _)
|
||||
| DefKind::Macro(_)
|
||||
| DefKind::ExternCrate
|
||||
| DefKind::Use
|
||||
| DefKind::ForeignMod
|
||||
| DefKind::AnonConst
|
||||
| DefKind::InlineConst
|
||||
| DefKind::Field
|
||||
| DefKind::LifetimeParam
|
||||
| DefKind::GlobalAsm
|
||||
| DefKind::Closure
|
||||
| DefKind::SyntheticCoroutineBody => ty::List::empty(),
|
||||
| DefKind::SyntheticCoroutineBody => {
|
||||
span_bug!(
|
||||
tcx.def_span(def_id),
|
||||
"`assumed_wf_types` not defined for {} `{def_id:?}`",
|
||||
kind.descr(def_id.to_def_id())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ use rustc_hir::def::DefKind;
|
|||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_hir::intravisit;
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::util::{CheckRegions, NotUniqueParam};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor};
|
||||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_span::Span;
|
||||
use tracing::{instrument, trace};
|
||||
|
||||
|
@ -320,9 +320,12 @@ fn opaque_types_defined_by<'tcx>(
|
|||
| DefKind::AnonConst => {
|
||||
collector.collect_taits_declared_in_body();
|
||||
}
|
||||
// Closures and coroutines are type checked with their parent
|
||||
DefKind::Closure | DefKind::InlineConst => {
|
||||
collector.opaques.extend(tcx.opaque_types_defined_by(tcx.local_parent(item)));
|
||||
}
|
||||
DefKind::AssocTy | DefKind::TyAlias | DefKind::GlobalAsm => {}
|
||||
DefKind::OpaqueTy
|
||||
| DefKind::TyAlias
|
||||
| DefKind::AssocTy
|
||||
| DefKind::Mod
|
||||
| DefKind::Struct
|
||||
| DefKind::Union
|
||||
|
@ -340,12 +343,13 @@ fn opaque_types_defined_by<'tcx>(
|
|||
| DefKind::ForeignMod
|
||||
| DefKind::Field
|
||||
| DefKind::LifetimeParam
|
||||
| DefKind::GlobalAsm
|
||||
| DefKind::Impl { .. }
|
||||
| DefKind::SyntheticCoroutineBody => {}
|
||||
// Closures and coroutines are type checked with their parent
|
||||
DefKind::Closure | DefKind::InlineConst => {
|
||||
collector.opaques.extend(tcx.opaque_types_defined_by(tcx.local_parent(item)));
|
||||
| DefKind::SyntheticCoroutineBody => {
|
||||
span_bug!(
|
||||
tcx.def_span(item),
|
||||
"`opaque_types_defined_by` not defined for {} `{item:?}`",
|
||||
kind.descr(item.to_def_id())
|
||||
);
|
||||
}
|
||||
}
|
||||
tcx.mk_local_def_ids(&collector.opaques)
|
||||
|
|
|
@ -116,7 +116,7 @@ pub fn walk_types<'tcx, V: SpannedTypeVisitor<'tcx>>(
|
|||
"{kind:?} has not seen any uses of `walk_types` yet, ping oli-obk if you'd like any help"
|
||||
)
|
||||
}
|
||||
// These don't have any types.
|
||||
// These don't have any types, but are visited during privacy checking.
|
||||
| DefKind::ExternCrate
|
||||
| DefKind::ForeignMod
|
||||
| DefKind::ForeignTy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue