profile
viewpoint
Mara Bos m-ou-se Fusion Engineering Delft, The Netherlands https://m-ou.se/

fusion-engineering/inline-python 393

Inline Python code directly in your Rust code

de-vri-es/assert2-rs 26

assert!() and check!() macros for Rust, inspired by Catch2

fusion-engineering/setup-git-credentials 24

GitHub action to clone private respositories.

fusion-engineering/rust-git-version 17

Compile the Git version (tag name, or hash otherwise) and dirty state into your Rust program.

m-ou-se/config 17

The one and only perfect configuration for Vim, Zsh, Bash, Git, etc.

m-ou-se/bootlib 16

A minimalistic library to help making your x86 assembly program bootable.

m-ou-se/linux-futex 6

Rust interface for Linux futexes, the fast user-space locking primitive.

m-ou-se/git-prompt-path 5

Display git information next to every path component in your prompt.

m-ou-se/floatconv 4

Fast implementations of integer/floating point conversion operations.

m-ou-se/cloudabi-cpp 2

C++ bindings for CloudABI.

push eventwg21link/db

npaperbot

commit sha f559e8a827805b0584faba318d57a2b4d6ec3428

Automatic update.

view details

push time in 3 hours

pull request commentrust-lang/rust

Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used.

cc @fasterthanlime whose blogpost inspired this change

m-ou-se

comment created time in 5 hours

push eventfusion-engineering-forks/rust

Joshua Nelson

commit sha dd7b8c85a6a2bffb2cce1c40ba72680a1d7be93b

Perform most diagnostic lookups in `resolution_failure` Previously, these were spread throughout the codebase. This had two drawbacks: 1. It caused the fast path to be slower: even if a link resolved, rustdoc would still perform various lookups for the error diagnostic. 2. It was inconsistent and didn't always give all diagnostics (https://github.com/rust-lang/rust/issues/76925) Now, diagnostics only perform expensive lookups in the error case. Additionally, the error handling is much more consistent, both in wording and behavior. - Remove `CannotHaveAssociatedItems`, `NotInScope`, `NoAssocItem`, and `NotAVariant` in favor of the more general `NotResolved` `resolution_failure` will now look up which of the four above categories is relevant, instead of requiring the rest of the code to be consistent and accurate in which it picked. - Remove unnecessary lookups throughout the intra-doc link pass. These are now done by `resolution_failure`. + Remove unnecessary `extra_fragment` argument to `variant_field()`; it was only used to do lookups on failure. + Remove various lookups related to associated items + Remove distinction between 'not in scope' and 'no associated item' - Don't perform unnecessary copies - Remove unused variables and code - Update tests - Note why looking at other namespaces is still necessary - 'has no inner item' -> 'contains no item' bless tests

view details

Joshua Nelson

commit sha 472e52e5a03790becdbe21be1002a90dd2d7d3d4

Fix intra-doc links for primitives - Add `PrimTy::name` and `PrimTy::name_str` - Use those new functions to distinguish between the name in scope and the canonical name - Fix diagnostics for primitive types - Add tests for primitives

view details

Joshua Nelson

commit sha 049d29bac580b958cdff6e898dad22de09a27958

Unify primitive errors with other intra-link errors Now that `PrimTy::name()` exists, there's no need to carry around the name of the primitive that failed to resolve. This removes the variants special-casing primitives in favor of `NotResolved`. - Remove `NoPrimitiveImpl` and `NoPrimitiveAssocItem` - Remove hacky `has_primitive` check in `resolution_failure()` - Fixup a couple tests that I forgot to `--bless` before

view details

Ralf Jung

commit sha 6f881b3b7db6e08d5ca3a940befc7898aab1568a

might_permit_raw_init: also check aggregate fields

view details

bors

commit sha 71bdb8481760f7c6b8540d3dd176ed54a92c0f31

Auto merge of #76955 - jyn514:refactor-diagnostics, r=euclio Refactor and fix intra-doc link diagnostics, and fix links to primitives Closes https://github.com/rust-lang/rust/issues/76925, closes https://github.com/rust-lang/rust/issues/76693, closes https://github.com/rust-lang/rust/issues/76692. Originally I only meant to fix #76925. But the hack with `has_primitive` was so bad it was easier to fix the primitive issues than to try and work around it. Note that this still has one bug: `std::primitive::i32::MAX` does not resolve. However, this fixes the ICE so I'm fine with fixing the link in a later PR. This is part of a series of refactors to make #76467 possible. This is best reviewed commit-by-commit; it has detailed commit messages. r? `@euclio`

view details

Ralf Jung

commit sha 3009c5260f292da6785c67af8c823d4fa0e870d9

update tokei and ripgrep in cargotest

view details

bors

commit sha b8363295d555494bbaa119eba8b16a3057e6728c

Auto merge of #71274 - RalfJung:raw-init-check-aggregate, r=petrochenkov might_permit_raw_init: also check aggregate fields This is the next step for https://github.com/rust-lang/rust/issues/66151: when doing `mem::zeroed`/`mem::uninitialized`, also recursively check fields of aggregates (except for arrays) for whether they permit zero/uninit initialization.

view details

Mara Bos

commit sha 07fd17f7014de6dc209c7dc4de159a2a5acea173

Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used. The thread local LOCAL_STDOUT and LOCAL_STDERR are only used by the test crate to capture output from tests when running them in the same process in differen threads. However, every program will check these variables on every print, even outside of testing. This involves allocating a thread local key, and registering a thread local destructor. This can be somewhat expensive. This change keeps a global flag (LOCAL_STREAMS) which will be set to true when either of these local streams is used. (So, effectively only in test and benchmark runs.) When this flag is off, these thread locals are not even looked at and therefore will not be initialized on the first output on every thread, which also means no thread local destructors will be registered.

view details

Mara Bos

commit sha ed3ead013f40c65e2972c794a71b756237a31b46

Relax memory ordering of LOCAL_STREAMS and document it.

view details

Mara Bos

commit sha de597fca40d129435c53a69c6662d7bfac29771d

Optimize set_{panic,print}(None).

view details

push time in 5 hours

PR opened rust-lang/rust

Only use LOCAL_{STDOUT,STDERR} when set_{print/panic} is used.

The thread local LOCAL_STDOUT and LOCAL_STDERR are only used by the test crate to capture output from tests when running them in the same process in differen threads. However, every program will check these variables on every print, even outside of testing.

This involves allocating a thread local key, and registering a thread local destructor. This can be somewhat expensive.

This change keeps a global flag (LOCAL_STREAMS) which will be set to true when either of these local streams is used. (So, effectively only in test and benchmark runs.) When this flag is off, these thread locals are not even looked at and therefore will not be initialized on the first output on every thread, which also means no thread local destructors will be registered.

+61 -23

0 comment

2 changed files

pr created time in 6 hours

push eventfusion-engineering-forks/rust

Mara Bos

commit sha d132cf6da07eb773d813f15338e4d8406db508dd

Optimize set_{panic,print}(None).

view details

push time in 6 hours

create barnchfusion-engineering-forks/rust

branch : skip-local-stdio

created branch time in 6 hours

push eventwg21link/db

npaperbot

commit sha de93521f411536520f903d5e95eeeba48cb79fea

Automatic update.

view details

push time in 8 hours

push eventfusion-engineering-forks/rust

Laurence Tratt

commit sha 73ada2d40429488aaaacf37b608bababc137b910

Explicitly document the size guarantees that Option makes. Triggered by a discussion on wg-unsafe-code-guidelines about which layouts of `Option<T>` one can guarantee are optimised to a single pointer.

view details

Laurence Tratt

commit sha f5118a525fcf9db4102d903650331039158eff11

Clarify and add guarantee about `transmute`.

view details

Laurence Tratt

commit sha 83f47aa11bd664ed8a15ef9833063833b7b3e71c

Be clear about the reverse `transmute` guarantees.

view details

Laurence Tratt

commit sha f3d7196caec3f54e572c7389b1cef9fd9e62c1ed

Be clearer about Some/None transmute.

view details

Laurence Tratt

commit sha 8cb8955d570c76631840bfc98825ca49c0dd8eea

Change notation. Co-authored-by: Ralf Jung <post@ralfj.de>

view details

Laurence Tratt

commit sha 55802e3bf3bf6d1db5c76aea581a7912bd752890

Add Rust function pointers. Co-authored-by: Ralf Jung <post@ralfj.de>

view details

Laurence Tratt

commit sha 68209c3fe4e0f5c3758f18e98efc175af31c2e51

Rename the types for clarity.

view details

Laurence Tratt

commit sha 9bac5774d7b452b2227c9fb77a4c6de3f432ee55

Grammar tweak.

view details

Ivan Tham

commit sha c5975e9b6c5781b3b7300b7921c14b060086e1c1

Reduce duplicate in liballoc reserve error handling

view details

Vali Schneider

commit sha 459969f88ff95c94b7b34043a7f0e13de91de4f8

added restriction lint that prohibits the usage of unimplemented, unreachable or panic in a function of type result or option

view details

Vali Schneider

commit sha ceab1a9167655eba9f9556f8766f8702e49dfef3

removed unnecessary comment

view details

Vali Schneider

commit sha 8462cce96081b87eba7a5bc89130a1a09fe1f6d0

edited documentation

view details

Vali Schneider

commit sha b2d8ca9a766703469178ea37d4d46067bb6fa926

ran cargo dev update lints

view details

Vali Schneider

commit sha b006522393a3c3c2656e1ccdfbb0076ff1bd7e99

added lint for todo and removed option

view details

Vali Schneider

commit sha a424a2c1676a29c147252873037e8943d54941d3

changed check_impl_item to check_fn and added a few more test cases

view details

Vali Schneider

commit sha 73a3288282e733bfc5893e9920d29f1de5a21591

uncommented fn

view details

Federico Ponzi

commit sha 27c90b881df93b53fd3f24dcbfed116379c2fc69

initial implementation of OpenOptions to c_int

view details

Federico Ponzi

commit sha eb3906be4ad375cc6b83cd6a6e0116817db22575

Fix typo get openoptions function name Co-authored-by: Ivan Tham <pickfire@riseup.net>

view details

Erik Desjardins

commit sha d3b9ece4c0028ff7e36e34df2d2b26366f9c0648

add tests related to tuple scalar layout with ZST in last field

view details

Erik Desjardins

commit sha e5d85f917b8965a5e62513c17cbb887366b152bc

allow reordering of the last field of a MaybeUnsized struct if it's a ZST

view details

push time in 9 hours

push eventfusion-engineering-forks/rust

Laurence Tratt

commit sha 73ada2d40429488aaaacf37b608bababc137b910

Explicitly document the size guarantees that Option makes. Triggered by a discussion on wg-unsafe-code-guidelines about which layouts of `Option<T>` one can guarantee are optimised to a single pointer.

view details

Laurence Tratt

commit sha f5118a525fcf9db4102d903650331039158eff11

Clarify and add guarantee about `transmute`.

view details

Laurence Tratt

commit sha 83f47aa11bd664ed8a15ef9833063833b7b3e71c

Be clear about the reverse `transmute` guarantees.

view details

Laurence Tratt

commit sha f3d7196caec3f54e572c7389b1cef9fd9e62c1ed

Be clearer about Some/None transmute.

view details

Laurence Tratt

commit sha 8cb8955d570c76631840bfc98825ca49c0dd8eea

Change notation. Co-authored-by: Ralf Jung <post@ralfj.de>

view details

Laurence Tratt

commit sha 55802e3bf3bf6d1db5c76aea581a7912bd752890

Add Rust function pointers. Co-authored-by: Ralf Jung <post@ralfj.de>

view details

Laurence Tratt

commit sha 68209c3fe4e0f5c3758f18e98efc175af31c2e51

Rename the types for clarity.

view details

Laurence Tratt

commit sha 9bac5774d7b452b2227c9fb77a4c6de3f432ee55

Grammar tweak.

view details

Ivan Tham

commit sha c5975e9b6c5781b3b7300b7921c14b060086e1c1

Reduce duplicate in liballoc reserve error handling

view details

Vali Schneider

commit sha 459969f88ff95c94b7b34043a7f0e13de91de4f8

added restriction lint that prohibits the usage of unimplemented, unreachable or panic in a function of type result or option

view details

Vali Schneider

commit sha ceab1a9167655eba9f9556f8766f8702e49dfef3

removed unnecessary comment

view details

Vali Schneider

commit sha 8462cce96081b87eba7a5bc89130a1a09fe1f6d0

edited documentation

view details

Vali Schneider

commit sha b2d8ca9a766703469178ea37d4d46067bb6fa926

ran cargo dev update lints

view details

Vali Schneider

commit sha b006522393a3c3c2656e1ccdfbb0076ff1bd7e99

added lint for todo and removed option

view details

Vali Schneider

commit sha a424a2c1676a29c147252873037e8943d54941d3

changed check_impl_item to check_fn and added a few more test cases

view details

Vali Schneider

commit sha 73a3288282e733bfc5893e9920d29f1de5a21591

uncommented fn

view details

Federico Ponzi

commit sha 27c90b881df93b53fd3f24dcbfed116379c2fc69

initial implementation of OpenOptions to c_int

view details

Federico Ponzi

commit sha eb3906be4ad375cc6b83cd6a6e0116817db22575

Fix typo get openoptions function name Co-authored-by: Ivan Tham <pickfire@riseup.net>

view details

Erik Desjardins

commit sha d3b9ece4c0028ff7e36e34df2d2b26366f9c0648

add tests related to tuple scalar layout with ZST in last field

view details

Erik Desjardins

commit sha e5d85f917b8965a5e62513c17cbb887366b152bc

allow reordering of the last field of a MaybeUnsized struct if it's a ZST

view details

push time in 11 hours

push eventwg21link/db

npaperbot

commit sha 60bf2e50f23bcaecd8d9270e6d7bde6a1fec044b

Automatic update.

view details

push time in 21 hours

push eventwg21link/db

npaperbot

commit sha 2862af8adce255a04d2da514b1d108c9453b384d

Automatic update.

view details

push time in a day

push eventwg21link/db

npaperbot

commit sha b7a86249b1e935c0367a4b6c78cad2bcf871cd38

Automatic update.

view details

push time in a day

Pull request review commentrust-lang/rust

Use futex-based thread::park/unpark on Linux.

+#![cfg(any(target_os = "linux", target_os = "android"))]++use crate::convert::TryInto;+use crate::ptr::null;+use crate::sync::atomic::AtomicI32;+use crate::time::Duration;++pub fn futex_wait(futex: &AtomicI32, expected: i32, timeout: Option<Duration>) {+    let timespec = timeout.and_then(|d| {+        Some(libc::timespec {+            // Sleep forever if the timeout is longer than fits in a timespec.

i32::MAX seconds is more than 68 years, and most systems use a i64 (2e+11 years) here, so I don't think it really matters. (Note this is a duration, not an absolute timestamp.) The implementations I've seen round up (in case the underlying call doesn't do nanosecond precision, e.g. on Windows), and overflow to infinity. So I just followed that.

m-ou-se

comment created time in a day

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Use futex-based thread::park/unpark on Linux.

+use crate::sync::atomic::AtomicI32;+use crate::sync::atomic::Ordering::{Acquire, Release};+use crate::sys::futex::{futex_wait, futex_wake};+use crate::time::Duration;++const PARKED: i32 = -1;+const EMPTY: i32 = 0;+const NOTIFIED: i32 = 1;++pub struct Parker {+    state: AtomicI32,+}++// Notes about memory ordering:+//+// Memory ordering is only relevant for the relative ordering of operations+// between different variables. Even Ordering::Relaxed guarantees a+// monotonic/consistent order when looking at just a single atomic variable.+//+// So, since this parker is just a single atomic variable, we only need to look+// at the ordering guarantees we need to provide to the 'outside world'.+//+// The only memory ordering guarantee that parking and unparking provide, is+// that things which happened before unpark() are visible on the thread+// returning from park() afterwards. Otherwise, it was effectively unparked+// before unpark() was called while still consuming the 'token'.+//+// In other words, unpark() needs to synchronize with the part of park() that+// consumes the token and returns.+//+// This is done with a release-acquire synchronization, by using+// Ordering::Release when writing NOTIFIED (the 'token') in unpark(), and using+// Ordering::Acquire when checking for this state in park().+impl Parker {+    #[inline]+    pub const fn new() -> Self {+        Parker { state: AtomicI32::new(EMPTY) }+    }++    // Assumes this is only called by the thread that owns the Parker,+    // which means that `self.state != PARKED`.+    pub unsafe fn park(&self) {+        // Change NOTIFIED=>EMPTY or EMPTY=>PARKED, and directly return in the+        // first case.+        if self.state.fetch_sub(1, Acquire) == NOTIFIED {+            return;+        }+        loop {+            // Wait for something to happen, assuming it's still set to PARKED.+            futex_wait(&self.state, PARKED, None);

Nope. This is the value expected when starting the wait. If it matches, it continues to put the thread to sleep and wait for a notification (all atomically). If it doesn't match, it doesn't wait and returns directly.

m-ou-se

comment created time in a day

PullRequestReviewEvent

pull request commentrust-lang/rust

Remove std::io::lazy::Lazy in favour of SyncOnceCell

Maybe add comments explaining why this is ignored?

Done.

It might be the case that adding this in the test would also solve it:

#[cfg(target_os = "emscripten")]
#[link_args = "-s EXIT_RUNTIME=1"]
extern "C" {}

But I'm unable to test this locally. And I don't think this test really matters on emscripten.

m-ou-se

comment created time in a day

push eventfusion-engineering-forks/rust

Mara Bos

commit sha 6b8b9c4adbd7d8d53d730a3c01d154dec3bd179f

Disable stdout-during-shutdown test on emscripten.

view details

push time in a day

push eventfusion-engineering-forks/rust

Mara Bos

commit sha 120b26946bd4b7d8a074634367bc21694d5e6b02

Disable stdout-during-shutdown test on emscripten/wasm.

view details

push time in a day

push eventfusion-engineering-forks/rust

Mara Bos

commit sha c0ed0257609e469ede50f6784c8cdaed8270f15c

Disable stdout-during-shutdown test on emscripten/wasm.

view details

push time in a day

push eventfusion-engineering-forks/rust

Mara Bos

commit sha ea3ac18fd79b62d2c84bae9386b334503fd1f487

Disable stdout-during-shutdown test on wasm.

view details

push time in a day

pull request commentrust-lang/rust

Remove std::io::lazy::Lazy in favour of SyncOnceCell

#77212 failed on this PR for auto (wasm32, ubuntu-latest-xl):

failures:

---- [ui] ui/stdout-during-shutdown.rs stdout ----
diff of run.stdout:

-	hello, world!


The actual run.stdout differed from the expected run.stdout.
Actual run.stdout saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/stdout-during-shutdown/stdout-during-shutdown.run.stdout
normalized run.stderr:
stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc.

Apparently that target has trouble with atexit and output without a newline, which is exactly the point of the test. See this:

By default Emscripten sets EXIT_RUNTIME=0, which means that we don’t include code to shut down the runtime. That means that when main() exits, we don’t flush the stdio streams, or call the destructors of global C++ objects, or call atexit callbacks.

I'll disable the test for this platform.

m-ou-se

comment created time in a day

push eventfusion-engineering-forks/rust

Ivan Tham

commit sha c5975e9b6c5781b3b7300b7921c14b060086e1c1

Reduce duplicate in liballoc reserve error handling

view details

Vali Schneider

commit sha 459969f88ff95c94b7b34043a7f0e13de91de4f8

added restriction lint that prohibits the usage of unimplemented, unreachable or panic in a function of type result or option

view details

Vali Schneider

commit sha ceab1a9167655eba9f9556f8766f8702e49dfef3

removed unnecessary comment

view details

Vali Schneider

commit sha 8462cce96081b87eba7a5bc89130a1a09fe1f6d0

edited documentation

view details

Vali Schneider

commit sha b2d8ca9a766703469178ea37d4d46067bb6fa926

ran cargo dev update lints

view details

Vali Schneider

commit sha b006522393a3c3c2656e1ccdfbb0076ff1bd7e99

added lint for todo and removed option

view details

Vali Schneider

commit sha a424a2c1676a29c147252873037e8943d54941d3

changed check_impl_item to check_fn and added a few more test cases

view details

Vali Schneider

commit sha 73a3288282e733bfc5893e9920d29f1de5a21591

uncommented fn

view details

Federico Ponzi

commit sha 27c90b881df93b53fd3f24dcbfed116379c2fc69

initial implementation of OpenOptions to c_int

view details

Federico Ponzi

commit sha eb3906be4ad375cc6b83cd6a6e0116817db22575

Fix typo get openoptions function name Co-authored-by: Ivan Tham <pickfire@riseup.net>

view details

Erik Desjardins

commit sha d3b9ece4c0028ff7e36e34df2d2b26366f9c0648

add tests related to tuple scalar layout with ZST in last field

view details

Erik Desjardins

commit sha e5d85f917b8965a5e62513c17cbb887366b152bc

allow reordering of the last field of a MaybeUnsized struct if it's a ZST

view details

Erik Desjardins

commit sha e9bc3ddb073f2261ac46832d985efe8db863ed6a

test that we do not change the offset of ZST tuple fields when unsizing

view details

Erik Desjardins

commit sha 68217c9e0f1269d29b4c1c72d08fb1b95bf441cd

ignore zst offsets instead

view details

Erik Desjardins

commit sha 6fc1d8bc13124bb134d7ab54e56237821a55912e

add codegen test

view details

Erik Desjardins

commit sha 24e0913e37cc6fc363b37d13bf519db212f175a2

handle vector layout

view details

Federico Ponzi

commit sha 1bc0627607262cc60a7692b16e205f30fc88b89f

Add as_flag function to the OpenOptionsExt struct

view details

Federico Ponzi

commit sha 2c9e27b759a9e9feeb943fb855e32d7383d1dcc6

Merge branch 'convert-openoptions-cint' of github.com:FedericoPonzi/rust into convert-openoptions-cint

view details

Vali Schneider

commit sha f9fcbbea03edb735c22311522b55d7b854bd6ac0

fixed bug

view details

Federico Ponzi

commit sha 7c1e5c1dcd25c945f619eda289f639dbe2b002da

Update OpenOptions::as_flags docs, and minor styling

view details

push time in 2 days

push eventwg21link/db

npaperbot

commit sha 91785f70a0b16032f1d100a58f15bfc79e0e176f

Automatic update.

view details

push time in 2 days

push eventwg21link/db

npaperbot

commit sha fa4572d373b0cc9eee608b74ed4ad0d42c82a320

Automatic update.

view details

push time in 2 days

push eventwg21link/db

npaperbot

commit sha fecd0af10d1efca0760ac43803e4def9683d028e

Automatic update.

view details

push time in 2 days

push eventwg21link/db

npaperbot

commit sha d29e6e969ec5e8a95767043a041b4487f5492f8b

Automatic update.

view details

push time in 3 days

push eventwg21link/db

npaperbot

commit sha 3f4b35e3a296f15075c65687cb6176a182a73cf4

Automatic update.

view details

push time in 3 days

push eventwg21link/db

npaperbot

commit sha 3284116f8a8bed2e2df27989bdbcb69693c5b825

Automatic update.

view details

push time in 3 days

push eventwg21link/db

npaperbot

commit sha 27f42fd507402814c8caa10ccfe7cce954e5180e

Automatic update.

view details

push time in 3 days

pull request commentrust-lang/rust

Fix FIXME in core::num test: Check sign of zero in min/max tests.

r? @nagisa

m-ou-se

comment created time in 3 days

PR opened rust-lang/rust

Fix FIXME in core::num test: Check sign of zero in min/max tests.

r? nagisa

@rustbot modify labels: +C-cleanup

+13 -1

0 comment

1 changed file

pr created time in 3 days

create barnchfusion-engineering-forks/rust

branch : fix-fixme-min-max-sign-test

created branch time in 3 days

issue commentrust-lang/rust

BufWriter should buffer up to its capacity

Maybe instead, writing "12" and then "34" into a BufWriter with a capacity of 4 should flush right after the "34", instead of waiting until the next call. Feels slightly more consistent.

Lucretiel

comment created time in 3 days

issue commentrust-lang/rust

BufWriter should buffer up to its capacity

I think the current implementation makes sense. I'd say the goal of a BufWriter to reduce the number of write calls on the underlying stream. Buffering a write call of the full buffer capacity only serves the purpose of using the buffer as much as possible, as the number of write calls (and their sizes) remain the same. That doesn't seem useful to me.

Lucretiel

comment created time in 3 days

push eventfusion-engineering-forks/rust

Mara Bos

commit sha 95bbadb31564e8eb163e54cbe834d08a4ecabfc7

Split sys_common::Mutex in StaticMutex and MovableMutex. The (unsafe) Mutex from sys_common had a rather complicated interface. You were supposed to call init() manually, unless you could guarantee it was neither moved nor used reentrantly. Calling `destroy()` was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if destroy() should only be called when `init()` was called. This allowed for a number of interesting (confusing?) different ways to use this Mutex, all captured in a single type. In practice, this type was only ever used in two ways: 1. As a static variable. In this case, neither init() nor destroy() are called. The variable is never moved, and it is never used reentrantly. It is only ever locked using the LockGuard, never with raw_lock. 2. As a Boxed variable. In this case, both init() and destroy() are called, it will be moved and possibly called reentrantly. No other combinations are used anywhere in `std`. This change simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex. The interface of both new types is now both safer and simpler. The first one does not call nor expose init/destroy, and the second one calls those automatically in its new() and Drop functions. Also, the locking functions of MovableMutex are no longer unsafe.

view details

Mara Bos

commit sha 21f2799183df40d116f993c82eb73ec7c5e78f6f

Add missing safety note about (internal) std::io::Lazy.

view details

Mara Bos

commit sha 6d2d2a67ba98f58f2b74be517813b67fa2f723fc

Fix ui test. This test checks if the compiler complains about accesing a private field before complaining (or crashing) about the private function on it not marked as stable/unstable. The interface of the internal type (sys_common's Mutex) used for this was changed. With this change, it uses another function to test for the same issue.

view details

push time in 3 days

pull request commentrust-lang/rust

Split sys_common::Mutex in StaticMutex and MovableMutex.

@rustbot modify labels: +A-concurrency +C-cleanup

m-ou-se

comment created time in 3 days

pull request commentrust-lang/rust

Use futex-based thread::park/unpark on Linux.

@rustbot modify labels: +T-libs +A-concurrency +O-linux

m-ou-se

comment created time in 3 days

pull request commentrust-lang/rust

Remove std::io::lazy::Lazy in favour of SyncOnceCell

@rustbot modify labels: +T-libs +A-io

m-ou-se

comment created time in 3 days

PR opened rust-lang/rust

Remove workaround for deref issue that no longer exists.

The double underscores were used to work around issue #12808, which was solved in 2016.

+4 -6

0 comment

1 changed file

pr created time in 3 days

create barnchfusion-engineering-forks/rust

branch : no-more-funny-underscores

created branch time in 3 days

pull request commentrust-lang/rust

Remove std::io::lazy::Lazy in favour of SyncOnceCell

Two interesting minor differences before/after:


1:

use std::{thread, io, mem, time::Duration};

fn main() {
    print!("hello");
    thread::spawn(|| mem::forget(io::stdout()));
    thread::sleep(Duration::from_secs(1));
}

Before this change, this outputs nothing: The Arc count does not drop back to 0, the stdout buffer is not dropped/flushed. After this change, this propefly flushes the stream, and outputs hello. Improvement!


2:

use std::{thread, io, mem, time::Duration};

fn main() {
    print!("hello");
    thread::spawn(|| mem::forget(io::stdout().lock()));
    thread::sleep(Duration::from_secs(1));
}

Before this change, this outputs hello, while after this change, this no longer flushes the stream and outputs nothing. This seems like a regression. However: This only worked because the whole ReentrantMutex in the Arc was dropped (thus flushing the buffer), even though the ReentrantMutex inside there was still locked (since a guard was leaked). This might have been unsound: destroying a locked mutex can be undefined behaviour with posix pthreads.

m-ou-se

comment created time in 3 days

push eventfusion-engineering-forks/rust

Mara Bos

commit sha 6f9c1323a7a0fe162a5642e229d54afec7ccb299

Call ReentrantMutex::init() in stdout().

view details

push time in 3 days

push eventwg21link/db

npaperbot

commit sha 60c2c08c98dda7f9d9648fb92879fa0192df6240

Automatic update.

view details

push time in 3 days

push eventfusion-engineering-forks/rust

Mara Bos

commit sha 45700a9d58679131a628ddc95dd8ce0fcf1f2430

Drop use of Arc from Stdin and Stdout.

view details

push time in 3 days

push eventfusion-engineering-forks/rust

Mara Bos

commit sha e9b25f520bd2e3687213aa1162e631b08b9bf7ed

Add test to check stdout flushing during shutdown.

view details

push time in 3 days

push eventfusion-engineering-forks/rust

Mara Bos

commit sha bab15f773afd5724023d9a065b5af276e2468ff5

Remove std::io::lazy::Lazy in favour of SyncOnceCell The (internal) std::io::lazy::Lazy was used to lazily initialize the stdout and stdin buffers (and mutexes). It uses atexit() to register a destructor to flush the streams on exit, and mark the streams as 'closed'. Using the stream afterwards would result in a panic. Stdout uses a LineWriter which contains a BufWriter that will flush the buffer on drop. This one is important to be executed during shutdown, to make sure no buffered output is lost. It also forbids access to stdout afterwards, since the buffer is already flushed and gone. Stdin uses a BufReader, which does not implement Drop. It simply forgets any previously read data that was not read from the buffer yet. This means that in the case of stdin, the atexit() function's only effect is making stdin inaccessible to the program, such that later accesses result in a panic. This is uncessary, as it'd have been safe to access stdin during shutdown of the program. --- This change removes the entire io::lazy module in favour of SyncOnceCell. SyncOnceCell's fast path is much faster (a single atomic operation) than locking a sys_common::Mutex on every access like Lazy did. However, SyncOnceCell does not use atexit() to drop the contained object during shutdown. As noted above, this is not a problem for stdin. It simply means stdin is now usable during shutdown. The atexit() call for stdout is moved to the stdio module. Unlike the now-removed Lazy struct, SyncOnceCell does not have a 'gone and unusable' state that panics. Instead of adding this again, this simply replaces the buffer with one with zero capacity. This effectively flushes the old buffer *and* makes any writes afterwards pass through directly without touching a buffer, making print!() available during shutdown without panicking.

view details

Mara Bos

commit sha 2fed486355c0177f955a700130770d258e425ea7

Add test to check stdout flushing during shutdown.

view details

push time in 3 days

PR opened rust-lang/rust

Remove std::io::lazy::Lazy in favour of SyncOnceCell

The (internal) std::io::lazy::Lazy was used to lazily initialize the stdout and stdin buffers (and mutexes). It uses atexit() to register a destructor to flush the streams on exit, and mark the streams as 'closed'. Using the stream afterwards would result in a panic.

Stdout uses a LineWriter which contains a BufWriter that will flush the buffer on drop. This one is important to be executed during shutdown, to make sure no buffered output is lost. It also forbids access to stdout afterwards, since the buffer is already flushed and gone.

Stdin uses a BufReader, which does not implement Drop. It simply forgets any previously read data that was not read from the buffer yet. This means that in the case of stdin, the atexit() function's only effect is making stdin inaccessible to the program, such that later accesses result in a panic. This is uncessary, as it'd have been safe to access stdin during shutdown of the program.


This change removes the entire io::lazy module in favour of SyncOnceCell. SyncOnceCell's fast path is much faster (a single atomic operation) than locking a sys_common::Mutex on every access like Lazy did.

However, SyncOnceCell does not use atexit() to drop the contained object during shutdown.

As noted above, this is not a problem for stdin. It simply means stdin is now usable during shutdown.

The atexit() call for stdout is moved to the stdio module. Unlike the now-removed Lazy struct, SyncOnceCell does not have a 'gone and unusable' state that panics. Instead of adding this again, this simply replaces the buffer with one with zero capacity. This effectively flushes the old buffer and makes any writes afterwards pass through directly without touching a buffer, making print!() available during shutdown without panicking.

+55 -98

0 comment

5 changed files

pr created time in 3 days

create barnchfusion-engineering-forks/rust

branch : lazy-stdio

created branch time in 3 days

push eventwg21link/db

npaperbot

commit sha 8e7ed192935d382e649b15ff36833511a2ae7b13

Automatic update.

view details

push time in 3 days

push eventfusion-engineering-forks/rust

Mara Bos

commit sha 982fd1617521595b996e42fce54b3d39a1478e14

Fix ui test. This test checks if the compiler complains about accesing a private field before complaining (or crashing) about the private function on it not marked as stable/unstable. The interface of the internal type (sys_common's Mutex) used for this was changed. With this change, it uses another function to test for the same issue.

view details

push time in 3 days

push eventfusion-engineering-forks/rust

Mara Bos

commit sha 11b8eeb38306e8b193e2a174842ccea70f7dd4fa

Add missing safety note about (internal) std::io::Lazy.

view details

push time in 3 days

PR opened rust-lang/rust

Split sys_common::Mutex in StaticMutex and MovableMutex.

The (unsafe) Mutex from sys_common had a rather complicated interface. You were supposed to call init() manually, unless you could guarantee it was neither moved nor used reentrantly.

Also, wait_timeout was not guaranteed to use the monotonic clock when init() was not called, although that was not documented.

Calling destroy() was also optional, although it was unclear if 1) resources might be leaked or not, and 2) if destroy() should only be called when init() was called.

This allowed for a number of interesting (confusing?) different ways to use this Mutex, all captured in a single type.

In practice, this type was only ever used in two ways:

  1. As a static variable. In this case, neither init() nor destroy() are called. Locking with timeout is not used. The variable is never moved, and it is never used reentrantly. It is only ever locked using the LockGuard, never with raw_lock.

  2. As a Boxed variable. In this case, both init() and destroy() are called, locking with timeouts is used, it will be moved, etc.

No other combinations are used anywhere in std.

This change simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex.

The interface of both new types is now both safer and simpler. The first one does not call nor expose init/destroy, and the second one calls those automatically in its new() and Drop functions. Also, the locking functions of MovableMutex are no longer unsafe.


@rustbot modify labels: +T-libs

+104 -125

0 comment

14 changed files

pr created time in 3 days

create barnchfusion-engineering-forks/rust

branch : static-mutex

created branch time in 3 days

create barnchfusion-engineering-forks/rust

branch : unbox-the-mutex

created branch time in 3 days

push eventwg21link/db

npaperbot

commit sha 73e5090e76bc7b46cdc7be33786eda25bd81aa22

Automatic update.

view details

push time in 4 days

push eventwg21link/db

npaperbot

commit sha a55910ccd5dc83183c2406c1c876d35306327362

Automatic update.

view details

push time in 4 days

push eventwg21link/db

npaperbot

commit sha f9553b823d5ba739de5cfd576513387932580659

Automatic update.

view details

push time in 4 days

push eventwg21link/db

npaperbot

commit sha 63902378ecbd7bdc36919d9e379e2c6c75fb306c

Automatic update.

view details

push time in 4 days

push eventwg21link/db

npaperbot

commit sha d460a2a52791eb0161005f140829e4b63d7c0eae

Automatic update.

view details

push time in 4 days

pull request commentrust-lang/rust

Stabilize slice_ptr_range.

@rustbot modify labels: +T-libs +A-raw-pointers +A-slice

m-ou-se

comment created time in 4 days

PR opened rust-lang/rust

Stabilize slice_ptr_range.

This has been unstable for almost a year now. Time to stabilize?

Closes #65807.

@rustbot modify labels: +T-libs +A-raw-pointers +A-slice +needs-fcp

+2 -4

0 comment

1 changed file

pr created time in 4 days

create barnchfusion-engineering-forks/rust

branch : stabilize-slice-ptr-range

created branch time in 4 days

push eventwg21link/db

npaperbot

commit sha 53d4cb0b5e1b9475b8ebb2929345a796edc41906

Automatic update.

view details

push time in 4 days

push eventwg21link/db

npaperbot

commit sha 4d20cb8127c5196bac82478431f4c88822ff065a

Automatic update.

view details

push time in 4 days

issue commentrust-lang/rust

Tracking issue for slice_ptr_range

Note that with #71499 these functions can be made const fn. The stabilization of these methods as const fn can just be tracked as part of #71499.

Thanks! PR: #77097.

m-ou-se

comment created time in 4 days

PR opened rust-lang/rust

Make [].as_[mut_]ptr_range() (unstably) const.

Gated behind const_ptr_offset, as suggested by https://github.com/rust-lang/rust/issues/65807#issuecomment-697229404

This also marks [].as_mut_ptr() as const, because it's used by as_mut_ptr_range. I gated it behind the same feature, because I figured it's not worth adding a separate tracking issue for const as_mut_ptr.

+6 -3

0 comment

1 changed file

pr created time in 4 days

create barnchfusion-engineering-forks/rust

branch : slice-ptr-range-const-fn

created branch time in 4 days

push eventwg21link/db

npaperbot

commit sha 2f1c45a50e29e0e8fb1ab89497d6477e8c071156

Automatic update.

view details

push time in 5 days

push eventwg21link/db

npaperbot

commit sha fa0c7f8350ce2211bef027498293a3ba55cbf1e2

Automatic update.

view details

push time in 5 days

push eventwg21link/db

npaperbot

commit sha 92447a73563fb26aed83c2d8bc2fdce50cba2445

Automatic update.

view details

push time in 5 days

push eventwg21link/db

npaperbot

commit sha 28df7edde553e7a48c16dbea9274e36ebc3d8c76

Automatic update.

view details

push time in 5 days

push eventwg21link/db

npaperbot

commit sha 9a4740c83eb6789888db5387b8df59d198acea5a

Automatic update.

view details

push time in 5 days

push eventwg21link/db

npaperbot

commit sha 069b49d76573f802c53486506c4137c51b716d5a

Automatic update.

view details

push time in 5 days

push eventwg21link/db

npaperbot

commit sha 3a0dc5868b3764c4ec7bf0235c506e98dc1f3b9e

Automatic update.

view details

push time in 5 days

push eventwg21link/db

npaperbot

commit sha eb62e7949c97353b284cb76bb91b0111cc3f6742

Automatic update.

view details

push time in 5 days

push eventwg21link/db

npaperbot

commit sha b97d0b81f44106a796fc9b442809c74725ac294c

Automatic update.

view details

push time in 5 days

push eventwg21link/db

npaperbot

commit sha 11f8f0367c1edfeabcb2633c40a90444ecedb86c

Automatic update.

view details

push time in 5 days

push eventwg21link/db

npaperbot

commit sha 9468bd6222ac3e7fe4ac834b6ed7a7ab9174e845

Automatic update.

view details

push time in 5 days

pull request commentrust-lang/rust

Take 2: Add `take_...` functions to slices

The first commit is just the code of the previous PR.

Tip: You can use git commit --author to set the author on the original commit.

timvermeulen

comment created time in 5 days

push eventwg21link/db

npaperbot

commit sha a47dd70163c3b4eca4933980315158ac46fb7499

Automatic update.

view details

push time in 5 days

pull request commentjonas-hagen/hx711

Add get_mode function.

Thanks!

m-ou-se

comment created time in 5 days

push eventwg21link/db

npaperbot

commit sha afdbbd65eb9a71bbc7ef23ed00d2f6fbba92ecd1

Automatic update.

view details

push time in 6 days

push eventwg21link/db

npaperbot

commit sha 9403d09b17e34af331ce2b7fb1b90520554a2691

Automatic update.

view details

push time in 6 days

push eventwg21link/db

npaperbot

commit sha 94a0e6e53e833116e1a44c34fc967e71c4c7bb5c

Automatic update.

view details

push time in 6 days

push eventwg21link/db

npaperbot

commit sha f45786318552fa835788e0975a842783e596b62e

Automatic update.

view details

push time in 6 days

push eventwg21link/db

npaperbot

commit sha 1a39b84186fcddc49c19f0d97f93faf788659ef9

Automatic update.

view details

push time in 6 days

pull request commentrust-lang/rust

Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.

I've added the test. I made it specific for both x86 and linux, because some other x86 platforms do use 64 bit alignment for 64 bit integers:

        target            u64 alignment
i686-unknown-linux-gnu         32
i586-unknown-linux-gnu         32
i686-unknown-linux-musl        32
i586-unknown-linux-musl        32
i686-linux-android             32
i686-unknown-freebsd           32
i686-unknown-openbsd           32
i686-unknown-netbsd            32
i686-unknown-haiku             32
i686-apple-darwin              32
i686-pc-windows-gnu               64
i686-uwp-windows-gnu              64
i686-pc-windows-msvc              64
i686-uwp-windows-msvc             64
i586-pc-windows-msvc              64
i686-unknown-cloudabi          32
i686-unknown-uefi                 64
i686-wrs-vxworks               32

But still, if this test ever happens to run on some x86 Linux target with fully aligned u64s, it'll fail. But that shouldn't affect people cross compiling libcore themselves (-Zbuld-std), as this is a ui test.

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

m-ou-se

comment created time in 6 days

push eventfusion-engineering-forks/rust

Mara Bos

commit sha bcc1d56917fe061071ebc539b5d2e304a44a7b00

Test that AtomicU64::from_mut is not available on x86 linux.

view details

push time in 6 days

push eventfusion-engineering-forks/rust

Mara Bos

commit sha c9c35343073b6a389cd1e7118f59c16c229ae962

Test that AtomicU64::from_mut is not available on x86 linux.

view details

push time in 6 days

push eventwg21link/db

npaperbot

commit sha 48d06bdacdea182df4155a8067e7897b8f476bc5

Automatic update.

view details

push time in 6 days

pull request commentrust-lang/rust

Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.

Could you add a compile-fail ui test to ensure that from_mut is not available on x86?

Sure. Working on it.

@rustbot modify labels: -S-waiting-on-review +S-waiting-on-author

m-ou-se

comment created time in 6 days

push eventwg21link/db

npaperbot

commit sha 75c376ac575059b5eeb07c576fba23c0df008eaf

Automatic update.

view details

push time in 6 days

Pull request review commentrust-lang/rust

Add cfg(target_has_atomic_equal_alignment) and use it for Atomic::from_mut.

 use self::Ordering::*; use crate::cell::UnsafeCell; use crate::fmt; use crate::intrinsics;++#[allow(unused_imports)] use crate::mem::align_of;

Done!

m-ou-se

comment created time in 6 days

PullRequestReviewEvent

push eventfusion-engineering-forks/rust

Mara Bos

commit sha 5d6f1a1e32de4936e5b269b04781b2737f6d410b

Move `use align_of` in atomic.rs into the places where it is used.

view details

push time in 6 days

push eventfusion-engineering-forks/rust

CDirkx

commit sha 518f1ccb728aa03665e51710c12973a74cc98df5

Stabilize some Result methods as const Stabilize the following methods of `Result` as const: - `is_ok` - `is_err` - `as_ref` Possible because of stabilization of #49146 (Allow if and match in constants).

view details

Christiaan Dirkx

commit sha 787b2707a77fa1a98f512a4905662a1a16daf13c

Move const tests for `Result` to `library\core` Part of #76268

view details

Guillaume Gomez

commit sha 69ffed763d1540c387db3b578848184026da0484

Add error explanation for E0755

view details

Tavian Barnes

commit sha a06edda3ad9abd4f07d07bbe46cb488efeebbbd0

Fix segfault if pthread_getattr_np fails glibc destroys[1] the passed pthread_attr_t if pthread_getattr_np() fails. Destroying it again leads to a segfault. Fix it by only destroying it on success for glibc. [1]: https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_getattr_np.c;h=ce437205e41dc05653e435f6188768cccdd91c99;hb=HEAD#l205

view details

Tavian Barnes

commit sha a684153f2920729f9fc3ea27ddb77d7cc3543214

Only call pthread_attr_destroy() after getattr_np() succeeds on all libcs The calling convention of pthread_getattr_np() is to initialize the pthread_attr_t, so _destroy() is only necessary on success (and _init() isn't necessary beforehand). On the other hand, FreeBSD wants the attr_t to be initialized before pthread_attr_get_np(), and therefore it should always be destroyed afterwards.

view details

Camelid

commit sha fd79ed42254d7483569ccc48ef35a79635ed5881

Add docs for `BasicBlock`

view details

Camelid

commit sha a872ec47145ce3a82c39bedaca21b99e867d9be2

Clarify how branching works in a CFG

view details

Stein Somers

commit sha 176956c115c2b797471a3f59eef3e17789229007

Test and fix Sync & Send traits of BTreeMap artefacts

view details

Camelid

commit sha c051f61d3c078343db70e355feea808892deed75

Improve wording Co-authored-by: Joshua Nelson <joshua@yottadb.com>

view details

khyperia

commit sha 21b0c1286a1f01cb8a21bda0973833ca11889364

Extract some intrinsics out of rustc_codegen_llvm A significant amount of intrinsics do not actually need backend-specific behaviors to be implemented, instead relying on methods already in rustc_codegen_ssa. So, extract those methods out to rustc_codegen_ssa, so that each backend doesn't need to reimplement the same code.

view details

Joshua Nelson

commit sha c35ce3ff170333d11ccf89e75dc87c49f44a570a

Don't generate bootstrap usage unless it's needed Previously, `x.py` would unconditionally run `x.py build` to get the help message. After https://github.com/rust-lang/rust/issues/76165, when checking the CI stage was moved into `Config`, that would cause an assertion failure (but only only in CI!): ``` thread 'main' panicked at 'assertion failed: `(left == right)` left: `1`, right: `2`', src/bootstrap/config.rs:619:49 ``` This changes bootstrap to only generate a help message when it needs to (when someone passes `--help`).

view details

Jethro Beekman

commit sha 1d2290ffb0f8f85c8de56c17e6be748d84dcfb04

Update LLVM

view details

Matthias Krüger

commit sha 94dae6004035c356b00dac8764c1b4808d740928

simplfy condition in ItemLowerer::with_trait_impl_ref()

view details

Camelid

commit sha 57eb29cd2dc30c47b613ced135422a4120bc6a78

Update based on review suggestions

view details

Ivan Tham

commit sha b7c8bea6cbf0aff4cbb36b127edc0bb4c66c4cf9

Fix wording in mir doc

view details

Hanif Bin Ariffin

commit sha f4a7149f499a4b91d296678002f0bce4ded85038

Don't compile regex at every function call. Use `SyncOnceCell` to only compile it once. I believe this still adds some kind of locking mechanism?

view details

est31

commit sha b47913962097874257ad10227b943ef7af85d49f

Remove intrinsics::arith_offset use from libarena The use of arith_offset was added in 803e9ae67b770d8500c4ab5862e988d29118356a before the stable wrapper of the intrinsic was available. https://doc.rust-lang.org/stable/std/intrinsics/fn.arith_offset.html

view details

est31

commit sha 4fe6ca37898bcd65488764f2679e27c936879ade

Replace const_generics feature gate with min_const_generics The latter is on the path to stabilization.

view details

est31

commit sha ebdea011436dfea810ff1bbd827636ac75f6f092

Remove redundant #![feature(...)] 's from compiler/

view details

Bastian Kauschke

commit sha 5f58e00ca565c8964dbf89f510236f72951d0bab

fix array_windows docs

view details

push time in 6 days

push eventwg21link/db

npaperbot

commit sha 51b3df2c282b205fc2b77356339c2300884433ab

Automatic update.

view details

push time in 6 days

PR opened jonas-hagen/hx711

Add get_mode function.
+5 -0

0 comment

1 changed file

pr created time in 6 days

push eventfusion-engineering-forks/hx711

Mara Bos

commit sha 2b6957bba9a67eacabf83e291c1d4e9e95f4f088

Add get_mode function.

view details

push time in 6 days

more