Auto merge of #112716 - compiler-errors:rollup-h77daia, r=compiler-errors
Rollup of 7 pull requests Successful merges: - #111074 (Relax implicit `T: Sized` bounds on `BufReader<T>`, `BufWriter<T>` and `LineWriter<T>`) - #112226 (std: available_parallelism using native netbsd api first) - #112474 (Support 128-bit enum variant in debuginfo codegen) - #112662 (`#[lang_item]` for `core::ptr::Unique`) - #112665 (Make assumption functions in new solver take `Binder<'tcx, Clause<'tcx>>`) - #112684 (Disable alignment checks on i686-pc-windows-msvc) - #112706 (Add `SyntaxContext::is_root`) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
670a0edaa9
29 changed files with 331 additions and 163 deletions
|
@ -108,6 +108,10 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
|||
self.const_uint(self.type_u64(), i)
|
||||
}
|
||||
|
||||
fn const_u128(&self, i: u128) -> RValue<'gcc> {
|
||||
self.const_uint_big(self.type_u128(), i)
|
||||
}
|
||||
|
||||
fn const_usize(&self, i: u64) -> RValue<'gcc> {
|
||||
let bit_size = self.data_layout().pointer_size.bits();
|
||||
if bit_size < 64 {
|
||||
|
@ -254,7 +258,7 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
|||
// SIMD builtins require a constant value.
|
||||
self.bitcast_if_needed(value, typ)
|
||||
}
|
||||
|
||||
|
||||
fn const_ptr_byte_offset(&self, base_addr: Self::Value, offset: abi::Size) -> Self::Value {
|
||||
self.context.new_array_access(None, base_addr, self.const_usize(offset.bytes())).get_address(None)
|
||||
}
|
||||
|
|
|
@ -168,6 +168,10 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||
self.const_uint(self.type_i64(), i)
|
||||
}
|
||||
|
||||
fn const_u128(&self, i: u128) -> &'ll Value {
|
||||
self.const_uint_big(self.type_i128(), i)
|
||||
}
|
||||
|
||||
fn const_usize(&self, i: u64) -> &'ll Value {
|
||||
let bit_size = self.data_layout().pointer_size.bits();
|
||||
if bit_size < 64 {
|
||||
|
|
|
@ -429,7 +429,7 @@ pub fn type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll D
|
|||
return existing_di_node;
|
||||
}
|
||||
|
||||
debug!("type_di_node: {:?}", t);
|
||||
debug!("type_di_node: {:?} kind: {:?}", t, t.kind());
|
||||
|
||||
let DINodeCreationResult { di_node, already_stored_in_typemap } = match *t.kind() {
|
||||
ty::Never | ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) => {
|
||||
|
|
|
@ -412,13 +412,7 @@ fn build_enum_variant_member_di_node<'ll, 'tcx>(
|
|||
enum_type_and_layout.size.bits(),
|
||||
enum_type_and_layout.align.abi.bits() as u32,
|
||||
Size::ZERO.bits(),
|
||||
discr_value.opt_single_val().map(|value| {
|
||||
// NOTE(eddyb) do *NOT* remove this assert, until
|
||||
// we pass the full 128-bit value to LLVM, otherwise
|
||||
// truncation will be silent and remain undetected.
|
||||
assert_eq!(value as u64 as u128, value);
|
||||
cx.const_u64(value as u64)
|
||||
}),
|
||||
discr_value.opt_single_val().map(|value| cx.const_u128(value)),
|
||||
DIFlags::FlagZero,
|
||||
variant_member_info.variant_struct_type_di_node,
|
||||
)
|
||||
|
|
|
@ -15,6 +15,7 @@ pub trait ConstMethods<'tcx>: BackendTypes {
|
|||
fn const_i32(&self, i: i32) -> Self::Value;
|
||||
fn const_u32(&self, i: u32) -> Self::Value;
|
||||
fn const_u64(&self, i: u64) -> Self::Value;
|
||||
fn const_u128(&self, i: u128) -> Self::Value;
|
||||
fn const_usize(&self, i: u64) -> Self::Value;
|
||||
fn const_u8(&self, i: u8) -> Self::Value;
|
||||
fn const_real(&self, t: Self::Type, val: f64) -> Self::Value;
|
||||
|
|
|
@ -9,7 +9,7 @@ use rustc_session::parse::{feature_err, ParseSess};
|
|||
use rustc_span::symbol::{kw, sym, Ident};
|
||||
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::{Span, SyntaxContext};
|
||||
use rustc_span::Span;
|
||||
|
||||
const VALID_FRAGMENT_NAMES_MSG: &str = "valid fragment specifiers are \
|
||||
`ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, \
|
||||
|
@ -72,7 +72,7 @@ pub(super) fn parse(
|
|||
// `SyntaxContext::root()` from a foreign crate will
|
||||
// have the edition of that crate (which we manually
|
||||
// retrieve via the `edition` parameter).
|
||||
if span.ctxt() == SyntaxContext::root() {
|
||||
if span.ctxt().is_root() {
|
||||
edition
|
||||
} else {
|
||||
span.edition()
|
||||
|
|
|
@ -260,6 +260,8 @@ language_item_table! {
|
|||
EhCatchTypeinfo, sym::eh_catch_typeinfo, eh_catch_typeinfo, Target::Static, GenericRequirement::None;
|
||||
|
||||
OwnedBox, sym::owned_box, owned_box, Target::Struct, GenericRequirement::Minimum(1);
|
||||
// Experimental language item for Miri
|
||||
PtrUnique, sym::ptr_unique, ptr_unique, Target::Struct, GenericRequirement::Exact(1);
|
||||
|
||||
PhantomData, sym::phantom_data, phantom_data, Target::Struct, GenericRequirement::Exact(1);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use rustc_middle::hir;
|
|||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::config::MirSpanview;
|
||||
use rustc_span::{BytePos, Pos, Span, SyntaxContext};
|
||||
use rustc_span::{BytePos, Pos, Span};
|
||||
|
||||
use std::cmp;
|
||||
use std::io::{self, Write};
|
||||
|
@ -327,7 +327,7 @@ fn compute_block_span(data: &BasicBlockData<'_>, body_span: Span) -> Span {
|
|||
let mut span = data.terminator().source_info.span;
|
||||
for statement_span in data.statements.iter().map(|statement| statement.source_info.span) {
|
||||
// Only combine Spans from the root context, and within the function's body_span.
|
||||
if statement_span.ctxt() == SyntaxContext::root() && body_span.contains(statement_span) {
|
||||
if statement_span.ctxt().is_root() && body_span.contains(statement_span) {
|
||||
span = span.to(statement_span);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -586,6 +586,24 @@ pub enum Clause<'tcx> {
|
|||
ConstArgHasType(Const<'tcx>, Ty<'tcx>),
|
||||
}
|
||||
|
||||
impl<'tcx> Binder<'tcx, Clause<'tcx>> {
|
||||
pub fn as_trait_clause(self) -> Option<Binder<'tcx, TraitPredicate<'tcx>>> {
|
||||
if let ty::Clause::Trait(trait_clause) = self.skip_binder() {
|
||||
Some(self.rebind(trait_clause))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_projection_clause(self) -> Option<Binder<'tcx, ProjectionPredicate<'tcx>>> {
|
||||
if let ty::Clause::Projection(projection_clause) = self.skip_binder() {
|
||||
Some(self.rebind(projection_clause))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, TyEncodable, TyDecodable)]
|
||||
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
|
||||
pub enum PredicateKind<'tcx> {
|
||||
|
@ -1203,6 +1221,17 @@ impl<'tcx> ToPredicate<'tcx> for TraitRef<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ToPredicate<'tcx, Binder<'tcx, Clause<'tcx>>> for TraitRef<'tcx> {
|
||||
#[inline(always)]
|
||||
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> Binder<'tcx, Clause<'tcx>> {
|
||||
Binder::dummy(Clause::Trait(TraitPredicate {
|
||||
trait_ref: self,
|
||||
constness: ty::BoundConstness::NotConst,
|
||||
polarity: ty::ImplPolarity::Positive,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ToPredicate<'tcx> for Binder<'tcx, TraitRef<'tcx>> {
|
||||
#[inline(always)]
|
||||
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
|
||||
|
@ -1211,6 +1240,14 @@ impl<'tcx> ToPredicate<'tcx> for Binder<'tcx, TraitRef<'tcx>> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ToPredicate<'tcx, Binder<'tcx, Clause<'tcx>>> for Binder<'tcx, TraitRef<'tcx>> {
|
||||
#[inline(always)]
|
||||
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Binder<'tcx, Clause<'tcx>> {
|
||||
let pred: PolyTraitPredicate<'tcx> = self.to_predicate(tcx);
|
||||
pred.to_predicate(tcx)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ToPredicate<'tcx, PolyTraitPredicate<'tcx>> for Binder<'tcx, TraitRef<'tcx>> {
|
||||
#[inline(always)]
|
||||
fn to_predicate(self, _: TyCtxt<'tcx>) -> PolyTraitPredicate<'tcx> {
|
||||
|
@ -1240,6 +1277,12 @@ impl<'tcx> ToPredicate<'tcx> for PolyTraitPredicate<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ToPredicate<'tcx, Binder<'tcx, Clause<'tcx>>> for PolyTraitPredicate<'tcx> {
|
||||
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> Binder<'tcx, Clause<'tcx>> {
|
||||
self.map_bound(|p| Clause::Trait(p))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ToPredicate<'tcx> for PolyRegionOutlivesPredicate<'tcx> {
|
||||
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
|
||||
self.map_bound(|p| PredicateKind::Clause(Clause::RegionOutlives(p))).to_predicate(tcx)
|
||||
|
@ -1258,6 +1301,12 @@ impl<'tcx> ToPredicate<'tcx> for PolyProjectionPredicate<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ToPredicate<'tcx, Binder<'tcx, Clause<'tcx>>> for PolyProjectionPredicate<'tcx> {
|
||||
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> Binder<'tcx, Clause<'tcx>> {
|
||||
self.map_bound(|p| Clause::Projection(p))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> ToPredicate<'tcx> for TraitPredicate<'tcx> {
|
||||
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
|
||||
PredicateKind::Clause(Clause::Trait(self)).to_predicate(tcx)
|
||||
|
@ -1327,6 +1376,23 @@ impl<'tcx> Predicate<'tcx> {
|
|||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_clause(self) -> Option<Binder<'tcx, Clause<'tcx>>> {
|
||||
let predicate = self.kind();
|
||||
match predicate.skip_binder() {
|
||||
PredicateKind::Clause(clause) => Some(predicate.rebind(clause)),
|
||||
PredicateKind::AliasRelate(..)
|
||||
| PredicateKind::Subtype(..)
|
||||
| PredicateKind::Coerce(..)
|
||||
| PredicateKind::WellFormed(..)
|
||||
| PredicateKind::ObjectSafe(..)
|
||||
| PredicateKind::ClosureKind(..)
|
||||
| PredicateKind::ConstEvaluatable(..)
|
||||
| PredicateKind::ConstEquate(..)
|
||||
| PredicateKind::Ambiguous
|
||||
| PredicateKind::TypeWellFormedFromEnv(..) => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents the bounds declared on a particular set of type
|
||||
|
|
|
@ -15,6 +15,10 @@ pub struct CheckAlignment;
|
|||
|
||||
impl<'tcx> MirPass<'tcx> for CheckAlignment {
|
||||
fn is_enabled(&self, sess: &Session) -> bool {
|
||||
// FIXME(#112480) MSVC and rustc disagree on minimum stack alignment on x86 Windows
|
||||
if sess.target.llvm_target == "i686-pc-windows-msvc" {
|
||||
return false;
|
||||
}
|
||||
sess.opts.debug_assertions
|
||||
}
|
||||
|
||||
|
|
|
@ -507,7 +507,7 @@ impl HygieneData {
|
|||
self.normalize_to_macro_rules(call_site_ctxt)
|
||||
};
|
||||
|
||||
if call_site_ctxt == SyntaxContext::root() {
|
||||
if call_site_ctxt.is_root() {
|
||||
return self.apply_mark_internal(ctxt, expn_id, transparency);
|
||||
}
|
||||
|
||||
|
@ -671,12 +671,17 @@ impl SyntaxContext {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn as_u32(self) -> u32 {
|
||||
pub const fn is_root(self) -> bool {
|
||||
self.0 == SyntaxContext::root().as_u32()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) const fn as_u32(self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn from_u32(raw: u32) -> SyntaxContext {
|
||||
pub(crate) const fn from_u32(raw: u32) -> SyntaxContext {
|
||||
SyntaxContext(raw)
|
||||
}
|
||||
|
||||
|
@ -1500,7 +1505,7 @@ impl<CTX: HashStableContext> HashStable<CTX> for SyntaxContext {
|
|||
const TAG_EXPANSION: u8 = 0;
|
||||
const TAG_NO_EXPANSION: u8 = 1;
|
||||
|
||||
if *self == SyntaxContext::root() {
|
||||
if self.is_root() {
|
||||
TAG_NO_EXPANSION.hash_stable(ctx, hasher);
|
||||
} else {
|
||||
TAG_EXPANSION.hash_stable(ctx, hasher);
|
||||
|
|
|
@ -826,9 +826,9 @@ impl Span {
|
|||
// Return the macro span on its own to avoid weird diagnostic output. It is preferable to
|
||||
// have an incomplete span than a completely nonsensical one.
|
||||
if span_data.ctxt != end_data.ctxt {
|
||||
if span_data.ctxt == SyntaxContext::root() {
|
||||
if span_data.ctxt.is_root() {
|
||||
return end;
|
||||
} else if end_data.ctxt == SyntaxContext::root() {
|
||||
} else if end_data.ctxt.is_root() {
|
||||
return self;
|
||||
}
|
||||
// Both spans fall within a macro.
|
||||
|
@ -837,7 +837,7 @@ impl Span {
|
|||
Span::new(
|
||||
cmp::min(span_data.lo, end_data.lo),
|
||||
cmp::max(span_data.hi, end_data.hi),
|
||||
if span_data.ctxt == SyntaxContext::root() { end_data.ctxt } else { span_data.ctxt },
|
||||
if span_data.ctxt.is_root() { end_data.ctxt } else { span_data.ctxt },
|
||||
if span_data.parent == end_data.parent { span_data.parent } else { None },
|
||||
)
|
||||
}
|
||||
|
@ -855,7 +855,7 @@ impl Span {
|
|||
Span::new(
|
||||
span.hi,
|
||||
end.lo,
|
||||
if end.ctxt == SyntaxContext::root() { end.ctxt } else { span.ctxt },
|
||||
if end.ctxt.is_root() { end.ctxt } else { span.ctxt },
|
||||
if span.parent == end.parent { span.parent } else { None },
|
||||
)
|
||||
}
|
||||
|
@ -879,9 +879,9 @@ impl Span {
|
|||
// Return the macro span on its own to avoid weird diagnostic output. It is preferable to
|
||||
// have an incomplete span than a completely nonsensical one.
|
||||
if span_data.ctxt != end_data.ctxt {
|
||||
if span_data.ctxt == SyntaxContext::root() {
|
||||
if span_data.ctxt.is_root() {
|
||||
return end;
|
||||
} else if end_data.ctxt == SyntaxContext::root() {
|
||||
} else if end_data.ctxt.is_root() {
|
||||
return self;
|
||||
}
|
||||
// Both spans fall within a macro.
|
||||
|
@ -890,7 +890,7 @@ impl Span {
|
|||
Span::new(
|
||||
span_data.lo,
|
||||
end_data.lo,
|
||||
if end_data.ctxt == SyntaxContext::root() { end_data.ctxt } else { span_data.ctxt },
|
||||
if end_data.ctxt.is_root() { end_data.ctxt } else { span_data.ctxt },
|
||||
if span_data.parent == end_data.parent { span_data.parent } else { None },
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1156,6 +1156,7 @@ symbols! {
|
|||
ptr_null_mut,
|
||||
ptr_offset_from,
|
||||
ptr_offset_from_unsigned,
|
||||
ptr_unique,
|
||||
pub_macro_rules,
|
||||
pub_restricted,
|
||||
public,
|
||||
|
|
|
@ -105,7 +105,7 @@ pub(super) trait GoalKind<'tcx>:
|
|||
fn probe_and_match_goal_against_assumption(
|
||||
ecx: &mut EvalCtxt<'_, 'tcx>,
|
||||
goal: Goal<'tcx, Self>,
|
||||
assumption: ty::Predicate<'tcx>,
|
||||
assumption: ty::Binder<'tcx, ty::Clause<'tcx>>,
|
||||
then: impl FnOnce(&mut EvalCtxt<'_, 'tcx>) -> QueryResult<'tcx>,
|
||||
) -> QueryResult<'tcx>;
|
||||
|
||||
|
@ -115,7 +115,7 @@ pub(super) trait GoalKind<'tcx>:
|
|||
fn consider_implied_clause(
|
||||
ecx: &mut EvalCtxt<'_, 'tcx>,
|
||||
goal: Goal<'tcx, Self>,
|
||||
assumption: ty::Predicate<'tcx>,
|
||||
assumption: ty::Binder<'tcx, ty::Clause<'tcx>>,
|
||||
requirements: impl IntoIterator<Item = Goal<'tcx, ty::Predicate<'tcx>>>,
|
||||
) -> QueryResult<'tcx> {
|
||||
Self::probe_and_match_goal_against_assumption(ecx, goal, assumption, |ecx| {
|
||||
|
@ -131,7 +131,7 @@ pub(super) trait GoalKind<'tcx>:
|
|||
fn consider_alias_bound_candidate(
|
||||
ecx: &mut EvalCtxt<'_, 'tcx>,
|
||||
goal: Goal<'tcx, Self>,
|
||||
assumption: ty::Predicate<'tcx>,
|
||||
assumption: ty::Binder<'tcx, ty::Clause<'tcx>>,
|
||||
) -> QueryResult<'tcx> {
|
||||
Self::probe_and_match_goal_against_assumption(ecx, goal, assumption, |ecx| {
|
||||
ecx.validate_alias_bound_self_from_param_env(goal)
|
||||
|
@ -144,7 +144,7 @@ pub(super) trait GoalKind<'tcx>:
|
|||
fn consider_object_bound_candidate(
|
||||
ecx: &mut EvalCtxt<'_, 'tcx>,
|
||||
goal: Goal<'tcx, Self>,
|
||||
assumption: ty::Predicate<'tcx>,
|
||||
assumption: ty::Binder<'tcx, ty::Clause<'tcx>>,
|
||||
) -> QueryResult<'tcx> {
|
||||
Self::probe_and_match_goal_against_assumption(ecx, goal, assumption, |ecx| {
|
||||
let tcx = ecx.tcx();
|
||||
|
@ -467,11 +467,13 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||
candidates: &mut Vec<Candidate<'tcx>>,
|
||||
) {
|
||||
for (i, assumption) in goal.param_env.caller_bounds().iter().enumerate() {
|
||||
match G::consider_implied_clause(self, goal, assumption, []) {
|
||||
Ok(result) => {
|
||||
candidates.push(Candidate { source: CandidateSource::ParamEnv(i), result })
|
||||
if let Some(clause) = assumption.as_clause() {
|
||||
match G::consider_implied_clause(self, goal, clause, []) {
|
||||
Ok(result) => {
|
||||
candidates.push(Candidate { source: CandidateSource::ParamEnv(i), result })
|
||||
}
|
||||
Err(NoSolution) => (),
|
||||
}
|
||||
Err(NoSolution) => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -517,11 +519,13 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||
|
||||
for assumption in self.tcx().item_bounds(alias_ty.def_id).subst(self.tcx(), alias_ty.substs)
|
||||
{
|
||||
match G::consider_alias_bound_candidate(self, goal, assumption) {
|
||||
Ok(result) => {
|
||||
candidates.push(Candidate { source: CandidateSource::AliasBound, result })
|
||||
if let Some(clause) = assumption.as_clause() {
|
||||
match G::consider_alias_bound_candidate(self, goal, clause) {
|
||||
Ok(result) => {
|
||||
candidates.push(Candidate { source: CandidateSource::AliasBound, result })
|
||||
}
|
||||
Err(NoSolution) => (),
|
||||
}
|
||||
Err(NoSolution) => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -675,18 +679,20 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||
// projection predicates that we reach by elaborating the principal trait ref,
|
||||
// since that'll cause ambiguity.
|
||||
//
|
||||
// We can remove this when we have implemented intersections in responses.
|
||||
// We can remove this when we have implemented lifetime intersections in responses.
|
||||
if assumption.to_opt_poly_projection_pred().is_some()
|
||||
&& !own_bounds.contains(&assumption)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
match G::consider_object_bound_candidate(self, goal, assumption) {
|
||||
Ok(result) => {
|
||||
candidates.push(Candidate { source: CandidateSource::BuiltinImpl, result })
|
||||
if let Some(clause) = assumption.as_clause() {
|
||||
match G::consider_object_bound_candidate(self, goal, clause) {
|
||||
Ok(result) => {
|
||||
candidates.push(Candidate { source: CandidateSource::BuiltinImpl, result })
|
||||
}
|
||||
Err(NoSolution) => (),
|
||||
}
|
||||
Err(NoSolution) => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,15 +105,15 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
|
|||
fn probe_and_match_goal_against_assumption(
|
||||
ecx: &mut EvalCtxt<'_, 'tcx>,
|
||||
goal: Goal<'tcx, Self>,
|
||||
assumption: ty::Predicate<'tcx>,
|
||||
assumption: ty::Binder<'tcx, ty::Clause<'tcx>>,
|
||||
then: impl FnOnce(&mut EvalCtxt<'_, 'tcx>) -> QueryResult<'tcx>,
|
||||
) -> QueryResult<'tcx> {
|
||||
if let Some(poly_projection_pred) = assumption.to_opt_poly_projection_pred()
|
||||
&& poly_projection_pred.projection_def_id() == goal.predicate.def_id()
|
||||
if let Some(projection_pred) = assumption.as_projection_clause()
|
||||
&& projection_pred.projection_def_id() == goal.predicate.def_id()
|
||||
{
|
||||
ecx.probe(|ecx| {
|
||||
let assumption_projection_pred =
|
||||
ecx.instantiate_binder_with_infer(poly_projection_pred);
|
||||
ecx.instantiate_binder_with_infer(projection_pred);
|
||||
ecx.eq(
|
||||
goal.param_env,
|
||||
goal.predicate.projection_ty,
|
||||
|
|
|
@ -81,17 +81,17 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> {
|
|||
fn probe_and_match_goal_against_assumption(
|
||||
ecx: &mut EvalCtxt<'_, 'tcx>,
|
||||
goal: Goal<'tcx, Self>,
|
||||
assumption: ty::Predicate<'tcx>,
|
||||
assumption: ty::Binder<'tcx, ty::Clause<'tcx>>,
|
||||
then: impl FnOnce(&mut EvalCtxt<'_, 'tcx>) -> QueryResult<'tcx>,
|
||||
) -> QueryResult<'tcx> {
|
||||
if let Some(poly_trait_pred) = assumption.to_opt_poly_trait_pred()
|
||||
&& poly_trait_pred.def_id() == goal.predicate.def_id()
|
||||
&& poly_trait_pred.polarity() == goal.predicate.polarity
|
||||
if let Some(trait_clause) = assumption.as_trait_clause()
|
||||
&& trait_clause.def_id() == goal.predicate.def_id()
|
||||
&& trait_clause.polarity() == goal.predicate.polarity
|
||||
{
|
||||
// FIXME: Constness
|
||||
ecx.probe(|ecx| {
|
||||
let assumption_trait_pred =
|
||||
ecx.instantiate_binder_with_infer(poly_trait_pred);
|
||||
ecx.instantiate_binder_with_infer(trait_clause);
|
||||
ecx.eq(
|
||||
goal.param_env,
|
||||
goal.predicate.trait_ref,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue