Conversation
|
|
This comment has been minimized.
This comment has been minimized.
1d08de5 to
92b334a
Compare
library/coretests/tests/array.rs
Outdated
| #[test] | ||
| fn extra_const_array_ops() { | ||
| let x: [u8; 4] = | ||
| const { std::array::from_fn(const |i| i + 4).map(const |x| x * 2).map(const |x| x as _) }; |
There was a problem hiding this comment.
Also add a test with upvars (both trivial ones and ones with const Drop impls
There was a problem hiding this comment.
And a UI test that fails if an upvar is not const Destruct
92b334a to
9a21f8d
Compare
This comment has been minimized.
This comment has been minimized.
tests/ui/traits/const-traits/const-closure-with-indestructible-indestructible.rs
Show resolved
Hide resolved
9a21f8d to
cf2876e
Compare
This comment has been minimized.
This comment has been minimized.
d2537d2 to
20dfeff
Compare
This comment has been minimized.
This comment has been minimized.
20dfeff to
29a13cc
Compare
This comment has been minimized.
This comment has been minimized.
29a13cc to
bc613f8
Compare
This comment has been minimized.
This comment has been minimized.
bc613f8 to
5c1e5d5
Compare
This comment has been minimized.
This comment has been minimized.
5c1e5d5 to
02e4873
Compare
This comment has been minimized.
This comment has been minimized.
02e4873 to
50d7a00
Compare
|
lgtm. Pls squash the commits as the test commit doesn't test "before this PR" behaviour but is just tied to the second commit r=me @bors delegate+ |
50d7a00 to
04b3bca
Compare
|
@bors r=oli-obk |
|
⌛ Testing commit 04b3bca with merge 629890a... Workflow: https://github.com/rust-lang/rust/actions/runs/23156680213 |
constify const Fn*: Destruct makes closures const destruct where their upvars are. i think this makes sense and is how this should be implemented. r? @oli-obk
|
💥 Test timed out after |
|
|
||
| // Coroutines and closures could implement `[const] Drop`, | ||
| // Closures are [const] Destruct when all of their upvars (captures) are [const] Destruct. | ||
| ty::Closure(def, args) if cx.closure_is_const(def) => { |
There was a problem hiding this comment.
The old and next solvers in this PR seem to treat non-const closures differently. Please test if this code has the same behavior on the old solver and the next solver:
#![feature(const_trait_impl, const_destruct)]
use std::marker::Destruct;
const fn foo(x: i32) -> impl const Destruct {
move || { std::hint::black_box(x); }
}|
@bors retry |
… r=oli-obk constify const Fn*: Destruct makes closures const destruct where their upvars are. i think this makes sense and is how this should be implemented. r? @oli-obk
04b3bca to
5ff4862
Compare
|
This pull request was unapproved. This PR was contained in a rollup (#154007), which was closed. |
|
@rustbot ready |
5ff4862 to
b90abe6
Compare
makes closures const destruct where their upvars are. i think this makes sense
and is how this should be implemented.
r? @oli-obk