Rollup merge of #94869 - jackh726:gats_extended, r=compiler-errors
Add the generic_associated_types_extended feature Right now, this only ignore obligations that reference new placeholders in `poly_project_and_unify_type`. In the future, this might do other things, like allowing object-safe GATs. **This feature is *incomplete* and quite likely unsound. This is mostly just for testing out potential future APIs using a "relaxed" set of rules until we figure out *proper* rules.** Also drive by cleanup of adding a `ProjectAndUnifyResult` enum instead of using a `Result<Result<Option>>`. r? `@nikomatsakis`
This commit is contained in:
commit
e08ab08a2e
14 changed files with 261 additions and 33 deletions
|
@ -5,6 +5,7 @@ use super::*;
|
|||
|
||||
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
|
||||
use crate::infer::InferCtxt;
|
||||
use crate::traits::project::ProjectAndUnifyResult;
|
||||
use rustc_middle::ty::fold::TypeFolder;
|
||||
use rustc_middle::ty::{Region, RegionVid, Term};
|
||||
|
||||
|
@ -751,7 +752,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
debug!("Projecting and unifying projection predicate {:?}", predicate);
|
||||
|
||||
match project::poly_project_and_unify_type(select, &obligation.with(p)) {
|
||||
Err(e) => {
|
||||
ProjectAndUnifyResult::MismatchedProjectionTypes(e) => {
|
||||
debug!(
|
||||
"evaluate_nested_obligations: Unable to unify predicate \
|
||||
'{:?}' '{:?}', bailing out",
|
||||
|
@ -759,11 +760,11 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
);
|
||||
return false;
|
||||
}
|
||||
Ok(Err(project::InProgress)) => {
|
||||
ProjectAndUnifyResult::Recursive => {
|
||||
debug!("evaluate_nested_obligations: recursive projection predicate");
|
||||
return false;
|
||||
}
|
||||
Ok(Ok(Some(v))) => {
|
||||
ProjectAndUnifyResult::Holds(v) => {
|
||||
// We only care about sub-obligations
|
||||
// when we started out trying to unify
|
||||
// some inference variables. See the comment above
|
||||
|
@ -782,7 +783,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
}
|
||||
}
|
||||
}
|
||||
Ok(Ok(None)) => {
|
||||
ProjectAndUnifyResult::FailedNormalization => {
|
||||
// It's ok not to make progress when have no inference variables -
|
||||
// in that case, we were only performing unification to check if an
|
||||
// error occurred (which would indicate that it's impossible for our
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue