profile
viewpoint
Ben Kimock saethlin Redjack Silver Spring, MD Senior Software Developer @ Redjack | Rust enthusiast he/him

saethlin/fls 10

fastest ls in the west

saethlin/flatvec 2

A vec-like container that stores dynamically-sized objects with no more than 2 allocations

saethlin/astrotools 1

Scripts and stuff, mostly astronomy

atvaccaro/slackbots 0

Bots and slash-commands for the StayEthical and Lol-xD teams

redjack/dns-parser 0

The parser of DNS protocol packets in rust

saethlin/advisory-db 0

Security advisory database for Rust crates published through crates.io

saethlin/ahf 0

Amiga's Halo Finder (forked to add HDF5 support)

saethlin/arrayvec 0

A vector with a fixed capacity. (Rust)

push eventsaethlin/rust

Mario Carneiro

commit sha 3eb87dbe2ddd99c5334d5282e6a4d3de6d9fa6c0

doc: guarantee call order for sort_by_cached_key `slice::sort_by_cached_key` takes a caching function `f: impl FnMut(&T) -> K`, which means that the order that calls to the caching function are made is user-visible. This adds a clause to the documentation to promise the current behavior, which is that `f` is called on all elements of the slice from left to right, unless the slice has len < 2 in which case `f` is not called.

view details

Josh Triplett

commit sha 470b49bac9ca58e48a92a0f69aef2745413fe9b4

Clarify how to quote and respond to the target tier policy requirements Several times, people have seemed unclear on how to respond to some of the policy requirements, particularly those that just state things the target developers must *not* do (e.g. not posting to PRs that break the target). Add a note that such requirements just need acknowledgement, nothing more. Make quoting and responding a "must" rather than an "is encouraged to", since it's easier to review the requirements that way.

view details

Josh Triplett

commit sha 9a016badfae61b7527f94168c2829e775d83401b

Clarify dependency requirements in the face of cross-compilation The requirement on dependencies was phrased in terms of "host tools", but it was also intended to apply equally to targets that only support cross-compilation. Only the exception (for libraries commonly needed for binaries on the target) was intended to apply to host tools. Reword the requirement to talk about the dependencies required for "compiling, linking,and emitting functional binaries, libraries, or other code for the target", rather than generically in terms of dependencies for rustc/cargo. This doesn't change the net effect of the requirements, since other requirements already stated that the target can't make the Rust toolchain depend on proprietary libraries. However, this should make the requirements clearer.

view details

Josh Triplett

commit sha 1aeb3f9cadd940825e1e0ce167a8852e0681c20d

Clarify documentation about running binaries The requirement for target documentation talks about "running tests", but tier 3 targets often don't support running the full testsuite, and in practice the documentation for how to run an individual binary may be more useful. Change "running tests" to "running binaries, or running tests".

view details

Josh Triplett

commit sha 10420ef94514b6319ab87442bfbc7fd465c3394b

Point to platform-support/ for target-specific documentation Explain that target-specific documentation should appear in a subdirectory of platform-support, with a link from the target's entry on the platform-support page.

view details

Josh Triplett

commit sha f863e4cc301c7ab7c97b86ad142474989789badc

Add a template for target-specific documentation

view details

Tomasz Miąsko

commit sha 763703cb7696d51b83bb8507e5a74a31144ac782

Remove redundant check for promoteds For some time CTFE has been using a dedicated MIR which is never optimized, so the check for promoted became redundant.

view details

Tomasz Miąsko

commit sha d5a91f3114dde5a32dc69f9114fca0d9b0fd2abc

Use `IndexVec::indices` instead of reimplementing it The change is limited to the iteration over indices instead of using `basic_blocks_mut()` directly, in the case the previous implementation intentionally avoided invalidating the caches stored in MIR body.

view details

Tomasz Miąsko

commit sha c3e71d83cdeb0ccaf6584255313380fd166b1096

Fix a variant index and variant discriminant confusion Previously for enums using the `Variants::Single` layout, the variant index was being confused with its discriminant. For example, in the case of `enum E { A = 1 }`. Use `discriminant_for_variant` to avoid the issue.

view details

David Tolnay

commit sha 01800caddf74375e17bbdedb9606139704fc3aed

Add test of qpath interpolations

view details

David Tolnay

commit sha 558ddee2cea3063a487393ea292126259702fe97

Add test of NtTy in a qpath Currently fails: error: expected identifier, found `ToOwned` --> src/test/ui/macros/macro-interpolation.rs:23:19 | LL | <$type as $trait>::$name | ^^^^^^ expected identifier ... LL | let _: qpath!(ty, <str as ToOwned>::Owned); | ----------------------------------- | | | this macro call doesn't expand to a type | in this macro invocation

view details

David Tolnay

commit sha 0cbb00f89875c085181f1d55bbe46d39ec36be3f

Let qpath contain NtTy: <$:ty as $:ty>::rest

view details

David Tolnay

commit sha 87a7defa8e08c971a30b152509c6c1ab9f718092

Reject generic arguments on mod style interpolated path

view details

SparrowLii

commit sha 61ff847203d6491f13782b0f6e461b593afc7a0d

Use iterator instead of recursion in `codegen_place`

view details

AngelicosPhosphoros

commit sha 4b62a77e4d76f2f29cd46812e6d7400636790723

Little improves in CString `new` when creating from slice Old code already contain optimization for cases with `&str` and `&[u8]` args. This commit adds a specialization for `&mut[u8]` too. Also, I added usage of old slice in search for zero bytes instead of new buffer because it produce better code for Windows on LTO builds. For other platforms, this wouldn't cause any difference because it calls `libc` anyway. Inlined `_new` method into spec trait to reduce amount of code generated to `CString::new` callers.

view details

Michael Watzko

commit sha 1c0dc1810d778bb6fea16aac02cafc5aa2e84b11

Add {Add,Sub,Mul,Div,Rem,BitXor,BitOr,BitAnd}{,Assign}<$t> to Saturating<$t>

view details

David Tolnay

commit sha a18f43f25d414a9a3990bd2afe25e26b92f5fb22

Fix unclosed boxes in pretty printing of TraitAlias

view details

Caleb Zulawski

commit sha d32ca64692d95c08d6563f363ea3074d1d30ce52

Allow isize/usize in simd_cast

view details

Caleb Zulawski

commit sha 8fae33d9b21e1e29da65506a2d6ac5bbbb3c4a86

Add simd_as intrinsic

view details

Caleb Zulawski

commit sha 3cd49767cfd765d377f2349fd7f450258d9b8be8

Add pointer-sized integer tests

view details

push time in 19 hours

issue commentjaparic/syscall.rs

make this crate work on stable

On nightly-2022-01-18 and later this crate no longer builds because llvm_asm! was removed in https://github.com/rust-lang/rust/pull/92816. And asm! is available on beta since 2022-01-13.

I might take a shot at a patch, but I'm quite terrible at inline assembly. If someone has any expertise with asm! please help.

japaric

comment created time in 3 days

issue commentrust-lang/reference

Documentation for #[inline] in the reference doesn't align with external resources

I know what #[inline] does in rustc. My concern is that people are going looking for documentation for it, finding the reference, and concluding that what the reference mentions is the extent of what rustc does. That is, just a hint to the LLVM inliner, and ergo it is gratuitous to put the attribute on small functions, when the exact opposite is true.

I think it would be a nice improvement to make the language in the reference either more vague, such as amending

Note: #[inline] in every form is a hint, with no requirements on the language to place a copy of the attributed function in the caller.

To

Note: #[inline] in every form is a hint. Implementations may significantly adapt their code generation model to accommodate the hint, or ignore it entirely. Refer to your implementation's documentation for details.

saethlin

comment created time in 3 days

issue commentrust-lang/reference

Documentation for #[inline] in the reference doesn't align with external resources

My concern is that I told a user about the alteration to the way rustc does codegen, and they tried to tell me I was wrong by citing the reference. So where in that is the problem?

saethlin

comment created time in 3 days

issue commentrust-lang/reference

Documentation for #[inline] in the reference doesn't align with external resources

Ah, so people are wrong to read the reference as indicating that #[inline] is a hint to the inliner? It sounds like the reference should say that if the attribute does anything, it suggests inlining, and implementations may do this by whatever means they see fit.

Or maybe this deserves to be in a Note:, after all there is already one about the rustc implementation on this attribute.

saethlin

comment created time in 3 days

issue openedrust-lang/reference

Documentation for #[inline] in the reference doesn't align with external resources

The current documentation for #[inline] places huge emphasis on its effect as an inlining hint. I was recently referred to the reference when I tried to inform another user that its primary effect is enabling cross-crate inlining of non-generic functions. I'm not sure if this lack of documentation is just an oversight (which I'm happy to correct with a PR) or if this is deliberate because the cross-crate inlining effect is planned to be removed, or if the hint is guaranteed, but the codegen difference isn't.

I'm particularly concerned, because this effect is well-known in resources outside of the reference: https://matklad.github.io/2021/07/09/inline-in-rust.html https://github.com/rust-lang/hashbrown/pull/119#issuecomment-537539046

created time in 3 days

issue openedrust-lang/rust

The panic branch in the expression Some(x).unwrap() is not removed for some types

Demos: https://godbolt.org/z/TMh3Krfc5

The motivating example is:

pub fn bad_vec(s: Vec<u8>) -> Vec<u8> {
    Some(s).expect("bad_vec")
}
example::bad_myvec:
        push    rax
        mov     rax, qword ptr [rsi]
        test    rax, rax
        je      .LBB5_1
        mov     qword ptr [rdi], rax
        movups  xmm0, xmmword ptr [rsi + 8]
        movups  xmmword ptr [rdi + 8], xmm0
        mov     rax, rdi
        pop     rcx
        ret
.LBB5_1:
        lea     rdi, [rip + .L__unnamed_5]
        lea     rdx, [rip + .L__unnamed_6]
        mov     esi, 9
        call    qword ptr [rip + core::option::expect_failed@GOTPCREL]
        ud2

It looks to me like the problem with Vec is that specifically the nonnull attribute does not survive being wrapped in two structs that each contain a second member. If either of RawVec or Vec is missing a usize member, the optimization works.

There is a missed NonZero* optimization in here that I found looking for types that fail to optimize. It's unclear to me if this was reported previously in https://github.com/rust-lang/rust/issues/49572, or if whatever fixes the problem with Vec will also fix the NonZero* example.


I think this is similar but not the same problem as seen in https://github.com/rust-lang/rust/issues/71257

created time in 5 days

PR opened jedisct1/rust-siphash

Don't narrow provenance through references

slice::get_unchecked returns a reference, and since references narrow provenance, when the reference is coerced to a pointer it is UB to use the pointer outside of its current pointee. This is the same fix as rust-lang/rust #78602

This problem is identified by miri by running MIRIFLAGS="-Zmiri-tag-raw-pointers" cargo +nightly miri test

+4 -4

0 comment

2 changed files

pr created time in 5 days

create barnchsaethlin/rust-siphash

branch : fix-provenance

created branch time in 5 days

fork saethlin/rust-siphash

SipHash (2-4, 1-3 + 128 bit variant) implementations for Rust

fork in 5 days

issue openedrust-lang/rust

memcpy-style copies of small fixed length arrays become memcpy, unless done via a loop with ops::Index

godbolt demo

I have a [u8; 4] and I want to copy an unknown number of bytes from it into a &mut [u8]. Based on benchmarking, on x86_64 at least it is much slower to call memcpy than it is to do a byte-by-byte copy. The fastest implementation of this pattern in Rust is this:

if len > 4 {
    core::hint::unreachable_unchecked();
}
for i in 0..len {
    *dst.get_unchecked_mut(i) = src[i];
}

That just doesn't seem right to me.

created time in 6 days

issue closedsaethlin/programming-videos

Add Kevlin Henney

https://www.youtube.com/watch?v=ZsHMHukIlJY

closed time in 6 days

saethlin

push eventsaethlin/rust

Ben Kimock

commit sha 62c31f94aed7644c64f59b1752e5ed1ca9532f98

Use the same code for uppercase

view details

push time in 6 days

issue commentrust-lang/rust

Several trivial `Vec<T>` methods (deref, as_ref, etc) end up in compiled output when optimizing for size.

I don't really know when this was fixed, but I'm not seeing the particular codegen that I complained about on 1.58.0 (latest stable) or nightly-2022-01-15 (latest nightly) anymore.

thomcc

comment created time in 6 days

push eventsaethlin/rust

Ben Kimock

commit sha 59da247684485eb4a2d1cdab3f2c19b5ba178647

Use the same code for uppercase

view details

push time in 6 days

push eventsaethlin/rust

Ben Kimock

commit sha d681b246bd25ab62990634d0bf5e0cdd37700402

Clean up a bit

view details

push time in 7 days

push eventsaethlin/rust

Ben Kimock

commit sha 16f6b19769665881419b6ffbb37c2f0402ca77ac

Add a cache to the tiered lookup tables

view details

push time in 7 days

push eventsaethlin/rust

Gary Guo

commit sha 1788cfd95d343dc59c2555ac895acb26cd5d3811

Remove NullOp::Box

view details

Sean Chen

commit sha 59df6c8eb917cba41c15e3366f29ee780c9c74df

Try commiting again

view details

Sean Chen

commit sha 6a59d0e3aa26543fc4d3eaae1fa4cd48522045d2

Have `pretty` and `show_backtrace` accept booleans

view details

Sean Chen

commit sha c6de41331c732a8f70088ceab12a5049e3db0caa

Change `source` field to `error`

view details

Sean Chen

commit sha c0f14cb9301eacb51fc660f1d461cbc783f4aaa7

Attempt to fix tidy errors

view details

Sean Chen

commit sha aa853bd31775db7fcb5074f78d8b989053ae101d

Add `rust` annotation to doctest

view details

Sean Chen

commit sha d2f49eeb176a670c76f3c8c6005208a9d3cc30ee

Format doctest

view details

Sean Chen

commit sha 32bcb8113f750db36b9590b516a9fc40c0fa99df

Fix broken doctest

view details

Jane Lusby

commit sha 1386a15529f5241402125b37eda7a5bb03fbd247

Update std::error::Report based on feedback

view details

Oli Scherer

commit sha 689a868a1f6f20b49ea904ca7cda14636b7768b3

Remove some noise from opaque type errors around associated types

view details

Oli Scherer

commit sha 5c4600227329a273c0c6c844e4a10ce650ead601

Eagerly instantiate opaque types

view details

Oli Scherer

commit sha bdeeb07bf6400622074f04ca2523dac1512ab662

Prove obligations to termination instead of ignoring ambiguities. Sometimes an obligation depends on a later one, so we can't just process them in order like it was done previously. This is not a problem in our test suite, but there may be ICEs out there and it will definitely be a problem with lazy TAIT.

view details

Oli Scherer

commit sha 5d07a6ceb4d54ad05d701fa8344468d9a8d707a5

Actually instantiate the opaque type when checking bounds Before this change, `instantiate_opaque_types` was a no-op

view details

Jane Lusby

commit sha 4420cc33d6686c9d4ae6bf490b977fc47e56d340

Update report output and fix examples

view details

Jane Lusby

commit sha 078b112d9452eb24cf6d5dffe8f4479cbe830d4e

add a panicking example

view details

Jane Lusby

commit sha 9be1cc9b6133fc8341ab605d426e675746144f29

more docs improvements

view details

Jane Lusby

commit sha 5b3902fc6550f7646c4612c7ff8f4d8712f13334

attempt to make Report usable with Box dyn Error and fn main

view details

Oli Scherer

commit sha 15f7e818ec83cd8b6a726e625b24e1507d8687ee

Check all opaque types, even return position impl trait. While not necessary right now, this is the safe choice and will be necessary for lazy TAIT.

view details

Wesley Wiser

commit sha 341d65d975453af9e548f1f668256604dc1f156a

Add test case for #86177 and #85718

view details

Wesley Wiser

commit sha ef57f249a2244634a5c98d431d3bbfd715bd9c89

[code coverage] Fix missing dead code in modules that are never called The issue here is that the logic used to determine which CGU to put the dead function stubs in doesn't handle cases where a module is never assigned to a CGU. The partitioning logic also caused issues in #85461 where inline functions were duplicated into multiple CGUs resulting in duplicate symbols. This commit fixes the issue by removing the complex logic used to assign dead code stubs to CGUs and replaces it with a much simplier model: we pick one CGU to hold all the dead code stubs. We pick a CGU which has exported items which increases the likelihood the linker won't throw away our dead functions and we pick the smallest to minimize the impact on compilation times for crates with very large CGUs. Fixes #86177 Fixes #85718 Fixes #79622

view details

push time in 7 days

push eventsaethlin/rust

Gary Guo

commit sha 1788cfd95d343dc59c2555ac895acb26cd5d3811

Remove NullOp::Box

view details

Sean Chen

commit sha 59df6c8eb917cba41c15e3366f29ee780c9c74df

Try commiting again

view details

Sean Chen

commit sha 6a59d0e3aa26543fc4d3eaae1fa4cd48522045d2

Have `pretty` and `show_backtrace` accept booleans

view details

Sean Chen

commit sha c6de41331c732a8f70088ceab12a5049e3db0caa

Change `source` field to `error`

view details

Sean Chen

commit sha c0f14cb9301eacb51fc660f1d461cbc783f4aaa7

Attempt to fix tidy errors

view details

Sean Chen

commit sha aa853bd31775db7fcb5074f78d8b989053ae101d

Add `rust` annotation to doctest

view details

Sean Chen

commit sha d2f49eeb176a670c76f3c8c6005208a9d3cc30ee

Format doctest

view details

Sean Chen

commit sha 32bcb8113f750db36b9590b516a9fc40c0fa99df

Fix broken doctest

view details

Jane Lusby

commit sha 1386a15529f5241402125b37eda7a5bb03fbd247

Update std::error::Report based on feedback

view details

Oli Scherer

commit sha 689a868a1f6f20b49ea904ca7cda14636b7768b3

Remove some noise from opaque type errors around associated types

view details

Oli Scherer

commit sha 5c4600227329a273c0c6c844e4a10ce650ead601

Eagerly instantiate opaque types

view details

Oli Scherer

commit sha bdeeb07bf6400622074f04ca2523dac1512ab662

Prove obligations to termination instead of ignoring ambiguities. Sometimes an obligation depends on a later one, so we can't just process them in order like it was done previously. This is not a problem in our test suite, but there may be ICEs out there and it will definitely be a problem with lazy TAIT.

view details

Jane Lusby

commit sha 4420cc33d6686c9d4ae6bf490b977fc47e56d340

Update report output and fix examples

view details

Jane Lusby

commit sha 078b112d9452eb24cf6d5dffe8f4479cbe830d4e

add a panicking example

view details

Jane Lusby

commit sha 9be1cc9b6133fc8341ab605d426e675746144f29

more docs improvements

view details

Jane Lusby

commit sha 5b3902fc6550f7646c4612c7ff8f4d8712f13334

attempt to make Report usable with Box dyn Error and fn main

view details

Wesley Wiser

commit sha 341d65d975453af9e548f1f668256604dc1f156a

Add test case for #86177 and #85718

view details

Wesley Wiser

commit sha ef57f249a2244634a5c98d431d3bbfd715bd9c89

[code coverage] Fix missing dead code in modules that are never called The issue here is that the logic used to determine which CGU to put the dead function stubs in doesn't handle cases where a module is never assigned to a CGU. The partitioning logic also caused issues in #85461 where inline functions were duplicated into multiple CGUs resulting in duplicate symbols. This commit fixes the issue by removing the complex logic used to assign dead code stubs to CGUs and replaces it with a much simplier model: we pick one CGU to hold all the dead code stubs. We pick a CGU which has exported items which increases the likelihood the linker won't throw away our dead functions and we pick the smallest to minimize the impact on compilation times for crates with very large CGUs. Fixes #86177 Fixes #85718 Fixes #79622

view details

Jack Huey

commit sha d3aecc1001e3a4cf1117de3456d2a30662493c78

When obligation is a sized predicate, prefer projection or object candidates instead of param_env candidates

view details

lcnr

commit sha d5cbae90f9e3f323f18d9234b3e55b98c52fed52

fix clippy

view details

push time in 7 days

push eventsaethlin/rust

Ben Kimock

commit sha 53104ddad006a3d77d220730ed1dcb4f567ef905

Improve data layout, remove redundant checks

view details

push time in 7 days

PR closed bluejekyll/trust-dns

Add a test case for and fix #1571

Fixes: #1571

+17 -13

7 comments

2 changed files

saethlin

pr closed time in 8 days

pull request commentbluejekyll/trust-dns

Add a test case for and fix #1571

Subsumed by #1605

saethlin

comment created time in 8 days

pull request commentogham/exa

Add threading around std::fs::symlink_metadata

Doing some housekeeping on my open PRs. I don't really know how I lost track of this, but to be fair I didn't really know how to use GitHub back when I opened this.

I have noticed that exa has some parallelism now. Is this sort of change still of interest? I no longer have access to an environment which a terribly slow filesystem to do such benchmarking, but I'm happy to do something here if there is still interest.

saethlin

comment created time in 9 days

PR closed Enet4/julia-bench-rs

Improve fib, prevent regression in parse_int

Motivation: There's no reason for the Rust version of fib to be any slower than the C one. The only difference I see is that there's a black_box in the Rust one, so let's try to get rid of it.

I modified the implementation of measure_best to put the benchmark results behind a memory allocation which should prevent them from being optimized away. It's janky and criterion would probably be better but it works. This should bring the Rust fib in line with the C one; I'd love to test personally but I don't currently have the time to figure out the system that the Julia repository is using to run them (trying to load libraries from inside the source tree and all that).

This change would cause a regression in parse_int, but switching the assert inside its hot loop to a debug_assert prevents the regression though I'm not entirely certain why.

+3 -3

3 comments

1 changed file

saethlin

pr closed time in 9 days

pull request commentEnet4/julia-bench-rs

Improve fib, prevent regression in parse_int

Doing some housekeeping on my open PRs. No idea how I lost track of this one, but I agree with the feedback. Nothing to see here.

saethlin

comment created time in 9 days

pull request commentabidrahmank/OpenCV2-Python-Tutorials

Remove use of eval() in template matching

Just doing some housekeeping on my open PRs. (I'd still advise making this change, but it's been years since I opened this)

saethlin

comment created time in 9 days

PR closed billy210/whatever

Carry headers from original data
+1 -1

0 comment

1 changed file

saethlin

pr closed time in 9 days

pull request commentSWystub/Gravastar

adding numba.vectorize instead of numpy.vectorize

Doing some housekeeping on my open PRs.

saethlin

comment created time in 9 days

PR closed SWystub/Gravastar

adding numba.vectorize instead of numpy.vectorize

I'm seeing ~50% speed increase on compute_density, close to 25% overall. This does add another dependency but if you don't have numba, you should really fix that.

I've poked around using @numba.jit on your other functions and it can be done with a bit of refactoring but the compile time per run of anicomp.py outpaces the speedup.

+4 -4

1 comment

1 changed file

saethlin

pr closed time in 9 days

more