about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
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-21Only assert the `Parser` size on specific archesJosh Stone-2/+3
The size of this struct depends on the alignment of `u128`, for example powerpc64le and s390x have align-8 and end up with only 280 bytes. Our 64-bit tier-1 arches are the same though, so let's just assert on those.
2025-01-22Auto merge of #135848 - matthiaskrgr:rollup-sftciqm, r=matthiaskrgrbors-25/+31
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-9/+70
``` 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-21remove long-deprecated no-op attributes no_start and crate_idRalf Jung-31/+2
2025-01-21Rollup merge of #135833 - lqd:add-ice-test, r=compiler-errorsMatthias Krüger-0/+6
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 #135706 - compiler-errors:elaborate, r=lcnrMatthias Krüger-25/+25
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-21Auto merge of #135487 - klensy:windows-0.59, r=Mark-Simulacrumbors-8/+8
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-21Detect missing fields with default values and suggest `..`Esteban Küber-0/+30
When a struct definition has default field values, and the use struct ctor has missing field, if all those missing fields have defaults suggest `..`: ``` error[E0063]: missing fields `field1` and `field2` in initializer of `S` --> $DIR/non-exhaustive-ctor.rs:16:13 | LL | let _ = S { field: () }; | ^ missing `field1` and `field2` | help: all remaining fields have defaults, use `..` | LL | let _ = S { field: (), .. }; | ++++ ```
2025-01-21Auto merge of #134299 - RalfJung:remove-start, r=compiler-errorsbors-441/+116
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-25/+25
2025-01-21add fixme in typoed const pattern lintRémy Rakic-0/+6
2025-01-21remove support for the #[start] attributeRalf Jung-441/+116
2025-01-21bumpt compiler and tools to windows 0.59klensy-8/+8
2025-01-21rustc_resolve: don't open-code `Option::filter`Yotam Ofek-4/+1
2025-01-21rustc_resolve: use `Iterator` combinators instead of `for` loops where ↵Yotam Ofek-26/+12
applicable
2025-01-21rustc_resolve: reduce rightwards drift with `let..else` 👉💨Yotam Ofek-381/+387
2025-01-21rustc_resolve: flatten nested `if`sYotam Ofek-229/+198
2025-01-21rustc_resolve: remove unneeded `return`sYotam Ofek-2/+0
2025-01-21Auto merge of #133830 - compiler-errors:span-key, r=lcnrbors-291/+199
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-21Treat undef bytes as equal to any other byteOli Scherer-2/+35
2025-01-21Also generate undef scalars and scalar pairsOli Scherer-23/+38
2025-01-21use slice patterns for checking for elements of sliceYotam Ofek-5/+6
2025-01-21don't use partial ordering on types that support total orderingYotam Ofek-2/+2
2025-01-21Note that cg_llvm's gimli should match the version used elsewhereZalathar-0/+2
2025-01-21Make our `DIFlags` match `LLVMDIFlags` in the LLVM-C APIZalathar-117/+85
2025-01-20"structural" ruleset: match against the inherited ref when a reference ↵dianne-2/+11
pattern doesn't match the mutability of an inner reference This is the `Deref(EatInner, FallbackToOuter)` rule in Typing Rust Patterns.
2025-01-20"structural" ruleset: use the "classic" ruleset's diagnostic and fallback ↵dianne-27/+31
for inherited ref mutability mismatches I think the diagnostic could use some work, but it's more helpful than the alternative. The previous error was misleading, since it ignored the inherited reference altogether.
2025-01-20"structural" ruleset: account for dbm mutability cap in Deref(EatInner) rulesdianne-1/+6
2025-01-20remove Rule 3 from `ref_pat_eat_one_layer_2024`dianne-3/+5
The debug assertion ensuring that the pattern mutability cap holds assumes the presence of Rule 3, so it now checks for that. I considered going back to only tracking the mutability cap when Rule 3 is present, but since the mutability cap is used in Rule 5's implementation too, the debug assertion would still need to check which typing rules are present. This also required some changes to tests: - `ref_pat_eat_one_layer_2021.rs` had a test for Rule 3; I'll be handling tests for earlier editions in a later commit, so as a stopgap I've #[cfg]ed it out. - One test case had to be moved from `well-typed-edition-2024.rs` to `borrowck-errors.rs` in order to get borrowck to run on it and emit an error.
2025-01-20Don't require `--verbose` to show linker stdoutjyn-8/+20
2025-01-20don't ICE when emitting linker errors during `-Z link-only`jyn-21/+37
note that this still ICEs when passed `-Z link-only --error-format json` because i can't be bothered to fix it right now
2025-01-20warn on unused linker_messages warning attributesjyn-0/+34
2025-01-20make it possible to silence linker warnings with a crate-level attributejyn-11/+85
this was slightly complicated because codegen_ssa doesn't have access to a tcx.
2025-01-20show linker warnings even if it returns 0jyn-3/+31
2025-01-20Set `DebuginfoKind::Dwarf` for `*-windows-gnu` and `*-windows-gnullvm`Wesley Wiser-2/+2
These targets have always generated DWARF debuginfo and not CodeView/PDB debuginfo like the MSVC Windows targets. Correct their target definitions to reflect this. The newly added tests for the various combinations of `*-windows-gnu*` targets and `-Csplit-debuginfo` show that this does not change any stable behavior.
2025-01-20on s390x, use `PassMode::Direct` for vector typesFolkert de Vries-3/+11
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 #135333 - vayunbiyani:test-environment, r=RalfJungMatthias Krüger-0/+1
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
2025-01-20handle global trait bounds defining assoc typelcnr-2/+22
2025-01-20remove unnecessary collectionlcnr-19/+6
2025-01-20Auto merge of #135769 - jieyouxu:rollup-3h384pz, r=jieyouxubors-24/+15
Rollup of 5 pull requests Successful merges: - #135433 (Add Profile Override for Non-Git Sources) - #135626 (doc: Point to methods on `Command` as alternatives to `set/remove_var`) - #135658 (Do not include GCC source code in source tarballs) - #135676 (rustc_resolve: use structured fields in traces) - #135762 (Correct counting to four in cell module docs) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-20work around the `wasm32-unknown-unknown` ABI being brokenFolkert de Vries-8/+39
2025-01-20support wasm inline assembly in naked functionsFolkert de Vries-4/+136
2025-01-20Respect --target in get_backend_from_raw_matchesbjorn3-9/+15
2025-01-20Merge commit '728bc27f32c05ac8a9b5eb33fd101e479072984f' into ↵bjorn3-5/+12
sync_cg_clif-2025-01-20
2025-01-20Auto merge of #135643 - khuey:135332, r=jieyouxubors-52/+35
When LLVM's location discriminator value limit is exceeded, emit locations with dummy spans instead of dropping them entirely Dropping them fails `-Zverify-llvm-ir`. Fixes #135332. r? `@jieyouxu`
2025-01-20Updated several files to use rust intrinsic macros instead of the legacy ↵vayunbiyani-0/+1
extern "rust-intrinsic" blocks