Walk return-position impl trait in trait deeply in associated_item_def_ids
This commit is contained in:
parent
478cbb42b7
commit
76b0cf812b
3 changed files with 36 additions and 22 deletions
|
@ -2,12 +2,13 @@
|
|||
|
||||
#![feature(return_position_impl_trait_in_trait)]
|
||||
|
||||
use std::ops::Deref;
|
||||
|
||||
pub trait Foo {
|
||||
fn bar() -> impl Sized;
|
||||
fn bar() -> impl Deref<Target = impl Sized>;
|
||||
}
|
||||
|
||||
pub struct Foreign;
|
||||
|
||||
impl Foo for Foreign {
|
||||
fn bar() {}
|
||||
fn bar() -> &'static () { &() }
|
||||
}
|
||||
|
|
|
@ -5,7 +5,17 @@
|
|||
|
||||
extern crate rpitit;
|
||||
|
||||
fn main() {
|
||||
// Witness an RPITIT from another crate
|
||||
let () = <rpitit::Foreign as rpitit::Foo>::bar();
|
||||
use std::sync::Arc;
|
||||
|
||||
// Implement an RPITIT from another crate.
|
||||
struct Local;
|
||||
impl rpitit::Foo for Local {
|
||||
fn bar() -> Arc<String> { Arc::new(String::new()) }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Witness an RPITIT from another crate.
|
||||
let &() = <rpitit::Foreign as rpitit::Foo>::bar();
|
||||
|
||||
let x: Arc<String> = <Local as rpitit::Foo>::bar();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue