mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 16:45:37 +00:00
hir_ty: don't pass where clauses of associated types down to chalk (temp. fix #9052)
This commit is contained in:
parent
f1d163ba51
commit
51cbcc5346
@ -383,7 +383,7 @@ pub(crate) fn associated_ty_data_query(
|
|||||||
// Lower bounds -- we could/should maybe move this to a separate query in `lower`
|
// Lower bounds -- we could/should maybe move this to a separate query in `lower`
|
||||||
let type_alias_data = db.type_alias_data(type_alias);
|
let type_alias_data = db.type_alias_data(type_alias);
|
||||||
let generic_params = generics(db.upcast(), type_alias.into());
|
let generic_params = generics(db.upcast(), type_alias.into());
|
||||||
let bound_vars = generic_params.bound_vars_subst(DebruijnIndex::INNERMOST);
|
// let bound_vars = generic_params.bound_vars_subst(DebruijnIndex::INNERMOST);
|
||||||
let resolver = hir_def::resolver::HasResolver::resolver(type_alias, db.upcast());
|
let resolver = hir_def::resolver::HasResolver::resolver(type_alias, db.upcast());
|
||||||
let ctx = crate::TyLoweringContext::new(db, &resolver)
|
let ctx = crate::TyLoweringContext::new(db, &resolver)
|
||||||
.with_type_param_mode(crate::lower::TypeParamLoweringMode::Variable);
|
.with_type_param_mode(crate::lower::TypeParamLoweringMode::Variable);
|
||||||
@ -396,8 +396,10 @@ pub(crate) fn associated_ty_data_query(
|
|||||||
.filter_map(|pred| generic_predicate_to_inline_bound(db, &pred, &self_ty))
|
.filter_map(|pred| generic_predicate_to_inline_bound(db, &pred, &self_ty))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let where_clauses = convert_where_clauses(db, type_alias.into(), &bound_vars);
|
// FIXME: Re-enable where clauses on associated types when an upstream chalk bug is fixed.
|
||||||
let bound_data = rust_ir::AssociatedTyDatumBound { bounds, where_clauses };
|
// (rust-analyzer#9052)
|
||||||
|
// let where_clauses = convert_where_clauses(db, type_alias.into(), &bound_vars);
|
||||||
|
let bound_data = rust_ir::AssociatedTyDatumBound { bounds, where_clauses: vec![] };
|
||||||
let datum = AssociatedTyDatum {
|
let datum = AssociatedTyDatum {
|
||||||
trait_id: to_chalk_trait_id(trait_),
|
trait_id: to_chalk_trait_id(trait_),
|
||||||
id,
|
id,
|
||||||
|
@ -161,7 +161,7 @@ mod result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn infer_tryv2() {
|
fn infer_try_trait_v2() {
|
||||||
check_types(
|
check_types(
|
||||||
r#"
|
r#"
|
||||||
//- /main.rs crate:main deps:core
|
//- /main.rs crate:main deps:core
|
||||||
@ -172,26 +172,41 @@ fn test() {
|
|||||||
} //^ i32
|
} //^ i32
|
||||||
|
|
||||||
//- /core.rs crate:core
|
//- /core.rs crate:core
|
||||||
#[prelude_import] use ops::*;
|
|
||||||
mod ops {
|
mod ops {
|
||||||
trait Try {
|
mod try_trait {
|
||||||
|
pub trait Try: FromResidual {
|
||||||
type Output;
|
type Output;
|
||||||
type Residual;
|
type Residual;
|
||||||
}
|
}
|
||||||
|
pub trait FromResidual<R = <Self as Try>::Residual> {}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub use self::try_trait::FromResidual;
|
||||||
|
pub use self::try_trait::Try;
|
||||||
|
}
|
||||||
|
|
||||||
|
mov convert {
|
||||||
|
pub trait From<T> {}
|
||||||
|
impl<T> From<T> for T {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[prelude_import] use result::*;
|
#[prelude_import] use result::*;
|
||||||
mod result {
|
mod result {
|
||||||
enum Infallible {}
|
use crate::convert::From;
|
||||||
enum Result<O, E> {
|
use crate::ops::{Try, FromResidual};
|
||||||
|
|
||||||
|
pub enum Infallible {}
|
||||||
|
pub enum Result<O, E> {
|
||||||
Ok(O),
|
Ok(O),
|
||||||
Err(E)
|
Err(E)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<O, E> crate::ops::Try for Result<O, E> {
|
impl<O, E> Try for Result<O, E> {
|
||||||
type Output = O;
|
type Output = O;
|
||||||
type Error = Result<Infallible, E>;
|
type Error = Result<Infallible, E>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T, E, F: From<E>> FromResidual<Result<Infallible, E>> for Result<T, F> {}
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user