about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-12-12Add xcoff supportKai Luo-1/+1
2023-12-11Auto merge of #117962 - weihanglo:debug-name-table, r=wesleywiserbors-3/+73
fix: stop emitting `.debug_pubnames` and `.debug_pubtypes` A continuation of #94181. Fixes #48762 MCP can be found in <https://github.com/rust-lang/compiler-team/issues/688>. `.debug_pubnames` and `.debug_pubtypes` are poorly designed and people seldom use them. However, they take a considerable portion of size in the final binary. This tells LLVM stop emitting those sections on DWARFv4 or lower. DWARFv5 use `.debug_names` which is more concise in size and performant for name lookup. Some other no-really-useful personal notes: <details><summary>Details</summary> <p> ## Pepole saying they are not useful * https://github.com/rust-lang/rust/issues/48762 * https://rust-lang.zulipchat.com/#narrow/stream/317568-t-compiler.2Fwg-debugging/topic/investigating.20debuginfo.20size/near/342713604 * `DwarfCompileUnit::hasDwarfPubSections()` — https://github.com/llvm/llvm-project/blob/f633f325a1b808d33ca9653ed373353549ddcde6/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp#L1477-L1494 * clang default to no debug name table when no option provided — https://github.com/llvm/llvm-project/blob/f633f325a1b808d33ca9653ed373353549ddcde6/clang/lib/Frontend/CompilerInvocation.cpp#L1819-L1824 * GCC explicitly says GDB doesn't use pub sections (`TARGET_WANT_DEBUG_PUB_SECTIONS` only be true on Darwin) — https://github.com/gcc-mirror/gcc/blob/5d2a360f0a541646abb11efdbabc33c6a04de7ee/gcc/target.def#L6985-L6990 and https://github.com/bminor/binutils-gdb/blob/319b460545dc79280e2904dcc280057cf71fb753/gold/dwarf_reader.h#L424-L427 * Probably the only place that makes use of pub section in lldb — https://github.com/llvm/llvm-project/blob/725115d7bba2faf3d0c21442f4661dea77b8a77c/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L2117-L2135 * "The -gsplit-dwarf option requires -ggnu-pubnames." — https://github.com/gcc-mirror/gcc/blob/5d2a360f0a541646abb11efdbabc33c6a04de7ee/gcc/opts.cc#L1205 * LLVM: Always emit `.debug_names` with dwarf 5 for Apple platforms — https://reviews.llvm.org/D118754 </p> </details>
2023-12-11refactor: only check dwarf version when emitting dwarfWeihang Lo-2/+8
2023-12-11Auto merge of #118838 - matthiaskrgr:rollup-8kwzpho, r=matthiaskrgrbors-2606/+2989
Rollup of 8 pull requests Successful merges: - #118620 (resolve: Use `def_kind` query to cleanup some code) - #118647 (dump bootstrap shims) - #118726 (Do not parenthesize exterior struct lit inside match guards) - #118818 (llvm-wrapper: adapt for LLVM API change) - #118822 (Extract exhaustiveness into its own crate) - #118826 (Edit target doc template to remove email) - #118827 (Update table for linker-plugin-lto docs) - #118835 (Fix again `rustc_codegen_gcc` tests) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-11fix: stop emitting `.debug_pubnames` and `.debug_pubtypes`Weihang Lo-5/+44
`.debug_pubnames` and `.debug_pubtypes` are poorly designed and people seldom use them. However, they take a considerable portion of size in the final binary. This tells LLVM stop emitting those sections on DWARFv4 or lower. DWARFv5 use `.debug_names` which is more concise in size and performant for name lookup.
2023-12-11test: demonstrate that dwarf debug names sections are emittedWeihang Lo-0/+25
2023-12-11Rollup merge of #118835 - Urgau:fix-rccg-gcc-tests, r=matthiaskrgrMatthias Krüger-1/+1
Fix again `rustc_codegen_gcc` tests Similar to https://github.com/rust-lang/rust/pull/118706 r? `@GuillaumeGomez`
2023-12-11Rollup merge of #118827 - Nilstrieb:linker-plugin-lto, r=ehussMatthias Krüger-2/+6
Update table for linker-plugin-lto docs
2023-12-11Rollup merge of #118826 - Nilstrieb:no-email-pls, r=davidtwcoMatthias Krüger-1/+1
Edit target doc template to remove email We don't really want to communicate with target maintainers via email. GitHub is where everything happens, people should have a GitHub account that can be pinged on issues. This doesn't necessarily have to be a strict rule, but edit the template to suggest this. The previous template made it look like we care about having an email address, which we do not. r? ````@davidtwco````
2023-12-11Rollup merge of #118822 - Nadrieril:librarify, r=compiler-errorsMatthias Krüger-2460/+2614
Extract exhaustiveness into its own crate It now makes sense to extract exhaustiveness into its own crate! This was much-requested by rust-analyzer (they currently maintain by hand a copy of the algorithm), and I hope this can serve other projects e.g. clippy. This is the churny PR: it exclusively moves code around. It's not yet useable outside of rustc but I wanted the churny parts to be out of the way. r? `@compiler-errors`
2023-12-11Rollup merge of #118818 - krasimirgg:llvm-18-pass, r=nikicMatthias Krüger-0/+4
llvm-wrapper: adapt for LLVM API change LLVM commit https://github.com/llvm/llvm-project/commit/1d608fc755a3e15d0020f61c9535c9b730ab9dec renamed the pass. r? ````@nikic````
2023-12-11Rollup merge of #118726 - dtolnay:matchguardlet, r=compiler-errorsMatthias Krüger-77/+174
Do not parenthesize exterior struct lit inside match guards Before this PR, the AST pretty-printer injects parentheses around expressions any time parens _could_ be needed depending on what else is in the code that surrounds that expression. But the pretty-printer did not pass around enough context to understand whether parentheses really _are_ needed on any particular expression. As a consequence, there are false positives where unneeded parentheses are being inserted. Example: ```rust #![feature(if_let_guard)] macro_rules! pp { ($e:expr) => { stringify!($e) }; } fn main() { println!("{}", pp!(match () { () if let _ = Struct {} => {} })); } ``` **Before:** ```console match () { () if let _ = (Struct {}) => {} } ``` **After:** ```console match () { () if let _ = Struct {} => {} } ``` This PR introduces a bit of state that is passed across various expression printing methods to help understand accurately whether particular situations require parentheses injected by the pretty printer, and it fixes one such false positive involving match guards as shown above. There are other parenthesization false positive cases not fixed by this PR. I intend to address these in follow-up PRs. For example here is one: the expression `{ let _ = match x {} + 1; }` is pretty-printed as `{ let _ = (match x {}) + 1; }` despite there being no reason for parentheses to appear there.
2023-12-11Rollup merge of #118647 - onur-ozkan:bootstrap-shims-dump, r=clubby789Matthias Krüger-26/+158
dump bootstrap shims When making changes to the bootstrap that shouldn't change its behavior, this feature will help developers perform comparisons to check whether the bootstrap behavior has changed or not. As an example, when removing Python from the bootstrap by migrating to Rust, this feature will be super useful for ensuring that the behavior remains unaffected. It will assist me in performing comparisons to verify that the bootstrap behavior and its outputs remains consistent throughout the migration process. This can also be used for different purposes. For example, allowing CI to dump the shims and upload them so that developers can download them and compare with their local dump to see if CI affects the bootstrap unexpectedly. Or, make CI perform comparisons on specific bootstrap tests to check for behavior changes between the master and PR branches.
2023-12-11Rollup merge of #118620 - petrochenkov:defeed2, r=compiler-errorsMatthias Krüger-39/+31
resolve: Use `def_kind` query to cleanup some code Follow up to https://github.com/rust-lang/rust/pull/118188. Similar attempts to use queries in resolver resulted in perf regressions in the past, so this needs a perf run first.
2023-12-11Fix rustc codegen gcc testsUrgau-1/+1
2023-12-11Auto merge of #118344 - saethlin:rmeta-header-pos, r=WaffleLapkinbors-44/+46
Use a u64 for the rmeta root position Waffle noticed this in https://github.com/rust-lang/rust/pull/117301#discussion_r1405410174 We've upgraded the other file offsets to u64, and this one only costs 4 bytes per file. Also the way the truncation was being done before was extremely easy to miss, I sure missed it! It's not clear to me if not having this change effectively made the other upgrades from u32 to u64 ineffective, but we can have it now. r? `@WaffleLapkin`
2023-12-11Auto merge of #117758 - Urgau:lint_pointer_trait_comparisons, r=davidtwcobors-254/+933
Add lint against ambiguous wide pointer comparisons This PR is the resolution of https://github.com/rust-lang/rust/issues/106447 decided in https://github.com/rust-lang/rust/issues/117717 by T-lang. ## `ambiguous_wide_pointer_comparisons` *warn-by-default* The `ambiguous_wide_pointer_comparisons` lint checks comparison of `*const/*mut ?Sized` as the operands. ### Example ```rust let ab = (A, B); let a = &ab.0 as *const dyn T; let b = &ab.1 as *const dyn T; let _ = a == b; ``` ### Explanation The comparison includes metadata which may not be expected. ------- This PR also drops `clippy::vtable_address_comparisons` which is superseded by this one. ~~One thing: is the current naming right? `invalid` seems a bit too much.~~ Fixes https://github.com/rust-lang/rust/issues/117717
2023-12-11Update table for linker-plugin-lto docsNilstrieb-2/+6
2023-12-11Edit target doc template to remove emailNilstrieb-1/+1
We don't really want to communicate with target maintainers via email. GitHub is where everything happens, people should have a GitHub account that can be pinged on issues. This doesn't necessarily have to be a strict rule, but edit the template to suggest this. The previous template made it look like we care about having an email address, which we do not.
2023-12-11Auto merge of #118823 - GuillaumeGomez:rollup-6v51gxv, r=GuillaumeGomezbors-667/+588
Rollup of 3 pull requests Successful merges: - #118802 (Remove edition umbrella features.) - #118807 (Remove an allocation in min_stack) - #118812 (rustdoc-search: do not treat associated type names as types) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-11Fix doc linksNadrieril-22/+22
2023-12-11sort dump files at the end of bootstraponur-ozkan-2/+29
To ensure deterministic results we must sort the dump lines. This is necessary because the order of rustc invocations different almost all the time. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-12-11update auto completionsonur-ozkan-17/+62
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-12-11Dump command invocations from bootstrap shimsonur-ozkan-9/+69
When making changes to the bootstrap that shouldn't change its behavior, this feature will help developers perform comparisons to check whether the bootstrap behavior has changed or not. This can also be used for different purposes. For example, allowing CI to dump the shims and upload them so that developers can download them and compare with their local dump to see if CI affects the bootstrap unexpectedly. Or, make CI perform comparisons on specific bootstrap tests to check for behavior changes between the master and PR branches. Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-12-11Rollup merge of #118812 - notriddle:notriddle/assoc-name-intern, ↵Guillaume Gomez-14/+116
r=GuillaumeGomez rustdoc-search: do not treat associated type names as types [Before](http://notriddle.com/rustdoc-html-demo-6/tor-before/tor_config/list_builder/trait.DirectDefaultEmptyListBuilderAccessors.html?search=DirectDefaultEmptyListBuilderAccessors%3CT%3DT%3E%20-%3E%20Vec%3CT%3E#associatedtype.T) [After](http://notriddle.com/rustdoc-html-demo-6/tor-after/tor_config/list_builder/trait.DirectDefaultEmptyListBuilderAccessors.html?search=DirectDefaultEmptyListBuilderAccessors%3CT%3DT%3E%20-%3E%20Vec%3CT%3E#associatedtype.T) [Profile](http://notriddle.com/rustdoc-html-demo-6/tor-profile/index.html) As a bit of background information: in type-based queries, a type name that does not exist gets treated as a generic type variable. This causes a counterintuitive behavior in the `tor_config` crate, which has a trait with an associated type variable called `T`. This isn't a searchable concrete type, but its name still gets stored in the typeNameIdMap, as a convenient way to intern its name. (The second commit is a mostly unrelated bugfix.)
2023-12-11Rollup merge of #118807 - SUPERCILEX:allo, r=the8472Guillaume Gomez-1/+1
Remove an allocation in min_stack
2023-12-11Rollup merge of #118802 - ehuss:remove-edition-preview, r=TaKO8KiGuillaume Gomez-652/+471
Remove edition umbrella features. In the 2018 edition, there was an "umbrella" feature `#[feature(rust_2018_preview)]` which was used to enable several other features at once. This umbrella mechanism was not used in the 2021 edition and likely will not be used in 2024 either. During 2018 users reported that setting the feature was awkward, especially since they already needed to opt-in via the edition mechanism. This PR removes this mechanism because I believe it will not be used (and will clean up and simplify the code). I believe that there are better ways to handle features and editions. In short: - For highly experimental features, that may or may not be involved in an edition, they can implement regular feature gates like `tcx.features().my_feature`. - For experimental features that *might* be involved in an edition, they should implement gates with `tcx.features().my_feature && span.at_least_rust_20xx()`. This requires the user to still specify `#![feature(my_feature)]`, to avoid disrupting testing of other edition features which are ready and have been accepted within the edition. - For experimental features that have graduated to definitely be part of an edition, they should implement gates with `tcx.features().my_feature || span.at_least_rust_20xx()`, or just remove the feature check altogether and just check `span.at_least_rust_20xx()`. - For relatively simple changes, they can skip the whole feature gating thing and just check `span.at_least_rust_20xx()`, and rely on the instability of the edition itself (which requires `-Zunstable-options`) to gate it. I am working on documenting all of this in the rustc-dev-guide.
2023-12-11Auto merge of #118661 - fee1-dead-contrib:restore-const-partialEq, ↵bors-194/+149
r=compiler-errors Restore `const PartialEq` And thus fixes a number of tests. There is a bug that still needs to be fixed, so WIP for now. r? `@compiler-errors`
2023-12-11Include the new crate in triagebot pingsNadrieril-0/+4
2023-12-11Fix item visibilitiesNadrieril-31/+27
2023-12-11Make `MaybeInfiniteInt` rustc-independentNadrieril-34/+59
2023-12-11Move lints to their own moduleNadrieril-302/+347
2023-12-11Gather rustc-specific functions around `MatchCheckCtxt`Nadrieril-900/+903
2023-12-11Extract exhaustiveness into its own crateNadrieril-900/+981
2023-12-11llvm-wrapper: adapt for LLVM API changeKrasimir Georgiev-0/+4
LLVM commit https://github.com/llvm/llvm-project/commit/1d608fc755a3e15d0020f61c9535c9b730ab9dec renamed the pass.
2023-12-11Auto merge of #117116 - calebzulawski:repr-simd-packed, r=workingjubileebors-3/+83
Implement repr(packed) for repr(simd) This allows creating vectors with non-power-of-2 lengths that do not have padding. See rust-lang/portable-simd#319
2023-12-11Auto merge of #118494 - nnethercote:default_configuration-fill_well_known, ↵bors-166/+187
r=Mark-Simulacrum Rearrange `default_configuration` and `CheckCfg::fill_well_known`. There are comments saying these two functions should be kept in sync, but they have very different structures, process symbols in different orders, and there are some inconsistencies. This commit reorders them so they're both mostly processing symbols in alphabetical order, which makes cross-checking them a lot easier. The commit also adds some macros to factor out repetitive code patterns. The commit also moves the handling of `sym::test` out of `build_configuration` into `default_configuration`, where all the other symbols are handled. r? `@bjorn3`
2023-12-10Apply suggestions from code reviewBen Kimock-10/+9
Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2023-12-11Auto merge of #118032 - RalfJung:char-u32, r=Mark-Simulacrumbors-5/+19
guarantee that char and u32 are ABI-compatible In https://github.com/rust-lang/rust/pull/116894 we added a guarantee that `char` has the same alignment as `u32`, but there is still one axis where these types could differ: function call ABI. So let's nail that down as well: in a function signature, `char` and `u32` are completely equivalent. This is a new stable guarantee, so it will need t-lang approval.
2023-12-10rustdoc-search: fix fast path unboxing bindingsMichael Howell-1/+12
2023-12-11Auto merge of #118810 - Kobzol:revert-mcp-510-bootstrap, r=nnethercotebors-11/+3
Revert using MCP510 in bootstrap This reverts commit 40c3d351ada5d991f7474ecc4bc6c9b976c656cb. The commit started dogfooding MCP510 to enable `lld` when building the compiler , but it broke tests, because we don't pass `-Zunstable-options` on enough places. This PR hotfixes that, and temporarily makes the "self-contained" option.. not very self-contained. I'll send a proper fix later, but I want to unblock rustc developres that use `lld` locally. r? `@nnethercote` (who discovered the problem)
2023-12-11Auto merge of #114571 - nnethercote:improve-print_tts, r=petrochenkovbors-525/+816
Improve `print_tts` By slightly changing the meaning of `tokenstream::Spacing` we can greatly improve the output of `print_tts`. r? `@ghost`
2023-12-10rustdoc-search: do not treat associated type names as typesMichael Howell-13/+104
Before: http://notriddle.com/rustdoc-html-demo-6/tor-before/tor_config/ After: http://notriddle.com/rustdoc-html-demo-6/tor-after/tor_config/ Profile: http://notriddle.com/rustdoc-html-demo-6/tor-profile/ As a bit of background information: in type-based queries, a type name that does not exist gets treated as a generic type variable. This causes a counterintuitive behavior in the `tor_config` crate, which has a trait with an associated type variable called `T`. This isn't a searchable concrete type, but its name still gets stored in the typeNameIdMap, as a convenient way to intern its name.
2023-12-11Rearrange `default_configuration` and `CheckCfg::fill_well_known`.Nicholas Nethercote-166/+187
There are comments saying these two functions should be kept in sync, but they have very different structures, process symbols in different orders, and there are some inconsistencies. This commit reorders them so they're both mostly processing symbols in alphabetical order, which makes cross-checking them a lot easier. The commit also adds some macros to factor out repetitive code patterns. Plus it adds `sanitizer_cfi_normalize_{integers,pointers}` to `fill_well_known`, which were missing. The commit also moves the handling of `sym::test` out of `build_configuration` into `default_configuration`, where all the other symbols are handled.
2023-12-11Add a few cases with wonky formatting to `stringify.rs` test.Nicholas Nethercote-0/+4
Because the spacing-based pretty-printing partially preserves that.
2023-12-11Add spacing information to delimiters.Nicholas Nethercote-231/+307
This is an extension of the previous commit. It means the output of something like this: ``` stringify!(let a: Vec<u32> = vec![];) ``` goes from this: ``` let a: Vec<u32> = vec![] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![]; ```
2023-12-10Revert "Use MCP510"Jakub Beránek-11/+3
This reverts commit 40c3d351ada5d991f7474ecc4bc6c9b976c656cb. The option was dogfooded for using lld with MCP510 , but it broke testing with LLD, because we don't pass `-Zunstable-options` on enough places.
2023-12-11Improve `print_tts` by changing `tokenstream::Spacing`.Nicholas Nethercote-356/+567
`tokenstream::Spacing` appears on all `TokenTree::Token` instances, both punct and non-punct. Its current usage: - `Joint` means "can join with the next token *and* that token is a punct". - `Alone` means "cannot join with the next token *or* can join with the next token but that token is not a punct". The fact that `Alone` is used for two different cases is awkward. This commit augments `tokenstream::Spacing` with a new variant `JointHidden`, resulting in: - `Joint` means "can join with the next token *and* that token is a punct". - `JointHidden` means "can join with the next token *and* that token is a not a punct". - `Alone` means "cannot join with the next token". This *drastically* improves the output of `print_tts`. For example, this: ``` stringify!(let a: Vec<u32> = vec![];) ``` currently produces this string: ``` let a : Vec < u32 > = vec! [] ; ``` With this PR, it now produces this string: ``` let a: Vec<u32> = vec![] ; ``` (The space after the `]` is because `TokenTree::Delimited` currently doesn't have spacing information. The subsequent commit fixes this.) The new `print_tts` doesn't replicate original code perfectly. E.g. multiple space characters will be condensed into a single space character. But it's much improved. `print_tts` still produces the old, uglier output for code produced by proc macros. Because we have to translate the generated code from `proc_macro::Spacing` to the more expressive `token::Spacing`, which results in too much `proc_macro::Along` usage and no `proc_macro::JointHidden` usage. So `space_between` still exists and is used by `print_tts` in conjunction with the `Spacing` field. This change will also help with the removal of `Token::Interpolated`. Currently interpolated tokens are pretty-printed nicely via AST pretty printing. `Token::Interpolated` removal will mean they get printed with `print_tts`. Without this change, that would result in much uglier output for code produced by decl macro expansions. With this change, AST pretty printing and `print_tts` produce similar results. The commit also tweaks the comments on `proc_macro::Spacing`. In particular, it refers to "compound tokens" rather than "multi-char operators" because lifetimes aren't operators.
2023-12-10Auto merge of #118368 - GuillaumeGomez:env-flag, r=Nilstriebbors-3/+107
Implement `--env` compiler flag (without `tracked_env` support) Part of https://github.com/rust-lang/rust/issues/80792. Implementation of https://github.com/rust-lang/compiler-team/issues/653. Not an implementation of https://github.com/rust-lang/rfcs/pull/2794. It adds the `--env` compiler flag option which allows to set environment values used by `env!` and `option_env!`. Important to note: When trying to retrieve an environment variable value, it will first look into the ones defined with `--env`, and if there isn't one, then only it will look into the environment variables. So if you use `--env PATH=a`, then `env!("PATH")` will return `"a"` and not the actual `PATH` value. As mentioned in the title, `tracked_env` support is not added here. I'll do it in a follow-up PR. r? rust-lang/compiler
2023-12-10Remove an allocation in min_stackAlex Saveau-1/+1
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>