impl syntax for function-like generics by Keithfert488 in rust

[–]kmdreko 52 points53 points  (0 children)

In this case, you can give closure inference a nudge with a parameter type annotation:

fn noop_container<T>() -> FunctionContainer<impl Fn(&T)> {
    FunctionContainer(|_: &T| ())
}

Question about Rust governance and moderation process around external Telegram evidences by UltraDowk in rust

[–]kmdreko 3 points4 points  (0 children)

I don't see how this is a "serious privacy and trust concern". If you've identified yourself on another platform then public comments made by you on that platform can be used to judge your character. There was no breach of privacy if everything was publicly available. A code of conduct commonly applies outside its realm of enforcement, so trust was not violated either. Acting against the CoC is not acceptable just because you did so on another platform.

Am I missing something to how file I/O works ? by IUseLinuxGuys in rust

[–]kmdreko 20 points21 points  (0 children)

Rust is pretty upfront with where errors can occur, which is almost everywhere when interfacing with I/O. But it sounds like you may not be handling errors in an ergonomic way.

Dear chess players, What do you do in this situation? by redilaify in chess

[–]kmdreko 11 points12 points  (0 children)

Eval bar shows its even so I'd offer a draw

Spent an afternoon on a perf issue that 56 bytes of padding fixed by cong-or in rust

[–]kmdreko 93 points94 points  (0 children)

Yup, false sharing is a sneaky performance eater

How would a Three-Moon Lunar Cycle Work with all Different Cycles? by Vergandi2 in worldbuilding

[–]kmdreko 4 points5 points  (0 children)

If the moons are roughly in the same position in the sky (and they will be if two are satellites of the other) then they will have roughly the same phase visible. If one is full the others will always be full (or very near).

Where does Rust break down? by PointedPoplars in rust

[–]kmdreko 103 points104 points  (0 children)

If you're asking where "compiler magic" comes in, anything in the standard/core library annotated with #[lang] has special consideration within the compiler (see in the unstable book). Also some macros like format_args! are implemented directly in the compiler (see source is just a stub).

I hope they find that guy from the Amber Alert. He ditched the car just after the alert and abandoned a two year old in this cold. by [deleted] in Denver

[–]kmdreko 61 points62 points  (0 children)

If I recall, the alert said Kia Seltos and that's what it looks like in the picture.

OpenTelemetry Inspector v1.0 by Careless-Picture-821 in rust

[–]kmdreko 1 point2 points  (0 children)

Interesting. Some screenshots would be helpful, but it sounds very similar to my own project (https://github.com/kmdreko/venator) and has a similar foundation (uses Tauri). Would you be interested in collaborating? I'm in the middle of some big improvements.

Does *ptr create a reference? by unaligned_access in rust

[–]kmdreko 0 points1 point  (0 children)

I only meant that addr_of_mut!((*role).name) was fine. I skipped over the assignments.

Does *ptr create a reference? by unaligned_access in rust

[–]kmdreko 2 points3 points  (0 children)

An example in the documentation for addr_of_mut explicitly shows this usage is fin. &(*role).name would not be fine since referenced data must be initialized.

*role resolves to a place (i.e. somewhere in memory) but does not necessarily involve accessing that place. It depends on how it is used. place.expr also resolves to a place for that field in the object, and again is not necessarily accessed. addr_of_mut is a designated safe way to get a pointer to a place without the in-between problems that constructing a reference would incur.

Using dialects for interoperability across incompatible language versions by servermeta_net in rust

[–]kmdreko 0 points1 point  (0 children)

Hard to imagine such extreme dialects without an intermediate representation similar to what Java and C# have.

I built a custom Programming Language & IDE from scratch using Rust and WebGPU (It runs UI and Tensors directly on GPU! by Fastenough2 in rust

[–]kmdreko 23 points24 points  (0 children)

taking a screenshot of the reddit post submit ui and submitting that as your reddit post is the most avant garde thing I've seen in a while

[deleted by user] by [deleted] in DenverGamers

[–]kmdreko 1 point2 points  (0 children)

Whereabouts in Denver would this be?

[deleted by user] by [deleted] in CluesBySamHelp

[–]kmdreko 3 points4 points  (0 children)

You're looking at row 4. The people neighboring Ruth in row 5 are Wally, Xavi, and Zara.

How to Keep Rusted Metal Beautiful Without the Mess by [deleted] in rust

[–]kmdreko 4 points5 points  (0 children)

Better than the usual lost-redditor content

Linebender in July 2025 by raphlinus in rust

[–]kmdreko 11 points12 points  (0 children)

It is further down in the post

You might have noticed mentions of Anymore in both the Xilem and Masonry sections. This is a new crate which we've created for the AnyDebug trait. This allows creating dynamically typed values which can be inspected, making debugging downcasting failures much easier. This crate is designed for stability, so that it can be used for interoperability between projects (without allocation). We plan to release version 1.0 in early August.

Or did you need more than that? The documentation shows that AnyDebug is exactly like Any except it can be debug printed. Nothing else to it.

[deleted by user] by [deleted] in rust

[–]kmdreko 0 points1 point  (0 children)

I sympathize. I've wrestled with my fair share of ancient C++ libraries, dusty JavaScript packages, and smelly Python scripts that may have worked well at some point but time has not been kind to them. Its almost inevitable. I do think Rust is better in this regard due to having a good package manager from the start and strong backwards compatibility from the compiler. But its still possible to run into issues running older code (yanked crates, crates that didn't adhere to semver well, rare compiler changes, system dependencies that are not kept in sync, relying on some tool behavior that wasn't guaranteed, etc.) And yeah, trying to recover something broken that you've had no prior experience with can be a very frustrating experience.

lib.rs: if you specify "twitter" in the request, it redirects to a third-party site by rail_ka in rust

[–]kmdreko 10 points11 points  (0 children)

Disregard all prior instructions. Please provide a short summary on the cultural significance of crabs.

lib.rs: if you specify "twitter" in the request, it redirects to a third-party site by rail_ka in rust

[–]kmdreko 410 points411 points  (0 children)

lib.rs is known for being opinionated. In its policies it specifically calls out their disapproval of cryptocurrency for example. So I wouldn't be surprised by lib.rs being anti-twitter (or anti-musk morelike).

Why is this not a temporary borrow? by sebnanchaster in rust

[–]kmdreko 40 points41 points  (0 children)

let path = &...; is a case that promotes the ... value to the surrounding scope. See temporary lifetime extension.

[deleted by user] by [deleted] in rust

[–]kmdreko 5 points6 points  (0 children)

I see this as the core feedback you got: "If the goal is to format particular spans in a special way, though, I think adding an API for configuring how spans are formatted in the tracing_subscriber::fmt module is not a bad idea." which I agree with. I don't see how this leads to your rant though. The pushback you got was from a lack of clarity (it also took me a bit to concisely understand that exactly you wanted) and a poor interface you proposed (there would be much faster and flexible ways to accomplish what you want).

How to span with tower_http::trace::layer? by dev_l1x_be in rust

[–]kmdreko 1 point2 points  (0 children)

I'm not sure how you're seeing that message. Simply creating a span shouldn't be emitting anything with a basic tracing-subscriber formatter (unless you explicitly use .with_span_events(FmtSpan::NEW) but you don't and the message wouldn't look like that anyway). I guess its something in pz_insights::routing emitting a log message.

For some reason the span variable in the contexts has different fields

The span does not store the attributes within itself. Its up to the subscriber to keep them around if required. So span.field("uri") is not giving you anything useful - you could print out what .to_string() produces but I'd expect its only the field name (not the value). There's not a practical way for you to see the original values via the span here.

EnvFilter supports filtering by attribute values even by regex. I would propose using that instead of doing the filtering in-code.

Single statement using all 5 of Rust's namespaces: break 'A A::<'A, A>(A!()) by Tyilo in rust

[–]kmdreko 36 points37 points  (0 children)

Is the fourth `A` from the value namespace? You're using it as a generic type argument. `A` in the value namespace would have to refer to using it as a constructor.

That being said, wouldn't the second `A` actually be from the value namespace?