Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Lily Sturmann
    @lkatalin
    @npmccallum Hooray!
    What do you mean by follow-up? What's going on in entry() that uses a Register type?
    All those u64 are really Register<usize>.
    Actually, Register<u64> since the ABI is 64bit.
    Lily Sturmann
    @lkatalin
    @npmccallum Oh, I see what you're saying. Yes.
    Lily Sturmann
    @lkatalin
    @npmccallum Updated enarx/enarx#423
    Harald Hoyer
    @haraldh
    @npmccallum remember #![deny(clippy::integer_arithmetic)] ? Shall we add that to loader + shim?
    Nathaniel McCallum
    @npmccallum
    @haraldh Isn't that part of clippy::all?
    Harald Hoyer
    @haraldh
    nope
    Nathaniel McCallum
    @npmccallum
    Then, yes please.
    Harald Hoyer
    @haraldh
    Does the CI clippy ?
    Nathaniel McCallum
    @npmccallum
    @haraldh It is supposed to. If not, it is a bug.
    Harald Hoyer
    @haraldh
    Hmm, then I don't add it :) .. only to my own crates :)
    Nathaniel McCallum
    @npmccallum
    ACK
    Harald Hoyer
    @haraldh
    We should probably file issues for every crate then? IDK..
    Or an issue with a check list
    Nathaniel McCallum
    @npmccallum
    Yes, one of those.
    An issue with a check list is probably good.
    Harald Hoyer
    @haraldh
    Now where is this We when you need him... what does he do the whole day?
    Nathaniel McCallum
    @npmccallum
    haha
    Harald Hoyer
    @haraldh
    where is our intern?
    Nathaniel McCallum
    @npmccallum
    I'm now rethinking this clippy.
    It errors on a lot of things.
    Harald Hoyer
    @haraldh
    hehe
    yeah, that's why it isn't the default
    Nathaniel McCallum
    @npmccallum
    And it isn't clear how to fix the problem.
    Harald Hoyer
    @haraldh
    I'll keep it on, until it hurts too much
    Lily Sturmann
    @lkatalin
    @npmccallum Unsure if unwrap_or_else change is related to docs, but the rest looks good on enarx/enarx#533
    Nathaniel McCallum
    @npmccallum
    @lkatalin Same. I'm not sure what precisely triggered the compiler warning. But it is fixed now.
    Lily Sturmann
    @lkatalin
    Approved it
    Harald Hoyer
    @haraldh
    @npmccallum Oh... #![deny(clippy::integer_arithmetic)] really helps thinking about corner cases... e.g. I turned your: https://github.com/enarx/enarx/blob/master/enarx-keep-sgx/src/layout.rs#L19-L24
    into
    fn raise(value: usize, boundary: usize) -> Option<usize> {
        value
            .checked_add(boundary)
            .and_then(|v| v.checked_sub(1))
            .map(|v| lower(v, boundary))
    }
    Nathaniel McCallum
    @npmccallum
    :thumbsup:
    Harald Hoyer
    @haraldh
    and if you know you don't have to check, just put it in a block with
    #[allow(clippy::integer_arithmetic)]
    {
       // whatever
    }
    it's like unsafe {}
    Harald Hoyer
    @haraldh
    ok, scratch my last comment.. only works for functions ... doh!
    #[inline(always)]
    const fn lower(value: usize, boundary: usize) -> usize {
        #![allow(clippy::integer_arithmetic)]
        // integer_arithmetic checked
        value / boundary * boundary
    }
    
    #[inline(always)]
    fn raise(value: usize, boundary: usize) -> Option<usize> {
        value
            .checked_add(boundary)
            .map(|v| v.wrapping_sub(1))
            .map(|v| lower(v, boundary))
    }
    one can write wrapping_*
    haraldh @haraldh heads to bed.. gn8
    Nathaniel McCallum
    @npmccallum
    In a macro that I'm writing, I need an attribute that has no effect to satisfy the parser. Something like #[cfg(true)]. Any suggestions?
    Harald Hoyer
    @haraldh
    #[allow(missing_docs)]
    #[cfg(not(feature = "unlikely_to_exist_feature"))
    Connor Kuehl
    @connorkuehl
    [cfg(noop)] ?
    can we define one like that
    Harald Hoyer
    @haraldh
    #[cfg(not(__my_macro_name_undefined_cfg = ""))]
    if it has to be cfg.. @npmccallum say something :)
    Nathaniel McCallum
    @npmccallum
    It doesn't.
    @haraldh I'm currently using your first suggestion.