blob: 6285d7786d56a25dc8d9a43e743fbc6b2df76493 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// check-pass
// aux-build: rpitit.rs
#![feature(lint_reasons)]
extern crate rpitit;
use rpitit::{Foo, Foreign};
use std::sync::Arc;
// Implement an RPITIT from another crate.
pub struct Local;
impl Foo for Local {
#[expect(refining_impl_trait)]
fn bar(self) -> Arc<String> {
Arc::new(String::new())
}
}
struct LocalIgnoreRefining;
impl Foo for LocalIgnoreRefining {
#[deny(refining_impl_trait)]
fn bar(self) -> Arc<String> {
Arc::new(String::new())
}
}
fn generic(f: impl Foo) {
let x = &*f.bar();
}
fn main() {
// Witness an RPITIT from another crate.
let &() = Foreign.bar();
let x: Arc<String> = Local.bar();
let x: Arc<String> = LocalIgnoreRefining.bar();
}
|