From dc0db358abe19481e475e10c32149b53370f1a1c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:31 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- .../rfcs/rfc-2632-const-trait-impl/std-impl-gate.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.rs (limited to 'tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.rs') diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.rs new file mode 100644 index 000000000..e9e5e0235 --- /dev/null +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/std-impl-gate.rs @@ -0,0 +1,21 @@ +// This tests feature gates for const impls in the standard library. + +// revisions: stock gated +//[gated] known-bug: #110395 + +#![cfg_attr(gated, feature(const_trait_impl, const_default_impls))] + +fn non_const_context() -> Vec { + Default::default() +} + +const fn const_context() -> Vec { + Default::default() + //[stock]~^ ERROR cannot call non-const fn +} + +fn main() { + const VAL: Vec = const_context(); + + assert_eq!(VAL, non_const_context()); +} -- cgit v1.2.3