mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
55509a9fe4
`fn_abi_of_instance` can look at function bodies to deduce codegen optimization attributes (namely `ArgAttribute::ReadOnly` and `ArgAttribute::CapturesNone`) of indirectly-passed parameters. This can lead to cycles when performed during typeck, when such attributes are irrelevant. This patch breaks a subquery out from `fn_abi_of_instance`, `fn_abi_of_instance_no_deduced_attrs`, which returns the ABI before such parameter attributes are deduced; and that new subquery is used in CTFE instead.
19 lines
569 B
Rust
19 lines
569 B
Rust
//! Items whose type depends on CTFE (such as the async closure/coroutine beneath, whose type
|
|
//! depends upon evaluating `do_nothing`) should not cause a query cycle owing to the deduction of
|
|
//! the function's parameter attributes, which are only required for codegen and not for CTFE.
|
|
//!
|
|
//! Regression test for https://github.com/rust-lang/rust/issues/151748
|
|
//@ compile-flags: -O
|
|
//@ edition: 2018
|
|
//@ check-pass
|
|
|
|
fn main() {
|
|
let _ = async || {
|
|
let COMPLEX_CONSTANT = ();
|
|
};
|
|
}
|
|
|
|
const fn do_nothing() {}
|
|
|
|
const COMPLEX_CONSTANT: () = do_nothing();
|