diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2022-03-16 20:49:54 +1100 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-05-30 08:52:24 +0000 |
| commit | 257f06587c7cb271517ca9a02c4ed3fd4581f71e (patch) | |
| tree | 6874a3d3b7940e79c007321146df413274c6a3b2 /compiler/rustc_metadata/src | |
| parent | f558990814bb43cfb67db321b299dfdf275663e3 (diff) | |
| download | rust-257f06587c7cb271517ca9a02c4ed3fd4581f71e.tar.gz rust-257f06587c7cb271517ca9a02c4ed3fd4581f71e.zip | |
Remove `#[default..]` and add `#[const_trait]`
Diffstat (limited to 'compiler/rustc_metadata/src')
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/encoder.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 339d2fc0867..3e647f4a50e 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -891,9 +891,11 @@ fn should_encode_mir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> (bool, bool) { let needs_inline = (generics.requires_monomorphization(tcx) || tcx.codegen_fn_attrs(def_id).requests_inline()) && tcx.sess.opts.output_types.should_codegen(); - // The function has a `const` modifier or is annotated with `default_method_body_is_const`. - let is_const_fn = tcx.is_const_fn_raw(def_id.to_def_id()) - || tcx.has_attr(def_id.to_def_id(), sym::default_method_body_is_const); + // The function has a `const` modifier or is in a `#[const_trait]`. + let mut is_const_fn = tcx.is_const_fn_raw(def_id.to_def_id()); + if let Some(trait_) = tcx.trait_of_item(def_id.to_def_id()) { + is_const_fn = is_const_fn || tcx.has_attr(trait_, sym::const_trait); + } let always_encode_mir = tcx.sess.opts.debugging_opts.always_encode_mir; (is_const_fn, needs_inline || always_encode_mir) } |
