1
Fork 0

Rollup merge of #127437 - compiler-errors:uplift-trait-ref-is-knowable, r=lcnr

Uplift trait ref is knowable into `rustc_next_trait_solver`

Self-explanatory. Eliminates one more delegate method.

r? lcnr cc ``@fmease``
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-07-08 13:04:32 +08:00 committed by GitHub
commit 928d71f17b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 520 additions and 480 deletions

View file

@ -286,7 +286,7 @@ fn orphan_check<'tcx>(
tcx: TyCtxt<'tcx>,
impl_def_id: LocalDefId,
mode: OrphanCheckMode,
) -> Result<(), OrphanCheckErr<'tcx, FxIndexSet<DefId>>> {
) -> Result<(), OrphanCheckErr<TyCtxt<'tcx>, FxIndexSet<DefId>>> {
// We only accept this routine to be invoked on implementations
// of a trait, not inherent implementations.
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
@ -326,17 +326,16 @@ fn orphan_check<'tcx>(
ty
};
Ok(ty)
Ok::<_, !>(ty)
};
let Ok(result) = traits::orphan_check_trait_ref::<!>(
let result = traits::orphan_check_trait_ref(
&infcx,
trait_ref,
traits::InCrate::Local { mode },
lazily_normalize_ty,
) else {
unreachable!()
};
)
.into_ok();
// (2) Try to map the remaining inference vars back to generic params.
result.map_err(|err| match err {
@ -369,7 +368,7 @@ fn emit_orphan_check_error<'tcx>(
tcx: TyCtxt<'tcx>,
trait_ref: ty::TraitRef<'tcx>,
impl_def_id: LocalDefId,
err: traits::OrphanCheckErr<'tcx, FxIndexSet<DefId>>,
err: traits::OrphanCheckErr<TyCtxt<'tcx>, FxIndexSet<DefId>>,
) -> ErrorGuaranteed {
match err {
traits::OrphanCheckErr::NonLocalInputType(tys) => {
@ -482,7 +481,7 @@ fn emit_orphan_check_error<'tcx>(
fn lint_uncovered_ty_params<'tcx>(
tcx: TyCtxt<'tcx>,
UncoveredTyParams { uncovered, local_ty }: UncoveredTyParams<'tcx, FxIndexSet<DefId>>,
UncoveredTyParams { uncovered, local_ty }: UncoveredTyParams<TyCtxt<'tcx>, FxIndexSet<DefId>>,
impl_def_id: LocalDefId,
) {
let hir_id = tcx.local_def_id_to_hir_id(impl_def_id);

View file

@ -1201,6 +1201,7 @@ fn trait_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::TraitDef {
let is_marker = tcx.has_attr(def_id, sym::marker);
let rustc_coinductive = tcx.has_attr(def_id, sym::rustc_coinductive);
let is_fundamental = tcx.has_attr(def_id, sym::fundamental);
// FIXME: We could probably do way better attribute validation here.
let mut skip_array_during_method_dispatch = false;
@ -1352,6 +1353,7 @@ fn trait_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::TraitDef {
has_auto_impl: is_auto,
is_marker,
is_coinductive: rustc_coinductive || is_auto,
is_fundamental,
skip_array_during_method_dispatch,
skip_boxed_slice_during_method_dispatch,
specialization_kind,

View file

@ -71,6 +71,7 @@ This API is completely unstable and subject to change.
#![feature(rustdoc_internals)]
#![feature(slice_partition_dedup)]
#![feature(try_blocks)]
#![feature(unwrap_infallible)]
// tidy-alphabetical-end
#[macro_use]