diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-01-29 06:03:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-29 06:03:23 +0100 |
| commit | e37b744baedf8b13e021f94d3b8e4f7983b9cbd5 (patch) | |
| tree | bda7b516a9b3225b3841d8e1ddad54d4170fa4b9 /tests/ui/generic-const-items/def-site-eval.rs | |
| parent | bde47b7ae81103febb80b45f083ef2982859ad41 (diff) | |
| parent | 0a9ee02d0a3ac8a45ab00b817c801f087a06828e (diff) | |
| download | rust-e37b744baedf8b13e021f94d3b8e4f7983b9cbd5.tar.gz rust-e37b744baedf8b13e021f94d3b8e4f7983b9cbd5.zip | |
Rollup merge of #136168 - fmease:gci-fix-mono, r=compiler-errors
GCI: Don't try to eval / collect mono items inside overly generic free const items
Fixes #136156. Thanks for the pointers, errs!
There's one (preexisting) thing of note (maybe?). There's a difference between `const _: () = panic!();` and `const _<'a>: () = panic!();`: The former is a pre-mono error, the latter is a post-mono error. For comparison, both `fn _f() { const { panic!() } }` and `fn _f<'a: 'a>() { const { panic!() } }` are post-mono errors.
cc `@oli-obk`
r? compiler-errors or reassign
Diffstat (limited to 'tests/ui/generic-const-items/def-site-eval.rs')
| -rw-r--r-- | tests/ui/generic-const-items/def-site-eval.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/generic-const-items/def-site-eval.rs b/tests/ui/generic-const-items/def-site-eval.rs new file mode 100644 index 00000000000..3ed7f96aed0 --- /dev/null +++ b/tests/ui/generic-const-items/def-site-eval.rs @@ -0,0 +1,16 @@ +//! Test that we only evaluate free const items (their def site to be clear) +//! whose generics don't require monomorphization. +#![feature(generic_const_items)] +#![allow(incomplete_features)] + +//@ revisions: fail pass +//@[fail] build-fail (we require monomorphization) +//@[pass] build-pass (we require monomorphization) + +const _<_T>: () = panic!(); +const _<const _N: usize>: () = panic!(); + +#[cfg(fail)] +const _<'_a>: () = panic!(); //[fail]~ ERROR evaluation of `_::<'_>` failed + +fn main() {} |
