diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-08-16 23:37:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-16 23:37:34 +0200 |
| commit | 4de53c427bffc24590056932770ebfc21427aa16 (patch) | |
| tree | a5197ca1e86a2b302ca12914eea0a15eb511f52e /src/test | |
| parent | 18a7b6d32a07f26010ee25f0ae50b04cf2cac27d (diff) | |
| parent | 85abdf07578f14b9c07b3aed9f6b23b1bbf23f8f (diff) | |
Rollup merge of #88080 - fee1-dead:iterator-const, r=oli-obk
Skip assert ICE with default_method_body_is_const functions marked with #[default_method_body_is_const] would ICE when being const checked due to it not being a const function: `tcx.is_const_fn_raw(did)` returns false. We should skip this assert when it is marked with that attribute. r? `@oli-obk`
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs new file mode 100644 index 00000000000..d5b1a9073ac --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/default-method-body-is-const-with-staged-api.rs @@ -0,0 +1,18 @@ +// check-pass + +// This was an ICE, because the compiler ensures the +// function to be const when performing const checking, +// but functions marked with the attribute are not const +// *and* subject to const checking. + +#![feature(staged_api)] +#![feature(const_trait_impl)] +#![feature(const_fn_trait_bound)] +#![stable(since = "1", feature = "foo")] + +trait Tr { + #[default_method_body_is_const] + fn a() {} +} + +fn main() {} |
