Conversation
|
How much of a change would it be to change |
chifflier
left a comment
There was a problem hiding this comment.
So, the concatenation is done using a mix of const fn and macros. Is it entirely resolved at compile time ?
Otherwise, another approach would be to entirely do that at runtime, and use the .bytes() method from oid, so it would work generically. The caller would probably have use something like lazy_static.
| no_crate_inject, | ||
| attr(deny(warnings/*, rust_2018_idioms*/), allow(dead_code, unused_variables)) | ||
| ))] | ||
| #![feature(const_precise_live_drops)] |
There was a problem hiding this comment.
Unfortunately, this prevents from building with stable rustc, which would not be acceptable.
Why is it required ? I see no code using it (at least in rustc 1.53, bytes_from_borrowed does not require it)
| pub const fn bytes_from_borrowed(&self) -> &[u8] { | ||
| match &self.asn1 { | ||
| Cow::Borrowed(b) => *b, | ||
| _ => &[], |
There was a problem hiding this comment.
I don't know what the best behavior is:
- returning an empty slice hides the error, which may be bad
- this is a
const fn, so we can't panic (an ugly way to do that would be to do something like{"error message"[256]; &[]}so at least we get an error message
|
|
||
| #![deny(/*missing_docs,*/ | ||
| unstable_features, | ||
| /*unstable_features,*/ |
There was a problem hiding this comment.
I really would prefer not to do this (see below)
Just draft to implement possibility of #44
But this functionality requires
#![feature(const_precise_live_drops)]