about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-11-09Auto merge of #132815 - matthiaskrgr:rollup-nti992u, r=matthiaskrgrbors-651/+1059
Rollup of 7 pull requests Successful merges: - #132341 (Reject raw lifetime followed by `'`, like regular lifetimes do) - #132363 (Enforce that raw lifetimes must be valid raw identifiers) - #132744 (add regression test for #90781) - #132754 (Simplify the internal API for declaring command-line options) - #132772 (use `download-rustc="if-unchanged"` as a global default) - #132774 (Use lld with non-LLVM backends) - #132799 (Make `Ty::primitive_symbol` recognize `str`) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-09Rollup merge of #132799 - zachs18:str-primitive-symbol, r=compiler-errorsMatthias Krüger-3/+29
Make `Ty::primitive_symbol` recognize `str` Make `Ty::primitive_symbol` recognize `str`, which makes `str` eligible for the "expected primitive, found local type" (and vice versa) [diagnostic](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs#L1430-L1437) that already exists for other primitives. <details><summary> diagnostic difference</summary> ```rs #[allow(non_camel_case_types)] struct str; fn foo() { let _: &str = "hello"; let _: &core::primitive::str = &str; } ``` `rustc --crate-type lib --edition 2021 a.rs` Current nightly: ```rs error[E0308]: mismatched types --> a.rs:5:19 | 5 | let _: &str = "hello"; | ---- ^^^^^^^ expected `str`, found a different `str` | | | expected due to this | = note: expected reference `&str` found reference `&'static str` error[E0308]: mismatched types --> a.rs:6:36 | 6 | let _: &core::primitive::str = &str; | --------------------- ^^^^ expected `str`, found a different `str` | | | expected due to this | = note: expected reference `&str` (`str`) found reference `&str` (`str`) error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. ``` With this patch: ```rs error[E0308]: mismatched types --> a.rs:5:19 | 5 | let _: &str = "hello"; | ---- ^^^^^^^ expected `str`, found a different `str` | | | expected due to this | = note: str and `str` have similar names, but are actually distinct types = note: str is a primitive defined by the language note: `str` is defined in the current crate --> a.rs:2:1 | 2 | struct str; | ^^^^^^^^^^ error[E0308]: mismatched types --> a.rs:6:36 | 6 | let _: &core::primitive::str = &str; | --------------------- ^^^^ expected `str`, found a different `str` | | | expected due to this | = note: str and `str` have similar names, but are actually distinct types = note: str is a primitive defined by the language note: `str` is defined in the current crate --> a.rs:2:1 | 2 | struct str; | ^^^^^^^^^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. ``` </details>
2024-11-09Rollup merge of #132774 - bjorn3:cranelift_lld, r=lqdMatthias Krüger-17/+0
Use lld with non-LLVM backends On arm64, Cranelift used to produce object files that don't work with lld. This has since been fixed. The GCC backend should always produce object files that work with lld unless lld for whatever reason drops GCC support. Most of the other more niche backends don't use cg_ssa's linker code at all. If they do and don't work with lld, they can always disable lld usage using a cli argument. Without this commit using cg_clif is by default in a non-trivial amount of cases a perf regression on Linux due to ld.bfd being a fair bit slower than lld. It is possible to explicitly enable it without this commit, but most users are unlikely to do this.
2024-11-09Rollup merge of #132772 - onur-ozkan:download-rustc-default, r=jieyouxuMatthias Krüger-32/+35
use `download-rustc="if-unchanged"` as a global default If `download-rustc` isn't explicitly set and the source is Git-managed, it should be totally okay to utilize "if-unchanged" behaviour. The "dist" profile already sets `download-rustc` to `false`, so this shouldn’t impact anything on CI. This also resolves an unhandled case where `bootstrap` unexpectedly panics if `"if-unchanged"` was used with a non-Git source. Now we exits gracefully with an error message pointing the problem.
2024-11-09Rollup merge of #132754 - Zalathar:opts, r=GuillaumeGomez,jieyouxuMatthias Krüger-594/+807
Simplify the internal API for declaring command-line options The internal APIs for declaring command-line options are old, and intimidatingly complex. This PR replaces them with a single function that takes explicit `stability` and `kind` arguments, making it easier to see how each option is handled, and whether it is treated as stable or unstable. We also don't appear to have any tests for the output of `rustc --help` and similar, so I've added a run-make test to verify that this PR doesn't change any output. (There is already a similar run-make test for rustdoc's help output.) --- The librustdoc changes are simply adjusting to updated compiler APIs; no functional change intended. --- A side-effect of these changes is that rustfmt can once again format the entirety of these option declaration lists, which it was not doing before.
2024-11-09Rollup merge of #132744 - lolbinarycat:test-90781, r=aDotInTheVoidMatthias Krüger-0/+78
add regression test for #90781 closes #90781
2024-11-09Rollup merge of #132363 - compiler-errors:raw-lt-id-valid, r=wesleywiserMatthias Krüger-4/+72
Enforce that raw lifetimes must be valid raw identifiers Make sure that the identifier part of a raw lifetime is a valid raw identifier. This precludes `'r#_` and all module segment paths for now. I don't believe this is compelling to support. This was raised by `@ehuss` in https://github.com/rust-lang/reference/pull/1603#discussion_r1822726753 (well, specifically the `'r#_` case), but I don't see why we shouldn't just make it consistent with raw identifiers.
2024-11-09Rollup merge of #132341 - compiler-errors:raw-lt-prefix-id, r=chenyukangMatthias Krüger-1/+38
Reject raw lifetime followed by `'`, like regular lifetimes do See comment. We want to reject cases like `'r#long'id`, which currently gets interpreted as a raw lifetime (`'r#long`) followed by a lifetime (`'id`). This could have alternative lexes, such as an overlong char literal (`'r#long'`) followed by an identifier (`id`). To avoid committing to this in any case, let's reject the whole thing. `@mattheww,` is this what you were looking for in https://github.com/rust-lang/reference/pull/1603#issuecomment-2339237325? I'd say ignore the details about the specific error message (the fact that this gets reinterpreted as a char literal is 🤷), just that because this causes a lexer error we're effectively saving syntactical space like you wanted.
2024-11-09Auto merge of #132613 - khuey:master, r=jieyouxubors-3/+133
Add discriminators to DILocations when multiple functions are inlined into a single point. LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM. This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling.
2024-11-09Add discriminators to DILocations when multiple functions are inlined into a ↵Kyle Huey-3/+133
single point. LLVM does not expect to ever see multiple dbg_declares for the same variable at the same location with different values. proc-macros make it possible for arbitrary code, including multiple calls that get inlined, to happen at any given location in the source code. Add discriminators when that happens so these locations are different to LLVM. This may interfere with the AddDiscriminators pass in LLVM, which is added by the unstable flag -Zdebug-info-for-profiling. Fixes #131944
2024-11-09Auto merge of #132807 - bjorn3:sync_cg_clif-2024-11-09, r=bjorn3bors-26/+52
Subtree sync for rustc_codegen_cranelift Apart from a perf optimization for some crates (https://github.com/rust-lang/rustc_codegen_cranelift/pull/1541) not much changed this time as the last sync was less than a week ago. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2024-11-09Merge commit '1fa693ca4462fc1f790693464cf765ad693616af' into ↵bjorn3-26/+52
sync_cg_clif-2024-11-09
2024-11-09Rustup to rustc 1.84.0-nightly (59cec72a5 2024-11-08)bjorn3-1/+1
2024-11-09Auto merge of #132800 - matthiaskrgr:rollup-c1kkj56, r=matthiaskrgrbors-31/+203
Rollup of 5 pull requests Successful merges: - #132552 (Add v9, v8plus, and leoncasa target feature to sparc and use v8plus in create_object_file) - #132745 (pointee_info_at: fix logic for recursing into enums) - #132777 (try_question_mark_nop: update test for LLVM 20) - #132785 (rustc_target: more target string fixes for LLVM 20) - #132794 (Use a separate dir for r-a builds consistently in helix config) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-09Sync from rust 59cec72a57af178767a7b8e7f624b06cc50f1087bjorn3-21/+66
2024-11-09Merge pull request #1541 from rust-lang/perf_optsbjorn3-1/+9
Use a BufWriter in emit_module to reduce syscall overhead
2024-11-09Rollup merge of #132794 - WaffleLapkin:helix-improved-config, r=jieyouxuMatthias Krüger-2/+15
Use a separate dir for r-a builds consistently in helix config r? `@jieyouxu` cc `@mrkajetanp` Previously config used `build-rust-analyzer` for rustfmt and proc macros server, while not using it for actual `x check` commands. This PR: - Replaces the build dir with `build/rust-analyzer` - This is just my preference - Although I do think this is the nicest option: the directory is already git-ignored, `rm -fr ./build` removes everything, etc - Uses said directory with the `x check` commands in helix r-a config - Adds instructions on how to build rustfmt and proc macro server to the config As of note, this is not what other configs do (like vscode's), however this _is_ what I would actually suggest to people (and what I'm actually using).
2024-11-09Rollup merge of #132785 - durin42:llvm-20-more-alignments, r=nikicMatthias Krüger-4/+4
rustc_target: more target string fixes for LLVM 20 LLVM continues to clean these up, and we continue to make this consistent. This is similar to 9caced7badc337ced7ad89eb614621c39bd996e9 and e9853961452b56997cc127b51308879b9cd09482. `@rustbot` label: +llvm-main
2024-11-09Rollup merge of #132777 - durin42:llvm-20-poison-prop, r=nikicMatthias Krüger-1/+10
try_question_mark_nop: update test for LLVM 20 llvm/llvm-project@dd116369f646d023a2e7e5c145a1bed5dcf9a45c changes the IR of this test in a way that I don't think is bad, but needs adjusting. r? `@nikic` `@rustbot` label: +llvm-main
2024-11-09Rollup merge of #132745 - RalfJung:pointee-info-inside-enum, r=DianQKMatthias Krüger-20/+61
pointee_info_at: fix logic for recursing into enums Fixes https://github.com/rust-lang/rust/issues/131834 The logic in `pointee_info_at` was likely written at a time when the null pointer optimization was the *only* enum layout optimization -- and as `Variant::Multiple` kept getting expanded, nobody noticed that the logic is now unsound. The job of this function is to figure out whether there is a dereferenceable-or-null and aligned pointer at a given offset inside a type. So when we recurse into a multi-variant enum, we better make sure that all the other enum variants must be null! This is the part that was forgotten, and this PR adds it. The reason this didn't explode in many ways so far is that our references only have 1 niche value (null), so it's not possible on stable to have a multi-variant enum with a dereferenceable pointer and other enum variants that are not null. But with `rustc_layout_scalar_valid_range` attributes one can force such a layout, and if `@the8472's` work on alignment niches ever lands, that will make this possible on stable.
2024-11-09Rollup merge of #132552 - taiki-e:sparc-target-feature, r=workingjubileeMatthias Krüger-4/+113
Add v9, v8plus, and leoncasa target feature to sparc and use v8plus in create_object_file This adds the following three unstable target features: - `v9`: SPARC-V9 instructions ([LLVM definition][sparc-v9]) - Relevant to https://github.com/rust-lang/rust/pull/131222#issuecomment-2453310963 - Relevant to https://github.com/rust-lang/rust/pull/132472#discussion_r1832606081 - This is also needed to implement https://github.com/taiki-e/atomic-maybe-uninit/pull/31 (depends on inline assembly support) more robustly. - `v8plus`: SPARC-V8+ ABI ([LLVM definition][sparc-v8plus]) - This is added in LLVM 20. In LLVM 19 and older, it is emulated to work the same way as LLVM in each LLVM version. - See https://github.com/rust-lang/rust/issues/132585#issuecomment-2453926257 for more. - `leoncasa`: CASA instruction[^1] of LEON3 and LEON4 processors ([LLVM definition][sparc-leoncasa], LLVM feature name: `hasleoncasa`) - This is needed to implement https://github.com/taiki-e/atomic-maybe-uninit/pull/31 (depends on inline assembly support) more robustly. [^1]: Atomic CAS instruction [sparc-v9]: https://github.com/llvm/llvm-project/blob/f5e4ffaa49254706ad6fa209de8aec28e20f0041/llvm/lib/Target/Sparc/Sparc.td#L37-L39 [sparc-v8plus]: https://github.com/llvm/llvm-project/blob/f5e4ffaa49254706ad6fa209de8aec28e20f0041/llvm/lib/Target/Sparc/Sparc.td#L37-L39 [sparc-leoncasa]: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/LeonFeatures.td#L32-L37
2024-11-09Auto merge of #132584 - Zalathar:includes, r=cuviperbors-164/+145
Trim and tidy includes in `rustc_llvm` These includes tend to accumulate over time, and are usually only removed when something breaks in a new LLVM version, so it's nice to clean them up manually once in a while. General strategy used for this PR: - Remove all includes from `LLVMWrapper.h` that aren't needed by the header itself, transplanting them to individual source files as necessary. - For each source file, temporarily remove each include if doing so doesn't cause a compile error. - If a “required” include looks like it shouldn't be needed, try replacing it with its sub-includes, then trim that list. - After doing all of the above, go back and re-add any removed include if the file does actually use things defined in that header, even if the header happens to also be included by something else.
2024-11-09Auto merge of #132798 - workingjubilee:rollup-qxvmmqo, r=workingjubileebors-445/+559
Rollup of 5 pull requests Successful merges: - #132755 (Do not reveal opaques in the param-env, we got lazy norm instead) - #132757 (Get rid of `check_opaque_type_well_formed`) - #132760 (Don't suggest `.into_iter()` on iterators) - #132778 (update io::Error::into_inner to acknowledge io::Error::other) - #132780 (use verbose for path separator suggestion) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-09Add test for str for "expected primitive, found type"Zachary S-3/+28
2024-11-09Add str to "expected primitive, found type" diagnosticZachary S-0/+1
2024-11-08Rollup merge of #132780 - compiler-errors:verbose, r=estebankJubilee-19/+104
use verbose for path separator suggestion A single `-` of suggestion underlining that is adjacent to a much more significant `^^^` underlying of the LHS path component is hard to distinguish. IMO this presents much more cleanly when it's verbose, especially because it's a *replacment* suggestion. r? estebank
2024-11-08Rollup merge of #132778 - lolbinarycat:io-Error-into_inner-docs, r=cuviperJubilee-2/+4
update io::Error::into_inner to acknowledge io::Error::other
2024-11-08Rollup merge of #132760 - dianne:iter-into-iter, r=lcnrJubilee-8/+56
Don't suggest `.into_iter()` on iterators This makes the the suggestion to call `.into_iter()` only consider unsatisfied `Iterator` bounds for the receiver type itself. That way, it ignores predicates generated by trying to auto-ref the receiver (the result of which usually won't implement `Iterator`). Fixes #127511 Unfortunately, the error in that case is still confusing: it labels `Iterator` as an unsatisfied bound because `&impl Iterator: Iterator` can't be satisfied, despite that not being required or helpful. I'd like to handle that in a separate PR. ~~I'm hoping fixing #124802 will fix it too.~~ It doesn't look connected to that issue. Still, I think it'd be clearest to visually distinguish unsatisfied predicates from different attempts at `pick_method`; I'll make a PR for that soon.
2024-11-08Rollup merge of #132757 - compiler-errors:yeet-check-wf, r=lcnrJubilee-411/+388
Get rid of `check_opaque_type_well_formed` Instead, replicate it by improving the span of the opaque in `check_opaque_meets_bounds`. This has two consequences: 1. We now prefer "concrete type differs" errors, since we'll hit those first before we check the opaque is WF. 2. Spans have gotten slightly worse. Specifically, (2.) could be improved by adding a new obligation cause that explains that the definition's environment has stronger assumptions than the declaration. r? lcnr
2024-11-08Rollup merge of #132755 - compiler-errors:reveal-param, r=lcnrJubilee-5/+7
Do not reveal opaques in the param-env, we got lazy norm instead r? lcnr
2024-11-09Auto merge of #132549 - Zalathar:rust-string, r=cuviperbors-47/+60
Make `RustString` an extern type to avoid `improper_ctypes` warnings Currently, any FFI function that uses `&RustString` needs to also add `#[ignore(improper_ctypes)]` to silence a warning. The warning is not _completely_ bogus, because `RustString` contains `Vec<u8>` and therefore does not have a guaranteed layout. But we have no way of telling the lint that this doesn't matter, because the C++ code only uses that pointer opaquely and never relies on its underlying layout. Ideally there would be some way to silence `improper_ctypes` at the type-definition site. But because there isn't, casting to and from a separate extern type is better than having to annotate every single use site.
2024-11-09Do not reveal opaques in the param-env, we got lazy norm insteadMichael Goulet-5/+7
2024-11-08Don't suggest `.into_iter()` on iteratorsdianne-8/+56
2024-11-09Use a separate dir for r-a builds consistently in helix configMaybe Lapkin-2/+15
2024-11-09Make `RustString` an extern type to avoid `improper_ctypes` warningsZalathar-44/+56
2024-11-08rustc_target: more target string fixes for LLVM 20Augie Fackler-4/+4
LLVM continues to clean these up, and we continue to make this consistent. This is similar to 9caced7badc337ced7ad89eb614621c39bd996e9 and e9853961452b56997cc127b51308879b9cd09482. @rustbot label: +llvm-main
2024-11-08Auto merge of #132764 - MikaelUrankar:freebsd_armv7, r=workingjubileebors-2/+0
Drop "gnu" in the target env for FreeBSD armv6/7 FreeBSD is not a GNU system
2024-11-09Add v8plus target feature to sparc and use it in create_object_fileTaiki Endo-3/+97
2024-11-09Add v9 and leoncasa target feature to sparcTaiki Endo-3/+18
2024-11-08fix `core::config::tests::override_toml`onur-ozkan-0/+3
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-11-08use verbose for path separator suggestionMichael Goulet-19/+104
2024-11-08Auto merge of #132746 - flip1995:clippy-subtree-update, r=Manishearthbors-900/+5023
Clippy subtree update r? `@Manishearth`
2024-11-08update io::Error::into_inner to acknowlage io::Error::otherbinarycat-2/+4
2024-11-08Use a BufWriter in emit_module to reduce syscall overheadbjorn3-1/+7
For the coercions rustc-perf benchmark without this commit reduces the total amount of time it takes to emit the object file from 270ms to 27ms.
2024-11-08try_question_mark_nop: update test for LLVM 20Augie Fackler-1/+10
llvm/llvm-project@dd116369f646d023a2e7e5c145a1bed5dcf9a45c changes the IR of this test in a way that I don't think is bad, but needs adjusting. r? @nikic @rustbot label: +llvm-main
2024-11-08Add finish_ongoing_codegen timer in join_codegen to match cg_llvmbjorn3-0/+2
2024-11-08Use lld with non-LLVM backendsbjorn3-17/+0
On arm64, Cranelift used to produce object files that don't work with lld. This has since been fixed. The GCC backend should always produce object files that work with lld unless lld for whatever reason drops GCC support. Most of the other more niche backends don't use cg_ssa's linker code at all. If they do and don't work with lld, they can always disable lld usage using a cli argument. Without this commit using cg_clif is by default in a non-trivial amount of cases a perf regression on Linux due to ld.bfd being a fair bit slower than lld. It is possible to explicitly enable it without this commit, but most users are unlikely to do this.
2024-11-08respect to global `download-rustc` default in non-dist profilesonur-ozkan-8/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-11-08use `download-rustc="if-unchanged"` as default whenever possibleonur-ozkan-3/+13
"whenever possible" means applying it if `download-rustc` isn't explicitly set and the source is Git-managed. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-11-08read repository information configs at an earlier stageonur-ozkan-21/+18
Signed-off-by: onur-ozkan <work@onurozkan.dev>