diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/encoder.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 76007398000..4231db620b0 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1223,7 +1223,12 @@ impl EncodeContext<'a, 'tcx> { let fn_data = if let hir::ImplItemKind::Fn(ref sig, body) = ast_item.kind { FnData { asyncness: sig.header.asyncness, - constness: sig.header.constness, + // Can be inside `impl const Trait`, so using sig.header.constness is not reliable + constness: if self.tcx.is_const_fn_raw(def_id) { + hir::Constness::Const + } else { + hir::Constness::NotConst + }, param_names: self.encode_fn_param_names_for_body(body), } } else { |
