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
|
@ -21,6 +21,7 @@ use super::{
|
|||
|
||||
use crate::infer::{InferCtxt, InferOk, TypeFreshener};
|
||||
use crate::traits::error_reporting::InferCtxtExt;
|
||||
use crate::traits::project::ProjectAndUnifyResult;
|
||||
use crate::traits::project::ProjectionCacheKeyExt;
|
||||
use crate::traits::ProjectionCacheKey;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
|
@ -525,7 +526,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let data = bound_predicate.rebind(data);
|
||||
let project_obligation = obligation.with(data);
|
||||
match project::poly_project_and_unify_type(self, &project_obligation) {
|
||||
Ok(Ok(Some(mut subobligations))) => {
|
||||
ProjectAndUnifyResult::Holds(mut subobligations) => {
|
||||
'compute_res: {
|
||||
// If we've previously marked this projection as 'complete', then
|
||||
// use the final cached result (either `EvaluatedToOk` or
|
||||
|
@ -573,9 +574,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
res
|
||||
}
|
||||
}
|
||||
Ok(Ok(None)) => Ok(EvaluatedToAmbig),
|
||||
Ok(Err(project::InProgress)) => Ok(EvaluatedToRecur),
|
||||
Err(_) => Ok(EvaluatedToErr),
|
||||
ProjectAndUnifyResult::FailedNormalization => Ok(EvaluatedToAmbig),
|
||||
ProjectAndUnifyResult::Recursive => Ok(EvaluatedToRecur),
|
||||
ProjectAndUnifyResult::MismatchedProjectionTypes(_) => Ok(EvaluatedToErr),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue