• 0 Posts
  • 56 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle
  • Lots of major companies like Microsoft and IBM also contribute to Linux, it doesn’t make them saints nor even necessarily compare to what they get for using the volunteer dev work inside Linux.

    Most of those companies actually contribute to the kernel or to foundational software used on servers, but few contribute to the userspace for desktop consumers on the level that Valve does.















  • It’s mentioned in footnote 6:

    As an example, to make this work I’m assuming some kind of “true deref” trait that indicates that Deref yields a reference that remains valid even as the value being deref’d moves from place to place. We need a trait much like this for other reasons too.

    It would only work for references that are stable after the value they reference is moved. Think for example of a &str you get from a String.





  • They tested the same strings on that implementation

    The code they were looking at was used for writing the table, but they were testing the one that read it (which is instead correct).

    though judging by the recent comments someone’s found something.

    Yeah that’s me :)The translation using an associated const also works when the const block uses generic parameters. For example:

    fn require_zst<T>() {
        const { assert!(std::mem::size_of::<T>() == 0) }
    }
    

    This can be written as:

    fn require_zst<T>() {
        struct Foo<T>(PhantomData<T>);
        impl<T> Foo<T> {
            const FOO: () = assert!(std::mem::size_of::<T>() == 0);
        }
        Foo::<T>::FOO
    }
    

    However it cannot be written as:

    fn require_zst<T>() {
        const FOO: () = assert!(std::mem::size_of::<T>() == 0);
        FOO
    }
    

    Because const FOO: () is an item, thus it is only lexically scoped (i.e. visible) inside require_zst, but does not inherit its generics (thus it cannot use T).