rust/tests/ui/delegation/unsupported.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.5 KiB
Rust
Raw Normal View History

#![feature(const_trait_impl)]
2023-11-26 06:57:31 -06:00
#![feature(c_variadic)]
#![feature(effects)]
2023-11-26 06:57:31 -06:00
#![feature(fn_delegation)]
#![allow(incomplete_features)]
2023-11-26 06:57:31 -06:00
mod opaque {
trait Trait {}
impl Trait for () {}
mod to_reuse {
use super::Trait;
pub fn opaque_ret() -> impl Trait { unimplemented!() }
2024-05-19 21:24:23 -05:00
//~^ warn: this function depends on never type fallback being `()`
//~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2023-11-26 06:57:31 -06:00
}
trait ToReuse {
fn opaque_ret() -> impl Trait { unimplemented!() }
2024-05-19 21:24:23 -05:00
//~^ warn: this function depends on never type fallback being `()`
//~| warn: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2023-11-26 06:57:31 -06: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 06:57:31 -06: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
}
mod effects {
#[const_trait]
trait Trait {
fn foo();
}
reuse Trait::foo;
//~^ ERROR delegation to a function with effect parameter is not supported yet
}
2023-11-26 06:57:31 -06:00
fn main() {}