2025-10-02 00:51:44 +00:00
|
|
|
//@ revisions: current next
|
|
|
|
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
|
|
|
|
//@[next] compile-flags: -Znext-solver
|
|
|
|
|
//@ check-fail
|
|
|
|
|
|
|
|
|
|
// Next solver revision included because of trait-system-refactor-initiative#234.
|
|
|
|
|
// If we end up in a query cycle, it should be okay as long as results are the same.
|
|
|
|
|
|
2024-05-30 22:00:44 +03:00
|
|
|
#![feature(const_trait_impl)]
|
2023-11-26 15:57:31 +03:00
|
|
|
#![feature(c_variadic)]
|
|
|
|
|
#![feature(fn_delegation)]
|
2024-03-26 18:59:03 +03:00
|
|
|
#![allow(incomplete_features)]
|
2023-11-26 15:57:31 +03:00
|
|
|
|
|
|
|
|
mod opaque {
|
|
|
|
|
trait Trait {}
|
|
|
|
|
impl Trait for () {}
|
|
|
|
|
|
|
|
|
|
mod to_reuse {
|
|
|
|
|
use super::Trait;
|
|
|
|
|
|
2024-11-12 22:23:01 +01:00
|
|
|
pub fn opaque_ret() -> impl Trait { () }
|
2023-11-26 15:57:31 +03:00
|
|
|
}
|
|
|
|
|
|
2024-03-14 15:42:14 +03:00
|
|
|
trait ToReuse {
|
2024-11-12 22:23:01 +01:00
|
|
|
fn opaque_ret() -> impl Trait { () }
|
2023-11-26 15:57:31 +03:00
|
|
|
}
|
|
|
|
|
|
2024-03-14 15:42:14 +03:00
|
|
|
// FIXME: Inherited `impl Trait`s create query cycles when used inside trait impls.
|
|
|
|
|
impl ToReuse for u8 {
|
|
|
|
|
reuse to_reuse::opaque_ret; //~ ERROR cycle detected when computing type
|
|
|
|
|
}
|
|
|
|
|
impl ToReuse for u16 {
|
|
|
|
|
reuse ToReuse::opaque_ret; //~ ERROR cycle detected when computing type
|
|
|
|
|
}
|
2023-11-26 15:57:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mod recursive {
|
|
|
|
|
mod to_reuse1 {
|
|
|
|
|
pub mod to_reuse2 {
|
|
|
|
|
pub fn foo() {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub reuse to_reuse2::foo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reuse to_reuse1::foo;
|
|
|
|
|
//~^ ERROR recursive delegation is not supported yet
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-30 22:00:44 +03:00
|
|
|
mod effects {
|
|
|
|
|
#[const_trait]
|
|
|
|
|
trait Trait {
|
|
|
|
|
fn foo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reuse Trait::foo;
|
2024-10-20 19:49:11 +00:00
|
|
|
//~^ ERROR type annotations needed
|
2024-05-30 22:00:44 +03:00
|
|
|
}
|
|
|
|
|
|
2023-11-26 15:57:31 +03:00
|
|
|
fn main() {}
|