Add more tests

This commit is contained in:
Oli Scherer 2025-07-22 08:11:23 +00:00 committed by Oli Scherer
parent b9e7cf61be
commit a6ca44cf40
3 changed files with 35 additions and 0 deletions

View file

@ -181,3 +181,5 @@ trait Visible {
pub fn f();
pub fn g() {}
}
const trait Foomp = Hash;

View file

@ -218,3 +218,5 @@ trait Visible {
pub fn f();
pub fn g() {}
}
trait Foomp = Hash;

View file

@ -0,0 +1,31 @@
//! Test that we do not need to handle host effects in `expand_trait_aliases`
#![feature(trait_alias, const_trait_impl)]
//@ check-pass
mod foo {
pub const trait Bar {
fn bar(&self) {}
}
pub const trait Baz {
fn baz(&self) {}
}
impl const Bar for () {}
impl const Baz for () {}
pub const trait Foo = [const] Bar + Baz;
}
use foo::Foo as _;
const _: () = {
// Ok via `[const] Bar` on `Foo`
().bar();
// Also works, because everything is fully concrete, so we're ignoring that
// `Baz` is not a const trait bound of `Foo`.
().baz();
};
fn main() {}