Skip to content

Commit 3223981

Browse files
committed
Add more tests
1 parent 9925b88 commit 3223981

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/tools/rustfmt/tests/source/trait.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,5 @@ trait Visible {
181181
pub fn f();
182182
pub fn g() {}
183183
}
184+
185+
const trait Foomp = Hash;

src/tools/rustfmt/tests/target/trait.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,5 @@ trait Visible {
218218
pub fn f();
219219
pub fn g() {}
220220
}
221+
222+
trait Foomp = Hash;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//! Test that we do not need to handle host effects in `expand_trait_aliases`
2+
3+
#![feature(trait_alias, const_trait_impl)]
4+
//@ check-pass
5+
6+
mod foo {
7+
pub const trait Bar {
8+
fn bar(&self) {}
9+
}
10+
pub const trait Baz {
11+
fn baz(&self) {}
12+
}
13+
14+
impl const Bar for () {}
15+
impl const Baz for () {}
16+
17+
pub const trait Foo = [const] Bar + Baz;
18+
}
19+
20+
use foo::Foo as _;
21+
22+
23+
const _: () = {
24+
// Ok via `[const] Bar` on `Foo`
25+
().bar();
26+
// Also works, because everything is fully concrete, so we're ignoring that
27+
// `Baz` is not a const trait bound of `Foo`.
28+
().baz();
29+
};
30+
31+
fn main() {}

0 commit comments

Comments
 (0)