Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
359bfa901b9d8eddbed7b88b6716dbb77b7bfb95
rust/tests/ui/consts/const-blocks/fn-call-in-non-const.rs

17 lines
285 B
Rust
Raw Normal View History

Fix tests for RFC 2203 in a `const` The previous test was incorrect. `const fn`s are *always* promotable when inside a `const`, so it should pass. The error was caused by a bug in `promote_consts`. I've added a failing test outside a `const` alongside the existing one, which is now run-pass.
2019-11-22 10:45:49 -08:00
// Some type that is not copyable.
struct Bar;
const fn no_copy() -> Option<Bar> {
None
}
const fn copy() -> u32 {
3
}
fn main() {
let _: [u32; 2] = [copy(); 2];
let _: [Option<Bar>; 2] = [no_copy(); 2];
Check that repeat expression elements are Copy (ignoring lifetimes) in typeck and that they are Copy (with proper lifetime checks) in borrowck
2022-04-11 16:38:48 +00:00
//~^ ERROR the trait bound `Bar: Copy` is not satisfied
Fix tests for RFC 2203 in a `const` The previous test was incorrect. `const fn`s are *always* promotable when inside a `const`, so it should pass. The error was caused by a bug in `promote_consts`. I've added a failing test outside a `const` alongside the existing one, which is now run-pass.
2019-11-22 10:45:49 -08:00
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 2110ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API