about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-08-14Unconditionally use the LLVM symbol readerbjorn3-22/+0
This may fix a linker error on MSVC
2024-08-14Apply some suggestions to the test rmake filebjorn3-8/+3
2024-08-11Fix review comments and other improvementsbjorn3-24/+34
2024-08-10Add fixme for removing LlvmArchiveBuilder in the futurebjorn3-0/+4
2024-08-10Use ArArchiveBuilder with the LLVM backend toobjorn3-3/+1
All regressions that were blocking usage of ArArchiveBuilder should now be fixed.
2024-08-10Add test for thin archive reading supportbjorn3-0/+37
2024-08-10Support reading thin archives in ArArchiveBuilderbjorn3-4/+11
2024-08-10Auto merge of #122792 - Nadrieril:stabilize-min-exh-pats2, r=fee1-deadbors-935/+1061
Stabilize `min_exhaustive_patterns` ## Stabilisation report I propose we stabilize the [`min_exhaustive_patterns`](https://github.com/rust-lang/rust/issues/119612) language feature. With this feature, patterns of empty types are considered unreachable when matched by-value. This allows: ```rust enum Void {} fn foo() -> Result<u32, Void>; fn main() { let Ok(x) = foo(); // also match foo() { Ok(x) => ..., } } ``` This is a subset of the long-unstable [`exhaustive_patterns`](https://github.com/rust-lang/rust/issues/51085) feature. That feature is blocked because omitting empty patterns is tricky when *not* matched by-value. This PR stabilizes the by-value case, which is not tricky. The not-by-value cases (behind references, pointers, and unions) stay as they are today, e.g. ```rust enum Void {} fn foo() -> Result<u32, &Void>; fn main() { let Ok(x) = foo(); // ERROR: missing `Err(_)` } ``` The consequence on existing code is some extra "unreachable pattern" warnings. This is fully backwards-compatible. ### Comparison with today's rust This proposal only affects match checking of empty types (i.e. types with no valid values). Non-empty types behave the same with or without this feature. Note that everything below is phrased in terms of `match` but applies equallly to `if let` and other pattern-matching expressions. To be precise, a visibly empty type is: - an enum with no variants; - the never type `!`; - a struct with a *visible* field of a visibly empty type (and no #[non_exhaustive] annotation); - a tuple where one of the types is visibly empty; - en enum with all variants visibly empty (and no `#[non_exhaustive]` annotation); - a `[T; N]` with `N != 0` and `T` visibly empty; - all other types are nonempty. (An extra change was proposed below: that we ignore #[non_exhaustive] for structs since adding fields cannot turn an empty struct into a non-empty one) For normal types, exhaustiveness checking requires that we list all variants (or use a wildcard). For empty types it's more subtle: in some cases we require a `_` pattern even though there are no valid values that can match it. This is where the difference lies regarding this feature. #### Today's rust Under today's rust, a `_` is required for all empty types, except specifically: if the matched expression is of type `!` (the never type) or `EmptyEnum` (where `EmptyEnum` is an enum with no variants), then the `_` is not required. ```rust let foo: Result<u32, !> = ...; match foo { Ok(x) => ..., Err(_) => ..., // required } let foo: Result<u32, &!> = ...; match foo { Ok(x) => ..., Err(_) => ..., // required } let foo: &! = ...; match foo { _ => ..., // required } fn blah(foo: (u32, !)) { match foo { _ => ..., // required } } unsafe { let ptr: *const ! = ...; match *ptr {} // allowed let ptr: *const (u32, !) = ...; match *ptr { (x, _) => { ... } // required } let ptr: *const Result<u32, !> = ...; match *ptr { Ok(x) => { ... } Err(_) => { ... } // required } } ``` #### After this PR After this PR, a pattern of an empty type can be omitted if (and only if): - the match scrutinee expression has type `!` or `EmptyEnum` (like before); - *or* the empty type is matched by value (that's the new behavior). In all other cases, a `_` is required to match on an empty type. ```rust let foo: Result<u32, !> = ...; match foo { Ok(x) => ..., // `Err` not required } let foo: Result<u32, &!> = ...; match foo { Ok(x) => ..., Err(_) => ..., // required because `!` is under a dereference } let foo: &! = ...; match foo { _ => ..., // required because `!` is under a dereference } fn blah(foo: (u32, !)) { match foo {} // allowed } unsafe { let ptr: *const ! = ...; match *ptr {} // allowed let ptr: *const (u32, !) = ...; match *ptr { (x, _) => { ... } // required because the matched place is under a (pointer) dereference } let ptr: *const Result<u32, !> = ...; match *ptr { Ok(x) => { ... } Err(_) => { ... } // required because the matched place is under a (pointer) dereference } } ``` ### Documentation The reference does not say anything specific about exhaustiveness checking, hence there is nothing to update there. The nomicon does, I opened https://github.com/rust-lang/nomicon/pull/445 to reflect the changes. ### Tests The relevant tests are in `tests/ui/pattern/usefulness/empty-types.rs`. ### Unresolved Questions None that I know of. try-job: dist-aarch64-apple
2024-08-10Auto merge of #128746 - compiler-errors:cache-super-outlives, r=lcnrbors-26/+42
Cache supertrait outlives of impl header for soundness check This caches the results of computing the transitive supertraits of an impl and filtering it to its outlives obligations. This is purely an optimization to improve https://github.com/rust-lang/rust/pull/124336.
2024-08-10Fixes in various placesNadrieril-4/+12
2024-08-10Test that 0/unknown-length arrays are nonemptyNadrieril-47/+144
2024-08-10Update std and compilerNadrieril-4/+8
2024-08-10Update testsNadrieril-841/+878
2024-08-10Stabilize `min_exhaustive_patterns`Nadrieril-39/+19
2024-08-10Auto merge of #128740 - compiler-errors:generic-preds, r=estebankbors-6/+6
Stop unnecessarily taking GenericPredicates by `&self` This results in overcapturing in edition 2024, and is unnecessary since `GenericPredicates: Copy`.
2024-08-10Auto merge of #128714 - camelid:wf-struct-exprs, r=BoxyUwUbors-56/+560
WF-check struct field types at construction site Fixes #126272. Fixes #127299. Rustc of course already WF-checked the field types at the definition site, but for error tainting of consts to work properly, there needs to be an error emitted at the use site. Previously, with no use-site error, we proceeded with CTFE and ran into ICEs since we are running code with type errors. Emitting use-site errors also brings struct-like constructors more in line with fn-like constructors since they already emit use-site errors for WF issues. r? `@BoxyUwU`
2024-08-10Auto merge of #128584 - DianQK:tests-for-llvm-19, r=nikicbors-0/+67
Add a set of tests for LLVM 19 Close #107681. Close #118306. Close #126585. r? compiler
2024-08-09Auto merge of #125642 - khuey:zstd, r=Kobzolbors-7/+126
Enable zstd for debug compression. Set LLVM_ENABLE_ZSTD alongside LLVM_ENABLE_ZLIB so that --compress-debug-sections=zstd is an option. See #120953 try-job: x86_64-gnu-tools
2024-08-09Auto merge of #128896 - bjorn3:sync_cg_clif-2024-08-09, r=bjorn3bors-850/+390
Subtree sync for rustc_codegen_cranelift The main highlight this time is support for raw-dylib on Windows thanks to `@dpaoliello.` Compiling the ring crate for arm64 macOS has been fixed too. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2024-08-09Auto merge of #128883 - matthiaskrgr:rollup-mkzi7my, r=matthiaskrgrbors-50/+218
Rollup of 9 pull requests Successful merges: - #128815 (Add `Steal::is_stolen()`) - #128817 (VxWorks code refactored ) - #128822 (add `builder-config` into tarball sources) - #128838 (rustdoc: do not run doctests with invalid langstrings) - #128852 (use stable sort to sort multipart diagnostics) - #128859 (Fix the name of signal 19 in library/std/src/sys/pal/unix/process/process_unix/tests.rs for mips/sparc linux) - #128864 (Use `SourceMap::end_point` instead of `- BytePos(1)` in arg removal suggestion) - #128865 (Ensure let stmt compound assignment removal suggestion respect codepoint boundaries) - #128874 (Disable verbose bootstrap command failure logging by default) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-09Update tidy for new cranelift-bitset cratebjorn3-0/+2
2024-08-09Use ar_archive_writer from sysroot for cg_clifbjorn3-11/+1
2024-08-09Merge commit '69b3f5a426a5c1c05236a45b36f6679d95fbe01b' into ↵bjorn3-850/+398
sync_cg_clif-2024-08-09
2024-08-09Rollup merge of #128874 - Kobzol:cmd-verbose-logging, r=onur-ozkanMatthias Krüger-5/+14
Disable verbose bootstrap command failure logging by default One of my recent bootstrap command refactoring PRs enabled verbose logging of command failures by default. While this is great for debugging bootstrap, in many situations it's just too verbose and prevents the user from seeing the actual printed stdout/stderr, which usually contains much more useful information. This PR reverts that logic, and only prints a detailed error when `-v` is passed to bootstrap. r? ````@onur-ozkan````
2024-08-09Rollup merge of #128865 - jieyouxu:unicurd, r=UrgauMatthias Krüger-2/+48
Ensure let stmt compound assignment removal suggestion respect codepoint boundaries Previously we would try to issue a suggestion for `let x <op>= 1`, i.e. a compound assignment within a `let` binding, to remove the `<op>`. The suggestion code unfortunately incorrectly assumed that the `<op>` is an exactly-1-byte ASCII character, but this assumption is incorrect because we also recover Unicode-confusables like `➖=` as `-=`. In this example, the suggestion code used a `+ BytePos(1)` to calculate the span of the `<op>` codepoint that looks like `-` but the mult-byte Unicode look-alike would cause the suggested removal span to be inside a multi-byte codepoint boundary, triggering a codepoint boundary assertion. The fix is to use `SourceMap::start_point(token_span)` which properly accounts for codepoint boundaries. Fixes #128845. cc #128790 r? ````@fmease````
2024-08-09Rollup merge of #128864 - jieyouxu:funnicode, r=UrgauMatthias Krüger-3/+63
Use `SourceMap::end_point` instead of `- BytePos(1)` in arg removal suggestion Previously, we tried to remove extra arg commas when providing extra arg removal suggestions. One of the edge cases is having to account for an arg that has a closing delimiter `)` following it. However, the previous suggestion code assumed that the delimiter is in fact exactly the 1-byte `)` character. This assumption was proven incorrect, because we recover from Unicode-confusable delimiters in the parser, which means that the ending delimiter could be a multi-byte codepoint that looks *like* a `)`. Subtracing 1 byte could land us in the middle of a codepoint, triggering a codepoint boundary assertion. This is fixed by using `SourceMap::end_point` which properly accounts for codepoint boundaries. Fixes #128717. cc ````@fmease```` and #128790
2024-08-09Rollup merge of #128859 - MinxuanZ:mips-sig, r=AmanieuMatthias Krüger-0/+13
Fix the name of signal 19 in library/std/src/sys/pal/unix/process/process_unix/tests.rs for mips/sparc linux relate to #128816
2024-08-09Rollup merge of #128852 - folkertdev:multipart-suggestion-stable-sort, ↵Matthias Krüger-3/+3
r=compiler-errors use stable sort to sort multipart diagnostics I think a stable sort should be used to sort the different parts of a multipart selection. The current unstable sort uses the text of the suggestion as a tie-breaker. That just doesn't seem right, and the order of the input is a better choice I think, because it gives the diagnostic author more control. This came up when I was building a suggestion where ```rust fn foo() {} ``` must be turned into an unsafe function, and an attribute must be added ```rust #[target_feature(enable = "...")] unsafe fn foo() {} ``` In this example, the two suggestions occur at the same position, but the order is extremely important: unsafe must come after the attribute. But the situation changes if there is a pub/pub(crate), and if the unsafe is already present. It just out that because of the suggestion text, there is no way for me to order the suggestions correctly. This change probably should be tested, but are there tests of the diagnostics code itself in the tests? r? ```@estebank```
2024-08-09Rollup merge of #128838 - notriddle:notriddle/invalid-tag-is-not-rust, ↵Matthias Krüger-7/+36
r=GuillaumeGomez rustdoc: do not run doctests with invalid langstrings https://github.com/rust-lang/rust/pull/124577#issuecomment-2276034737 CC ``@decathorpe``
2024-08-09Rollup merge of #128822 - onur-ozkan:add-build-config-in-tarballs, r=KobzolMatthias Krüger-1/+11
add `builder-config` into tarball sources This will be useful for certain scenarios where developers want to know how the tarball sources were generated. We also want this to check for CI rustc incompatible options on bootstrap. Blocker for #122709 r? Kobzol
2024-08-09Rollup merge of #128817 - biabbas:vxworks_update, r=tgross35Matthias Krüger-29/+21
VxWorks code refactored 1. Extern TaskNameSet as minimum supported version of os is VxWorks 7 which would have taskNameSet 2. Vx_TASK_NAME_LEN is 31 on VxWorks7, defined variable res. 3. Add unsafe blocks on Non::Zero usage in available_parallelism() 4. Update vxworks docs. r? `@tgross35` cc `@devnexen`
2024-08-09Rollup merge of #128815 - Nadrieril:is_stolen, r=jieyouxu,lcnrMatthias Krüger-0/+9
Add `Steal::is_stolen()` Writers of rustc drivers (such as myself) often encounter stealing issues. It is currently impossible to gracefully handle them. This PR adds a `Steal::is_stolen()` function for that purpose.
2024-08-09Couple of minor cleanupsbjorn3-2/+1
2024-08-09Stop using a custom Cargo.toml and Cargo.lock for the standard librarybjorn3-485/+0
The rust-src component now ships a working copy of both.
2024-08-09Disable f16 and f128 in compiler-builtins when running rustc testsbjorn3-0/+25
2024-08-09Rustup to rustc 1.82.0-nightly (3e9bd8b56 2024-08-08)bjorn3-1/+1
2024-08-09rustdoc: move invalid langstring test to UIMichael Howell-0/+6
2024-08-09Do not print verbose error when a bootstrap command fails without verbose modeJakub Beránek-4/+12
2024-08-09Install zstd in dist builder image.Kyle Huey-0/+33
Build libzstd from source because the EPEL package is built without fPIC.
2024-08-09Add zlib and zstd dev packages for building lld.Kyle Huey-0/+2
2024-08-09Test --compress-debug-sections with rust-lld.Kyle Huey-0/+40
2024-08-09Enable zstd for debug compression.Kyle Huey-7/+51
Set LLVM_ENABLE_ZSTD alongside LLVM_ENABLE_ZLIB so that --compress-debug-sections=zstd is an option. Use static linking to avoid a new runtime dependency. Add an llvm.libzstd bootstrap option for LLVM with zstd. Set it off by default except for the dist builder. Handle llvm-config --system-libs output that contains static libraries.
2024-08-09Auto merge of #128703 - compiler-errors:normalizing-tails, r=lcnrbors-46/+245
Miscellaneous improvements to struct tail normalization 1. Make checks for foreign tails more accurate by normalizing the struct tail. I didn't write a test for this one. 2. Normalize when computing struct tail for `offset_of` for slice/str. This fixes the new solver only. 3. Normalizing when computing tails for disaligned reference check. This fixes both solvers. r? lcnr
2024-08-09Make `Build::run` comment more accurateJakub Beránek-1/+2
2024-08-09use absolute path for `config.toml`onur-ozkan-1/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-09add `builder-config` into tarball sourcesonur-ozkan-0/+6
This will be useful for certain scenarios where developers want to know how the tarball sources were generated. We also want this to check for CI rustc incompatible options on bootstrap. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-09use stable sort to sort multipart diagnosticsFolkert-3/+3
2024-08-09parser: ensure let stmt compound assignment removal suggestion respect ↵许杰友 Jieyou Xu (Joe)-2/+6
codepoint boundaries Previously we would try to issue a suggestion for `let x <op>= 1`, i.e. a compound assignment within a `let` binding, to remove the `<op>`. The suggestion code unfortunately incorrectly assumed that the `<op>` is an exactly-1-byte ASCII character, but this assumption is incorrect because we also recover Unicode-confusables like `➖=` as `-=`. In this example, the suggestion code used a `+ BytePos(1)` to calculate the span of the `<op>` codepoint that looks like `-` but the mult-byte Unicode look-alike would cause the suggested removal span to be inside a multi-byte codepoint boundary, triggering a codepoint boundary assertion. Issue: <https://github.com/rust-lang/rust/issues/128845>
2024-08-09tests: add regression test for #128845许杰友 Jieyou Xu (Joe)-0/+42
For codepoint boundary assertion triggered by a let stmt compound assignment removal suggestion when encountering recovered multi-byte compound ops. Issue: <https://github.com/rust-lang/rust/issues/128845>
2024-08-09hir_typeck: use `end_point` over `BytePos` manipulations许杰友 Jieyou Xu (Joe)-3/+6
Parser has error recovery for Unicode-confusables, which includes the right parentheses `)`. If a multi-byte right parentheses look-alike reaches the argument removal suggestion diagnostics, it would trigger an assertion because the diagnostics used `- BytePos(1)` which can land within a multi-byte codepoint. This is fixed by using `SourceMap::end_point` to find the final right delimiter codepoint, which correctly respects codepoint boundaries.