We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ede6e2 commit 3b9453bCopy full SHA for 3b9453b
compiler/rustc_metadata/src/rmeta/encoder.rs
@@ -1223,7 +1223,12 @@ impl EncodeContext<'a, 'tcx> {
1223
let fn_data = if let hir::ImplItemKind::Fn(ref sig, body) = ast_item.kind {
1224
FnData {
1225
asyncness: sig.header.asyncness,
1226
- constness: sig.header.constness,
+ // Can be inside `impl const Trait`, so using sig.header.constness is not reliable
1227
+ constness: if self.tcx.is_const_fn_raw(def_id) {
1228
+ hir::Constness::Const
1229
+ } else {
1230
+ hir::Constness::NotConst
1231
+ },
1232
param_names: self.encode_fn_param_names_for_body(body),
1233
}
1234
} else {
0 commit comments