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
|
@ -14,6 +14,7 @@
|
|||
//! At present, however, we do run collection across all items in the
|
||||
//! crate as a kind of pass. This should eventually be factored away.
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::cell::Cell;
|
||||
use std::iter;
|
||||
use std::ops::Bound;
|
||||
|
@ -1344,7 +1345,8 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_, ty::PolyFn
|
|||
compute_sig_of_foreign_fn_decl(tcx, def_id, sig.decl, abi, sig.header.safety())
|
||||
}
|
||||
|
||||
Ctor(data) | Variant(hir::Variant { data, .. }) if data.ctor().is_some() => {
|
||||
Ctor(data) => {
|
||||
assert_matches!(data.ctor(), Some(_));
|
||||
let adt_def_id = tcx.hir_get_parent_item(hir_id).def_id.to_def_id();
|
||||
let ty = tcx.type_of(adt_def_id).instantiate_identity();
|
||||
let inputs = data.fields().iter().map(|f| tcx.type_of(f.def_id).instantiate_identity());
|
||||
|
|
|
@ -44,13 +44,13 @@ fn variances_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Variance] {
|
|||
return &[];
|
||||
}
|
||||
|
||||
match tcx.def_kind(item_def_id) {
|
||||
let kind = tcx.def_kind(item_def_id);
|
||||
match kind {
|
||||
DefKind::Fn
|
||||
| DefKind::AssocFn
|
||||
| DefKind::Enum
|
||||
| DefKind::Struct
|
||||
| DefKind::Union
|
||||
| DefKind::Variant
|
||||
| DefKind::Ctor(..) => {
|
||||
// These are inferred.
|
||||
let crate_map = tcx.crate_variances(());
|
||||
|
@ -89,7 +89,11 @@ fn variances_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Variance] {
|
|||
}
|
||||
|
||||
// Variance not relevant.
|
||||
span_bug!(tcx.def_span(item_def_id), "asked to compute variance for wrong kind of item");
|
||||
span_bug!(
|
||||
tcx.def_span(item_def_id),
|
||||
"asked to compute variance for {}",
|
||||
kind.descr(item_def_id.to_def_id())
|
||||
);
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue