2022-09-22 19:56:55 -05:00
|
|
|
// check-pass
|
|
|
|
// aux-build: rpitit.rs
|
|
|
|
|
2023-09-06 19:45:12 -05:00
|
|
|
#![feature(lint_reasons)]
|
|
|
|
|
2022-09-22 19:56:55 -05:00
|
|
|
extern crate rpitit;
|
|
|
|
|
2023-04-30 16:52:35 -05:00
|
|
|
use rpitit::{Foo, Foreign};
|
2023-03-21 13:06:04 -05:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
// Implement an RPITIT from another crate.
|
2023-09-06 19:45:12 -05:00
|
|
|
pub struct Local;
|
2023-04-30 16:52:35 -05:00
|
|
|
impl Foo for Local {
|
2023-09-06 19:45:12 -05:00
|
|
|
#[expect(refining_impl_trait)]
|
|
|
|
fn bar(self) -> Arc<String> {
|
|
|
|
Arc::new(String::new())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct LocalIgnoreRefining;
|
|
|
|
impl Foo for LocalIgnoreRefining {
|
|
|
|
#[deny(refining_impl_trait)]
|
2023-06-23 22:00:08 -05:00
|
|
|
fn bar(self) -> Arc<String> {
|
|
|
|
Arc::new(String::new())
|
|
|
|
}
|
2023-03-21 13:06:04 -05:00
|
|
|
}
|
|
|
|
|
2023-06-29 11:37:13 -05:00
|
|
|
fn generic(f: impl Foo) {
|
|
|
|
let x = &*f.bar();
|
|
|
|
}
|
|
|
|
|
2022-09-22 19:56:55 -05:00
|
|
|
fn main() {
|
2023-03-21 13:06:04 -05:00
|
|
|
// Witness an RPITIT from another crate.
|
2023-04-30 16:52:35 -05:00
|
|
|
let &() = Foreign.bar();
|
2023-03-21 13:06:04 -05:00
|
|
|
|
2023-04-30 16:52:35 -05:00
|
|
|
let x: Arc<String> = Local.bar();
|
2023-09-06 19:45:12 -05:00
|
|
|
let x: Arc<String> = LocalIgnoreRefining.bar();
|
2022-09-22 19:56:55 -05:00
|
|
|
}
|