profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/Nadrieril/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.

dhall-lang/dhall-lang 3269

Maintainable configuration files

Nadrieril/dhall-rust 221

Maintainable configuration files, for Rust users

Ekleog/todiff 5

A differ for todo.txt files

Nadrieril/improved_slice_patterns 1

Match on `Vec`s and iterators using the syntax of slice_patterns, taking ownership

Faerix/family-tree 0

Visualisation de l'arbre généalogique de FaëriX

Nadrieril/abnf 0

A nom-based ABNF parser.

Nadrieril/angular-puzzle15 0

A little puzzle game in AngularJS

Nadrieril/apertium-pluralize 0

Gets the singular and plural forms of a word/group of words

pull request commentrust-lang/rust

Add an intermediate representation to exhaustiveness checking

Last perf run before this is reviewable :crossed_fingers:

@bors try @rust-timer queue

Nadrieril

comment created time in 12 hours

push eventNadrieril/rust

Nadrieril

commit sha 071955ff75047262516ce91d962dd285e07ce9dd

Don't cache `Fields::wildcards` `DeconstructedPat` made this caching a lot less useful, so we remove it for clarity's sake. The perf impact is negligible.

view details

push time in 12 hours

issue commentrust-lang/rust

Diagnostics emitted for disallowed exhaustive matches on types that contain a `usize` lack information about why the match cannot be considered exhaustive

Hm, even though usize has a different size on different architectures, 0..usize::MAX should always be exhaustive, right? Then that code would be accepted, but the following would still error:

match 0usize {
  0 => {}
  1..=18446744073709551615 => {}
}

We could have the error for this say "missing pattern: 18446744073709551616..=usize::MAX", which would also work if there's a Some around it.

That said, pretty sure what you describe also happens for non_exhaustive enums too, and there we'll want to do what you suggest.

PatchMixolydic

comment created time in 13 hours

PR closed rust-lang/rust

Remove premature optimization in exhaustiveness checking T-compiler S-waiting-on-review A-exhaustiveness-checking perf-regression

There are some optimizations that I never measured but add a lot of complexity, so let's see if they're worth it.

r? @ghost

+133 -170

15 comments

3 changed files

Nadrieril

pr closed time in 13 hours

pull request commentrust-lang/rust

Remove premature optimization in exhaustiveness checking

Closing in favor of https://github.com/rust-lang/rust/pull/88950

Nadrieril

comment created time in 13 hours

push eventNadrieril/rust

Nadrieril

commit sha c7ca94039b01bdf9ff8f2b9083e01285453d8c01

Replace `Pat` with a new intermediate representation

view details

Nadrieril

commit sha 6686fbae503ea3d3f99a4889f6fc35bd1daa4403

A for loop is a lot faster apparently

view details

push time in 19 hours

pull request commentrust-lang/rust

[Experiment] Add an intermediate representation to exhaustiveness checking

Cleaned up, let's test again

@bors try @rust-timer queue

Nadrieril

comment created time in a day

push eventNadrieril/rust

Nadrieril

commit sha f744453b6ccf54d5f5e3fd5896717698a34e77be

Rework `Fields` internals. Now `Fields` is just a `Vec` of patterns, with some extra info on the side to reconstruct patterns when needed. This emphasizes that this extra info is not central to the algorithm.

view details

Nadrieril

commit sha 5d09c091327218a1b787a609fe78beac17607df7

Remove premature shortcutting

view details

Nadrieril

commit sha f7057fc41a64d26f96aef69d0e765948b0e7cc75

Remove some unreachable code

view details

Nadrieril

commit sha c94c7fe92025cc791f1b8ddca7fc9982130c9ae0

Always report reachability for user-supplied patterns

view details

Nadrieril

commit sha 1aa18b18f923bd655a2cc7c472f1bed8b8ce7c5a

Cleanup the reporting of unreachable patterns

view details

Nadrieril

commit sha f8d544c592d74192377c4afb7dd547ac3f5a980c

Move special `&str` handling to `Constructor` and `Fields`

view details

Nadrieril

commit sha 5cb0656f6904f04b222afbc428322e5db0f953c2

Remove dependency of `SubPatSet` on `Pat`

view details

Nadrieril

commit sha 208ff58c966bd494bba197f03a44a4662db1e825

Replace `Pat` with a new intermediate representation

view details

Nadrieril

commit sha 3d98b9305a4121268b0b97d5fb8e599c34f88b9f

A for loop is a lot faster apparently

view details

push time in a day

push eventNadrieril/rust

Nadrieril

commit sha bf1848d8a58e5ed70b016bc1039ca26e9941b6e8

Add tests

view details

Nadrieril

commit sha 2fbde12c4bf8fd7bf0b0866a2f645254429cd0e4

Rework `Fields` internals. Now `Fields` is just a `Vec` of patterns, with some extra info on the side to reconstruct patterns when needed. This emphasizes that this extra info is not central to the algorithm.

view details

Nadrieril

commit sha de92d0b3b206d1a7a5740052dc2c65d94ee623df

Remove premature shortcutting

view details

Nadrieril

commit sha dc626d6f6ee878f11c00e6936b18061dc068bf36

Remove some unreachable code

view details

Nadrieril

commit sha 37c74a69e5f82325e81b08e2d9371d533853f4fa

Always report reachability for user-supplied patterns

view details

Nadrieril

commit sha ec2430d892162f119099e5a848a0d136b384c1f9

Cleanup the reporting of unreachable patterns

view details

Nadrieril

commit sha ccd17306f8ac2051e95fa32ebd264b46d06b4277

Move special `&str` handling to `Constructor` and `Fields`

view details

Nadrieril

commit sha b44f308153af40a18952440cd7d62c7387cdb371

Remove dependency of `SubPatSet` on `Pat`

view details

Nadrieril

commit sha 72aa9a2dff1c5e1422bb77e92d667b4199838417

Replace `Pat` with a new intermediate representation

view details

Nadrieril

commit sha 4b7198cea9c823d906f669a12e57a67613ff6cbe

A for loop is a lot faster apparently

view details

push time in a day

pull request commentrust-lang/rust

Fix: non_exhaustive_omitted_patterns by filtering unstable and doc hidden variants

@DevinR528 if you're curious, my general rules for splitting commits: each commit should compile and make sense on its own (I also commit the test outputs and that stage), and if two changes make sense individually I commit them separately. So I often end up with a ton of small commits ^^'. I haven't completely figured out how to limit that

DevinR528

comment created time in 2 days

pull request commentrust-lang/rust

Fix: non_exhaustive_omitted_patterns by filtering unstable and doc hidden variants

Woo, great! LGTM.

I expect a perf degradation because of the extra stability test. The doc(hidden) test is on a diagnostics-only path so won't matter. I expect that match-stress-enum will particularly suffer because it has a ton of variants. Given that this is a correctness fix we might have to accept the perf regression anyway.

@bors try @rust-timer queue

DevinR528

comment created time in 2 days

issue openedrust-analyzer/rust-analyzer

Inline function assist doesn't update `Self`

If I run the inline function assist on the call of Foo::bar() in the following:

struct Foo;

impl Foo {
    fn foo() {}
    fn bar() {
        Self::foo()
    }
}

fn main() {
    Foo::bar()
}

I get:

fn main() {
    Self::foo()
}

which fails to compile. I would like to get Foo::foo() instead.

PS: much love to this awesome project, y'all have built an excellent tool :heart:

created time in 4 days

pull request commentrust-lang/rust

Fix: non_exhaustive_omitted_patterns by filtering unstable and doc hidden variants

Btw I'm only revieweing the logic, I don't feel competent to review the actual diagnostic change. Actually, could you add the tests first, so we see the diagnostic changes in the following commits?

DevinR528

comment created time in 4 days

pull request commentrust-lang/rust

Fix: non_exhaustive_omitted_patterns by filtering unstable and doc hidden variants

Nice, that was quick! I'd just ask for separate tests for the unstable part and the doc(hidden) part. It's cleaner to define our enum than to rely on ErrorKind since it will change over time.

unstable is tricky because it can normally only be defined within std. This seems to work:

#![feature(staged_api)]
#![stable(feature = "stable_test_feature", since = "1.0.0")]

#[unstable(feature = "unstable_test_feature", issue = "none")]
pub enum Foo {
	...
}

Look at e.g. src/test/ui/pattern/usefulness/empty-match.rs and src/test/ui/pattern/usefulness/auxiliary/empty.rs for how to use an external file (which will be compiled as a different crate) in a test.

DevinR528

comment created time in 4 days

issue commentrust-lang/rust

New non_exhaustive_omitted_patterns lint exposes unstable and hidden enum variants.

Yeah, I don't know what's the decision process for a small change in a lint message. I'll let whoever got assigned to that PR decide I guess ^^

m-ou-se

comment created time in 4 days

Pull request review commentrust-lang/rust

Fix: non_exhaustive_omitted_patterns by filtering unstable and doc hidden variants

 impl<'p, 'tcx> Usefulness<'p, 'tcx> {                         // constructor, that matches everything that can be built with                         // it. For example, if `ctor` is a `Constructor::Variant` for                         // `Option::Some`, we get the pattern `Some(_)`.-                        split_wildcard-                            .iter_missing(pcx)-                            .map(|missing_ctor| {-                                Fields::wildcards(pcx, missing_ctor).apply(pcx, missing_ctor)-                            })-                            .collect()+                        let mut new = vec![];+                        for missing_ctor in split_wildcard.iter_missing(pcx) {+                            if let Constructor::Variant(idx) = missing_ctor {+                                if let ty::Adt(adt, _) = pcx.ty.kind() {+                                    if pcx+                                        .cx+                                        .tcx+                                        .get_attrs(adt.variants[*idx].def_id)+                                        .iter()+                                        .find_map(|attr| {+                                            if attr.has_name(sym::doc) {+                                                attr.meta_item_list()+                                            } else {+                                                None+                                            }+                                        })+                                        .map(|items| {+                                            items+                                                .iter()+                                                .find(|item| item.has_name(sym::hidden))+                                                .is_some()+                                        })+                                        .unwrap_or_default()+                                    {+                                        new = vec![Pat::wildcard_from_ty(pcx.ty)];

This logic won't do what we want for

match Foo::A {
	Foo::A => {}
}

We probably want to just skip the hidden variants here, and add a wildcard at the end if we skipped anything

DevinR528

comment created time in 4 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust

Fix: non_exhaustive_omitted_patterns by filtering unstable and doc hidden variants

+#![feature(io_error_more)]++enum Foo {+    A,+    B,+    #[doc(hidden)]+    C,+}++fn main() {+    #[deny(non_exhaustive_omitted_patterns)]+    match std::io::ErrorKind::Other {+        std::io::ErrorKind::NotFound => {}+        std::io::ErrorKind::PermissionDenied => {}+        std::io::ErrorKind::ConnectionRefused => {}+        std::io::ErrorKind::ConnectionReset => {}+        std::io::ErrorKind::ConnectionAborted => {}+        std::io::ErrorKind::NotConnected => {}+        std::io::ErrorKind::AddrInUse => {}+        std::io::ErrorKind::AddrNotAvailable => {}+        std::io::ErrorKind::BrokenPipe => {}+        std::io::ErrorKind::AlreadyExists => {}+        std::io::ErrorKind::WouldBlock => {}+        std::io::ErrorKind::InvalidInput => {}+        std::io::ErrorKind::InvalidData => {}+        std::io::ErrorKind::TimedOut => {}+        std::io::ErrorKind::WriteZero => {}+        std::io::ErrorKind::Interrupted => {}+        std::io::ErrorKind::Other => {}+        std::io::ErrorKind::UnexpectedEof => {}+        std::io::ErrorKind::Unsupported => {}+        std::io::ErrorKind::OutOfMemory => {}+        // All stable variants are above and unstable in `_`+        _ => {}+    }+    //~^^ some variants are not matched explicitly++    match Foo::A {+        Foo::A => {}+        Foo::B => {}+    }+    //~^^^^ non-exhaustive patterns: `_` not covered++    match Foo::A {+        Foo::A => {}+        Foo::C => {}+    }+    //~^^^^ non-exhaustive patterns: `B` not covered

Could you also add

    match Foo::A {
        Foo::A => {}
    }
DevinR528

comment created time in 4 days

PullRequestReviewEvent

issue commentrust-lang/rust

New non_exhaustive_omitted_patterns lint exposes unstable and hidden enum variants.

Yeah exactly! Thanks for the detailed example. What should we do for the following?

match Foo::A {
    Foo::A => {}
}

I think "patterns B and _ not covered" is better than just "pattern _ not covered" even though it looks a bit weird. Maybe "patterns B and others not covered"?

I didn't know we could doc(hidden) a struct field, but if so then we can do something similar there yeah.

I don't feel competent to make that decision though. @m-ou-se do you know who I could ask something like that?

m-ou-se

comment created time in 5 days

push eventNadrieril/rust

Nadrieril

commit sha 9eef2660bb5ed67c70dc3d59b42dd3765afed467

oops

view details

push time in 6 days

issue commentrust-lang/rust

New non_exhaustive_omitted_patterns lint exposes unstable and hidden enum variants.

We'll want to completely ignore those variants even for exhaustiveness checking, so it's best to just not list unstable variants in SplitWildcard::new(). doc(hidden) is more subtle because as you say we don't want to change the logic in that case. But I think we can still omit them from the lints. For that we can do like you did in apply_constructor in your previous PR: filter out those variants from the witnesses list, and replace them with a _.

m-ou-se

comment created time in 6 days

pull request commentrust-lang/rust

[Experiment] Add an intermediate representation to exhaustiveness checking

Oops, I confused rustc-timer, that's the benchmark for the previous branch head. Let's try again, I'm measuring only improvements locally.

@bors try @rust-timer queue

Nadrieril

comment created time in 6 days

pull request commentrust-lang/rust

[Experiment] Add an intermediate representation to exhaustiveness checking

Huh ok I found the main issue; commit 180204f (#88950) fixes it. Apparently changing from an explicit for loop to the equivalent iterator expression killed perf specifically for match-stress-enum. The rest of the regression was because cloning my new struct is slower than copying a ref, so I arena-allocated my struct too. I don't know how to stop the timer, let's hope rescheduling does it.

@bors try @rust-timer queue

Nadrieril

comment created time in 6 days

push eventNadrieril/rust

Nadrieril

commit sha 93bda19aec4296f306725bbbf72037e61bd50ff0

--- Deconstruct all patterns in `PatStack`

view details

Nadrieril

commit sha 7480775abdf726518ba27984546f9a48cd4c5ab0

--- Do everything through `head_dpat()`

view details

Nadrieril

commit sha d2fbae89de2920c153a28cb4aa65795d2f8672d2

rename

view details

Nadrieril

commit sha 6398ec645eff69db37f0e5427ce04c01d44f57a3

+++ Split patterns into ctor and fields _before_ storing in the matrix

view details

Nadrieril

commit sha 399fafe534163ae8c8f9e15b2c3c345920f984d1

Use dpats some more

view details

Nadrieril

commit sha c107b6a45671d9e08b5593f0ad30ec887a9a382c

++ Mostly get rid of DeconstructedPat::pat

view details

Nadrieril

commit sha 217d43c78182c2109705e74737f2afe7ecf01f66

+ Entirely remove the dependence of DeconstructedPat on Pat

view details

Nadrieril

commit sha 49f11ee196bc34351d438e8633c8e2b36d4c09ef

Use `DeconstructedPat` for witnesses too

view details

Nadrieril

commit sha 511c07359e95a98f802cd109c2003ba6afaec704

Use DeconstructedPat in check_match

view details

Nadrieril

commit sha a39585ac7c4c60863ed3ee97330533009422c6e4

Use DeconstructedPat everywhere

view details

Nadrieril

commit sha 0018552b331c44f70b7fe983746bc31347b5ef30

Move a function

view details

Nadrieril

commit sha fbc4ab146b72e9b20953441d1be7aceea2c82ecc

Fuse `fold_pattern` and `DeconstructedPat::from_pat`

view details

Nadrieril

commit sha ec018fa870ac999b7a6f6d78e947c8f05b82b08a

Avoid some clones

view details

Nadrieril

commit sha 3170a28cf064b92c8dea20b5866708eaee3f426e

Replace `DPat::to_pat` with a clever `Display` impl

view details

Nadrieril

commit sha 3624890b3318ac4698f7796171430858a1799d29

++ Store PatStack fields in the arena This allows copying of the fields which should speed up PatStack operations

view details

Nadrieril

commit sha 54033adbf993e148663055d4090585293cc662b7

Add a lifetime to `Fields`

view details

Nadrieril

commit sha 1b0a831279b0a55ecea590832e3ec33aaa48b825

++ Allocate all patterns on the arena

view details

Nadrieril

commit sha 3ddf194d32414c745e7c4fc624e95d8ef5bcf118

Improve error message

view details

Nadrieril

commit sha 153439b9195b984ccfa5891b8657a82b9381abf6

tweak

view details

Nadrieril

commit sha 180204f0e8f27ceb2c34ca62c82cf131c43416c7

+++ Fix perf regression

view details

push time in 6 days

pull request commentrust-lang/rust

[Experiment] Add an intermediate representation to exhaustiveness checking

Ok, some progress. My local measurements differ quite a bit from perf here, so I want to see what it says now.

@bors try @rust-timer queue

Nadrieril

comment created time in 7 days

push eventNadrieril/rust

Fabian Wolff

commit sha 4e76c3820fea97e06f08555d4eeee3de3be4eb5a

Fix ICE in `improper_ctypes_definitions` lint with all-ZST transparent types

view details

Joshua Nelson

commit sha 56511924606ab8791a50822952e3101e8030fe8e

Remove unnecessary copies when using parallel IO Previously, rustdoc was making lots of copies of temporary owned values. Now, it uses the owned value wherever possible.

view details

piegames

commit sha ced597edb7e154092efde9df975ee76f9642a200

Add TcpListener::into_incoming and IntoIncoming The `incoming` method is really useful, however for some use cases the borrow this introduces is needlessly restricting. Thus, an owned variant is added.

view details

Mara Bos

commit sha 3caf0bcdeb9546bd8a3ab58c0e33baabdcaac75a

Accept `m!{ .. }.method()` and `m!{ .. }?` statements.

view details

Mara Bos

commit sha ebf12529dfa62cf463de4fd5e1355e8ea4fe0559

Add test for braced-macro followed by `.` or `?`.

view details

Esteban Kuber

commit sha b82ec362ca14a6c369b1999bdd40150b60567c96

Recover from `Foo(a: 1, b: 2)` Detect likely `struct` literal using parentheses as delimiters and emit targeted suggestion instead of type ascription parse error. Fix #61326.

view details

danakj

commit sha ce35f8ec56ec7e89d351cd95001f4d819c97e07d

remap-cwd-prefix

view details

danakj

commit sha 2a687deee872917b09519519290521fa8dd472b7

Move documentation to the unstable book

view details

bjorn3

commit sha a4a22f07d79b1a2adc6e59811ebfbcd8b2cf21a4

Doc comments

view details

bjorn3

commit sha 58000ed0e9152e331dc7c7319c7783cc7f028f84

Move get_tools_search_paths from FileSearch to Session It only uses fields of FileSearch that are stored in Session too

view details

bjorn3

commit sha d7ef0b30e89960aede88bf450e4a2172332432e0

Use Lrc instead of Option to avoid duplication of a SearchPath

view details

Deadbeef

commit sha 9c1a91628bb502deec644173d21830822a0f786a

cleanup hir hack

view details

Deadbeef

commit sha d9797d23d5e03aeafeac4eed6e147045af65783b

Remove unused query

view details

Deadbeef

commit sha 104e40fb740155f7dbd471f1550800ae458c672b

Const dropping

view details

Deadbeef

commit sha 9125fbfd60afd9dafca843857498232503be365a

Do not lint for ~const Drop bounds

view details

Deadbeef

commit sha f6f5180d5fef3b3a4cc8a383eb20b83716935e6a

Add a simple test case

view details

Deadbeef

commit sha 48a3ba9a335987cfae90dec92b08a8833e12ba07

fmt

view details

Deadbeef

commit sha 894ce921a091cb9252fd9d72f1c97b3996e3501c

better test

view details

Deadbeef

commit sha a13b13ff46b2d669f0d7a8e024938366fb4a3281

Const drop selection candidates

view details

Deadbeef

commit sha 4eab5c1f7b672b2d59328e24e05bc191e448d7d9

Failing test

view details

push time in 7 days

issue commentrust-lang/rust

New non_exhaustive_omitted_patterns lint exposes unstable and hidden enum variants.

Is there an enum in std that has #[unstable] variants but isn't #[non_exhaustive] by any chance?

m-ou-se

comment created time in 7 days

pull request commentrust-lang/rust

Add non_exhaustive_omitted_patterns lint related to rfc-2008-non_exhaustive

Ah well that's on me. I assumed that the exhaustiveness code already handled those variants in the expected way so I didn't double-check. Shouldn't be too hard to solve thankfully

DevinR528

comment created time in 7 days

pull request commentrust-lang/rust

[Experiment] Add an intermediate representation to exhaustiveness checking

It's weird though, because patterns used to be lowered already via a PatternFolder, which I imagine traverses everythings and reallocates. So I didn't expect that my new lowering would be much slower

Nadrieril

comment created time in 9 days