ChanServ changed the topic of #rust-embedded to: Welcome to the Rust Embedded IRC channel! Bridged to #rust-embedded:matrix.org and logged at https://libera.irclog.whitequark.org/rust-embedded, code of conduct at https://www.rust-lang.org/conduct.html
cinemaSundays has quit [Quit: Connection closed for inactivity]
pronvis has quit [Ping timeout: 246 seconds]
Socke has quit [Ping timeout: 260 seconds]
Socke has joined #rust-embedded
projectgus[m] has joined #rust-embedded
<projectgus[m]> Is there a linker-trick equivalent of no-panic that applies to asserts? (Associated Q: is this a bad idea?)... (full message at <https://catircservices.org/_irc/v1/media/download/AfBasEh1Ij4MTeITdoES77lM_V-KNjxluSQJpqFFePCTrNMPAwHJI3yhsErQ8YuDuI73a1dmkGGN1oNrDeMbBvi_8AAAAAAAAGNhdGlyY3NlcnZpY2VzLm9yZy90TFVaRW1WbEZmZlhYem5RcWF0VmVtWFk>)
emerent_ has joined #rust-embedded
emerent is now known as Guest8485
emerent_ is now known as emerent
Guest8485 has quit [Killed (mercury.libera.chat (Nickname regained by services))]
crabbedhaloablut has quit []
crabbedhaloablut has joined #rust-embedded
sroemer has quit [Ping timeout: 248 seconds]
sroemer has joined #rust-embedded
sroemer has quit [Ping timeout: 252 seconds]
sroemer has joined #rust-embedded
sroemer has quit [Ping timeout: 246 seconds]
sroemer has joined #rust-embedded
<JamesMunns[m]> you can do const asserts
<JamesMunns[m]> ah, got it
<JamesMunns[m]> (Shouldn't comment before I'm fully awake :) )
<JamesMunns[m]> I think that's just no-panic: asserts panic on failure, so if the assert isn't optimized out, it's a linker error
<JamesMunns[m]> or I guess, no-panic, but only do the linker trick based on a cfg
Maebli[m] has quit [Quit: Idle timeout reached: 172800s]
<JamesMunns[m]> Or you can do it at the crate level like panic never shows: https://docs.rs/panic-never/latest/panic_never/#example
haobogu[m] has quit [Quit: Idle timeout reached: 172800s]
M9names[m] has quit [Quit: Idle timeout reached: 172800s]
<thejpster[m]> aaaaaaaaaaaaaaaa
<thejpster[m]> error: creating a mutable reference to mutable static is discouraged
<thejpster[m]> that's not discouraged, that's banned
<JamesMunns[m]> You have -D warnings enabled
<JamesMunns[m]> = note: `-D static-mut-refs` implied by `-D warnings`
<JamesMunns[m]> = help: to override `-D warnings` add `#[allow(static_mut_refs)]`
<thejpster[m]> ahh
<JamesMunns[m]> Warning? Believe it or not? Straight to jail.
<thejpster[m]> that explains why they are only yellow further up
mchodzikiewicz[m has quit [Quit: Idle timeout reached: 172800s]
JamesSizeland[m] has joined #rust-embedded
<JamesSizeland[m]> What is the most ergonomic way of serializing a struct of primitives to a heapless vec in no_std? I feel like we're missing something...
<diondokter[m]> I have written macros before to automate things (which then also defines the struct so it's easy to build as a macro_rules macro)
<diondokter[m]> In the end it really depends on what you need... For example, if you need bools to be packed together, then that's harder
<diondokter[m]> Ah!
<diondokter[m]> When you create the vec it's gonna be empty
<diondokter[m]> So you get an empty slice from it
<JamesMunns[m]> dunno if you've tried postcard, but postcard definitely supports a direct to-vec method, but Dion is right here!
<JamesSizeland[m]> postcard is great, but I didn't think we could use it to talk to services that don't have the postcard deserialize on the other end
<diondokter[m]> You can't. But you didn't really specify what your constraints are :)
<JamesSizeland[m]> Yeah fair 😁
<JamesMunns[m]> Yeah, +1 that postcard is meant for when you have Rust on both sides :)
<JamesMunns[m]> At least until I finally get around to writing a compiler/code generator for other languages :)
<JamesMunns[m]> (it's 100% possible, the hard problem is "how do you define your schema outside of Rust", but I'm building a lot of tools for that now, for other reasons, so the bar is getting lower :) )
Kaspar[m] has joined #rust-embedded
<Kaspar[m]> <JamesSizeland[m]> "I'd expect this to work, but..." <- > <@jsizeland:matrix.org> I'd expect this to work, but it errors on the Vec being empty... (full message at <https://catircservices.org/_irc/v1/media/download/AebW6v8aaNjvdGlBXe2ErM38saCnrPoiIlsfQkEzQoZAmEbTz9VEe2rYR8WQJ4EP-oYc4Rj5VKYFAtbe2ZZ9dvi_8AAAAAAAAGNhdGlyY3NlcnZpY2VzLm9yZy9Bb1ZVSElrRWFFenBGdHd3ekJCZmhwV1c>)
petekubiak[m] has joined #rust-embedded
<petekubiak[m]> Yes this is the issue - core::io is experimental so I'm not really surprised Write hasn't been implemented on heapless::Vec
<JamesMunns[m]> Kaspar[m]: core::fmt::Write is, but io::Write isn't
<thejpster[m]> <JamesSizeland[m]> "I'd expect this to work, but..." <- > <@jsizeland:matrix.org> I'd expect this to work, but it errors on the Vec being empty... (full message at <https://catircservices.org/_irc/v1/media/download/AVkZPfuaex2Xe_VIKHOagTkj2KgEY_G_72ZzkpTfH-1MMlJjn1dC1jE7GoKNXh5fTqUot8xYfPpHyZuTFNHZyly_8AAAAAAAAGNhdGlyY3NlcnZpY2VzLm9yZy9yQW9SSkhoS1FyUFRVY0pxU1F2QnZvcWY>)
dinkelhacker_ has joined #rust-embedded
<diondokter[m]> thejpster[m]: πŸ‘οΈ
<thejpster[m]> (I get 10% OSS time. Right now I'm using up that time to do some releases. If this pleases you or your employer, you can always buy a ferrocene license)
cinemaSundays has joined #rust-embedded
<thejpster[m]> given James Munns 's recent podcast, Amos might appreciate https://github.com/rust-lang/rust/pull/133631/ - a triple with five parts.
dinkelhacker_ has quit [Quit: Client closed]
<thejpster[m]> I published defmt 0.3.10 which pins defmt-macros to 0.4.0 (which had a breaking bump from 0.3.whatever)
cinemaSundays has quit [Quit: Connection closed for inactivity]
JaminMartin[m] has quit [Quit: Idle timeout reached: 172800s]
<diondokter[m]> Hey, so this afternoon I released a second release candidate for device-driver. However, for some reason if rc.0 is specified in the cargo.toml, it'll just freely update to rc.1. Why?
<diondokter[m]> I thought all prerelease versions were counted as separate and would not update to the highest one?
<diondokter[m]> So 1.0.0-rc.0 auto updates to 1.0.0-rc.1 and I didn't think it would do that...
<thejpster[m]> That was my understanding too. Because after the dash is just arbitrary.
<thejpster[m]> > Cargo allows β€œnewer” pre-releases to be used automatically. For example, if 1.0.0-beta is published, then a requirement foo = "1.0.0-alpha" will allow updating to the beta version. Note that this only works on the same release version, foo = "1.0.0-alpha" will not allow updating to foo = "1.0.1-alpha" or foo = "1.0.1-beta".
<thejpster[m]> Oh
<thejpster[m]> So it ignores the text but understands publishing order
<diondokter[m]> Hmmmm... the semver crate is also happy to match them: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=41e3b78b02807b6836e09996686df198
<diondokter[m]> But then how was that done with embedded-hal? That one didn't update...
<diondokter[m]> Exactly the same... I don't get it
<thejpster[m]> Did they use =?
<diondokter[m]> No, but afaik you don't have to...
<thejpster[m]> If you pin with = you only get that exact version
<diondokter[m]> rc.1 should not be regarded as compatible with rc.0
<diondokter[m]> At least it didn't for embedded-hal when I was using the alpha and rc when I used it for its 1.0 release
<diondokter[m]> Maybe I just misremember?
<thejpster[m]> Maybe. Or maybe cargo changed. Or maybe your version was pinned.
<diondokter[m]> Oh! Maybe maybe it worked out because I was using a HAL that did pin it?
igiona[m] has quit [Quit: Idle timeout reached: 172800s]
cinemaSundays has joined #rust-embedded
<projectgus[m]> <JamesMunns[m]> "I think that's just no-panic..." <- Thanks James. I guess I wanted something more granular as there might be other places that can panic. But applying no-panic at the function level might be the right amount of granularity (and also easier to reason about than individual statements).
norineko has quit [Remote host closed the connection]
norineko has joined #rust-embedded
crabbedhaloablut has quit []
crabbedhaloablut has joined #rust-embedded