Rustc pull update - #3030
Merged
Merged
Rustc pull update#3030
Conversation
…hercote Mini optimization in `rustc_hir_typeck::upvar::restrict_precision_for_drop_types` Avoid calling `type_is_copy_modulo_regions` if not necessary. (Drive-by fix while I am working on something else)
implement `VaArgSafe` for `f128` On some platforms, especially when `long double` is IEEE f128 on the platform.
Add Natvis visualiser and debuginfo tests for `f128`
To render f128s in debuggers on MSVC targets, this PR changes the compiler to output `f128`s as `struct f128 { low_bits: u64, high_bits: u64 }`, and includes a Natvis visualiser that displays the float in hexdecimal format (similar to the `LowerHex` impl in rust-lang/rust#160626), as unlike `f16` there's no larger supported float format to convert to and trying to write a float to decimal string converter in Natvis didn't seem practical. gdb, lldb and cdb tests are also included for `f128`, although gdb does not yet correctly identify the float format.
I did consider also displaying a `double` approximation of the `f128` (as the debugger will convert that to a decimal string) but decided against it as `f64` has a significantly smaller exponent range too (meaning very large or small `f128`s couldn't have an approximation anyway) and `cdb` and `WinDbg` both seem to round all floating-point numbers to 6 decimal places, meaning the displayed number is (double) rounded even further than `f64` precision and is useless for tiny values.
Closes rust-lang/rust#121837
Tracking issue: rust-lang/rust#116909
…rait-import, r=JohnTitor Avoid suggesting imports of traits declared inside fn bodies Fixes rust-lang/rust#134146
Move parse error recovery for expression operators "out of line" & refactor in the area **Background**: While we do have 3k-line module `rustc_parse/src/parser/diagnostics.rs`[^1] dedicated to syntax error diagnostics & parse error recovery, the rest of the parser is still "littered" or "interwoven" through and through with complex or verbose diagnostic code. We support numerous recoveries from syntaxes found in other languages right next to code that actually decides what is and what isn't part of Rust syntactically. This makes the parser code very messy, illegible, bug prone and otherwise hard to maintain. So my long-term plan is to push all this diagnostic & recovery code "out of line", namely into new `rustc_parse/src/parser/$fragment/diagnostics.rs` files, to keep the "inline code" of parsing routines in `$fragment.rs` focused on actually parsing Rust code. Why not just use the pre-existing `parser/diagnostics.rs` module? Well, making diagnostic code for expressions, patterns, types etc. share the same module is the definition of a hodgepodge. Moreover, moving all diagnostic code there would make the file way too large. Of course, for common code (if any) `parser/diagnostics.rs` would remain suitable. Best reviewed commit by commit. Commit [Refactor check_assoc_op to make it more legible](rust-lang/rust@66311aa) was cherry-picked from my PR rust-lang/rust#161775. <sub>(No LLM was or will be used by me during the entire creation process of this PR)</sub> [^1]: Not to be confused with `rustc_parse/src/diagnostics.rs` which holds diagnostic structs.
…ent-names, r=lolbinarycat [rustdoc] Correctly handle intra-doc links on inlined same item with different names Fixes rust-lang/rust#136777. It works as follow: we keep the `DefId` indexing, but we add a new `alternatives` entry (same inlined items, but under a different path) which allows to pick the right entry. So now, why this approach instead of changing the indexing (like `(DefId, Symbol)`)? Because it's much less common to import a same item with different names, so increasing the size of the index seems unnecessary. That does make the code more noisy, which I'm not a big fan of, so if someone has ideas for improvements, definitely interested! r? @lolbinarycat
Add useful APIs to `Unique(Arc|Rc)` Some of these we already had private methods for (only used for `(try_)map`), some of these (or lack thereof) (namely the `try_new` apis) prevented me from using `UniqueArc` in other parts of std. cc rust-lang/rust#112566
…t-callsite, r=saethlin Remove applying inline attributes at the callsite Following from our discussion and the currently open PR; rust-lang/rust#162460, removing the blanket addition of inline attributes at the callsite, even without the `#[inline(always)]` changes, looks to now have negligible impact.
Use spawned `SBDebugger` instance As mentioned in rust-lang/rust#162598, this is a small forward-compatibility fix for `tests/debuginfo` with LLDB 23, which seems to be significantly less willing to let us use the parent LLDB instance. I assume this is due to not updating internal/python state while a command is actively being processed (the entire time `debugger_tester` is running, we're in a top-level `script` command)? We avoided this before because we need to be able to exit with a non-0 status code when not all the expected types/vars are tested, and it wasn't obvious how to get that to happen. Here, we use `os.kill(os.getpid(), signal.SIGTERM)`, which kills the parent LLDB process from within python. `SIGTERM` is used because `SIGKILL` is unix only, and `SIGABRT` spits out a huge LLDB backtrace with "report this error to LLDB", which is potentially confusing. The error exit behavior can be tested by deleting one of the `lldb-repr` lines from `tests/debuginfo/basic-types/main.rs` r? @Kobzol, @jieyouxu
…orino More AST lowering cleanups Details in individual commits. r? @spastorino
…eyouxu Update `browser-ui-test` version to `0.25.2` Should help with rust-lang/rust#93784 (comment). cc @jieyouxu r? ghost
mark `f128` as reliable on `powerpc64` with `+vsx` This feature is only enabled by default for powerpc64le, and not enabled on the big-endian targets. Even with vsx, the default long double is ppcf128 on the big-endian targets, so LLVM calls the incorrect libcall. Also some libcalls just don't exist. I tested this with and without `rustflags = ["-C", "target-feature=+vsx"]` in the `bootstrap.toml`: ``` ./x.py test library/core --target powerpc64-unknown-linux-gnu ./x.py test library/core --target powerpc64le-unknown-linux-gnu ``` These all hit one failure, in the docs test for `library/core/src/keyword_docs.rs` where `become` is used: powerpc does not support guaranteed tail calls. Anyway, that is not relevant for f128 support. Sadly `powerpc-unknown-linux-gnu` with `+vsx` hits the issue fixed in llvm/llvm-project#216613, I've requested a backport for the fix. r? beetrees or @tgross35 cc @Gelbpunkt
…hnTitor Add performance notes for the floating-point round method This update has revised the documentation for f32::round and f64::round, stating that round_ties_even typically offers better performance on most hardware platforms, and reminding readers that the rounding rules at the midpoint are different for the two methods. This update addresses the unfinished documentation task in issue rust-lang/rust#55107.
yeet AliasConstKind::opt_def_id A while back, I made three PRs removing def_id from AliasConst/AliasTerm/AliasTy: - rust-lang/rust#157374 - rust-lang/rust#157653 - rust-lang/rust#158013 I did AliasConst first, and due to my inexperience with this refactor, I had this `opt_def_id` kludge. I didn't do the same thing in the AliasTy or AliasTerm PRs. It ought to be removed and replaced with explicit matches. related tracking-ish issues: - rust-lang/rust#152245 - rust-lang/rust#156181 - rust-lang/project-const-generics#98 - goodness we have a lot of issues on this general area of work r? @BoxyUwU
Ping T-libs-ping instead of T-libs-fcp for backports Blocked on rust-lang/team#2755.
Adjust `bug!`/`span_bug!` emission PR rust-lang/rust#161873 moved these macros from `rustc_middle` to `rustc_span`. In doing so it made some undesirable changes. - The internal `emit_producing_nothing` became public. - The macros now have different behaviour to function-based ICEs like `dcx.bug(..)` or `dcx.struct_bug(..).emit()`. This commit reverts those changes. This brings back `Box<dyn Any>` output in a few tests because the panic payload is `ExplicitBug` (which std doesn't know about) rather than `String`. That might be worth fixing again in the future, but if so, it should be done in a way that works with all aborts, not just those done via the macros. r? @mejrs
Add missing `#[repr(C)]` in UI, codegen and assembly tests
There are quite a few tests which omit the `#[repr(C)]` on structs that are then used in non-Rustic ABIs. I've gone through the tests in `ui/abi`, `ui/ffi`, `codegen-llvm` and `assembly-llvm` and added `#[repr(C)]` where it was missing. I also converted `#[allow(improper_ctypes{,_definitions})]` to `#[expect(improper_ctypes{,_definitions})]` where possible, and removed it where the lint no longer triggers.
I haven't done it in this PR, but I think it's worth making codegen and assembly tests deny warnings by default. With UI tests `improper_ctypes{,_definitions}` has to be either allowed or will show up in the output, meaning it should be fairly obvious to reviewers, but with codegen and assembly tests warnings just get ignored if the test passes.
Fixes rust-lang/rust#53858
r? @folkertdev
cc @RalfJung
rustc-dev-guide subtree update Subtree update of `rustc-dev-guide` to 9bf6185. Created using https://github.com/rust-lang/josh-sync. r? @ghost
Error on invalid placements for unstable attributes These are unstable, no need to have a warning.
…uwer Rollup of 22 pull requests Successful merges: - rust-lang/rust#163001 (Temporarily disable `test-x86_64-fuchsia`) - rust-lang/rust#162880 (Mini optimization in `rustc_hir_typeck::upvar::restrict_precision_for_drop_types`) - rust-lang/rust#161424 (implement `VaArgSafe` for `f128`) - rust-lang/rust#161777 (Add Natvis visualiser and debuginfo tests for `f128`) - rust-lang/rust#162506 (Avoid suggesting imports of traits declared inside fn bodies) - rust-lang/rust#162591 (Move parse error recovery for expression operators "out of line" & refactor in the area) - rust-lang/rust#162669 ([rustdoc] Correctly handle intra-doc links on inlined same item with different names) - rust-lang/rust#162733 (Add useful APIs to `Unique(Arc|Rc)`) - rust-lang/rust#162913 (Refactor LivenessResults into LivenessComputation, without typeck) - rust-lang/rust#162924 (Remove applying inline attributes at the callsite) - rust-lang/rust#162940 (Use spawned `SBDebugger` instance) - rust-lang/rust#162950 (More AST lowering cleanups) - rust-lang/rust#162964 (Update `browser-ui-test` version to `0.25.2`) - rust-lang/rust#162979 (mark `f128` as reliable on `powerpc64` with `+vsx`) - rust-lang/rust#161743 (Add performance notes for the floating-point round method) - rust-lang/rust#162797 (yeet AliasConstKind::opt_def_id) - rust-lang/rust#162836 (Ping T-libs-ping instead of T-libs-fcp for backports) - rust-lang/rust#162873 (Adjust `bug!`/`span_bug!` emission) - rust-lang/rust#162956 (Add missing `#[repr(C)]` in UI, codegen and assembly tests) - rust-lang/rust#162971 (libtest harness: avoid 'extern crate test' with custom runner) - rust-lang/rust#162981 (rustc-dev-guide subtree update) - rust-lang/rust#162985 (Error on invalid placements for unstable attributes)
Remove usages of `Unique` from `RawVec` See [zulip](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Can.20we.20nuke.20.60Unique.60.3F/with/624141418). Probably needs a perf run, because it touches code that might be very sensitive to build times and debug mode r? libs
even more cleanups for `rustc_builtin_macros` Followup to rust-lang/rust#162234 with more cleanups and perf improvements.
It encodes the `emit` behaviour, one of: - `BugAbort`: Abort as a bug. - `FatalAbort`: Abort as a fatal error. - `ErrorGuaranteed`: Return an `ErrorGuaranteed` (the default). - `()`: return `()`. This is useful but `Diag` is very widely used and it's arguably not useful enough to be worth the generic parameter. This commit removes it. Benefits: - Many fewer generic parameters, including many functions where the genericity is entirely uninteresting. This includes every `Diagnostic::into_diag` and `Subdiagnostic::add_to_diag`. Removes the need for the comment about `<G>` on `trait Diagnostic`. - No `PhantomData` in `Diag`. - Makes bootstrapping a bit faster. The downside is there is no longer a single `emit` method. - Getting a `!` return type requires calling `emit_bug` or `emit_fatal`. This only affects a few call sites. - Getting an `ErrorGuaranteed` return type requires calling `emit_err`. This affects a lot of call sites. (It arguably makes call sites more self-documenting.) - Using the wrong `emit_*` on a diagnostic causes a runtime abort, which previously couldn't occur. Seems unlikely, but it's not impossible. - Note: If no particular return type is needed, `emit` can be used for any diagnostic. (Bug/fatal diagnostics will still trigger abort.)
Remove `G` generic param from `Diag<'_, G>` The benefits are outweighed by the costs. Details in invidual commits. some minor earlier discussion about this change in rust-lang/rust#162630 (comment)
Staticlib rename internal symbols: add COFF support Follow-up to rust-lang/rust#156950. `-Zstaticlib-rename-internal-symbols` now also works on COFF targets (Windows). Renaming only rewrites symbol names, so unlike hide it needs no visibility concept. COFF objects keep their string table at the end of the file, so renames append the new names there and patch the 4-byte length prefix plus each symbol's name offset in place. Both regular and bigobj objects are handled; on i686 a leading underscore is stripped when matching against the exported set. The archive format differs (GNU ar on windows-gnu, COFF on windows-msvc) but the members are always COFF objects, so the existing archive code is unchanged. Supported on ELF, Apple, and COFF targets. `-Zstaticlib-hide-internal-symbols` remains ELF/Apple-only and still warns on Windows. A run-make test `staticlib-rename-internal-symbols-coff` mirrors the existing ELF and Mach-O tests. r? @bjorn3
…ross35 `core::num::f16b` Rust's 16bit Brain Float Implements the [RFC: f16b type](rust-lang/rfcs#3983). Best reviewed commit by commit, happy to split into separate PRs if that is deemed easier to review. However the line count and surface area is, in my opinion, reasonably small. Adds; - ABI plumbing for the `f16b` along with `bfloat` lang item to work with LLVM, GCC is explicitly `unimplemented!(...)` - `f16b` feature gate, page for `f16b` on libruscdoc and a `struct bf16` in `core::num` - Tests - Treat `f16b` as a scalar primitive for scalable vectors Issues; - [Tracking Issue](rust-lang/rust#160630) - [RFC](rust-lang/rfcs#3983)
…tfix, r=mejrs Preserve parentheses in raw borrow suggestions Fixes rust-lang/rust#161693
…ejrs Avoid suggesting closures when captures cross associated item boundaries Fixes rust-lang/rust#153363 We check the boundaries between a variable's declaration and its usage. If an associated item boundary is crossed, replacing a nested function with a closure does not eliminate this boundary. We retain the error but remove the ineffective suggestion. The hint is preserved for an ordinary nested function capturing a local variable of the method. Checks: full UI test run `./x test tests/ui --force-rerun`, 21853 passed / 410 ignored, and `./x test tidy`. Used an LLM for code navigation
Use span context for enclosing item(s) of unmet bound
Point at item that introduced an unmet bound and in the case of associated items, their container (trait/impl), without using a span label. This adds bits of code to the diagnostic, without explicitly pointing to it.
```
error[E0277]: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize`
--> $DIR/issue-54108.rs:23:17
|
LL | type Size = <Self as SubEncoder>::ActualSize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `<T as SubEncoder>::ActualSize + <T as SubEncoder>::ActualSize`
|
= help: the trait `Add` is not implemented for `<T as SubEncoder>::ActualSize`
note: required by a bound in `Encoder::Size`
--> $DIR/issue-54108.rs:8:16
|
LL | pub trait Encoder {
LL | type Size: Add<Output = Self::Size>;
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
```
r? @oli-obk
…em, r=oli-obk label the path segment that is not an associated item of the trait E0782 pointed only at the trait, leaving the segment that actually failed to resolve unmarked unless it was close enough to suggest a typo fix. rust-lang/rust#136994 r? @oli-obk cc @fmease
Add a README in tests/rustdoc-html to explain what each folder content is for Follow-up of rust-lang/rust#162906. r? @Urgau
Implement Allocator for Pin unstably [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/197181-t-libs.2Fwg-allocators/topic/Sorry.20Nia/with/625613195) r? clarfonthey
remove old solver use of `SolverRelating` cc @BennoLossin @Nadrieril also see the added FIXME `solver_relating::RelateExt` is only intended for use with the new solver. Should hopefully not matter at all in the medium term :> as the old solver is gone r? types
…uwer Rollup of 10 pull requests Successful merges: - rust-lang/rust#163083 (Remove `G` generic param from `Diag<'_, G>`) - rust-lang/rust#160679 (Staticlib rename internal symbols: add COFF support) - rust-lang/rust#160859 (`core::num::f16b` Rust's 16bit Brain Float) - rust-lang/rust#162007 (Preserve parentheses in raw borrow suggestions) - rust-lang/rust#162821 (Avoid suggesting closures when captures cross associated item boundaries) - rust-lang/rust#163057 (Use span context for enclosing item(s) of unmet bound) - rust-lang/rust#163070 (label the path segment that is not an associated item of the trait) - rust-lang/rust#163078 ( Add a README in tests/rustdoc-html to explain what each folder content is for) - rust-lang/rust#163107 (Implement Allocator for Pin unstably) - rust-lang/rust#163108 (remove old solver use of `SolverRelating`)
This updates the rust-version file to 56fad885ebfb0447660870715da4dfa75deae93d.
Pull recent changes from https://github.com/rust-lang/rust via Josh. Previous upstream ref: rust-lang/rust@420ed2a New upstream ref: rust-lang/rust@56fad88 Filtered ref: 3b18834 Upstream diff: rust-lang/rust@420ed2a...56fad88 This merge was created using https://github.com/rust-lang/josh-sync.
Collaborator
|
Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Latest update from rustc.