Skip to content

Commit 7a6db29

Browse files
committed
docs stderr | mod-subitem-as-enum-variant.rs
1 parent edb4a7b commit 7a6db29

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
//! Test that type arguments are properly rejected on modules.
2+
//!
3+
//! Related PR: https://github.com/rust-lang/rust/pull/56225 (RFC 2338 implementation)
4+
15
mod Mod {
26
pub struct FakeVariant<T>(pub T);
37
}
48

59
fn main() {
10+
// This should work fine - normal generic struct constructor
611
Mod::FakeVariant::<i32>(0);
12+
13+
// This should error - type arguments not allowed on modules
714
Mod::<i32>::FakeVariant(0);
815
//~^ ERROR type arguments are not allowed on module `Mod` [E0109]
916
}

tests/ui/type-alias-enum-variants/module-type-args-error.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0109]: type arguments are not allowed on module `Mod`
2-
--> $DIR/mod-subitem-as-enum-variant.rs:7:11
2+
--> $DIR/module-type-args-error.rs:14:11
33
|
44
LL | Mod::<i32>::FakeVariant(0);
55
| --- ^^^ type argument not allowed

0 commit comments

Comments
 (0)