upgraded to rust 1.86.0. now i'm getting some new missing_const_for_fn
lints, but when i add const
i get a compiler error. Am I missing something dumb here? Known issue? Am I holding it wrong? Here's a couple examples:
// ⚠️ clippy: this could be a `const fn`
pub fn authors(&self) -> &[Author] {
&self.authors
}
..adding const
produces:
1 error[E0015]: cannot perform non-const deref coercion on `std::vec::Vec<types::Author>` in constant functions
--> core/src/document_meta.rs:92:5
|
92 | &self.authors
| ^^^^^^^^^^^^^
|
= note: attempting to deref into `[types::Author]`
here's another:
// ⚠️ clippy: this could be a `const fn`
pub fn str(&self) -> Option<&str> {
match self {
AttrValue::String(s) => Some(s),
AttrValue::Bool(true) => Some(""),
AttrValue::Bool(false) => None,
}
}
which produces:
1 error[E0015]: cannot perform non-const deref coercion on `std::string::String` in constant functions
--> core/src/attrs.rs:22:36
|
22 | AttrValue::String(s) => Some(s),
| ^
|
= note: attempting to deref into `str`