]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/issue-32382-index-assoc-type-with-lifetime.rs
3 // rust-lang/rust#32382: Borrow checker used to complain about
4 // `foobar_3` in the `impl` below, presumably due to some interaction
5 // between the use of a lifetime in the associated type and the use of
6 // the overloaded operator[]. This regression test ensures that we do
7 // not resume complaining about it in the future.
10 use std
::marker
::PhantomData
;
13 pub trait Context
: Clone
{
14 type Container
: ?Sized
;
15 fn foobar_1( container
: &Self::Container
) -> &str;
16 fn foobar_2( container
: &Self::Container
) -> &str;
17 fn foobar_3( container
: &Self::Container
) -> &str;
22 phantom
: PhantomData
<&'
a ()>
25 impl<'a
> Context
for Foobar
<'a
> {
26 type Container
= [&'a
str];
28 fn foobar_1
<'r
>( container
: &'r
[&'a
str] ) -> &'r
str {
32 fn foobar_2
<'r
>( container
: &'r
Self::Container
) -> &'r
str {
36 fn foobar_3
<'r
>( container
: &'r
Self::Container
) -> &'r
str {