Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add more tests
  • Loading branch information
oli-obk committed Sep 22, 2025
commit 8d9ea3ad22cb19cfb5bd8eba62d3804b5ec79336
2 changes: 2 additions & 0 deletions src/tools/rustfmt/tests/source/trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,5 @@ trait Visible {
pub fn f();
pub fn g() {}
}

const trait Foomp = Hash;
2 changes: 2 additions & 0 deletions src/tools/rustfmt/tests/target/trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,5 @@ trait Visible {
pub fn f();
pub fn g() {}
}

trait Foomp = Hash;
31 changes: 31 additions & 0 deletions tests/ui/consts/trait_alias_method_call.rs
Original file line number Diff line number Diff line change
@@ -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() {}