X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_infer%2Fsrc%2Finfer%2Fopaque_types.rs;h=d25484efabc5fd613c1eb76817ab68855008177a;hb=7907385999b4a83d37ed31d334f3ed9ca02983a1;hp=78e6f3a05be66c58c46c54a29f59ee3a63ab264d;hpb=ec667fbcfcd29e2b5080f6be04e229356b27e600;p=rust.git diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index 78e6f3a05be..d25484efabc 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -309,14 +309,22 @@ pub fn handle_opaque_type( /// the same as generating an outlives constraint on `Tc` itself. /// For example, if we had a function like this: /// - /// ```rust + /// ``` + /// # #![feature(type_alias_impl_trait)] + /// # fn main() {} + /// # trait Foo<'a> {} + /// # impl<'a, T> Foo<'a> for (&'a u32, T) {} /// fn foo<'a, T>(x: &'a u32, y: T) -> impl Foo<'a> { /// (x, y) /// } /// /// // Equivalent to: + /// # mod dummy { use super::*; /// type FooReturn<'a, T> = impl Foo<'a>; - /// fn foo<'a, T>(..) -> FooReturn<'a, T> { .. } + /// fn foo<'a, T>(x: &'a u32, y: T) -> FooReturn<'a, T> { + /// (x, y) + /// } + /// # } /// ``` /// /// then the hidden type `Tc` would be `(&'0 u32, T)` (where `'0` @@ -602,17 +610,17 @@ pub fn register_hidden_type( /// Returns `true` if `opaque_hir_id` is a sibling or a child of a sibling of `def_id`. /// /// Example: -/// ```rust +/// ```ignore UNSOLVED (is this a bug?) +/// # #![feature(type_alias_impl_trait)] /// pub mod foo { /// pub mod bar { -/// pub trait Bar { .. } -/// +/// pub trait Bar { /* ... */ } /// pub type Baz = impl Bar; /// -/// fn f1() -> Baz { .. } +/// # impl Bar for () {} +/// fn f1() -> Baz { /* ... */ } /// } -/// -/// fn f2() -> bar::Baz { .. } +/// fn f2() -> bar::Baz { /* ... */ } /// } /// ``` ///