Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

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 Oct 30, 2025
commit a6ca44cf4092c790664d7218c032ea47ba41f0bc
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() {}