about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-11-24Remove forces_embed_bitcodeDianQK-9/+2
2024-11-24embed-bitcode is no longer used in iOSDianQK-26/+6
2024-11-21Auto merge of #133280 - matthiaskrgr:rollup-8keusum, r=matthiaskrgrbors-182/+434
Rollup of 5 pull requests Successful merges: - #131736 (Emscripten: link with -sWASM_BIGINT) - #132207 (Store resolution for self and crate root module segments) - #133153 (Add visits to nodes that already have flat_maps in ast::MutVisitor) - #133218 (Implement `~const` item bounds in RPIT) - #133228 (Rewrite `show_md_content_with_pager`) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-21Rollup merge of #133228 - nnethercote:rewrite-show_md_content_with_pager, ↵Matthias Krüger-50/+43
r=tgross35 Rewrite `show_md_content_with_pager` `show_md_content_with_pager` is complex and has a couple of bugs. This PR improves it. r? ``@tgross35``
2024-11-21Rollup merge of #133218 - compiler-errors:const-opaque, r=fee1-deadMatthias Krüger-31/+144
Implement `~const` item bounds in RPIT an RPIT in a `const fn` is allowed to be conditionally const itself :) r? fee1-dead or reroll
2024-11-21Rollup merge of #133153 - maxcabrajac:flat_maps, r=petrochenkovMatthias Krüger-88/+177
Add visits to nodes that already have flat_maps in ast::MutVisitor This PR aims to add `visit_` methods for every node that has a `flat_map_` in MutVisitor, giving implementers free choice over overriding `flat_map` for 1-to-n conversions or `visit` for a 1-to-1. There is one major problem: `flat_map_stmt`. While all other default implementations of `flat_map`s are 1-to-1 conversion, as they either only call visits or a internal 1-to-many conversions are natural, `flat_map_stmt` doesn't follow this pattern. `flat_map_stmt`'s default implementation is a 1-to-n conversion that panics if n > 1 (effectively being a 1-to-[0;1]). This means that it cannot be used as is for a default `visit_stmt`, which would be required to be a 1-to-1. Implementing `visit_stmt` without runtime checks would require it to reach over a potential `flat_map_item` or `filter_map_expr` overrides and call for their `visit` counterparts directly. Other than that, if we want to keep the behavior of `flat_map_stmt` it cannot call `visit_stmt` internally. To me, it seems reasonable to make all default implementations 1-to-1 conversions and let implementers handle `visit_stmt` if they need it, but I don't know if calling `visit` directly when a 1-to-1 is required is ok or not. related to #128974 & #127615 r? ``@petrochenkov``
2024-11-21Rollup merge of #132207 - compiler-errors:tweak-res-mod-segment, r=petrochenkovMatthias Krüger-9/+65
Store resolution for self and crate root module segments Let's make sure to record the segment resolution for `self::`, `crate::` and `$crate::`. I'm actually somewhat surprised that the only diagnostic that uses this is the one that errors on invalid generics on a module segment... but seems strictly more correct regardless, and there may be other diagnostics using these segments resolutions that just haven't been tested for `self`. Also includes a drive-by on `report_prohibit_generics_error`.
2024-11-21Rollup merge of #131736 - hoodmane:emscripten-wasm-bigint, r=workingjubileeMatthias Krüger-4/+5
Emscripten: link with -sWASM_BIGINT When linking an executable without dynamic linking, this is a pure improvement. It significantly reduces code size and avoids a lot of buggy behaviors. It is supported in all browsers for many years and in all maintained versions of Node. It does change the ABI, so people who are dynamically linking with a library or executable that uses the old ABI may need to turn it off. It can be disabled if needed by passing `-Clink-arg -sWASM_BIGINT=0` to `rustc`. But few people will want to turn it off. Note this includes a libc bump to 0.2.162!
2024-11-21Auto merge of #133254 - Earlopain:llvm-19.1.4, r=DianQKbors-0/+0
Update LLVM to 19.1.4 Fixes https://github.com/rust-lang/rust/issues/125619 r? `@DianQK`
2024-11-20Auto merge of #133261 - matthiaskrgr:rollup-ekui4we, r=matthiaskrgrbors-266/+627
Rollup of 6 pull requests Successful merges: - #129838 (uefi: process: Add args support) - #130800 (Mark `get_mut` and `set_position` in `std::io::Cursor` as const.) - #132708 (Point at `const` definition when used instead of a binding in a `let` statement) - #133226 (Make `PointerLike` opt-in instead of built-in) - #133244 (Account for `wasm32v1-none` when exporting TLS symbols) - #133257 (Add `UnordMap::clear` method) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-21Rewrite `show_md_content_with_pager`.Nicholas Nethercote-49/+43
I think the control flow in this function is complicated and confusing, largely due to the use of two booleans `print_formatted` and `fallback_to_println` that are set in multiple places and then used to guide proceedings. As well as hurting readability, this leads to at least one bug: if the `write_termcolor_buf` call fails and the pager also fails, the function will try to print color output to stdout, but that output will be empty because `write_termcolor_buf` failed. I.e. the `if fallback_to_println` body fails to check `print_formatted`. This commit rewrites the function to be neater and more Rust-y, e.g. by putting the result of `write_termcolor_buf` into an `Option` so it can only be used on success, and by using `?` more. It also changes terminology a little, using "pretty" to mean "formatted and colorized". The result is a little shorter, more readable, and less buggy.
2024-11-21Remove redundant `is_terminal` check.Nicholas Nethercote-2/+1
It's not necessary because `show_md_content_with_pager` is only ever called if `is_terminal` is true.
2024-11-21Fix `catbat` pager typo.Nicholas Nethercote-1/+1
`bat` is known as `batcat` on Ubuntu and Debian, not `catbat`.
2024-11-20Use visit_item instead of flat_map_item in test_harness.rsmaxcabrajac-31/+21
2024-11-20Itemsmaxcabrajac-28/+71
2024-11-20Rollup merge of #133257 - GuillaumeGomez:unordmap-clear, r=lcnrMatthias Krüger-0/+5
Add `UnordMap::clear` method I need it for something I'm working on and I was surprised to see this method was not implemented.
2024-11-20Rollup merge of #133244 - daxpedda:wasm32v1-none-atomic, r=alexcrichtonMatthias Krüger-2/+2
Account for `wasm32v1-none` when exporting TLS symbols Exporting TLS related symbols was limited to `wasm32-unknown-unknown` because WASI and Emscripten (?) have their own infrastructure to deal with TLS. However, the introduction of `wasm32v1-none` is in the same boat as `wasm32-unknown-unknown`. This PR adjust the mechanism to account for `wasm32v1-none` as well. See https://github.com/rust-lang/rust/pull/102385 and https://github.com/rust-lang/rust/pull/102440. r? ``@alexcrichton``
2024-11-20Rollup merge of #133226 - compiler-errors:opt-in-pointer-like, r=lcnrMatthias Krüger-156/+195
Make `PointerLike` opt-in instead of built-in The `PointerLike` trait currently is a built-in trait that computes the layout of the type. This is a bit problematic, because types implement this trait automatically. Since this can be broken due to semver-compatible changes to a type's layout, this is undesirable. Also, calling `layout_of` in the trait system also causes cycles. This PR makes the trait implemented via regular impls, and adds additional validation on top to make sure that those impls are valid. This could eventually be `derive()`d for custom smart pointers, and we can trust *that* as a semver promise rather than risking library authors accidentally breaking it. On the other hand, we may never expose `PointerLike`, but at least now the implementation doesn't invoke `layout_of` which could cause ICEs or cause cycles. Right now for a `PointerLike` impl to be valid, it must be an ADT that is `repr(transparent)` and the non-1zst field needs to implement `PointerLike`. There are also some primitive impls for `&T`/ `&mut T`/`*const T`/`*mut T`/`Box<T>`.
2024-11-20Rollup merge of #132708 - estebank:const-as-binding, r=NadrierilMatthias Krüger-94/+365
Point at `const` definition when used instead of a binding in a `let` statement Modify `PatKind::InlineConstant` to be `ExpandedConstant` standing in not only for inline `const` blocks but also for `const` items. This allows us to track named `const`s used in patterns when the pattern is a single binding. When we detect that there is a refutable pattern involving a `const` that could have been a binding instead, we point at the `const` item, and suggest renaming. We do this for both `let` bindings and `match` expressions missing a catch-all arm if there's at least one single binding pattern referenced. After: ``` error[E0005]: refutable pattern in local binding --> $DIR/bad-pattern.rs:19:13 | LL | const PAT: u32 = 0; | -------------- missing patterns are not covered because `PAT` is interpreted as a constant pattern, not a new variable ... LL | let PAT = v1; | ^^^ pattern `1_u32..=u32::MAX` not covered | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `u32` help: introduce a variable instead | LL | let PAT_var = v1; | ~~~~~~~ ``` Before: ``` error[E0005]: refutable pattern in local binding --> $DIR/bad-pattern.rs:19:13 | LL | let PAT = v1; | ^^^ | | | pattern `1_u32..=u32::MAX` not covered | missing patterns are not covered because `PAT` is interpreted as a constant pattern, not a new variable | help: introduce a variable instead: `PAT_var` | = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html = note: the matched value is of type `u32` ``` CC #132582.
2024-11-20Rollup merge of #130800 - bjoernager:const-mut-cursor, r=joshtriplettMatthias Krüger-2/+4
Mark `get_mut` and `set_position` in `std::io::Cursor` as const. Relevant tracking issue: #130801 The methods `get_mut` and `set_position` can trivially be marked as const due to #57349 being stabilised.
2024-11-20Rollup merge of #129838 - Ayush1325:uefi-process-args, r=joboetMatthias Krüger-12/+56
uefi: process: Add args support - Wrap all args with quotes. - Escape ^ and " inside quotes using ^. - Doing reverse of arg parsing: https://github.com/rust-lang/rust/blob/d571ae851d93541bef826c3c48c1e9ad99da77d6/library/std/src/sys/pal/uefi/args.rs#L81 r​? joboet
2024-11-20we should not be reporting generic error if there is not a segment to denyMichael Goulet-2/+2
2024-11-20Store resolution for self and crate root module segmentsMichael Goulet-7/+63
2024-11-20Auto merge of #131326 - dingxiangfei2009:issue-130836-attempt-2, r=nikomatsakisbors-534/+2011
Reduce false positives of tail-expr-drop-order from consumed values (attempt #2) r? `@nikomatsakis` Tracked by #123739. Related to #129864 but not replacing, yet. Related to #130836. This is an implementation of the approach suggested in the [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/temporary.20drop.20order.20changes). A new MIR statement `BackwardsIncompatibleDrop` is added to the MIR syntax. The lint now works by inspecting possibly live move paths before at the `BackwardsIncompatibleDrop` location and the actual drop under the current edition, which should be one before Edition 2024 in practice.
2024-11-20Add `UnordMap::clear` methodGuillaume Gomez-0/+5
2024-11-20Make PointerLike opt-in as a traitMichael Goulet-52/+194
2024-11-20Rip out built-in PointerLike implMichael Goulet-104/+1
2024-11-20Update LLVM to 19.1.4Earlopain-0/+0
2024-11-20Auto merge of #133251 - matthiaskrgr:rollup-gjeis3q, r=matthiaskrgrbors-26/+28
Rollup of 3 pull requests Successful merges: - #131904 (Stabilize const_pin_2) - #133239 (Fix LLVM target triple for `x86_64-win7-windows-msvc`) - #133241 (interpret: make typing_env field private) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-20Rollup merge of #133241 - RalfJung:typing-env, r=lcnrMatthias Krüger-21/+23
interpret: make typing_env field private This was made public in https://github.com/rust-lang/rust/pull/133212 but IMO it should remain private. (Specifically, this prevents it from being mutated.) r? `@lcnr`
2024-11-20Rollup merge of #133239 - ↵Matthias Krüger-1/+1
kleisauke:fix-llvm-triple-x86_64-win7-windows-msvc, r=ChrisDenton Fix LLVM target triple for `x86_64-win7-windows-msvc` The vendor field needs to be `pc` rather than `win7`.
2024-11-20Rollup merge of #131904 - GKFX:stabilize-const-pin-2, r=tgross35Matthias Krüger-4/+4
Stabilize const_pin_2 Tracking issue #76654; review before FCP in progress.
2024-11-20Account for `wasm32v1-none` when exporting TLS symbolsdaxpedda-2/+2
2024-11-20Stabilize const_pin_2George Bateman-4/+4
2024-11-20reduce false positives of tail-expr-drop-order from consumed valuesDing Xiang Fei-534/+2011
take 2 open up coroutines tweak the wordings the lint works up until 2021 We were missing one case, for ADTs, which was causing `Result` to yield incorrect results. only include field spans with significant types deduplicate and eliminate field spans switch to emit spans to impl Drops Co-authored-by: Niko Matsakis <nikomat@amazon.com> collect drops instead of taking liveness diff apply some suggestions and add explantory notes small fix on the cache let the query recurse through coroutine new suggestion format with extracted variable name fine-tune the drop span and messages bugfix on runtime borrows tweak message wording filter out ecosystem types earlier apply suggestions clippy check lint level at session level further restrict applicability of the lint translate bid into nop for stable mir detect cycle in type structure
2024-11-20Auto merge of #133227 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 5 commits in 69e595908e2c420e7f0d1be34e6c5b984c8cfb84..66221abdeca2002d318fde6efff516aab091df0e 2024-11-16 01:26:11 +0000 to 2024-11-19 21:30:02 +0000 - Docs for optional registry JSON fields (rust-lang/cargo#14839) - Allow registries to omit empty/default fields in JSON (rust-lang/cargo#14838) - docs(unstable): Link to -Zwarnings issue, tracking issue (rust-lang/cargo#14836) - fix(): error context for git_fetch refspec not found (rust-lang/cargo#14806) - you we distinction (rust-lang/cargo#14829)
2024-11-20interpret: make typing_env field privateRalf Jung-21/+23
2024-11-20Fix LLVM target triple for `x86_64-win7-windows-msvc`Kleis Auke Wolthuizen-1/+1
The vendor field needs to be `pc` rather than `win7`.
2024-11-20Auto merge of #133234 - jhpratt:rollup-42dmg4p, r=jhprattbors-159/+305
Rollup of 5 pull requests Successful merges: - #132732 (Use attributes for `dangling_pointers_from_temporaries` lint) - #133108 (lints_that_dont_need_to_run: never skip future-compat-reported lints) - #133190 (CI: use free runner in dist-aarch64-msvc) - #133196 (Make rustc --explain compatible with BusyBox less) - #133216 (Implement `~const Fn` trait goal in the new solver) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-20Rollup merge of #133216 - compiler-errors:const-fn, r=lcnrJacob Pratt-109/+193
Implement `~const Fn` trait goal in the new solver Split out from https://github.com/rust-lang/rust/pull/132329 since this should be easier to review on its own. r? lcnr
2024-11-20Rollup merge of #133196 - omnivagant:correct-less-r-flag, r=tgross35Jacob Pratt-1/+1
Make rustc --explain compatible with BusyBox less busybox less does not support the -r flag and less(1) says: USE OF THE -r OPTION IS NOT RECOMMENDED.
2024-11-20Rollup merge of #133190 - MarcoIeni:dist-aarch64-msvc-free, r=KobzolJacob Pratt-1/+1
CI: use free runner in dist-aarch64-msvc try-job: dist-aarch64-msvc
2024-11-20Rollup merge of #133108 - RalfJung:future-compat-needs-to-run, r=lcnrJacob Pratt-16/+27
lints_that_dont_need_to_run: never skip future-compat-reported lints Follow-up to https://github.com/rust-lang/rust/pull/125116: future-compat lints show up with `--json=future-incompat` even if they are otherwise allowed in the crate. So let's ensure we do not skip those as part of the `lints_that_dont_need_to_run` logic. I could not find a current future compat lint that is emitted by a lint pass, so there's no clear way to add a test for this. Cc `@blyxyas` `@cjgillot`
2024-11-20Rollup merge of #132732 - gavincrawford:as_ptr_attribute, r=UrgauJacob Pratt-32/+83
Use attributes for `dangling_pointers_from_temporaries` lint Checking for dangling pointers by function name isn't ideal, and leaves out certain pointer-returning methods that don't follow the `as_ptr` naming convention. Using an attribute for this lint cleans things up and allows more thorough coverage of other methods, such as `UnsafeCell::get()`.
2024-11-20Auto merge of #133212 - lcnr:questionable-uwu, r=compiler-errorsbors-575/+512
continue `ParamEnv` to `TypingEnv` transition cc #132279 r? `@compiler-errors`
2024-11-19Update cargoWeihang Lo-0/+0
2024-11-20Auto merge of #133194 - khuey:master, r=jieyouxubors-34/+8301
Drop debug info instead of panicking if we exceed LLVM's capability to represent it Recapping a bit of history here: In #128861 I made debug info correctly represent parameters to inline functions by removing a fake lexical block that had been inserted to suppress LLVM assertions and by deduplicating those parameters. LLVM, however, expects to see a single parameter _with distinct locations_, particularly distinct inlinedAt values on the DILocations. This generally worked because no matter how deep the chain of inlines it takes two different call sites in the original function to result in the same function being present multiple times, and a function call requires a non-zero number of characters, but macros threw a wrench in that in #131944. At the time I thought the issue there was limited to proc-macros, where an arbitrary amount of code can be generated at a single point in the source text. In #132613 I added discriminators to DILocations that would otherwise be the same to repair #131944[^1]. This works, but LLVM's capacity for discriminators is not infinite (LLVM actually only allocates 12 bits for this internally). At the time I thought it would be very rare for anyone to hit the limit, but #132900 proved me wrong. In the relatively-minimized test case it also became clear to me that the issue affects regular macros too, because the call to the inlined function will (without collapse_debuginfo on the macro) be attributed to the (repeated, if the macro is used more than once) textual callsite in the macro definition. This PR fixes the panic by dropping debug info when we exceed LLVM's maximum discriminator value. There's also a preceding commit for a related but distinct issue: macros that use collapse_debuginfo should in fact have their inlinedAts collapsed to the macro callsite and thus not need discriminators at all (and not panic/warn accordingly when the discriminator limit is exhausted). Fixes #132900 r? `@jieyouxu` [^1]: Editor's note: `fix` is a magic keyword in PR description that apparently will close the linked issue (it's closed already in this case, but still).
2024-11-19Auto merge of #133219 - matthiaskrgr:rollup-hnuq0zf, r=matthiaskrgrbors-90/+429
Rollup of 8 pull requests Successful merges: - #123947 (Add vec_deque::Iter::as_slices and friends) - #125405 (Add std::thread::add_spawn_hook.) - #133175 (ci: use free runner in dist-i686-msvc) - #133183 (Mention std::fs::remove_dir_all in std::fs::remove_dir) - #133188 (Add `visit` methods to ast nodes that already have `walk`s on ast visitors) - #133201 (Remove `TokenKind::InvalidPrefix`) - #133207 (Default-enable `llvm_tools_enabled` when no `config.toml` is present) - #133213 (Correct the tier listing of `wasm32-wasip2`) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-19Rollup merge of #133213 - alexcrichton:fix-tier-listing, r=jieyouxuMatthias Krüger-1/+1
Correct the tier listing of `wasm32-wasip2` This target is tier 2, not tier 3, and I forgot to update this. Closes #133206
2024-11-19Rollup merge of #133207 - jieyouxu:macos-objcopy, r=Kobzol,bjorn3Matthias Krüger-0/+14
Default-enable `llvm_tools_enabled` when no `config.toml` is present Fixes #133195. cc `@wesleywiser` could you double check if with this patch and no `config.toml` that you can run `./x test tests/ui --stage 1`? `llvm-objcopy` is usually required by cg_ssa on macOS to workaround bad `strip`s. cc `@bjorn3` I hope this doesn't break cg_clif... r? bootstrap