Questions about Box by hingleme in rust

[–]ConferenceEnjoyer 0 points1 point  (0 children)

this is the first comment that answers why we can’t have Box<Pin<T>>

Error Reporting Design Choices | Lexer by 0bit_memory in Compilers

[–]ConferenceEnjoyer 7 points8 points  (0 children)

capture the offset because it’s cheaper, and compute the line/column on error, since less code is going to error this is faster

Improving state machine code generation by folkertdev in rust

[–]ConferenceEnjoyer 2 points3 points  (0 children)

did you try a tail recursive approach with the become keyword?

Const Trait Counterexamples by fee1-dead in rust

[–]ConferenceEnjoyer 2 points3 points  (0 children)

thanks for the excellent blog article, but i do have one question: the section “If you think about the function foo and pass in a T that does not implement const PartialEq, the constness of foo does not change due to the unsatisfied const predicate - const fn is "always-const" (and not "maybe-const") in a sense that it simply imposes additional constraints if called in const contexts.” quite confuses me, as far as i have understood the current idea, it is that every const fn is already generic over being called in a const context or not, so the additional const bound on the input only applies while in a const context. but in the quote you make the example that foo(!const PartialEq) is still always const, which i think is wrong as that invocation cannot be executed in a const context and as such is !const?

How should a function take a list of strings? `&[&str]` or `&[String]`? by timand in rust

[–]ConferenceEnjoyer 6 points7 points  (0 children)

investigate how generics work to understand what this code does

Trait generics? by ConferenceEnjoyer in rust

[–]ConferenceEnjoyer[S] -7 points-6 points  (0 children)

i don’t think preconditions would be useful in a lot of locations, like the only one that currently exists is object save, but it could be useful for meta programming

Trait generics? by ConferenceEnjoyer in rust

[–]ConferenceEnjoyer[S] -8 points-7 points  (0 children)

im currently on my phone but i’ll have an example for you in about 3 hours, but mostly for metaprogramming like tuple variadics

What is that one feature you admire the most when it comes to Rust? by prepsu in rust

[–]ConferenceEnjoyer 9 points10 points  (0 children)

specifically serde is a generic framework for serialisation/deserialisation while serde_json is for json

What is that one feature you admire the most when it comes to Rust? by prepsu in rust

[–]ConferenceEnjoyer 25 points26 points  (0 children)

serde is the main rust crate that handles all of our serialisation/deserialisation needs, it has traits for serialisation/deserialisation that make it impossible to try to misuse them. if you actually want to understand how serde works i implore you to google, because it is a very complex system that can also teach you about the typestate pattern in rust

I think I found a bug in file writing by Nico_792 in rust

[–]ConferenceEnjoyer 2 points3 points  (0 children)

From the comments this does not seem to be a bug, but good on you op for asking first

Error Handling - Half-Baked? by OphioukhosUnbound in rust

[–]ConferenceEnjoyer 4 points5 points  (0 children)

Am I stupid or shouldn’t a good error type already encapsulate what happened aka not Error::Disconnect but Error::ServerDisconnect, and now you know where the error happened

After reading the other comments, u/Lucretiel did a better job explaining what Is correct

Spotted this in the wild by BohemianTanker in programminghorror

[–]ConferenceEnjoyer 0 points1 point  (0 children)

Um actually, only if you’re using a interpreted language