about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-11-02bootstrap/setup: create hooks directory if non-existingAlejandro Martinez Ruiz-1/+6
2023-11-02Auto merge of #117204 - nnethercote:rustc_ast_passes, r=compiler-errorsbors-176/+145
Minor improvements to `rustc_ast_passes` Some improvements I found while looking at this code. r? `@compiler-errors`
2023-11-02Auto merge of #117386 - roblabla:fix-switch-stdio-win7, r=ChrisDentonbors-3/+21
Fix switch_stdout_to on Windows7 The `switch_stdout_to` test was broken on Windows7, as deleting the temporary test folder would fail since the `switch-stdout-output` file we redirected the stdout to is never closed, and it's impossible on Win7 to delete an opened file. To fix this issue, we make `switch_stdout_to` return the previous handle. Using this, we add a new `switch_stdout_to` call at the end of the test to return the stdio handles to their original state, and recover the handle to the file we opened. This handle is automatically closed at the end of the function, which should allow the temporary test folder to be deleted properly.
2023-11-02Auto merge of #117506 - massivebird:ord-typo, r=ChrisDentonbors-1/+1
fixes: typo in `std::cmp::Ord` trait docs Pluralizes the word "sequence"
2023-11-01fixes: typo in `std::cmp::Ord` trait docsmassivebird-1/+1
2023-11-01Auto merge of #117498 - matthiaskrgr:rollup-z7mg4ck, r=matthiaskrgrbors-41/+540
Rollup of 4 pull requests Successful merges: - #117298 (Recover from missing param list in function definitions) - #117373 (Avoid the path trimming ICE lint in error reporting) - #117441 (Do not assert in op_to_const.) - #117488 (Update minifier-rs version to 0.3.0) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-01Rollup merge of #117488 - GuillaumeGomez:update-minifier, r=notriddleMatthias Krüger-3/+3
Update minifier-rs version to 0.3.0 It fixes https://github.com/GuillaumeGomez/minifier-rs/issues/105. r? ```@notriddle```
2023-11-01Rollup merge of #117441 - cjgillot:diag-noassert, r=oli-obk,RalfJungMatthias Krüger-11/+468
Do not assert in op_to_const. `op_to_const` is used in `try_destructure_mir_constant_for_diagnostics`, which may encounter invalid constants created by optimizations and debugging. r? ``@oli-obk`` Fixes https://github.com/rust-lang/rust/issues/117368
2023-11-01Rollup merge of #117373 - saethlin:avoid-ice-lint, r=compiler-errorsMatthias Krüger-8/+4
Avoid the path trimming ICE lint in error reporting Types or really anything in MIR should never be formatted without path trimming disabled, because its formatting often tries to construct trimmed paths. In this case, the lint turns a nice error report into an irrelevant ICE.
2023-11-01Rollup merge of #117298 - clubby789:fn-missing-params, r=petrochenkovMatthias Krüger-19/+65
Recover from missing param list in function definitions Addresses the other issue mentioned in #108109
2023-11-01Auto merge of #117029 - rmehri01:mir_opt_filecheck_inline_tests, r=cjgillotbors-51/+156
Add FileCheck annotations to MIR-opt inlining tests Part of #116971, adds FileCheck annotations to MIR-opt tests in `tests/mir-opt/inline`. I left out a few (such as `inline_cycle`) where it mentioned that the particular outcome of inlining isn't important, just that the inliner doesn't get stuck in an infinite loop. r? cjgillot
2023-11-01Comment `for_diagnostics` flag.Camille GILLOT-0/+5
2023-11-01Auto merge of #117289 - estebank:issue-72298, r=cjgillotbors-1/+127
Account for `ref` and `mut` in the wrong place for pattern ident renaming If the user writes `S { ref field: name }` instead of `S { field: ref name }`, we suggest the correct code. Fix #72298.
2023-11-01Specify diagnostic path.Camille GILLOT-6/+13
2023-11-01Rebase fallout.Camille GILLOT-10/+2
2023-11-01Rename hook.Camille GILLOT-6/+6
2023-11-01Make ui into mir-opt test.Camille GILLOT-11/+453
2023-11-01Do not assert in op_to_const.Camille GILLOT-2/+13
2023-11-01Auto merge of #117307 - taiki-e:espidf-atomic-64, r=Amanieubors-3/+3
Set max_atomic_width for riscv32*-esp-espidf to 32 Fixes #117305 > Since riscv32 does not have 64-bit atomic instructions, I do not believe there is any way to fix this problem other than setting max_atomic_width of these targets to 32. This is a breaking change because Atomic\*64 will become unavailable, but all affected targets are tier 3, and the current Atomic*64 violates the standard library's API contract and can cause problems with code that rely on the standard library's atomic types being lock-free. r? `@Amanieu` cc `@ivmarkov` `@MabezDev`
2023-11-01fix spans for inline_couroutine panic-abortRyan Mehri-11/+11
2023-11-01Avoid the path trimming ICE lint in error reportingBen Kimock-8/+4
2023-11-01Recover from missing param list in function definitionsclubby789-19/+65
2023-11-01Update minifier-rs version to 0.3.0Guillaume Gomez-3/+3
2023-11-01Auto merge of #114208 - GKFX:offset_of_enum, r=wesleywiserbors-89/+477
Support enum variants in offset_of! This MR implements support for navigating through enum variants in `offset_of!`, placing the enum variant name in the second argument to `offset_of!`. The RFC placed it in the first argument, but I think it interacts better with nested field access in the second, as you can then write things like ```rust offset_of!(Type, field.Variant.field) ``` Alternatively, a syntactic distinction could be made between variants and fields (e.g. `field::Variant.field`) but I'm not convinced this would be helpful. [RFC 3308 # Enum Support](https://rust-lang.github.io/rfcs/3308-offset_of.html#enum-support-offset_ofsomeenumstructvariant-field_on_variant) Tracking Issue #106655.
2023-11-01Auto merge of #117482 - matthiaskrgr:rollup-doc6jgm, r=matthiaskrgrbors-1394/+1376
Rollup of 4 pull requests Successful merges: - #115626 (Clean up unchecked_math, separate out unchecked_shifts) - #117397 (Don't emit delayed good-path bugs on panic) - #117401 (Refactor: move suggestion functions from demand to suggestions) - #117475 (Inline and remove `create_session`.) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-01Rollup merge of #117475 - nnethercote:rm-create_session, r=oli-obkMatthias Krüger-97/+54
Inline and remove `create_session`. Currently the parts of session initialization that happen within `rustc_interface` are split between `run_compiler` and `create_session`. This split isn't necessary and obscures what's happening. This commit merges the two functions. I think a single longer function is much clearer than splitting this code across two functions in different modules, especially when `create_session` has 13 parameters, and is misnamed (it also creates the codegen backend). The net result is 43 fewer lines of code. r? ``@oli-obk``
2023-11-01Rollup merge of #117401 - chenyukang:yukang-cleanup-hir-typeck-suggestions, ↵Matthias Krüger-1273/+1272
r=compiler-errors Refactor: move suggestion functions from demand to suggestions follow-up from https://github.com/rust-lang/rust/pull/116841#discussion_r1370506700
2023-11-01Rollup merge of #117397 - compiler-errors:dont-emit-good-path-on-panic, ↵Matthias Krüger-1/+1
r=TaKO8Ki Don't emit delayed good-path bugs on panic This should fix #117381, cc ``@RalfJung`` As opposed to delayed bugs, delayed *good path* bugs really don't make sense to show on panics.
2023-11-01Rollup merge of #115626 - clarfonthey:unchecked-math, r=thomccMatthias Krüger-23/+49
Clean up unchecked_math, separate out unchecked_shifts Tracking issue: #85122 Changes: 1. Remove `const_inherent_unchecked_arith` flag and make const-stability flags the same as the method feature flags. Given the number of other unsafe const fns already stabilised, it makes sense to just stabilise these in const context when they're stabilised. 2. Move `unchecked_shl` and `unchecked_shr` into a separate `unchecked_shifts` flag, since the semantics for them are unclear and they'll likely be stabilised separately as a result. 3. Add an `unchecked_neg` method exclusively to signed integers, under the `unchecked_neg` flag. This is because it's a new API and probably needs some time to marinate before it's stabilised, and while it *would* make sense to have a similar version for unsigned integers since `checked_neg` also exists for those there is absolutely no case where that would be a good idea, IMQHO. The longer-term goal here is to prepare the `unchecked_math` methods for an FCP and stabilisation since they've existed for a while, their semantics are clear, and people seem in favour of stabilising them.
2023-11-01Auto merge of #117436 - nikic:update-llvm-16, r=cuviperbors-0/+0
Update to LLVM 17.0.4 Fixes #116668. Fixes #116941. Fixes #116976. r? `@cuviper`
2023-11-01Auto merge of #115356 - devnexen:haiku_set_name_use_return, r=thomccbors-1/+3
`std::thread::set_name` exploit the return on haiku
2023-11-01Auto merge of #117422 - joshtriplett:stabilize-file-times, r=workingjubileebors-21/+19
Stabilize `file_set_times` Approved via FCP in https://github.com/rust-lang/rust/issues/98245 .
2023-11-01Auto merge of #116692 - Nadrieril:half-open-ranges, r=cjgillotbors-597/+898
Match usize/isize exhaustively with half-open ranges The long-awaited finale to the saga of [exhaustiveness checking for integers](https://github.com/rust-lang/rust/pull/50912)! ```rust match 0usize { 0.. => {} // exhaustive! } match 0usize { 0..usize::MAX => {} // helpful error message! } ``` Features: - Half-open ranges behave as expected for `usize`/`isize`; - Trying to use `0..usize::MAX` will tell you that `usize::MAX..` is missing and explain why. No more unhelpful "`_` is missing"; - Everything else stays the same. This should unblock https://github.com/rust-lang/rust/issues/37854. Review-wise: - I recommend looking commit-by-commit; - This regresses perf because of the added complexity in `IntRange`; hopefully not too much; - I measured each `#[inline]`, they all help a bit with the perf regression (tho I don't get why); - I did not touch MIR building; I expect there's an easy PR there that would skip unnecessary comparisons when the range is half-open.
2023-11-01Inline and remove `create_session`.Nicholas Nethercote-97/+54
Currently the parts of session initialization that happen within `rustc_interface` are split between `run_compiler` and `create_session`. This split isn't necessary and obscures what's happening. This commit merges the two functions. I think a single longer function is much clearer than splitting this code across two functions in different modules, especially when `create_session` has 13 parameters, and is misnamed (it also creates the codegen backend). The net result is 43 fewer lines of code.
2023-11-01Auto merge of #113970 - cjgillot:assume-all-the-things, r=nikicbors-470/+573
Replace switch to unreachable by assume statements `UnreachablePropagation` currently keeps some switch terminators alive in order to ensure codegen can infer the inequalities on the discriminants. This PR proposes to encode those inequalities as `Assume` statements. This allows to simplify MIR further by removing some useless terminators.
2023-10-31Update based on wesleywiser reviewGeorge Bateman-8/+15
2023-10-31Update MIR tests for offset_ofGeorge Bateman-74/+48
2023-10-31Enums in offset_of: update based on est31, scottmcm & llogiq reviewGeorge Bateman-140/+150
2023-10-31Support enum variants in offset_of!George Bateman-75/+472
2023-10-31Auto merge of #117459 - matthiaskrgr:rollup-t3osb3c, r=matthiaskrgrbors-103/+811
Rollup of 5 pull requests Successful merges: - #113241 (rustdoc: Document lack of object safety on affected traits) - #117388 (Turn const_caller_location from a query to a hook) - #117417 (Add a stable MIR visitor) - #117439 (prepopulate opaque ty storage before using it) - #117451 (Add support for pre-unix-epoch file dates on Apple platforms (#108277)) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-31Auto merge of #117462 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 7 commits in 708383d620e183a9ece69b8fe930c411d83dee27..b4d18d4bd3db6d872892f6c87c51a02999b80802 2023-10-27 21:09:26 +0000 to 2023-10-31 18:19:10 +0000 - refactor(toml): Cleanup noticed on the way to rust-lang/cargo#12801 (rust-lang/cargo#12902) - feat(trim-paths): set env `CARGO_TRIM_PATHS` for build scripts (rust-lang/cargo#12900) - feat: implement RFC 3127 `-Ztrim-paths` (rust-lang/cargo#12625) - docs: clarify config to use vendored source is printed to stdout (rust-lang/cargo#12893) - Improve the margin calculation for the search command's UI (rust-lang/cargo#12890) - Add new packages to [workspace.members] automatically (rust-lang/cargo#12779) - refactor(toml): Decouple parsing from interning system (rust-lang/cargo#12881) r? ghost
2023-10-31Update cargoWeihang Lo-0/+0
2023-10-31change inline_retag to after.mirRyan Mehri-66/+60
2023-10-31Rollup merge of #117451 - Byron:issue-108277-apple-fix, r=joshtriplettMatthias Krüger-0/+66
Add support for pre-unix-epoch file dates on Apple platforms (#108277) Please note that even though the assertion being hit is the same on MacOS and thus similar to what's described in #108277, on MacOS it's possible to convert the numbers such that they are valid, don't hit the assertion and are round-trippable. Doing so effectively fixes the issue on Apple platforms. This PR does not attempt to harden other platforms against negative nanoseconds, which can happen for many reasons including mild filesystem corruption. ---- Time in UNIX system calls counts from the epoch, 1970-01-01. The timespec struct used in various system calls represents this as a number of seconds and a number of nanoseconds. Nanoseconds are required to be between 0 and 999_999_999, because the portion outside that range should be represented in the seconds field; if nanoseconds were larger than 999_999_999, the seconds field should go up instead. Suppose you ask for the time 1969-12-31, what time is that? On UNIX systems that support times before the epoch, that's seconds=-86400, one day before the epoch. But now, suppose you ask for the time 1969-12-31 23:59:00.1. In other words, a tenth of a second after one minute before the epoch. On most UNIX systems, that's represented as seconds=-60, nanoseconds=100_000_000. The macOS bug is that it returns seconds=-59, nanoseconds=-900_000_000. While that's in some sense an accurate description of the time (59.9 seconds before the epoch), that violates the invariant of the timespec data structure: nanoseconds must be between 0 and 999999999. This causes this assertion in the Rust standard library. So, on macOS, if we get a Timespec value with seconds less than or equal to zero, and nanoseconds between -999_999_999 and -1 (inclusive), we can add 1_000_000_000 to the nanoseconds and subtract 1 from the seconds, and then convert. The resulting timespec value is still accepted by macOS, and when fed back into the OS, produces the same results. (If you set a file's mtime with that timestamp, then read it back, you get back the one with negative nanoseconds again.) Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2023-10-31Rollup merge of #117439 - lcnr:prepopulate-earlier, r=compiler-errorsMatthias Krüger-6/+8
prepopulate opaque ty storage before using it doesn't have any significant impact rn afaict, as we freely define new opaque types during MIR typeck. It will be relevant with #117278 and once we stop allowing the definition of new opaques in MIR typeck r? `@compiler-errors`
2023-10-31Rollup merge of #117417 - celinval:smir-visitor, r=oli-obkMatthias Krüger-85/+662
Add a stable MIR visitor This change also adds a few utility functions as well and extend most `mir` and `ty` ADTs to implement `PartialEq` and `Eq`. Fixes https://github.com/rust-lang/project-stable-mir/issues/32 r? `@oli-obk`
2023-10-31Rollup merge of #117388 - oli-obk:dequerification, r=RalfJungMatthias Krüger-12/+14
Turn const_caller_location from a query to a hook blocked on https://github.com/rust-lang/rust/pull/117317 cc `@RalfJung`
2023-10-31Rollup merge of #113241 - poliorcetics:85138-doc-object-safety, r=GuillaumeGomezMatthias Krüger-0/+61
rustdoc: Document lack of object safety on affected traits Closes #85138 I saw the issue didn't have any recent activity, if there is another MR for it I missed it. I want the issue to move forward so here is my proposition. It takes some space just before the "Implementors" section and only if the trait is **not** object safe since it is the only case where special care must be taken in some cases and this has the benefit of avoiding generation of HTML in (I hope) the common case.
2023-10-31Auto merge of #117450 - oli-obk:rustdoc_verify, r=estebankbors-127/+428
Accept less invalid Rust in rustdoc pulled out of https://github.com/rust-lang/rust/pull/117213 where this change was already approved This only affects rustdoc, and has up to [20% perf regressions in rustdoc](https://github.com/rust-lang/rust/pull/117213#issuecomment-1785776288). These are unavoidable, as we are simply doing more checks now, but it's part of the longer term plan of making rustdoc more resistant to ICEs by only accepting valid Rust code.
2023-10-31Turn const_caller_location from a query to a hookOli Scherer-12/+14