about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2022-02-04Update library/std/src/io/error/repr_bitpacked.rsThom Chiovoloni-1/+1
Co-authored-by: the8472 <the8472@users.noreply.github.com>
2022-02-04Fix comment typos noticed by code review.Thom Chiovoloni-2/+2
Co-authored-by: Ralf Jung <post@ralfj.de>
2022-02-04Address address comments, improve comments slightlyThom Chiovoloni-5/+20
2022-02-04Optimize io::error::Repr layout on 64 bit targets.Thom Chiovoloni-4/+364
2022-02-04Hide Repr details from io::Error, and rework `io::Error::new_const`.Thom Chiovoloni-269/+345
2022-02-04Auto merge of #93654 - RalfJung:miri, r=RalfJungbors-9/+9
update miri Fixes https://github.com/rust-lang/rust/issues/93355 r? `@ghost`
2022-02-04update miriRalf Jung-9/+9
2022-02-04Auto merge of #93645 - matthiaskrgr:rollup-eua2621, r=matthiaskrgrbors-123/+276
Rollup of 11 pull requests Successful merges: - #92735 (Add crate filter parameter in URL) - #93402 (Windows: Disable LLVM crash dialog boxes.) - #93508 (Add rustdoc info to jsondocck output) - #93551 (Add package.json in gitignore) - #93555 (Link `try_exists` docs to `Path::exists`) - #93585 (Missing tests for #92630) - #93593 (Fix ret > 1 bound if shadowed by const) - #93630 (clippy::perf fixes) - #93631 (rustc_mir_dataflow: use iter::once instead of Some().into_iter) - #93632 (rustdoc: clippy::complexity fixes) - #93638 (rustdoc: remove unused Hash impl) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-02-04Rollup merge of #93638 - notriddle:notriddle/unused-hash, r=GuillaumeGomezMatthias Krüger-1/+1
rustdoc: remove unused Hash impl
2022-02-04Rollup merge of #93632 - matthiaskrgr:rustdoclippy2, r=GuillaumeGomezMatthias Krüger-13/+7
rustdoc: clippy::complexity fixes clippy::map_flatten clippy::clone_on_copy clippy::useless_conversion clippy::needless_arbitrary_self_type
2022-02-04Rollup merge of #93631 - notriddle:notriddle/cleanup-some-into-iter, r=oli-obkMatthias Krüger-3/+2
rustc_mir_dataflow: use iter::once instead of Some().into_iter
2022-02-04Rollup merge of #93630 - matthiaskrgr:clipperf, r=oli-obkMatthias Krüger-9/+9
clippy::perf fixes single_char_pattern and to_string_in_format_args
2022-02-04Rollup merge of #93593 - JulianKnodt:master, r=oli-obkMatthias Krüger-32/+63
Fix ret > 1 bound if shadowed by const Prior to a change, it would only look at types in bounds. When it started looking for consts, shadowing type variables with a const would cause an ICE, so now defer looking at consts only if there are no types present. cc ``````@compiler-errors`````` Should Fix #93553
2022-02-04Rollup merge of #93585 - tamaroning:add_tests_for_92630, r=m-ou-seMatthias Krüger-0/+24
Missing tests for #92630 fixes #93143
2022-02-04Rollup merge of #93555 - ChrisDenton:fs-try-exists-doc, r=Mark-SimulacrumMatthias Krüger-2/+6
Link `try_exists` docs to `Path::exists` Links to the existing `Path::exists` method from both `std::Path::try_exists` and `std::fs:try_exists`. Tracking issue for `path_try_exists`: #83186
2022-02-04Rollup merge of #93551 - GuillaumeGomez:ignore-package-json, r=Mark-SimulacrumMatthias Krüger-0/+1
Add package.json in gitignore It happened a few times (last one is https://github.com/rust-lang/rust/pull/93537/files#r796757998) so I think it's fine to ignore this file to prevent it to happen again in the future. :) r? ```@Mark-Simulacrum```
2022-02-04Rollup merge of #93508 - CraftSpider:jsondocck-runtest-output, r=Mark-SimulacrumMatthias Krüger-5/+12
Add rustdoc info to jsondocck output Makes debugging issues in the generated output simpler by handling emitted logs and etc.
2022-02-04Rollup merge of #93402 - ehuss:llvm-dialog, r=michaelwoeristerMatthias Krüger-0/+11
Windows: Disable LLVM crash dialog boxes. This disables the crash dialog box on Windows. When LLVM hits an assertion, it will open a dialog box with Abort/Retry/Ignore. This is annoying on CI because CI will just hang until it times out (which can take hours). Instead of opening a dialog box, it will print a message like this: ``` Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file D:\Proj\rust\rust\src\llvm-project\llvm\include\llvm/Support/Casting.h, line 255 ``` Closes #92829
2022-02-04Rollup merge of #92735 - GuillaumeGomez:crate-filter-url-param, r=jshaMatthias Krüger-58/+140
Add crate filter parameter in URL Fixes #92621. r? `@jsha`
2022-02-03rustdoc: remove unused Hash implMichael Howell-1/+1
2022-02-03rustdoc: clippy::complexity fixesMatthias Krüger-13/+7
clippy::map_flatten clippy::clone_on_copy clippy::useless_conversion clippy::needless_arbitrary_self_type
2022-02-03Add GUI test for crate filter URL parameterGuillaume Gomez-0/+30
2022-02-03Update tester to have FILTER_CRATE set to null if undefined.Guillaume Gomez-0/+2
2022-02-03Add filter-crate URL parameterGuillaume Gomez-47/+97
2022-02-03rustc_mir_dataflow: use iter::once instead of Some().into_iterMichael Howell-3/+2
2022-02-03clippy::perf fixesMatthias Krüger-9/+9
single_char_pattern and to_string_in_format_args
2022-02-03Auto merge of #93621 - JohnTitor:rollup-1bcud0x, r=JohnTitorbors-105/+215
Rollup of 7 pull requests Successful merges: - #92310 (rustdoc: Fix ICE report) - #92802 (Deduplicate lines in long const-eval stack trace) - #93515 (Factor convenience functions out of main printer implementation) - #93566 (Make rustc use `RUST_BACKTRACE=full` by default) - #93589 (Use Option::then in two places) - #93600 (fix: Remove extra newlines from junit output) - #93606 (Correct incorrect description of preorder traversals) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-02-03Fix ret > 1 bound if shadowed by constkadmin-32/+63
Prior to a change, it would only look at types in bounds. When it started looking for consts, shadowing type variables with a const would cause an ICE, so now defer looking at consts only if there are no types present.
2022-02-03Only disable dialogs on CI.Eric Huss-1/+6
The "CI" environment var isn't universal (for example, I think Azure uses TF_BUILD). However, we are mostly concerned with rust-lang/rust's own CI which currently is GitHub Actions which does set "CI". And I think most other providers use "CI" as well.
2022-02-03Rollup merge of #93606 - JakobDegen:mischaracterized-preorder, r=oli-obkYuki Okushi-4/+6
Correct incorrect description of preorder traversals The internal documentation for the `Preorder` type gave an incorrect description (the description is not even correct for the example provided, since C is visited after one of its successors). This corrects the description, and adds in a sentence explaining more precisely how the traversals are performed.
2022-02-03Rollup merge of #93600 - last-partizan:fix-junit-formatter, r=yaahcYuki Okushi-2/+1
fix: Remove extra newlines from junit output This PR fixes extra newline in junit output https://github.com/rust-lang/rust/issues/93454
2022-02-03Rollup merge of #93589 - est31:option_then, r=cjgillotYuki Okushi-2/+2
Use Option::then in two places
2022-02-03Rollup merge of #93566 - Aaron1011:rustc-backtrace, r=davidtwcoYuki Okushi-0/+36
Make rustc use `RUST_BACKTRACE=full` by default Compiler panics should be rare - when they do occur, we want the report filed by the user to contain as much information as possible. This is especially important when the panic is due to an incremental compilation bug, since we may not have enough information to reproduce it. This PR sets `RUST_BACKTRACE=full` inside `rustc` if the user has not explicitly set `RUST_BACKTRACE`. This is more verbose than `RUST_BACKTRACE=1`, but this may make it easier to debug incremental compilation issues. Users who find this too verbose can still manually set `RUST_BACKTRACE` before invoking the compiler. This only affects `rustc` (and any tool using `rustc_driver::install_ice_hook`). It does *not* affect any user crates or the standard library - backtraces will continue to be off by default in any application *compiled* by rustc.
2022-02-03Rollup merge of #93515 - dtolnay:convenience, r=davidtwcoYuki Okushi-75/+78
Factor convenience functions out of main printer implementation The pretty printer in rustc_ast_pretty has a section of methods commented "Convenience functions to talk to the printer". This PR pulls those out to a separate module. This leaves pp.rs with only the minimal API that is core to the pretty printing algorithm. I found this separation to be helpful in https://github.com/dtolnay/prettyplease because it makes clear when changes are adding some fundamental new capability to the pretty printer algorithm vs just making it more convenient to call some already existing functionality.
2022-02-03Rollup merge of #92802 - compiler-errors:deduplicate-stack-trace, r=oli-obkYuki Okushi-1/+71
Deduplicate lines in long const-eval stack trace Lemme know if this is kinda overkill, lol. Fixes #92796
2022-02-03Rollup merge of #92310 - ehuss:rustdoc-ice, r=estebankYuki Okushi-21/+21
rustdoc: Fix ICE report The ICE report in rustdoc was confusing because it was returning an argument parse error: ``` thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1212:27 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: internal compiler error: unexpected panic error: Unrecognized option: 'crate-version' ``` This is because the ICE reporter was trying to parse the arguments as rustc, not rustdoc. Since an argument error is a fatal error, it was early-exiting with the argument error due to unwinding. This changes it to be a more primitive scan of the arguments. The arguments being checked are pretty simple, and only have a small handful of forms that are easy to check for. It now looks like this: ``` thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1212:27 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace error: internal compiler error: unexpected panic note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: rustc 1.59.0-dev running on x86_64-apple-darwin note: compiler flags: --crate-type lib -Z treat-err-as-bug note: some of the compiler flags provided by cargo are hidden query stack during panic: end of query stack ``` It still says `rustc`, but I can live with that.
2022-02-03Auto merge of #92932 - ouz-a:master, r=oli-obkbors-1/+19
Temporary fix for the layout of aligned enums Fix for the issue #92464 ~~I was after this issue for quite some time now, I have a temporary fix for it. I think the current problem is [here](https://github.com/ouz-a/rust/blob/e75f96763f99d56d03ada939fe05cbeb2254888d/compiler/rustc_middle/src/ty/layout.rs#L1305-L1310) created `tag` value might be wrong, because when I checked `min` and `max` values it's always between 0..1, which results in wrong size comparison in a few lines down below. I think `min` and `max` values don't take `#[repr(aligned(8))]` into consideration and just act from base values assigned inside the enum. If what I am saying is true, aligned enums were created with the wrong layout for some time.~~ ~~As stated in the title this is only a temporary fix and I think this needs further investigation, if someone wants to mentor it I would like to work on that too.~~ 😸 **Edit: Weird some tests fail now going to close this for now...** **Edit2: I made it work again.** I think I figured out the main problem of the issue, layout types of aligned enums with custom discriminant types were not handled, which resulted in confusing(such as this issue) behavior down the line, this is a kinda hacky fix for the issue.
2022-02-03Auto merge of #93146 - workingjubilee:use-std-simd, r=Mark-Simulacrumbors-335/+537
pub use std::simd::StdFloat; Syncs portable-simd up to commit rust-lang/portable-simd@03f6fbb21e6050da2a05b3ce8f480c020b384916, Diff: https://github.com/rust-lang/portable-simd/compare/533f0fc81ab9ba097779fcd27c8f9ea12261fef5...03f6fbb21e6050da2a05b3ce8f480c020b384916 This sync requires a little bit more legwork because it also introduces a trait into `std::simd`, so that it is no longer simply a reexport of `core::simd`. Out of simple-minded consistency and to allow more options, I replicated the pattern for the way `core::simd` is integrated in the first place, however this is not necessary if it doesn't acquire any interdependencies inside `std`: it could be a simple crate reexport. I just don't know yet if that will happen or not. To summarize other misc changes: - Shifts no longer panic, now wrap on too-large shifts (like `Simd` integers usually do!) - mask16x32 will now be many i16s, not many i32s... 🙃 - `#[must_use]` is spread around generously - Adjusts division, float min/max, and `Mask::{from,to}_array` internally to be faster - Adds the much-requested `Simd::cast::<U>` function (equivalent to `simd.to_array().map(|lane| lane as U)`)
2022-02-03Auto merge of #93432 - Kobzol:stable-hash-isize-hash-compression, r=the8472bors-9/+57
Compress amount of hashed bytes for `isize` values in StableHasher This is another attempt to land https://github.com/rust-lang/rust/pull/92103, this time hopefully with a correct implementation w.r.t. stable hashing guarantees. The previous PR was [reverted](https://github.com/rust-lang/rust/pull/93014) because it could produce the [same hash](https://github.com/rust-lang/rust/pull/92103#issuecomment-1014625442) for different values even in quite simple situations. I have since added a basic [test](https://github.com/rust-lang/rust/pull/93193) that should guard against that situation, I also added a new test in this PR, specialised for this optimization. ## Why this optimization helps Since the original PR, I have tried to analyze why this optimization even helps (and why it especially helps for `clap`). I found that the vast majority of stable-hashing `i64` actually comes from hashing `isize` (which is converted to `i64` in the stable hasher). I only found a single place where is this datatype used directly in the compiler, and this place has also been showing up in traces that I used to find out when is `isize` being hashed. This place is `rustc_span::FileName::DocTest`, however, I suppose that isizes also come from other places, but they might not be so easy to find (there were some other entries in the trace). `clap` hashes about 8.5 million `isize`s, and all of them fit into a single byte, which is why this optimization has helped it [quite a lot](https://github.com/rust-lang/rust/pull/92103#issuecomment-1005711861). Now, I'm not sure if special casing `isize` is the correct solution here, maybe something could be done with that `isize` inside `DocTest` or in other places, but that's for another discussion I suppose. In this PR, instead of hardcoding a special case inside `SipHasher128`, I instead put it into `StableHasher`, and only used it for `isize` (I tested that for `i64` it doesn't help, or at least not for `clap` and other few benchmarks that I was testing). ## New approach Since the most common case is a single byte, I added a fast path for hashing `isize` values which positive value fits within a single byte, and a cold path for the rest of the values. To avoid the previous correctness problem, we need to make sure that each unique `isize` value will produce a unique hash stream to the hasher. By hash stream I mean a sequence of bytes that will be hashed (a different sequence should produce a different hash, but that is of course not guaranteed). We have to distinguish different values that produce the same bit pattern when we combine them. For example, if we just simply skipped the leading zero bytes for values that fit within a single byte, `(0xFF, 0xFFFFFFFFFFFFFFFF)` and `(0xFFFFFFFFFFFFFFFF, 0xFF)` would send the same hash stream to the hasher, which must not happen. To avoid this situation, values `[0, 0xFE]` are hashed as a single byte. When we hash a larger (treating `isize` as `u64`) value, we first hash an additional byte `0xFF`. Since `0xFF` cannot occur when we apply the single byte optimization, we guarantee that the hash streams will be unique when hashing two values `(a, b)` and `(b, a)` if `a != b`: 1) When both `a` and `b` are within `[0, 0xFE]`, their hash streams will be different. 2) When neither `a` and `b` are within `[0, 0xFE]`, their hash streams will be different. 3) When `a` is within `[0, 0xFE]` and `b` isn't, when we hash `(a, b)`, the hash stream will definitely not begin with `0xFF`. When we hash `(b, a)`, the hash stream will definitely begin with `0xFF`. Therefore the hash streams will be different. r? `@the8472`
2022-02-02Correct incorrect description of preorder traversals.Jakob Degen-4/+6
2022-02-02Auto merge of #93101 - Mark-Simulacrum:library-backtrace, r=yaahcbors-65/+165
Support configuring whether to capture backtraces at runtime Tracking issue: https://github.com/rust-lang/rust/issues/93346 This adds a new API to the `std::panic` module which configures whether and how the default panic hook will emit a backtrace when a panic occurs. After discussion with `@yaahc` on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/backtrace.20lib.20vs.2E.20panic), this PR chooses to avoid adjusting or seeking to provide a similar API for the (currently unstable) std::backtrace API. It seems likely that the users of that API may wish to expose more specific settings rather than just a global one (e.g., emulating the `env_logger`, `tracing` per-module configuration) to avoid the cost of capture in hot code. The API added here could plausibly be copied and/or re-exported directly from std::backtrace relatively easily, but I don't think that's the right call as of now. ```rust mod panic { #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[non_exhaustive] pub enum BacktraceStyle { Short, Full, Off, } fn set_backtrace_style(BacktraceStyle); fn get_backtrace_style() -> Option<BacktraceStyle>; } ``` Several unresolved questions: * Do we need to move to a thread-local or otherwise more customizable strategy for whether to capture backtraces? See [this comment](https://github.com/rust-lang/rust/pull/79085#issuecomment-727845826) for some potential use cases for this. * Proposed answer: no, leave this for third-party hooks. * Bikeshed on naming of all the options, as usual. * Should BacktraceStyle be moved into `std::backtrace`? * It's already somewhat annoying to import and/or re-type the `std::panic::` prefix necessary to use these APIs, probably adding a second module to the mix isn't worth it. Note that PR #79085 proposed a much simpler API, but particularly in light of the desire to fully replace setting environment variables via `env::set_var` to control the backtrace API, a more complete API seems preferable. This PR likely subsumes that one.
2022-02-02Unify storage getter and setter functionsGuillaume Gomez-12/+12
2022-02-02fix: Remove extra newlines from junit outputSerg Tereshchenko-2/+1
2022-02-02Auto merge of #93594 - matthiaskrgr:rollup-lcvhpdv, r=matthiaskrgrbors-255/+494
Rollup of 8 pull requests Successful merges: - #92528 (Make `Fingerprint::combine_commutative` associative) - #93221 ([borrowck] Fix help on mutating &self in async fns) - #93542 (Prevent lifetime elision in type alias) - #93546 (Validate that values in switch int terminator are unique) - #93571 (better suggestion for duplicated `where` clause) - #93574 (don't suggest adding `let` due to bad assignment expressions inside of `while` loop) - #93590 (More let_else adoptions) - #93592 (Remove unused dep from rustc_arena) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-02-02Configure panic hook backtrace behaviorMark Rousskov-65/+165
2022-02-02Rollup merge of #93592 - est31:remove_unused_deps, r=bjorn3Matthias Krüger-2/+0
Remove unused dep from rustc_arena
2022-02-02Rollup merge of #93590 - est31:let_else, r=lcnrMatthias Krüger-226/+208
More let_else adoptions Continuation of #89933, #91018, #91481, #93046.
2022-02-02Rollup merge of #93574 - compiler-errors:bad-let-suggestion, r=lcnrMatthias Krüger-8/+33
don't suggest adding `let` due to bad assignment expressions inside of `while` loop adds a check that our `lhs` expression is actually within the conditional part of the `while` loop, instead of anywhere in the `while` body. fixes #93486
2022-02-02Rollup merge of #93571 - compiler-errors:better-where-suggestion, r=lcnrMatthias Krüger-9/+147
better suggestion for duplicated `where` clause fixes #93567
2022-02-02Rollup merge of #93546 - tmiasko:validate-switch-int, r=oli-obkMatthias Krüger-0/+18
Validate that values in switch int terminator are unique