Rollup merge of #102613 - TaKO8Ki:fix-part-of-101739, r=compiler-errors
Fix ICE #101739 Fixes a part of #101739 This cannot cover the following case. It causes `too many args provided` error and obligation does not have references error. I want your advice to solve the following cases as well in this pull request or a follow-up. ```rust #![crate_type = "lib"] #![feature(transmutability)] #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { use std::mem::BikeshedIntrinsicFrom; pub fn is_transmutable< Src, Dst, Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, const ASSUME_VALIDITY: bool, const ASSUME_VISIBILITY: bool, >() where Dst: BikeshedIntrinsicFrom< Src, Context, ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_VALIDITY, ASSUME_VISIBILITY, >, {} } fn via_const() { struct Context; #[repr(C)] struct Src; #[repr(C)] struct Dst; const FALSE: bool = false; assert::is_transmutable::<Src, Dst, Context, FALSE, FALSE, FALSE, FALSE>(); } ```
This commit is contained in:
commit
aa076d6144
6 changed files with 112 additions and 10 deletions
|
@ -11,9 +11,10 @@ use rustc_hir::lang_items::LangItem;
|
|||
use rustc_index::bit_set::GrowableBitSet;
|
||||
use rustc_infer::infer::InferOk;
|
||||
use rustc_infer::infer::LateBoundRegionConversionTime::HigherRankedType;
|
||||
use rustc_middle::ty::{self, GenericParamDefKind, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{GenericArg, GenericArgKind, InternalSubsts, SubstsRef};
|
||||
use rustc_middle::ty::{ToPolyTraitRef, ToPredicate};
|
||||
use rustc_middle::ty::{
|
||||
self, GenericArg, GenericArgKind, GenericParamDefKind, InternalSubsts, SubstsRef,
|
||||
ToPolyTraitRef, ToPredicate, Ty, TyCtxt,
|
||||
};
|
||||
use rustc_span::def_id::DefId;
|
||||
|
||||
use crate::traits::project::{normalize_with_depth, normalize_with_depth_to};
|
||||
|
@ -289,8 +290,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
let scope = type_at(2).skip_binder();
|
||||
|
||||
let assume =
|
||||
rustc_transmute::Assume::from_const(self.infcx.tcx, obligation.param_env, const_at(3));
|
||||
let Some(assume) =
|
||||
rustc_transmute::Assume::from_const(self.infcx.tcx, obligation.param_env, const_at(3)) else {
|
||||
return Err(Unimplemented);
|
||||
};
|
||||
|
||||
let cause = obligation.cause.clone();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue