about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2025-04-16Auto merge of #136926 - wesleywiser:stabilize_dwarf-version, r=petrochenkovbors-13/+13
Stabilize `-Zdwarf-version` as `-Cdwarf-version` I propose stabilizing `-Zdwarf-version` as `-Cdwarf-version`. This PR adds a new `-Cdwarf-version` flag, leaving the unstable `-Z` flag as is to ease the transition period. The `-Z` flag will be removed in the future. # `-Zdwarf-version` stabilization report ## What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized? No RFC/MCP, this flag was added in https://github.com/rust-lang/rust/pull/98350 and was not deemed large enough to require additional process. The tracking issue for this feature is #103057. ## What behavior are we committing to that has been controversial? Summarize the major arguments pro/con. None that has been extensively debated but there are a few questions that could have been chosen differently: 1. What should the flag name be? The current flag name is very specific to DWARF. Other debuginfo formats exist (msvc's CodeView format or https://en.wikipedia.org/wiki/Stabs) so we could have chosen to generalize the flag name (`-{C,Z} debuginfo-version=dwarf-5` for example). While this would extend cleanly to support formats other than DWARF, there are some downsides to this design. Neither CodeView nor Stabs have specification or format versions so it's not clear what values would be supported beyond `dwarf-{2,3,4,5}` or `codeview`. We would also need to take care to ensure the name does not lead users to think they can pick a format other than one supported by the target. For instance, what would `--target x86_64-pc-windows-msvc -Cdebuginfo-version=dwarf-5` do? 2. What is the behavior when flag is used on targets that do not support DWARF? Currently, passing `-{C,Z} dwarf-version` on targets like `*-windows-msvc` does not do anything. It may be preferable to emit a warning alerting the user that the flag has no effect on the target platform. Alternatively, we could emit an error but this could be annoying since it would require the use of target specific RUSTFLAGS to use the flag correctly (and there isn't a way to target "any platform that uses DWARF" using cfgs). 3. Does the precompiled standard library potentially using a different version of DWARF a problem? I don't believe this is an issue as debuggers (and other such tools) already must deal with the possibility that an application uses different DWARF versions across its statically or dynamically linked libraries. ## Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those. No extensions per se, although future DWARF versions could be considered as such. At present, we validate the requested DWARF version is between 2 and 5 (inclusive) so new DWARF versions will not automatically be supported until the validation logic is adjusted. ## Summarize the major parts of the implementation and provide links into the code (or to PRs) - Targets define their preferred or default DWARF version: https://github.com/rust-lang/rust/blob/34a5ea911c56e79bd451c63f04ea2f5023d7d1a3/compiler/rustc_target/src/spec/mod.rs#L2369 - We use the target default but this can be overriden by `-{C,Z} dwarf-version` https://github.com/rust-lang/rust/blob/34a5ea911c56e79bd451c63f04ea2f5023d7d1a3/compiler/rustc_session/src/session.rs#L738 - The flag is validated https://github.com/rust-lang/rust/blob/34a5ea911c56e79bd451c63f04ea2f5023d7d1a3/compiler/rustc_session/src/session.rs#L1253-L1258 - When debuginfo is generated, we tell LLVM to use the requested value or the target default https://github.com/rust-lang/rust/blob/34a5ea911c56e79bd451c63f04ea2f5023d7d1a3/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs#L106 ## Summarize existing test coverage of this feature - Test that we actually generate the appropriate DWARF version - https://github.com/rust-lang/rust/blob/master/tests/assembly/dwarf5.rs - https://github.com/rust-lang/rust/blob/master/tests/assembly/dwarf4.rs - Test that LTO with different DWARF versions picks the highest version - https://github.com/rust-lang/rust/blob/master/tests/assembly/dwarf-mixed-versions-lto.rs - Test DWARF versions 2-5 are valid while 0, 1 and 6 report an error - https://github.com/rust-lang/rust/blob/master/tests/ui/debuginfo/dwarf-versions.rs - Ensure LLVM does not report a warning when LTO'ing different DWARF versions together - https://github.com/rust-lang/rust/blob/master/tests/ui/lto/dwarf-mixed-versions-lto.rs ## Has a call-for-testing period been conducted? If so, what feedback was received? No call-for-testing has been conducted but Rust for Linux has been using this flag without issue. ## What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking? All reported bugs have been resolved. ## Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization - Initial implementation in https://github.com/rust-lang/rust/pull/98350 by `@pcwalton` - Stop emitting `.debug_pubnames` and `.debug_pubtypes` when using DWARF 5 in https://github.com/rust-lang/rust/pull/117962 by `@weihanglo.` - Refactoring & cleanups (#135739), fix LLVM warning on LTO with different DWARF versions (#136659) and argument validation (#136746) by `@wesleywiser` ## What FIXMEs are still in the code for that feature and why is it ok to leave them there? No FIXMEs related to this feature. ## What static checks are done that are needed to prevent undefined behavior? This feature cannot cause undefined behavior. We ensure the DWARF version is one of the supported values [here](https://github.com/rust-lang/rust/blob/34a5ea911c56e79bd451c63f04ea2f5023d7d1a3/compiler/rustc_session/src/session.rs#L1255-L1257). ## In what way does this feature interact with the reference/specification, and are those edits prepared? No changes to reference/spec, unstable rustc docs are moved to the stable book as part of the stabilization PR. ## Does this feature introduce new expressions and can they produce temporaries? What are the lifetimes of those temporaries? No. ## What other unstable features may be exposed by this feature? `-Zembed-source` requires use of DWARF 5 extensions but has its own feature gate. ## What is tooling support like for this feature, w.r.t rustdoc, clippy, rust-analzyer, rustfmt, etc.? No support needed for rustdoc, clippy, rust-analyzer, rustfmt or rustup. Cargo could expose this as an option in build profiles but I would expect the decision as to what version should be used would be made for the entire crate graph at build time rather than by individual package authors. cc-rs has support for detecting the presence of `-{C,Z} dwarf-version` in `RUSTFLAGS` and providing the corresponding flag to Clang/gcc (https://github.com/rust-lang/cc-rs/pull/1395). --- Closes #103057
2025-04-16Only delete the lld directory if it existsJakub Beránek-1/+3
2025-04-16Allow disabling `--llvm-shared` in opt-distJakub Beránek-1/+1
2025-04-16Merge pull request #2337 from xizheyin/sync-codeJakub Beránek-0/+14
Remind to update dev branch while behind too many commits
2025-04-16Remind to update dev branch while behind too many commitsxizheyin-0/+14
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-15rustdoc: Output target feature informationWill Glynn-2/+125
`#[target_feature]` attributes refer to a target-specific list of features. Enabling certain features can imply enabling other features. Certain features are always enabled on certain targets, since they are required by the target's ABI. Features can also be enabled indirectly based on other compiler flags. Feature information is ultimately known to `rustc`. Rather than force external tools to track it -- which may be wildly impractical due to `-C target-cpu` -- have `rustdoc` output `rustc`'s feature data.
2025-04-16Improve `borrowck_graphviz_*` documentation.Nicholas Nethercote-1/+2
In particular, `borrowck_graphviz_preflow` no longer exists.
2025-04-15Update Cargo.lock for rustbookEric Huss-0/+10
2025-04-16Rename `LifetimeName` as `LifetimeKind`.Nicholas Nethercote-17/+17
It's a much better name, more consistent with how we name such things. Also rename `Lifetime::res` as `Lifetime::kind` to match. I suspect this field used to have the type `LifetimeRes` and then the type was changed but the field name remained the same.
2025-04-15Update booksrustbot-0/+0
2025-04-15Perform PGO for aarch64 buildsJakub Beránek-2/+3
2025-04-15normalize canonical and non-canonical paths in compiletestWaffle Lapkin-5/+8
Apparently there are tests that print canonical paths *and* tests which print non-canonical paths. An example of the latter is `tests/ui/type_length_limit.rs`.
2025-04-15commit rustfmt stump in `x t tidy` even on `check`Waffle Lapkin-3/+6
If checking succeeded, it's equivalent to successfully formatting.
2025-04-15Rollup merge of #139859 - marcoieni:rename-macos-runner, r=KobzolMatthias Krüger-6/+6
CI: rename MacOS runner r? ``@Kobzol``
2025-04-15Rollup merge of #138455 - yotamofek:pr/rustdoc/more-impl-display, ↵Matthias Krüger-230/+228
r=GuillaumeGomez `librustdoc`: more `impl fmt::Display` Continuation of #137425 and #136828 and #136784 Working towards getting rid of the `write_str` helper r? `@GuillaumeGomez` (if you want!)
2025-04-16feat: enhance signature help to display generic parameters for callables and ↵roifewu-13/+154
default values for generic args
2025-04-15Use PGO on Linux x64 buildsJakub Beránek-0/+1
2025-04-15Merge pull request #19585 from Kobzol/pgo-windowsLaurențiu Nicola-11/+53
Allow training PGO on a custom crate and enable it Windows on CI
2025-04-15add comment in `TomlConfig::merge` about the merge orderonur-ozkan-0/+2
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15Replace flag `--doctest-compilation-args` with a simpler one: ↵León Orell Valerian Liehr-71/+7
`--doctest-build-arg` More notably, the value of the new flag does *not* get lexed shell-like and ad hoc.
2025-04-15Use `manylinux` Docker container instead of zigbuild for x64 LinuxJakub Beránek-1/+9
This gets us glibc 2.28 without using `cargo zigbuild`, which is not compatible with PGO.
2025-04-15add a comment for code that isn'tWaffle Lapkin-1/+7
2025-04-15slightly correct comments and diagnostics about checking modificationsWaffle Lapkin-10/+13
I feel like they are still wrong, but maybe less so .-. The `info:` was unhelpful -- we only use upstream in CI nowdays.
2025-04-15use helper function instead of writing rustfmt stamp by handWaffle Lapkin-1/+2
2025-04-15tidy: don't crush on non-existent submodulesWaffle Lapkin-1/+3
2025-04-15Merge pull request #4260 from CraftSpider/windows-file-deleteOli Scherer-5/+46
Implement file deletion on Windows
2025-04-15Rename `is_builder_target` to `is_host_target`Jakub Beránek-19/+18
2025-04-15Move `is_builder_target`, `is_system_llvm` and `is_rust_llvm` from `Builder` ↵Jakub Beránek-53/+57
to `Config`
2025-04-15Add `explicit_extern_abis` unstable featureObei Sideg-0/+23
also add `explicit-extern-abis` feature section to the unstable book.
2025-04-15Use `-q` to silence RA outputJakub Beránek-3/+1
2025-04-15CI: rename MacOS runnerMarcoIeni-6/+6
2025-04-15Run PGO for Windows on CIJakub Beránek-0/+2
2025-04-15Allow passing a specific crate for PGO trainingJakub Beránek-10/+52
2025-04-15Fix `llvm-profdata` extension on non Linux OSesJakub Beránek-1/+1
2025-04-15add FIXME note in `TomlConfig::merge`onur-ozkan-0/+2
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15fix path and the ordering logiconur-ozkan-26/+28
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15apply nit notesonur-ozkan-26/+69
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15document `include` in `bootstrap.example.toml`onur-ozkan-2/+3
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15implement cyclic inclusion handlingonur-ozkan-13/+38
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15document config extensionsonur-ozkan-0/+36
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15add new config option: `include`onur-ozkan-1/+29
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-04-15Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalatharbors-230/+750
Rollup of 17 pull requests Successful merges: - #138374 (Enable contracts for const functions) - #138380 (ci: add runners for vanilla LLVM 20) - #138393 (Allow const patterns of matches to contain pattern types) - #139517 (std: sys: process: uefi: Use NULL stdin by default) - #139554 (std: add Output::exit_ok) - #139660 (compiletest: Add an experimental new executor to replace libtest) - #139669 (Overhaul `AssocItem`) - #139671 (Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file}) - #139750 (std/thread: Use default stack size from menuconfig for NuttX) - #139772 (Remove `hir::Map`) - #139785 (Let CStrings be either 1 or 2 byte aligned.) - #139789 (do not unnecessarily leak auto traits in item bounds) - #139791 (drop global where-bounds before merging candidates) - #139798 (normalize: prefer `ParamEnv` over `AliasBound` candidates) - #139822 (Fix: Map EOPNOTSUPP to ErrorKind::Unsupported on Unix) - #139833 (Fix some HIR pretty-printing problems) - #139836 (Basic tests of MPMC receiver cloning) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-15canonicalize test build dir before normalizing itWaffle Lapkin-1/+5
Fix fixes failures of the following tests when build directory is a symlink: - `tests/ui/error-codes/E{0464,0523}.rs` - `tests/ui/crate-loading/crateresolve{1,2}.rs` (those are the same tests)
2025-04-15fix typoWaffle Lapkin-1/+1
2025-04-15update submodules if the directory doesn't existWaffle Lapkin-0/+7
2025-04-15unstable book; document `macro_metavar_expr_concat`mejrs-0/+145
2025-04-14Setup editor file associations for non-rs extensionsThalia Archibald-11/+23
.gitattributes lists *.fixed, *.pp, and *.mir as file extensions which should be treated as Rust source code. Do the same for VS Code and Zed. This only does syntax highlighting, which is appropriate, as MIR isn't really Rust code. At the same time, consistently order `rust-analyzer.linkedProjects` between editors. For some reason, Eglot didn't include library/Cargo.toml.
2025-04-15Rollup merge of #139772 - nnethercote:rm-hir-Map, r=ZalatharStuart Cook-25/+19
Remove `hir::Map` A follow-up to https://github.com/rust-lang/rust/pull/139232. r? `@Zalathar`
2025-04-15Rollup merge of #139671 - m-ou-se:proc-macro-span, r=dtolnayStuart Cook-38/+15
Proc macro span API redesign: Replace proc_macro::SourceFile by Span::{file, local_file} Simplification/redesign of the unstable proc macro span API, tracked in https://github.com/rust-lang/rust/issues/54725: Before: ```rust impl Span { pub fn line(&self) -> usize; pub fn column(&self) -> usize; pub fn source_file(&self) -> SourceFile; } #[derive(Clone, Debug, PartialEq, Eq)] pub struct SourceFile { .. } impl !Send for SourceFile {} impl !Sync for SourceFile {} impl SourceFile { pub fn path(&self) -> PathBuf; pub fn is_real(&self) -> bool; } ``` After: ```rust impl Span { pub fn line(&self) -> usize; pub fn column(&self) -> usize; pub fn file(&self) -> String; // Mapped file name, for display purposes. pub fn local_file(&self) -> Option<PathBuf>; // Real file name as it exists on disk. } ``` This resolves the last blocker for stabilizing these methods. (Stabilizing will be a separate PR with FCP.)
2025-04-15Rollup merge of #139669 - nnethercote:overhaul-AssocItem, r=oli-obkStuart Cook-50/+48
Overhaul `AssocItem` `AssocItem` has multiple fields that only make sense some of the time. E.g. the `name` can be empty if it's an RPITIT associated type. It's clearer and less error prone if these fields are moved to the relevant `kind` variants. r? ``@fee1-dead``