diff options
author | Camille GILLOT <gillot.camille@gmail.com> | 2023-05-14 12:48:57 +0000 |
---|---|---|
committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-05-14 12:48:57 +0000 |
commit | 33ec632381cb0732dd7db3836116e5e273ab908b (patch) | |
tree | c551f54ec5fc74b8f659f6f5ced6635decf11846 | |
parent | 343819d33f5c4f026bbd789f87b03f932f11b0cb (diff) | |
download | rust-33ec632381cb0732dd7db3836116e5e273ab908b.tar.gz |
Add test.
-rw-r--r-- | tests/ui/self/self-ctor-nongeneric.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/self/self-ctor-nongeneric.rs b/tests/ui/self/self-ctor-nongeneric.rs new file mode 100644 index 00000000000..0ae7f8da4b4 --- /dev/null +++ b/tests/ui/self/self-ctor-nongeneric.rs @@ -0,0 +1,15 @@ +// `Self` as a constructor is currently allowed when the outer item is not generic. +// check-pass + +struct S0(usize); + +impl S0 { + fn foo() { + const C: S0 = Self(0); + fn bar() -> S0 { + Self(0) + } + } +} + +fn main() {} |