-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rollup of 11 pull requests #122466
Rollup of 11 pull requests #122466
Commits on Mar 1, 2024
-
Give
TRACK_DIAGNOSTIC
a return value.This means `DiagCtxtInner::emit_diagnostic` can return its result directly, rather than having to modify a local variable.
Configuration menu - View commit details
-
Copy full SHA for bf62d59 - Browse repository at this point
Copy the full SHA bf62d59View commit details -
Inline and remove
Level::get_diagnostic_id
.It has a single call site, and this will enable subsequent refactorings.
Configuration menu - View commit details
-
Copy full SHA for ecd3718 - Browse repository at this point
Copy the full SHA ecd3718View commit details -
Move
DelayedBug
handling into thematch
.It results in a tiny bit of duplication (another `self.treat_next_err_as_bug()` condition) but I think it's worth it to get more code into the main `match`.
Configuration menu - View commit details
-
Copy full SHA for 272e60b - Browse repository at this point
Copy the full SHA 272e60bView commit details -
Reorder
has_future_breakage
handling.This will enable additional refactorings.
Configuration menu - View commit details
-
Copy full SHA for c81767e - Browse repository at this point
Copy the full SHA c81767eView commit details -
Move
Expect
/ForceWarning
handling into thematch
.Note that `self.suppressed_expected_diag` is no longer set for `ForceWarning`, which is good. Nor is `TRACK_DIAGNOSTIC` called for `Allow`, which is also good.
Configuration menu - View commit details
-
Copy full SHA for aec4bdb - Browse repository at this point
Copy the full SHA aec4bdbView commit details -
Add comments about
TRACK_DIAGNOSTIC
use.Also add an assertion for the levels allowed with `has_future_breakage`.
Configuration menu - View commit details
-
Copy full SHA for a7d9262 - Browse repository at this point
Copy the full SHA a7d9262View commit details -
Make the
match
inemit_diagnostic
complete.This match is complex enough that it's a good idea to enumerate every variant. This also means `can_be_top_or_sub` can just be `can_be_subdiag`.
Configuration menu - View commit details
-
Copy full SHA for 7ef605b - Browse repository at this point
Copy the full SHA 7ef605bView commit details
Commits on Mar 3, 2024
-
Configuration menu - View commit details
-
Copy full SHA for d561a84 - Browse repository at this point
Copy the full SHA d561a84View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9aac0c9 - Browse repository at this point
Copy the full SHA 9aac0c9View commit details
Commits on Mar 6, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 408c0ea - Browse repository at this point
Copy the full SHA 408c0eaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 71080dd - Browse repository at this point
Copy the full SHA 71080ddView commit details
Commits on Mar 10, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 15b71f4 - Browse repository at this point
Copy the full SHA 15b71f4View commit details
Commits on Mar 12, 2024
-
rustdoc-search: parse and search with ML-style HOF
Option::map, for example, looks like this: option<t>, (t -> u) -> option<u> This syntax searches all of the HOFs in Rust: traits Fn, FnOnce, and FnMut, and bare fn primitives.
Configuration menu - View commit details
-
Copy full SHA for 7f427f8 - Browse repository at this point
Copy the full SHA 7f427f8View commit details -
rustdoc: clean up search.js by removing empty sort case
It's going to be a no-op on the empty list anyway (we have plenty of test cases that return nothing) so why send extra code?
Configuration menu - View commit details
-
Copy full SHA for d38527e - Browse repository at this point
Copy the full SHA d38527eView commit details -
rustdoc: use
const
for the special type name idsInitialize them before the search index is loaded.
Configuration menu - View commit details
-
Copy full SHA for 23e931f - Browse repository at this point
Copy the full SHA 23e931fView commit details -
rustdoc-search: add search query syntax
Fn(T) -> U
This is implemented, in addition to the ML-style one, because Rust does it. If we don't, we'll never hear the end of it. This commit also refactors some duplicate parts of the parser into a dedicated function.
Configuration menu - View commit details
-
Copy full SHA for 7b92655 - Browse repository at this point
Copy the full SHA 7b92655View commit details -
Add methods to create constants
I've been experimenting with transforming the StableMIR to instrument the code with potential UB checks. The modified body will only be used by our analysis tool, however, constants in StableMIR must be backed by rustc constants. Thus, I'm adding a few functions to build constants, such as building string and other primitives.
Configuration menu - View commit details
-
Copy full SHA for c076509 - Browse repository at this point
Copy the full SHA c076509View commit details -
Configuration menu - View commit details
-
Copy full SHA for 893a910 - Browse repository at this point
Copy the full SHA 893a910View commit details -
Configuration menu - View commit details
-
Copy full SHA for a38a556 - Browse repository at this point
Copy the full SHA a38a556View commit details
Commits on Mar 13, 2024
-
Various style improvements to
rustc_lint::levels
- Replace some nested if-let with let-chains - Tweak a match pattern to allow shorthand struct syntax - Fuse an `is_empty` check with getting the last element - Merge some common code that emits `MalformedAttribute` and continues - Format `"{tool}::{name}"` in a way that's consistent with other match arms - Replace if-let-else-panic with let-else - Use early-exit to flatten a method body
Configuration menu - View commit details
-
Copy full SHA for f2fcfe8 - Browse repository at this point
Copy the full SHA f2fcfe8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 90acda1 - Browse repository at this point
Copy the full SHA 90acda1View commit details -
Configuration menu - View commit details
-
Copy full SHA for f10ebfe - Browse repository at this point
Copy the full SHA f10ebfeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 44b1f8a - Browse repository at this point
Copy the full SHA 44b1f8aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 31fa142 - Browse repository at this point
Copy the full SHA 31fa142View commit details -
Configuration menu - View commit details
-
Copy full SHA for 71ef9e2 - Browse repository at this point
Copy the full SHA 71ef9e2View commit details -
Move generate_stacktrace_from_stack away from InterpCx to avoid havin…
…g to know the `Machine` type
Configuration menu - View commit details
-
Copy full SHA for bd7580b - Browse repository at this point
Copy the full SHA bd7580bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7aee665 - Browse repository at this point
Copy the full SHA 7aee665View commit details -
Configuration menu - View commit details
-
Copy full SHA for ffaf082 - Browse repository at this point
Copy the full SHA ffaf082View commit details -
Configuration menu - View commit details
-
Copy full SHA for 66a46bb - Browse repository at this point
Copy the full SHA 66a46bbView commit details -
Configuration menu - View commit details
-
Copy full SHA for af59eec - Browse repository at this point
Copy the full SHA af59eecView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a1a6fa - Browse repository at this point
Copy the full SHA 2a1a6faView commit details -
Rename some things around validation error reporting to signal that i…
…t is in fact about validation failures
Configuration menu - View commit details
-
Copy full SHA for 3393227 - Browse repository at this point
Copy the full SHA 3393227View commit details -
Configuration menu - View commit details
-
Copy full SHA for 514b274 - Browse repository at this point
Copy the full SHA 514b274View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1bde828 - Browse repository at this point
Copy the full SHA 1bde828View commit details -
Configuration menu - View commit details
-
Copy full SHA for be33586 - Browse repository at this point
Copy the full SHA be33586View commit details -
Configuration menu - View commit details
-
Copy full SHA for d3cab9f - Browse repository at this point
Copy the full SHA d3cab9fView commit details
Commits on Mar 14, 2024
-
Rollup merge of rust-lang#104353 - clarfonthey:cstr-bytes-iter, r=cuv…
…iper Add CStr::bytes iterator See rust-lang/libs-team#135 for an ACP. Since rust-lang/libs-team#134 was also accepted, this type is now `core::ffi::c_str::Bytes` instead of `core::ffi::CStrBytes`.
Configuration menu - View commit details
-
Copy full SHA for d87d02b - Browse repository at this point
Copy the full SHA d87d02bView commit details -
Rollup merge of rust-lang#114038 - Stargateur:108277, r=ChrisDenton
unix time module now return result First try to fix rust-lang#108277 without break anything. if anyone who read this know tips to be able to check compilation for different target I could use some help. So far I installed many target with rustup but `./x check --all-targets` doesn't seem to use them. TODO: - [x] better error - [ ] test, how ? `@rustbot` label -S-waiting-on-author +S-waiting-on-review
Configuration menu - View commit details
-
Copy full SHA for b335496 - Browse repository at this point
Copy the full SHA b335496View commit details -
Rollup merge of rust-lang#119676 - notriddle:notriddle/rustdoc-search…
…-hof, r=GuillaumeGomez rustdoc-search: search types by higher-order functions This feature extends rustdoc with syntax and search index information for searching function pointers and closures (Higher-Order Functions, or HOF). Part of rust-lang#60485 This PR adds two syntaxes: a high-level one for finding any kind of HOF, and a direct implementation of the parenthesized path syntax that Rust itself uses. ## Preview pages | Query | Results | |-------|---------| | [`option<T>, (fnonce (T) -> bool) -> option<T>`][optionfilter] | `Option::filter` | | [`option<T>, (T -> bool) -> option<T>`][optionfilter2] | `Option::filter` | Updated chapter of the book: https://notriddle.com/rustdoc-html-demo-9/search-hof/rustdoc/read-documentation/search.html [optionfilter]: https://notriddle.com/rustdoc-html-demo-9/search-hof/std/vec/struct.Vec.html?search=option<T>%2C+(fnonce+(T)+->+bool)+->+option<T>&filter-crate=std [optionfilter2]: https://notriddle.com/rustdoc-html-demo-9/search-hof/std/vec/struct.Vec.html?search=option<T>%2C+(T+->+bool)+->+option<T>&filter-crate=std ## Motivation When type-based search was first landed, it was directly [described as incomplete][a comment]. [a comment]: rust-lang#23289 (comment) Filling out the missing functionality is going to mean adding support for more of Rust's [type expression] syntax, such as references, raw pointers, function pointers, and closures. This PR adds function pointers and closures. [type expression]: https://doc.rust-lang.org/reference/types.html#type-expressions There's been demand for something "like Hoogle, but for Rust" expressed a few times [1](https://www.reddit.com/r/rust/comments/y8sbid/is_there_a_website_like_haskells_hoogle_for_rust/) [2](https://users.rust-lang.org/t/rust-equivalent-of-haskells-hoogle/102280) [3](https://internals.rust-lang.org/t/std-library-inclusion-policy/6852/2) [4](https://discord.com/channels/442252698964721669/448238009733742612/1109502307495858216). Some of them just don't realize what functionality already exists ([`Duration -> u64`](https://doc.rust-lang.org/nightly/std/?search=duration%20-%3E%20u64) already works), but a lot of them specifically want to search for higher-order functions like option combinators. ## Guide-level explanation (from the Rustdoc book) To search for a function that accepts a function as a parameter, like `Iterator::all`, wrap the nested signature in parenthesis, as in [`Iterator<T>, (T -> bool) -> bool`][iterator-all]. You can also search for a specific closure trait, such as `Iterator<T>, (FnMut(T) -> bool) -> bool`, but you need to know which one you want. [iterator-all]: https://notriddle.com/rustdoc-html-demo-9/search-hof/std/vec/struct.Vec.html?search=Iterator<T>%2C+(T+->+bool)+->+bool&filter-crate=std ## Reference-level description (also from the Rustdoc book) ### Primitives with Special Syntax <table> <thead> <tr> <th>Shorthand</th> <th>Explicit names</th> </tr> </thead> <tbody> <tr><td colspan="2">Before this PR</td></tr> <tr> <td><code>[]</code></td> <td><code>primitive:slice</code> and/or <code>primitive:array</code></td> </tr> <tr> <td><code>[T]</code></td> <td><code>primitive:slice<T></code> and/or <code>primitive:array<T></code></td> </tr> <tr> <td><code>!</code></td> <td><code>primitive:never</code></td> </tr> <tr> <td><code>()</code></td> <td><code>primitive:unit</code> and/or <code>primitive:tuple</code></td> </tr> <tr> <td><code>(T)</code></td> <td><code>T</code></td> </tr> <tr> <td><code>(T,)</code></td> <td><code>primitive:tuple<T></code></td> </tr> <tr><td colspan="2">After this PR</td></tr> <tr> <td><code>(T, U -> V, W)</code></td> <td><code>fn(T, U) -> (V, W)</code>, Fn, FnMut, and FnOnce</td> </tr> </tbody> </table> The `->` operator has lower precedence than comma. If it's not wrapped in brackets, it delimits the return value for the function being searched for. To search for functions that take functions as parameters, use parenthesis. ### Search query grammar ```ebnf ident = *(ALPHA / DIGIT / "_") path = ident *(DOUBLE-COLON ident) [BANG] slice-like = OPEN-SQUARE-BRACKET [ nonempty-arg-list ] CLOSE-SQUARE-BRACKET tuple-like = OPEN-PAREN [ nonempty-arg-list ] CLOSE-PAREN arg = [type-filter *WS COLON *WS] (path [generics] / slice-like / tuple-like) type-sep = COMMA/WS *(COMMA/WS) nonempty-arg-list = *(type-sep) arg *(type-sep arg) *(type-sep) [ return-args ] generic-arg-list = *(type-sep) arg [ EQUAL arg ] *(type-sep arg [ EQUAL arg ]) *(type-sep) normal-generics = OPEN-ANGLE-BRACKET [ generic-arg-list ] *(type-sep) CLOSE-ANGLE-BRACKET fn-like-generics = OPEN-PAREN [ nonempty-arg-list ] CLOSE-PAREN [ RETURN-ARROW arg ] generics = normal-generics / fn-like-generics return-args = RETURN-ARROW *(type-sep) nonempty-arg-list exact-search = [type-filter *WS COLON] [ RETURN-ARROW ] *WS QUOTE ident QUOTE [ generics ] type-search = [ nonempty-arg-list ] query = *WS (exact-search / type-search) *WS ; unchanged parts of the grammar, like the full list of type filters, are omitted ``` ## Future direction ### The remaining type expression grammar As described in rust-lang#118194, this is another step in the type expression grammar: BareFunction, and the function-like mode of TypePath, are now supported. * RawPointerType and ReferenceType actually are a priority. * ImplTraitType and TraitObjectType (and ImplTraitTypeOneBound and TraitObjectTypeOneBound) aren't as much of a priority, since they desugar pretty easily. ### Search subtyping and traits This is the other major factor that makes it less useful than it should be. * `iterator<result<t>> -> result<t>` doesn't find `Result::from_iter`. You have to search [`intoiterator<result<t>> -> result<t>`](https://notriddle.com/rustdoc-html-demo-9/search-hof/std/vec/struct.Vec.html?search=intoiterator%3Cresult%3Ct%3E%3E%20-%3E%20result%3Ct%3E&filter-crate=std). Nobody's going to search for IntoIterator unless they basically already know about it and don't need the search engine anyway. * Iterator combinators are usually structs that happen to implement Iterator, like `std::iter::Map`. To solve these cases, it needs to look at trait implementations, knowing that Iterator is a "subtype of" IntoIterator, and Map is a "subtype of" Iterator, so `iterator -> result` is a subtype of `intoiterator -> result` and `iterator<t>, (t -> u) -> iterator<u>` is a subtype of [`iterator<t>, (t -> u) -> map<t -> u>`](https://notriddle.com/rustdoc-html-demo-9/search-hof/std/vec/struct.Vec.html?search=iterator%3Ct%3E%2C%20(t%20-%3E%20u)%20-%3E%20map%3Ct%20-%3E%20u%3E&filter-crate=std).
Configuration menu - View commit details
-
Copy full SHA for 13b2c43 - Browse repository at this point
Copy the full SHA 13b2c43View commit details -
Rollup merge of rust-lang#120699 - nnethercote:rm-useless-TRACK_DIAGN…
…OSTIC-calls, r=oli-obk Document `TRACK_DIAGNOSTIC` calls. r? ````@cjgillot````
Configuration menu - View commit details
-
Copy full SHA for 7acaa32 - Browse repository at this point
Copy the full SHA 7acaa32View commit details -
Rollup merge of rust-lang#121899 - shepmaster:dead-code-docs, r=wesle…
…ywiser Document how removing a type's field can be bad and what to do instead Related to rust-lang#119645
Configuration menu - View commit details
-
Copy full SHA for 7e6d4e9 - Browse repository at this point
Copy the full SHA 7e6d4e9View commit details -
Rollup merge of rust-lang#121940 - veera-sivarajan:bugfix-121593, r=f…
…mease Mention Register Size in `#[warn(asm_sub_register)]` Fixes rust-lang#121593 Displays the register size information obtained from `suggest_modifier()` and `default_modifier()`.
Configuration menu - View commit details
-
Copy full SHA for fbfd486 - Browse repository at this point
Copy the full SHA fbfd486View commit details -
Rollup merge of rust-lang#122397 - oli-obk:machine-read-hook2, r=Ralf…
…Jung Various cleanups around the const eval query providers r? ````@RalfJung```` after this, working on running validation before interning starts with swapping the order of two lines of code
Configuration menu - View commit details
-
Copy full SHA for 0bb6e4c - Browse repository at this point
Copy the full SHA 0bb6e4cView commit details -
Rollup merge of rust-lang#122405 - celinval:smir-new-const, r=oli-obk
Add methods to create StableMIR constant I've been experimenting with transforming the StableMIR to instrument the code with potential UB checks. The modified body will only be used by our analysis tool, however, constants in StableMIR must be backed by rustc constants. Thus, I'm adding a few functions to build constants, such as building string and other primitives. One question I have is whether we should create a global allocation instead for strings. r? ```@oli-obk```
Configuration menu - View commit details
-
Copy full SHA for 206847a - Browse repository at this point
Copy the full SHA 206847aView commit details -
Rollup merge of rust-lang#122416 - Zalathar:levels, r=petrochenkov
Various style improvements to `rustc_lint::levels` While reading this file, I noticed a few opportunities to make things a little nicer: - Replace some nested if-let with let-chains - Tweak a match pattern to allow shorthand struct syntax - Fuse an `is_empty` check with getting the last element - Merge some common code that emits `MalformedAttribute` and continues - Format `"{tool}::{name}"` in a way that's consistent with other match arms - Replace if-let-else-panic with let-else - Use early-exit to flatten a method body Some of these changes cause indentation churn, so ignoring whitespace is recommended.
Configuration menu - View commit details
-
Copy full SHA for 012b5a0 - Browse repository at this point
Copy the full SHA 012b5a0View commit details -
Rollup merge of rust-lang#122440 - RalfJung:required-consts, r=oli-obk
const-eval: organize and extend tests for required-consts This includes some tests that are known-broken and hence disabled (due to rust-lang#107503). r? ```@oli-obk```
Configuration menu - View commit details
-
Copy full SHA for 2b1cd91 - Browse repository at this point
Copy the full SHA 2b1cd91View commit details -
Rollup merge of rust-lang#122461 - the8472:fix-step-forward-unchecked…
…, r=Amanieu fix unsoundness in Step::forward_unchecked for signed integers Fixes rust-lang#122420 ```rust pub fn foo(a: i8, b: u8) -> i8 { unsafe { a.checked_add_unsigned(b).unwrap_unchecked() } } ``` still compiles down to a single arithmetic instruction ([godbolt](https://rust.godbolt.org/z/qsd3xYWfE)). But we may be losing some loop optimizations if llvm can no longer easily derive that it's a finite counted loop from the no-wrapping flags.
Configuration menu - View commit details
-
Copy full SHA for 787cb68 - Browse repository at this point
Copy the full SHA 787cb68View commit details