-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make RPITITs simple cases work when using lower_impl_trait_in_trait_to_assoc_ty #108700
Changes from all commits
c223852
47860dd
97eaa5d
3ecb701
83c0ff8
e10034c
290c638
bc9ffbe
e132d29
31a0d67
34ca2dc
b1efed4
5daa01e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ use rustc_hir as hir; | |
use rustc_hir::def::DefKind; | ||
use rustc_index::bit_set::BitSet; | ||
use rustc_middle::ty::{ | ||
self, Binder, EarlyBinder, Predicate, PredicateKind, ToPredicate, Ty, TyCtxt, | ||
TypeSuperVisitable, TypeVisitable, TypeVisitor, | ||
self, Binder, EarlyBinder, ImplTraitInTraitData, Predicate, PredicateKind, ToPredicate, Ty, | ||
TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor, | ||
}; | ||
use rustc_session::config::TraitSolver; | ||
use rustc_span::def_id::{DefId, CRATE_DEF_ID}; | ||
|
@@ -117,6 +117,15 @@ fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> &[Ty<'_>] { | |
|
||
/// See `ParamEnv` struct definition for details. | ||
fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ParamEnv<'_> { | ||
// When computing the param_env of an RPITIT, copy param_env of the containing function. The | ||
// synthesized associated type doesn't have extra predicates to assume. | ||
let def_id = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this not being fed? Cycles? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, all of the queries that I'm not feeding are because of cycles. |
||
if let Some(ImplTraitInTraitData::Trait { fn_def_id, .. }) = tcx.opt_rpitit_info(def_id) { | ||
fn_def_id | ||
} else { | ||
def_id | ||
}; | ||
|
||
// Compute the bounds on Self and the type parameters. | ||
let ty::InstantiatedPredicates { mut predicates, .. } = | ||
tcx.predicates_of(def_id).instantiate_identity(tcx); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// check-pass | ||
// compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty | ||
|
||
#![feature(return_position_impl_trait_in_trait)] | ||
#![allow(incomplete_features)] | ||
|
||
trait Foo { | ||
fn foo() -> impl Sized; | ||
} | ||
|
||
impl Foo for String { | ||
fn foo() -> i32 { | ||
22 | ||
} | ||
} | ||
|
||
fn main() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code feels a little tangled but I don't know how to disentangle it... 🤔