From 51cbcc53468a4f9fbeae8b11f1b1b0f09a9d3454 Mon Sep 17 00:00:00 2001 From: cynecx Date: Sun, 30 May 2021 18:37:02 +0200 Subject: hir_ty: don't pass where clauses of associated types down to chalk (temp. fix #9052) --- crates/hir_ty/src/tests/traits.rs | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'crates/hir_ty/src/tests') diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 7c0ff2170..49add4ab9 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs @@ -161,7 +161,7 @@ mod result { } #[test] -fn infer_tryv2() { +fn infer_try_trait_v2() { check_types( r#" //- /main.rs crate:main deps:core @@ -172,26 +172,41 @@ fn test() { } //^ i32 //- /core.rs crate:core -#[prelude_import] use ops::*; mod ops { - trait Try { - type Output; - type Residual; + mod try_trait { + pub trait Try: FromResidual { + type Output; + type Residual; + } + pub trait FromResidual::Residual> {} } + + pub use self::try_trait::FromResidual; + pub use self::try_trait::Try; +} + +mov convert { + pub trait From {} + impl From for T {} } #[prelude_import] use result::*; mod result { - enum Infallible {} - enum Result { + use crate::convert::From; + use crate::ops::{Try, FromResidual}; + + pub enum Infallible {} + pub enum Result { Ok(O), Err(E) } - impl crate::ops::Try for Result { + impl Try for Result { type Output = O; type Error = Result; } + + impl> FromResidual> for Result {} } "#, ); -- cgit v1.2.3