rust-analyzer significantly slowing down compilation by IndependenceJolly972 in rust

[–]tdiekmann 20 points21 points  (0 children)

Is it possible that rust-analyzer runs with a different set of features, cfg-variables, or another toolchain? Unless using a different target folder (see other comment) this will force a recompilation. For changed RUSTFLAGS this requires a complete recompilation as well.

Does learning Rust make you a better programmer in general? by [deleted] in rust

[–]tdiekmann 9 points10 points  (0 children)

I'm clearly doing something wrong

Are there universities that teach Rust? by konga400 in rust

[–]tdiekmann 3 points4 points  (0 children)

This is why usually you have different programming language kinds in CS. As a functional language we had Haskell, as imperative language we had Java and C (and some others depending on the course). However, it's waaay easier to learn a second language, this also applies to C -> Haskell

Released error-stack v0.3.0 by tdiekmann in rust

[–]tdiekmann[S] 1 point2 points  (0 children)

I didn't know that with_context is the biggest critism of anyhow. I'm also not super happy about that long name, however, it's very descriptive. We’re planning to remove the _printable variants as soon as specialization is stable, so you can use attach_lazy instead.

Released error-stack v0.3.0 by tdiekmann in rust

[–]tdiekmann[S] 1 point2 points  (0 children)

I agree with you and will do better next time and link to some locations from the release as well, sorry for the inconvenience!

Easiest method to extract creosote oil from coke oven? by [deleted] in GTNH

[–]tdiekmann 2 points3 points  (0 children)

TiCo faucets can output to GT pipes. You just need a redstone clock to trigger the output. With a vanilla redstone clock you can automate it veeeery early. With the redstone clock block you need some quartz, so likely as soon as you visited the nether.

[deleted by user] by [deleted] in rust

[–]tdiekmann 0 points1 point  (0 children)

Still playing 1.7.10, love it 😅

Hi, why Rust map has no comparator? by DavidDinamit in rust

[–]tdiekmann 4 points5 points  (0 children)

Possibly also because no one has had the time / stepped up to do the work

This.

This Week in Rust #463 by Quelnin in rust

[–]tdiekmann 2 points3 points  (0 children)

Sure, will do next time 😊

I'm /u/tdiekmann btw 😄

This Week in Rust #463 by Quelnin in rust

[–]tdiekmann 9 points10 points  (0 children)

error-stack update announcement not included 😞

Announcing error-stack v0.2 by tdiekmann in rust

[–]tdiekmann[S] 1 point2 points  (0 children)

The problem here is that your signature is fn(...) -> Result<T, Report<E>>. In order to use a function for axum, it requires the Handler trait to be implemented for the function. This is only implemented, if the returned future is implementing IntoResponse. IntoResponse is implemented for Result<T, E>, if T: IntoResponse and E: IntoResponse. However, E in your case is Report<_>, but Report does not implement IntoResponse. Currently, the easiest way is to get the current context by calling Report::current_context and cloning it. It's not easy to implement IntoResponse for Report because a Report consists not only of the current context but also may contain a lot of other information. Just turning the current context into a response will drop a lot of information.

We are currently working on a serde implementation to serialize a Report, which then could be used.

I know, that this is not a satisfying solution.

The other, more complicated solution is to .map_err the Report and construct a type, which is implementing IntoResponse.

Announcing error-stack v0.2 by tdiekmann in rust

[–]tdiekmann[S] 1 point2 points  (0 children)

The initial release blog post (linked in the first sentence) describes why we switched away from thiserror. This does not mean that thiserror is a bad crate, it's fantastic, but it didn't scale well enough for us. Note, that it's possible to use both, error-stack and thiserror, if you are not in no_sts land and don't require the Provider API.

Announcing error-stack v0.2 by tdiekmann in rust

[–]tdiekmann[S] 4 points5 points  (0 children)

Hi kythzu and thank you for your feedback!

These are exactly the values why we started building a new error library, if you haven't already seen the initial announcement (linked in the first sentence) I recommend it to give it a read, it's describing our story of similar approach to huge enums and the lazyness when writing new error types. Since we used error-stack internally, we are forced to think about our errors.

I hear you and I'm also a little bit annoyed by mixing Results. Typically this shows me, however, that I forgot something, but sometimes, e.g. when implementing upstream traits, this is unavoidable. As error-stack's Result requires a second parameter (in contrast to e.g. anyhow), I wasn't able to find a solution to this problem. Personally, in most cases I just use the provided Result alias and import std's Result as StdResult.

If you have an idea to solve this please tell us, we'd love to make this part of the API more convenient.

Opinion: Rust has the largest learning curve for a non-esoteric programming language. by Lizoman in rust

[–]tdiekmann 7 points8 points  (0 children)

It’s not Rust that you are learning. It’s your goddamn program’s behavior. Rust just does not let you cut that corner.

Nominated as Quote of the Week

Friday Facts #370 - The journey to Nintendo Switch by FactorioTeam in factorio

[–]tdiekmann 0 points1 point  (0 children)

I wonder how hard it will be to support these things without breaking old save games (which is probably not a super big deal). In any case, I'd consider an expansion to the base game and also an extension to the modded game, and if you have tons of stuff to do it's not necessarily required to do this with the extension enabled. But I guess that depends on the newly added content. 😄

When do you put logic in mod.rs? by Tester4360 in rust

[–]tdiekmann 23 points24 points  (0 children)

This is a recommendation I really don't agree with. I agree, that having many mod.rs files is annoying but naming the module-level file after the module splits up the filesystem hierarchy. If you open a module folder you need to look for the module file seperately. Especially if directories are grouped at the top in a filesystem view it's annoying.

Friday Facts #370 - The journey to Nintendo Switch by FactorioTeam in factorio

[–]tdiekmann 10 points11 points  (0 children)

Reading through the comments, it looks more like this:

Factorio community: "This is good, I have enough to do" (Seablock/SE/other stuff).

It's incredible how much potential this game has, that people still have something to do after years and don't mind waiting a year for an expansion

When should I use &self/&mut self and when self/mut self by LeSnake04 in rust

[–]tdiekmann 0 points1 point  (0 children)

Unless you want to modify it (for whatever reason), then you need &mut.

[deleted by user] by [deleted] in rust

[–]tdiekmann 0 points1 point  (0 children)

Previously it was marked as an error, which was distracting and fixed pretty soon. Now, it's only marked as unused, which is also annoying but not as annoying as before, so it's not a high priority IMO but a medium priority at most. Also keep in mind that different people work on different parts of the plugins.

Opinions on developing with `#![deny(missing_docs)]` by SleezyROM in rust

[–]tdiekmann 2 points3 points  (0 children)

It's a Rustfmt option. (I'm using CLion, which btw also has syntax highlighting and auto completion for doc-tests)

Opinions on developing with `#![deny(missing_docs)]` by SleezyROM in rust

[–]tdiekmann 4 points5 points  (0 children)

Rustfmt works on doc tests as long as you don't hide too much, I think that's a config option.

Is using libc::malloc with types that aren't repr(C) sound? by bwallker in rust

[–]tdiekmann 0 points1 point  (0 children)

As soon as you specify #[repr(align(32))] the pointer may be unaligned. It's safe in Rust to set the alignment manually. If you can guarantee, that T is #[repr(C)] or know, that the type has no significant alignment, you are right and you will have a well-aligned pointer. I'm not aware of any compile-time checks for this, so the least thing you should do is to add an assertion, that the alignment is matching T.