about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-21Auto merge of #134299 - RalfJung:remove-start, r=compiler-errorsbors-488/+241
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-21remove support for the #[start] attributeRalf Jung-488/+241
2025-01-21Auto merge of #133830 - compiler-errors:span-key, r=lcnrbors-351/+362
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-21Add more testsOli Scherer-0/+49
2025-01-21Treat undef bytes as equal to any other byteOli Scherer-5/+5
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-2/+0
2025-01-20Rollup merge of #133695 - x17jiri:hint_likely, r=AmanieuMatthias Krüger-4/+219
Reexport likely/unlikely in std::hint Since `likely`/`unlikely` should be working now, we could reexport them in `std::hint`. I'm not sure if this is already approved or if it requires approval Tracking issue: #26179
2025-01-20Auto merge of #135643 - khuey:135332, r=jieyouxubors-0/+76
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-20Auto merge of #135754 - jieyouxu:rollup-j4q1hpr, r=jieyouxubors-11/+118
Rollup of 7 pull requests Successful merges: - #135542 (Add the concrete syntax for precise capturing to 1.82 release notes.) - #135700 (Emit single privacy error for struct literal with multiple private fields and add test for `default_field_values` privacy) - #135722 (make it possible to use ci-rustc on tarball sources) - #135729 (Add debug assertions to compiler profile) - #135736 (rustdoc: Fix flaky doctest test) - #135738 (Replace usages of `map_or(bool, ...)` with `is_{some_and|none_or|ok_and}`) - #135747 (Rename FileName::QuoteExpansion to CfgSpec) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-20Rollup merge of #135237 - dianne:match-2024-cleanup, r=Nadrieril许杰友 Jieyou Xu (Joe)-688/+626
Match Ergonomics 2024: document and reorganize the currently-implemented feature gates The hope here is to make it easier to adjust, understand, and test the experimental pattern typing rules implemented in the compiler. This PR doesn't (or at isn't intended to) change any behavior or add any new tests; I'll be handling that later. I've also included some reasoning/commentary on the more involved changes in the commit messages. Relevant tracking issue: #123076 r? `@Nadrieril`
2025-01-20Rollup merge of #134276 - RalfJung:destabilize-custom-inner-attr, r=SparrowLii许杰友 Jieyou Xu (Joe)-55/+31
fully de-stabilize all custom inner attributes `#![test]` and `#![rustfmt::skip]` were accidentally accepted in more places than they should. These have been marked as soft-unstable since forever (https://github.com/rust-lang/rust/pull/82399) and shown in future-compat reports since Rust 1.77 (https://github.com/rust-lang/rust/pull/116274). Cc `@rust-lang/lang` `@petrochenkov`
2025-01-20Rollup merge of #135736 - fmease:rustdoc-fix-flaky-test, r=GuillaumeGomez许杰友 Jieyou Xu (Joe)-1/+2
rustdoc: Fix flaky doctest test Fixes #135660.
2025-01-20Rollup merge of #135700 - estebank:priv-field-dfv, r=wesleywiser许杰友 Jieyou Xu (Joe)-10/+116
Emit single privacy error for struct literal with multiple private fields and add test for `default_field_values` privacy Add test ensuring that struct with default field values is not constructable if the fields are not accessible. Collect all unreachable fields in a single struct literal struct and emit a single error, instead of one error per private field. ``` error[E0451]: fields `beta` and `gamma` of struct `Alpha` are private --> $DIR/visibility.rs:18:13 | LL | let _x = Alpha { | ----- in this type LL | beta: 0, | ^^^^^^^ private field LL | .. | ^^ field `gamma` is private ```
2025-01-19rustdoc: Fix flaky doctest testLeón Orell Valerian Liehr-1/+2
2025-01-19fully de-stabilize all custom inner attributesRalf Jung-55/+31
2025-01-19When LLVM's location discriminator value limit is exceeded, emit locations ↵Kyle Huey-0/+76
with dummy spans instead of dropping them entirely Revert most of #133194 (except the test and the comment fixes). Then refix not emitting locations at all when the correct location discriminator value exceeds LLVM's capacity.
2025-01-19Rollup merge of #135685 - GuillaumeGomez:rm-unused-css-class, r=notriddleGuillaume Gomez-2/+2
Remove unused `item-row` CSS class Seems like a CSS class we forgot to remove at some point. r? `@notriddle`
2025-01-19Rollup merge of #134858 - estebank:issue-81370, r=NoratriebGuillaume Gomez-13/+52
Provide structured suggestion for `#![feature(..)]` in more cases Fix #81370.
2025-01-19Remove unused `item-row` CSS classGuillaume Gomez-2/+2
2025-01-19Auto merge of #135709 - lqd:bring-back-len, r=compiler-errorsbors-1389/+1737
Temporarily bring back `Rvalue::Len` r? `@compiler-errors` as requested in https://github.com/rust-lang/rust/issues/135671#issuecomment-2599580364 > However, in the mean time, I'd rather we not crunch trying to find and more importantly validate the soundness of a solution 🤔 Agreed. To fix the IMO P-critical #135671 for which we somehow didn't have test coverage, this PR temporarily reverts: - https://github.com/rust-lang/rust/pull/133734 - its bugfix https://github.com/rust-lang/rust/pull/134371 - https://github.com/rust-lang/rust/pull/134330 cc `@scottmcm` I added the few samples from that issue as a test, but we can add more in the future, in particular it seems `@steffahn` [will work on that](https://github.com/rust-lang/rust/issues/135671#issuecomment-2599714354). Fixes #135671. And if we want to land this, it should also be nominated for beta backport.
2025-01-19Auto merge of #135715 - matthiaskrgr:rollup-9a18sxj, r=matthiaskrgrbors-163/+189
Rollup of 4 pull requests Successful merges: - #135641 ([rustdoc] Replace module list items `ul`/`li` with `dl`/`dd`/`dt` elements) - #135703 (Disallow `A { .. }` if `A` has no fields) - #135705 (Consolidate ad-hoc MIR lints into real pass-manager-based MIR lints) - #135708 (Some random compiler nits) Failed merges: - #135685 (Remove unused `item-row` CSS class) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-19Rollup merge of #135705 - compiler-errors:lint, r=estebankMatthias Krüger-1/+1
Consolidate ad-hoc MIR lints into real pass-manager-based MIR lints It feels much cleaner to do all MIR-related things using the pass manager.
2025-01-19Rollup merge of #135703 - estebank:empty-dfv, r=compiler-errorsMatthias Krüger-0/+47
Disallow `A { .. }` if `A` has no fields ``` error: `A` has no fields, `..` needs at least one default field in the struct definition --> $DIR/empty-struct.rs:16:17 | LL | let _ = A { .. }; | - ^^ | | | this type has no fields ```
2025-01-19Rollup merge of #135641 - GuillaumeGomez:items-list, r=notriddleMatthias Krüger-162/+141
[rustdoc] Replace module list items `ul`/`li` with `dl`/`dd`/`dt` elements `@hywan` suggested that rustdoc should use `dl`,`dt` and `dd` HTML tags for listing items on module pages as it matches better what this is (an item and optionally its description). This is a very good idea so here is the implementation. Also nice side-effect of this change: it reduces a bit the generated HTML since we go from: This PR shouldn't impact page appearance. ```html <ul class="item-table"> <li> <div class="item-name">NAME</div> <div class="desc docblock-short">THE DOC</div> </li> </ul> ``` to: ```html <dl class="item-table"> <dt>NAME</dt> <dd>THE DOC</dd> </dl> ``` You can test it [here](https://rustdoc.crud.net/imperio/items-list/std/index.html). r? `@notriddle`
2025-01-19Rollup merge of #135663 - frank-king:fix/135614, r=compiler-errorsMatthias Krüger-0/+107
Fix ICE in resolving associated items as non-bindings Fixes #135614 so that imported associated functions of traits can be shadowed by local bindings and associated constants of traits can be used in patterns.
2025-01-18add tests for issue 135671Rémy Rakic-0/+30
2025-01-18Revert "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, ↵Rémy Rakic-1330/+1626
r=davidtwco,RalfJung" This reverts commit b57d93d8b9525fa261404b4cd9c0670eeb1264b8, reversing changes made to 0aeaa5eb22180fdf12a8489e63c4daa18da6f236.
2025-01-18Revert "Rollup merge of #134371 - scottmcm:fix-134352, r=oli-obk"Rémy Rakic-23/+0
This reverts commit 7c301ecdf5e806b7aa3c44e4a185049fabbc4381, reversing changes made to dffaad83327454430129802f240121f8c7866208.
2025-01-18Revert "Auto merge of #134330 - scottmcm:no-more-rvalue-len, r=matthewjasper"Rémy Rakic-36/+81
This reverts commit e108481f74ff123ad98a63bd107a18d13035b275, reversing changes made to 303e8bd768526a5812bb1776e798e829ddb7d3ca.
2025-01-18Consolidate ad-hoc MIR lints into real pass-manager-based MIR lintsMichael Goulet-1/+1
2025-01-18Provide suggestion for `#![feature(default_field_values)]`Esteban Küber-10/+40
``` error[E0797]: base expression required after `..` --> $DIR/feature-gate-default-field-values.rs:62:21 | LL | let x = Foo { .. }; | ^ | help: add `#![feature(default_field_values)]` to the crate attributes to enable default values on `struct` fields | LL + #![feature(default_field_values)] | help: add a base expression here | LL | let x = Foo { ../* expr */ }; | ++++++++++ ```
2025-01-18Structured suggestion for "missing `feature` intrinsic"Esteban Küber-2/+8
``` error: `size_of_val` is not yet stable as a const intrinsic --> $DIR/const-unstable-intrinsic.rs:17:9 | LL | unstable_intrinsic::size_of_val(&x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(unstable)]` to the crate attributes to enable help: add `#![feature(unstable)]` to the crate attributes to enable | LL + #![feature("unstable")] | ```
2025-01-18Structured suggestion for "missing `feature` in unstable fn call"Esteban Küber-1/+4
When encountering a call corresponding to an item marked as unstable behind a feature flag, provide a structured suggestion pointing at where in the crate the `#![feature(..)]` needs to be written. ``` error: `foobar` is not yet stable as a const fn --> $DIR/const-stability-attribute-implies-no-feature.rs:12:5 | LL | foobar(); | ^^^^^^^^ | help: add `#![feature(const_foobar)]` to the crate attributes to enable | LL + #![feature(const_foobar)] | ``` Fix #81370.
2025-01-18Disallow `A { .. }` if `A` has no fieldsEsteban Küber-0/+47
``` error: `A` has no fields, `..` needs at least one default field in the struct definition --> $DIR/empty-struct.rs:16:17 | LL | let _ = A { .. }; | - ^^ | | | this type has no fields ```
2025-01-18Emit a single privacy error for multiple fields on the same struct expressionEsteban Küber-31/+74
Collect all unreachable fields in a single struct literal struct and emit a single error, instead of one error per private field. ``` error[E0451]: fields `beta` and `gamma` of struct `Alpha` are private --> $DIR/visibility.rs:18:13 | LL | let _x = Alpha { | ----- in this type LL | beta: 0, | ^^^^^^^ private field LL | .. | ^^ field `gamma` is private ```
2025-01-18Remove more CSS classesGuillaume Gomez-134/+127
2025-01-18Auto merge of #135682 - matthiaskrgr:rollup-cl7zlt1, r=matthiaskrgrbors-3/+9
Rollup of 7 pull requests Successful merges: - #133700 (const-eval: detect more pointers as definitely not-null) - #135290 (Encode constraints that hold at all points as logical edges in location-sensitive polonius) - #135478 (Run clippy for rustc_codegen_gcc on CI) - #135583 (Move `std::pipe::*` into `std::io`) - #135612 (Include x scripts in tarballs) - #135624 (ci: mirror buildkit image to ghcr) - #135661 (Stabilize `float_next_up_down`) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-18Rollup merge of #135583 - NobodyXu:move-pipe-to-io, r=joshtriplettMatthias Krüger-1/+1
Move `std::pipe::*` into `std::io` Resolve concern from final comment period https://github.com/rust-lang/rust/issues/127154#issuecomment-2590419895
2025-01-18Rollup merge of #133700 - RalfJung:const-non-null, r=lcnrMatthias Krüger-2/+8
const-eval: detect more pointers as definitely not-null This fixes https://github.com/rust-lang/rust/issues/133523 by making the `scalar_may_be_null` check smarter: for instance, an odd offset in any 2-aligned allocation can never be null, even if it is out-of-bounds. More generally, if an allocation with unknown base address B is aligned to alignment N, and a pointer is at offset X inside that allocation, then we know that `(B + X) mod N = B mod N + X mod N = X mod N`. Since `0 mod N` is definitely 0, if we learn that `X mod N` is *not* 0 we can deduce that `B + X` is not 0. This is immediately visible on stable, via `ptr.is_null()` (and, more subtly, by not raising a UB error when such a pointer is used somewhere that a non-null pointer is required). Therefore nominating for `@rust-lang/lang.`
2025-01-18Rollup merge of #135639 - lqd:trivial-builtin-impls, r=lcnrMatthias Krüger-1/+7
new solver: prefer trivial builtin impls As discussed [on zulip](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/needs_help.3A.20trivial.20builtin.20impls), this PR: - adds a new `BuiltinImplSource::Trivial` source, and marks the `Sized` builtin impls as trivial - prefers these trivial builtin impls in `merge_trait_candidates` The comments can likely be wordsmithed a bit better, and I ~stole~ was inspired by the old solver ones. Let me know how you want them improved. When enabling the new solver for tests, 3 UI tests now pass: - `regions/issue-26448-1.rs` and its sibling `regions/issue-26448-2.rs` were rejected by the new solver but accepted by the old one - and `issues/issue-42796.rs` where the old solver emitted some overflow errors in addition to the expected error (For some reason one of these tests is run-pass, but I can take care of that another day) r? lcnr
2025-01-18Rollup merge of #135611 - chenyukang:yukang-fix-135341-ice-crash, r=oli-obkMatthias Krüger-5/+13
Remove unnecessary assertion for reference error Fixes #135341 From comment: https://github.com/rust-lang/rust/issues/135341#issuecomment-2594430504 r? ``@oli-obk``
2025-01-18const-eval: detect more pointers as definitely not-nullRalf Jung-2/+8
2025-01-18Add context on private fields that are not on the same line as the struct nameEsteban Küber-0/+7
``` error[E0451]: field `x` of struct `S` is private --> $DIR/visibility.rs:24:9 | LL | let a = baz::S { | ------ in this type LL | .. | ^^ field `x` is private ```
2025-01-18Fix ICE in resolving associated items as non-bindingsFrank King-0/+107
2025-01-18Add test for construction of struct with private field with default valueEsteban Küber-0/+56
``` error[E0451]: field `beta` of struct `Alpha` is private --> $DIR/visibility.rs:11:37 | LL | let x = crate::foo::Alpha { .. }; | ^^ field `beta` is private ```
2025-01-18Auto merge of #135618 - lcnr:coherence-unknown, r=compiler-errorsbors-4/+70
add cache to `AmbiguityCausesVisitor` fixes #135457, alternative to #135524. cc https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/new-solver.20hang.20.23135457 r? `@compiler-errors`
2025-01-17Update rustdoc testsGuillaume Gomez-56/+42
2025-01-17new solver: prefer trivial builtin impls over where-clausesRémy Rakic-1/+7
for now, only builtin `Sized` impls are tracked as being `Trivial`
2025-01-17Auto merge of #135534 - folkertdev:fix-wasm-i128-f128, r=tgross35bors-0/+98
use indirect return for `i128` and `f128` on wasm32 fixes #135532 Based on https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md we now use an indirect return for `i128`, `u128` and `f128`. That is what LLVM ended up doing anyway. r? `@bjorn3`