rust/tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ok.rs

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

23 lines
564 B
Rust
Raw Normal View History

2024-03-14 16:45:13 +00:00
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@ build-pass
2024-03-14 16:45:13 +00:00
// Check that we are able to instantiate a binder during trait upcasting,
// and that it doesn't cause any issues with codegen either.
2024-03-14 16:45:13 +00:00
#![feature(trait_upcasting)]
trait Supertrait<'a, 'b> {}
2024-03-14 16:45:13 +00:00
trait Subtrait<'a, 'b>: Supertrait<'a, 'b> {}
impl Supertrait<'_, '_> for () {}
impl Subtrait<'_, '_> for () {}
2024-03-14 16:45:13 +00:00
fn ok(x: &dyn for<'a, 'b> Subtrait<'a, 'b>) -> &dyn for<'a> Supertrait<'a, 'a> {
x
2024-03-14 16:45:13 +00:00
}
fn main() {
ok(&());
}