about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-01-22Rollup merge of #135596 - compiler-errors:stack, r=oli-obkMatthias Krüger-15/+20
Properly note when query stack is being cut off cc #70953 also, i'm not certain whether we should even limit this at all. i don't see the problem with printing the full query stack, apparently it was limited b/c we used to ICE? but we're already printing the full stack to disk since #108714. r? oli-obk
2025-01-22Rollup merge of #135557 - estebank:wtf8, r=fee1-deadMatthias Krüger-20/+88
Point at invalid utf-8 span on user's source code ``` error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8 --> $DIR/not-utf8-2.rs:6:5 | LL | include!("not-utf8-bin-file.rs"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: byte `193` is not valid utf-8 --> $DIR/not-utf8-bin-file.rs:2:14 | LL | let _ = "�|�␂!5�cc␕␂��"; | ^ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) ``` When we attempt to load a Rust source code file, if there is a OS file failure we try reading the file as bytes. If that succeeds we try to turn it into UTF-8. If *that* fails, we provide additional context about *where* the file has the first invalid UTF-8 character. Fix #76869.
2025-01-22Rollup merge of #135409 - ↵Matthias Krüger-29/+115
Shunpoco:issue-133117-ICE-never-false-edge-start-block, r=Nadrieril Fix ICE-133117: multiple never-pattern arm doesn't have false_edge_start_block Fixes #133117 , and close fixes #133063 , fixes #130779 In order to fix ICE-133117, at first I needed to tackle to ICE-133063 (this fixed 130779 as well). ### ICE-133063 and ICE-130779 This ICE is caused by those steps: 1. An arm has or-pattern, and all of the sub-candidates are never-pattern 2. In that case, all sub-candidates are removed in remove_never_subcandidates(). So the arm (candidate) has no sub-candidate. 3. In the current implementation, if there is no sub-candidate, the function assigns `pre_binding_block` into the candidate ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/builder/matches/mod.rs#L2002-L2004)). However, otherwise_block should be assigned to the candidate as well, because the otherwise_block is unwrapped in multiple place (like in lower_match_tree()). As a result, it causes the panic. I simply added the same block as pre_binding_block into otherwise_block, but I'm wondering if there is a better block to assign to otherwise_block (is it ok to assign the same block into pre_binding and otherwise?) ### ICE-133117 This is caused by those steps: 1. There are two arms, both are or-pattern and each has one match-pair (in the test code, both are `(!|!)`), and the second arm has a guard. 2. In match_candidate() for the first arm, it expands the second arm’s sub-candidates as well ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/builder/matches/mod.rs#L1800-L1805)). As a result, the root candidate of the second arm is not evaluated/modified in match_candidate(). So a false_edge_start_block is not assigned to the candidate. 3. merge_trivial_subcandidates() is called against the candidate for the second arm. It just returns immediately because the candidate has a guard. So a flase_edge_start_block is not assigned to the candidate also in this function. 4. remove_never_subcandidates() is called against the candidate. Since all sub-candidates are never-pattern. they are removed. 5. In lower_match_tree(), since there is no sub-candidate for the candidate, the candidate itself is evaluated in visit_leave_rev ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/builder/matches/mod.rs#L1532)). Because the candidate has no false_edge_start_block, it causes the panic. So I modified the order of if blocks in merge_trivial_subcandidates() to assign a false_edge_start_block if the candidate doesn't have.
2025-01-22Rollup merge of #132983 - Anthony-Eid:dangling-pointers-lint, r=UrgauMatthias Krüger-2/+86
Edit dangling pointers Closes: #132283
2025-01-22Auto merge of #134478 - compiler-errors:attr-span, r=oli-obkbors-34/+105
Properly record metavar spans for other expansions other than TT This properly records metavar spans for nonterminals other than tokentree. This means that we operations like `span.to(other_span)` work correctly for macros. As you can see, other diagnostics involving metavars have improved as a result. Fixes #132908 Alternative to #133270 cc `@ehuss` cc `@petrochenkov`
2025-01-22Update lint tests with new dangling pointers messageAnthony Eid-2/+82
2025-01-22Auto merge of #135674 - scottmcm:assume-better, r=estebankbors-84/+114
Update our range `assume`s to the format that LLVM prefers I found out in https://github.com/llvm/llvm-project/issues/123278#issuecomment-2597440158 that the way I started emitting the `assume`s in #109993 was suboptimal, and as seen in that LLVM issue the way we're doing it -- with two `assume`s sometimes -- can at times lead to CVP/SCCP not realize what's happening because one of them turns into a `ne` instead of conveying a range. So this updates how it's emitted from ``` assume( x >= LOW ); assume( x <= HIGH ); ``` or ``` // (for ranges that wrap the range) assume( (x <= LOW) | (x >= HIGH) ); ``` to ``` assume( (x - LOW) <= (HIGH - LOW) ); ``` so that we don't need multiple `icmp`s nor multiple `assume`s for a single value, and both wrappping and non-wrapping ranges emit the same shape. (And we don't bother emitting the subtraction if `LOW` is zero, since that's trivial for us to check too.)
2025-01-22modify commentShunpoco-1/+1
Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
2025-01-22address review: modify matches/mod.rsShunpoco-4/+9
The candidate shouldn't have false_edge_start_block if it has sub candidates. In remove_never_subcandidates(), the false_edge_start_block from the first sub candidte is assigned to a value and the value is later used if all sub candidates are removed and candidate doesn't have false_edge_start_block. In merge_trivial_subcandidates, I leave the if block which assign a false_edge_start_block into the candidate as before I put this commit since compile panics. Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
2025-01-22address review: modify ICE-133063-never-arm-no-otherwise-block.rsShunpoco-43/+12
- Use enum Void to avoid mismatched types error - We don't need to use if let to check the ICE Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
2025-01-22address review: modify ICE-133117-duplicated-never-arm.rsShunpoco-29/+15
Use enum Void to avoid mistmatched types error Signed-off-by: Shunpoco <tkngsnsk313320@gmail.com>
2025-01-22Auto merge of #135848 - matthiaskrgr:rollup-sftciqm, r=matthiaskrgrbors-90/+107
Rollup of 8 pull requests Successful merges: - #132232 (CI: build FreeBSD artifacts on FreeBSD 13.4) - #135706 (Move `supertrait_def_ids` into the elaborate module like all other fns) - #135750 (Add an example of using `carrying_mul_add` to write wider multiplication) - #135793 (Ignore `mermaid.min.js`) - #135810 (Add Kobzol on vacation) - #135821 (fix OsString::from_encoded_bytes_unchecked description) - #135824 (tests: delete `cat-and-grep-sanity-check`) - #135833 (Add fixme and test for issue #135289) Failed merges: - #135816 (Use `structurally_normalize` instead of manual `normalizes-to` goals in alias relate errors) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-22Point at invalid utf-8 span on user's source codeEsteban Küber-20/+88
``` error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8 --> $DIR/not-utf8-2.rs:6:5 | LL | include!("not-utf8-bin-file.rs"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: `[193]` is not valid utf-8 --> $DIR/not-utf8-bin-file.rs:2:14 | LL | let _ = "�|�␂!5�cc␕␂��"; | ^ = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info) ``` When we attempt to load a Rust source code file, if there is a OS file failure we try reading the file as bytes. If that succeeds we try to turn it into UTF-8. If *that* fails, we provide additional context about *where* the file has the first invalid UTF-8 character. Fix #76869.
2025-01-21Rollup merge of #135833 - lqd:add-ice-test, r=compiler-errorsMatthias Krüger-0/+36
Add fixme and test for issue #135289 This PR: - adds a test minimizing issue #135289 for PR #135310 - adds a fixme about the suboptimal fix for the ICE I've verified the test indeed ICEs with 3f2f695d68334ca4ecc8aec0aa38b5391051c987 reverted. r? `@estebank`
2025-01-21Rollup merge of #135824 - jieyouxu:delete-bintools-check, r=NoratriebMatthias Krüger-51/+0
tests: delete `cat-and-grep-sanity-check` Part of #121876. All remaining `Makefile`s have open PRs that do not rely on platform `cat` or `grep` or the `cat-and-grep` script.
2025-01-21Rollup merge of #135821 - hkBst:patch-11, r=ibraheemdevMatthias Krüger-2/+2
fix OsString::from_encoded_bytes_unchecked description fixes #133010
2025-01-21Rollup merge of #135810 - Kobzol:kobzol-parental-leave, r=KobzolMatthias Krüger-0/+1
Add Kobzol on vacation I will be mostly reviewing diaper contents in the upcoming weeks, so I'm (proactively, for now) removing myself from the auto review rotation. Feel free to CC me (explicit `r?` won't work) explicitly though, I will be around. r? `````@ghost`````
2025-01-21Rollup merge of #135793 - jyn514:gitignore, r=jieyouxuMatthias Krüger-0/+1
Ignore `mermaid.min.js` It is very long and tends to match a lot of search queries. It's not useful to show with ripgrep. Note that this does not actually untrack the file; changes can still be committed (although I suspect it may not have been intentional to commit originally?). This just changes how it interacts with tools that use `.gitignore` as a default filter. r? rustc-dev-guide
2025-01-21Rollup merge of #135750 - scottmcm:cma-example, r=cuviperMatthias Krüger-2/+31
Add an example of using `carrying_mul_add` to write wider multiplication Just the basic quadratic version that you wouldn't actually use for really-big integers, but it's nice and short so is useful as for a demonstration of why you might find `carrying_mul_add` useful :) cc #85532 ``````@clarfonthey``````
2025-01-21Rollup merge of #135706 - compiler-errors:elaborate, r=lcnrMatthias Krüger-26/+27
Move `supertrait_def_ids` into the elaborate module like all other fns It's strange that this is the only elaborate-like fn on tcx. r? lcnr
2025-01-21Rollup merge of #132232 - asomers:fbsd-13.4, r=Mark-SimulacrumMatthias Krüger-9/+9
CI: build FreeBSD artifacts on FreeBSD 13.4 13.2 is EoL, and 13.3 will be EoL too in about 2 months. Plus, both suffer from a bug in LLVM's libunwind. It causes a segfault inside of std::backtrace::Backtrace::capture(). Fixes #132185 cc ``````@ehuss`````` . before you can do the trybuild, you'll also have to download new FreeBSD 13.4 base.txz images and place them in https://ci-mirrors.rust-lang.org/rustc , then update this PR with the correct file names. try-job: dist-x86_64-freebsd try-job: dist-various-2
2025-01-21Auto merge of #135487 - klensy:windows-0.59, r=Mark-Simulacrumbors-45/+153
bump compiler and tools to windows 0.59, bootstrap to 0.57 This bumps compiler and tools to windows 0.59 (temporary dupes version, as `sysinfo` still depend on <= 0.57). Bootstrap bumps only to 0.57 (the same sysinfo dep). This additionally resolves my comment https://github.com/rust-lang/rust/pull/130874#issuecomment-2393562071 Will work on it in follow up pr: There still some sus imports for `rustc_driver.dll` like ws2_32 or RoOriginateErrorW, but i will look at them later.
2025-01-21Auto merge of #134299 - RalfJung:remove-start, r=compiler-errorsbors-1260/+454
remove support for the (unstable) #[start] attribute As explained by `@Noratrieb:` `#[start]` should be deleted. It's nothing but an accidentally leaked implementation detail that's a not very useful mix between "portable" entrypoint logic and bad abstraction. I think the way the stable user-facing entrypoint should work (and works today on stable) is pretty simple: - `std`-using cross-platform programs should use `fn main()`. the compiler, together with `std`, will then ensure that code ends up at `main` (by having a platform-specific entrypoint that gets directed through `lang_start` in `std` to `main` - but that's just an implementation detail) - `no_std` platform-specific programs should use `#![no_main]` and define their own platform-specific entrypoint symbol with `#[no_mangle]`, like `main`, `_start`, `WinMain` or `my_embedded_platform_wants_to_start_here`. most of them only support a single platform anyways, and need cfg for the different platform's ways of passing arguments or other things *anyways* `#[start]` is in a super weird position of being neither of those two. It tries to pretend that it's cross-platform, but its signature is a total lie. Those arguments are just stubbed out to zero on ~~Windows~~ wasm, for example. It also only handles the platform-specific entrypoints for a few platforms that are supported by `std`, like Windows or Unix-likes. `my_embedded_platform_wants_to_start_here` can't use it, and neither could a libc-less Linux program. So we have an attribute that only works in some cases anyways, that has a signature that's a total lie (and a signature that, as I might want to add, has changed recently, and that I definitely would not be comfortable giving *any* stability guarantees on), and where there's a pretty easy way to get things working without it in the first place. Note that this feature has **not** been RFCed in the first place. *This comment was posted [in May](https://github.com/rust-lang/rust/issues/29633#issuecomment-2088596042) and so far nobody spoke up in that issue with a usecase that would require keeping the attribute.* Closes https://github.com/rust-lang/rust/issues/29633 try-job: x86_64-gnu-nopt try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: test-various
2025-01-21Move supertrait_def_ids into the elaborate module like all other fnsMichael Goulet-26/+27
2025-01-21add fixme in typoed const pattern lintRémy Rakic-0/+6
2025-01-21add test for issue 135289Rémy Rakic-0/+30
2025-01-21remove support for the #[start] attributeRalf Jung-1260/+454
2025-01-21tidyklensy-0/+1
2025-01-21bump bootsrap windows to 0.57klensy-23/+4
2025-01-21bumpt compiler and tools to windows 0.59klensy-22/+148
2025-01-21tests: delete `cat-and-grep-sanity-check`许杰友 Jieyou Xu (Joe)-51/+0
All remaining `Makefile`s have open PRs that do not rely on platform `cat` or `grep`.
2025-01-21fix OsString::from_encoded_bytes_unchecked descriptionMarijn Schouten-2/+2
2025-01-21Auto merge of #133830 - compiler-errors:span-key, r=lcnrbors-642/+561
Rework dyn trait lowering to stop being so intertwined with trait alias expansion This PR reworks the trait object lowering code to stop handling trait aliases so funky, and removes the `TraitAliasExpander` in favor of a much simpler design. This refactoring is important for making the code that I'm writing in https://github.com/rust-lang/rust/pull/133397 understandable and easy to maintain, so the diagnostics regressions are IMO inevitable. In the old trait object lowering code, we used to be a bit sloppy with the lists of traits in their unexpanded and expanded forms. This PR largely rewrites this logic to expand the trait aliases *once* and handle them more responsibly throughout afterwards. Please review this with whitespace disabled. r? lcnr
2025-01-21Auto merge of #135335 - oli-obk:push-zxwssomxxtnq, r=saethlinbors-30/+125
codegen: store ScalarPair via memset when one side is undef and the other side can be memset Basically since `undef` can be any byte, it can also be the byte(s) that are in the non-undef parts of a value. So we can just treat the `undef` at not being there and only look at the initialized bytes and memset over them fixes #104290 based on https://github.com/rust-lang/rust/pull/135258
2025-01-21Add Kobzol on vacationJakub Beránek-0/+1
2025-01-21Add more testsOli Scherer-0/+49
2025-01-21Treat undef bytes as equal to any other byteOli Scherer-7/+40
2025-01-21Ensure we always get a constant, even without mir optsOli Scherer-1/+1
2025-01-21Also generate undef scalars and scalar pairsOli Scherer-25/+38
2025-01-21Auto merge of #135632 - marcoieni:split-x86_64-msvc-2025, r=Kobzolbors-11/+17
CI: split x86_64-msvc job using windows 2025 try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: dist-x86_64-msvc
2025-01-21Auto merge of #135224 - wyfo:tls-panic-outline, r=cuviperbors-8/+16
Outline panicking code for `LocalKey::with` See https://github.com/rust-lang/rust/pull/115491 for prior related modifications. https://godbolt.org/z/MTsz87jGj shows a reduction of the code size for TLS accesses.
2025-01-20Auto merge of #134286 - Urgau:unreach_pub-std, r=ibraheemdevbors-131/+150
Enable `unreachable_pub` lint in core This PR enables the [`unreachable_pub`](https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#unreachable-pub) as warn in `core`, `rtstartup` and `panic_unwind`. The motivation is similar to the compiler [MCP: Enable deny(unreachable_pub) on `rustc_*` crates](https://github.com/rust-lang/compiler-team/issues/773#issue-2467219005) : > "Where is this thing used?" is a question I ask all the time when reading unfamiliar code. Because of this, I generally find it annoying when things are marked with a more permissive visibility than necessary. "This thing marked pub, which other crates is it used in? Oh, it's not used in any other crates." Another motivation is to help to lint by utilizing it in-tree and seeing it's limitation in more complex scenarios. The diff was mostly generated with `./x.py fix --stage 1 library/core/ -- --broken-code`, as well as manual edits for code in macros, generated code and other targets. r? libs
2025-01-20Ignore `mermaid.min.js`jyn-0/+1
It is very long and tends to match a lot of search queries. It's not useful to show with ripgrep. Note that this does not actually untrack the file; changes can still be committed (although I suspect it may not have been intentional to commit originally?). This just changes how it interacts with tools that use `.gitignore` as a default filter.
2025-01-20Auto merge of #135789 - matthiaskrgr:rollup-4cvw8s4, r=matthiaskrgrbors-3037/+9572
Rollup of 7 pull requests Successful merges: - #133695 (Reexport likely/unlikely in std::hint) - #135330 (Respect --sysroot for rustc -vV and -Cpasses=list) - #135333 (Partial progress on #132735: Replace extern "rust-intrinsic" with #[rustc_intrinsic] across the codebase) - #135741 (Recognise new IPv6 documentation range from IETF RFC 9637) - #135770 (Update contributing docs for submodule/subtree changes) - #135775 (Subtree update of `rust-analyzer`) - #135776 (Subtree sync for rustc_codegen_cranelift) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-20Rollup merge of #135776 - bjorn3:sync_cg_clif-2025-01-20, r=bjorn3Matthias Krüger-5/+12
Subtree sync for rustc_codegen_cranelift Nothing too exciting this time, but this includes a fix for a linker hang on Windows: https://github.com/rust-lang/rustc_codegen_cranelift/pull/1554 r? ``@ghost`` ``@rustbot`` label +A-codegen +A-cranelift +T-compiler
2025-01-20Rollup merge of #135775 - lnicola:sync-from-ra, r=lnicolaMatthias Krüger-2920/+9088
Subtree update of `rust-analyzer` r? ``@ghost``
2025-01-20Rollup merge of #135770 - jieyouxu:subtree-submodule-contributing, r=KobzolMatthias Krüger-0/+9
Update contributing docs for submodule/subtree changes Noticed in https://github.com/rust-lang/rust/pull/135337#issuecomment-2602434736. r? ``@Kobzol`` (or anyone really)
2025-01-20Rollup merge of #135741 - bardiharborow:std/net/rfc9637, r=AmanieuMatthias Krüger-4/+17
Recognise new IPv6 documentation range from IETF RFC 9637 This PR adds the `3fff::/20` range defined by [IETF RFC 9637](https://datatracker.ietf.org/doc/rfc9637/) to those ranges which `Ipv6Addr::is_documentation` recognises as a documentation IP. See also: https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml Unstable tracking issue: #27709
2025-01-20Rollup merge of #135333 - vayunbiyani:test-environment, r=RalfJungMatthias Krüger-85/+61
Partial progress on #132735: Replace extern "rust-intrinsic" with #[rustc_intrinsic] across the codebase Part of #132735: Replace `extern "rust-intrinsic"` with `#[rustc_intrinsic]` macro - Updated all instances of `extern "rust-intrinsic"` to use the `#[rustc_intrinsic]` macro. - Skipped `.md` files and test files to avoid unnecessary changes.
2025-01-20Rollup merge of #135330 - bjorn3:respect_sysroot_in_version_printing, r=lqdMatthias Krüger-19/+31
Respect --sysroot for rustc -vV and -Cpasses=list This is necessary when the specified codegen backend is in a custom sysroot. Fixes https://github.com/rust-lang/rust/issues/135165