about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-07-04Rollup merge of #143308 - compiler-errors:no-pointer-like, r=oli-obkMatthias Krüger-38/+0
Remove `PointerLike` trait r? oli-obk
2025-07-04Rollup merge of #143286 - Muscraft:track-diagnostics-note, r=WaffleLapkinMatthias Krüger-22/+43
Make -Ztrack-diagnostics emit like a note [#t-compiler/diagnostics > Rendering -Ztrack-diagnostics like a note](https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/Rendering.20-Ztrack-diagnostics.20like.20a.20note/with/526608647) As discussed on the Zulip thread above, I want to make `-Ztrack-diagnostics` emit like a `note`. This is because I find its current output jarring, and the fact that it gets rendered completely left-aligned, [even in the middle of a snippet](https://github.com/rust-lang/rust/blob/86e05cd300fac9e83e812c4d46582b48db780d8f/tests/ui/track-diagnostics/track6.stderr), seems like something that should be changed. Turning it into a `note` seems like the best choice, as it would align it with the rest of the output, and `note` is already used for somewhat similar things, like seeing why a lint was fired. --- Note: turning `-Ztrack-diagnostics` into a `note` will also make `annotate-snippets` API a bit cleaner
2025-07-04Auto merge of #143237 - JonathanBrouwer:no_implicit_prelude_parser, ↵bors-18/+21
r=jdonszelmann,oli-obk Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure Ports no_implicit_prelude to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? `@oli-obk` cc `@jdonszelmann`
2025-07-04Rollup merge of #143381 - fee1-dead-contrib:push-pzxuvlnymxpu, r=GuillaumeGomezJacob Pratt-0/+36
rustdoc: don't treat methods under const impls or traits as const Fixes rust-lang/rust#143071
2025-07-04Rollup merge of #143307 - compiler-errors:fast-path-nitpicks, r=lcnrJacob Pratt-0/+23
Fast path nitpicks Miscellaneous commits that I didn't really want to fold into anything else. Fixes one theoretical bug with the fast path not considering polarity for `T: !Sized` bounds.
2025-07-03Auto merge of #142890 - kornelski:unused-var-debug, r=saethlinbors-0/+50
MIR inliner maintains unused var_debug_info Only `full` debuginfo level promises variable-level debug information, but the MIR inline pass needlessly preserved the local variable debug info for the `limited` level too.
2025-07-03Remove PointerLike traitMichael Goulet-38/+0
2025-07-03Port `#[no_implicit_prelude]` to the new attribute parsing infrastructureJonathan Brouwer-18/+21
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03Rollup merge of #141831 - lolbinarycat:rustdoc-extern-reexport-135092, ↵Guillaume Gomez-0/+26
r=GuillaumeGomez rustdoc: fix attrs of locally reexported foreign items fixes rust-lang/rust#135092 also tweaks a few outdated/misleading comments. r? `@GuillaumeGomez`
2025-07-03rustdoc: don't treat methods under const impls or traits as constDeadbeef-0/+36
2025-07-03refactor: Make -Ztrack-diagnostics emit like a noteScott Schafer-22/+43
2025-07-03Rollup merge of #143329 - folkertdev:minicore-diagnostic-on-unimplemented, ↵Jana Dönszelmann-21/+58
r=jieyouxu minicore: use core's `diagnostic::on_unimplemented` messages Without these attributes, the error message is different. Keeping the diagnostics up-to-date seems related to https://github.com/rust-lang/rust/issues/137531. The modified test files are reported in https://github.com/rust-lang/rust/issues/143319 as failing for `--target=riscv64gc-unknown-linux-gnu`. Using `minicore` for them makes it easier to troubleshoot this sort of issue. r? ``@jieyouxu``
2025-07-03Rollup merge of #143083 - JonathanBrouwer:rustdoc-fix, r=jdonszelmannJana Dönszelmann-0/+13
Fix rustdoc not correctly showing attributes on re-exports Fixes attributes not being shown correctly in rustdoc on re-exports Does this need to be backported to beta? r? ``@jdonszelmann``
2025-07-03Rollup merge of #143038 - Qelxiros:142676-private-dependency-traits, r=tgross35Jana Dönszelmann-0/+78
avoid suggesting traits from private dependencies fixes rust-lang/rust#142676 fixes rust-lang/rust#138191 r? ``@tgross35``
2025-07-03Rollup merge of #142876 - JonathanBrouwer:target_feature_parser, r=oli-obkJana Dönszelmann-112/+170
Port `#[target_feature]` to new attribute parsing infrastructure Ports `target_feature` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? ``@jdonszelmann``
2025-07-03Rollup merge of #134006 - klensy:typos, r=nnethercoteJana Dönszelmann-10/+10
setup typos check in CI This allows to check typos in CI, currently for compiler only (to reduce commit size with fixes). With current setup, exclude list is quite short, so it worth trying? Also includes commits with actual typo fixes. MCP: https://github.com/rust-lang/compiler-team/issues/817 typos check currently turned for: * ./compiler * ./library * ./src/bootstrap * ./src/librustdoc After merging, PRs which enables checks for other crates (tools) can be implemented too. Found typos will **not break** other jobs immediately: (tests, building compiler for perf run). Job will be marked as red on completion in ~ 20 secs, so you will not forget to fix it whenever you want, before merging pr. Check typos: `python x.py test tidy --extra-checks=spellcheck` Apply typo fixes: `python x.py test tidy --extra-checks=spellcheck:fix` (in case if there only 1 suggestion of each typo) Current fail in this pr is expected and shows how typo errors emitted. Commit with error will be removed after r+.
2025-07-03minicore: use core's `diagnostic::on_unimplemented` messagesFolkert de Vries-21/+58
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-10/+10
2025-07-03Port `#[target_feature]` to the new attribute parsing infrastructureJonathan Brouwer-112/+170
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03Rollup merge of #143273 - 1c3t3a:enum-check-negative, r=SparrowLiiMatthias Krüger-0/+67
Make the enum check work for negative discriminants The discriminant check was not working correctly for negative numbers. This change fixes that by masking out the relevant bits correctly. Fixes rust-lang/rust#143218.
2025-07-03Rollup merge of #143192 - GuillaumeGomez:code-line-number, r=lolbinaryMatthias Krüger-10/+25
Improve CSS for source code block line numbers Extract some changes from https://github.com/rust-lang/rust/pull/137229 to make the PR smaller (thanks `@yotamofek` for the suggestion!). r? notriddle
2025-07-02avoid suggesting traits from private dependenciesJeremy Smart-23/+14
2025-07-02Auto merge of #143338 - matthiaskrgr:rollup-ykaxh04, r=matthiaskrgrbors-208/+681
Rollup of 11 pull requests Successful merges: - rust-lang/rust#131923 (Derive `Copy` and `Hash` for `IntErrorKind`) - rust-lang/rust#138340 (Remove some unsized tuple impls now that we don't support unsizing tuples anymore) - rust-lang/rust#141219 (Change `{Box,Arc,Rc,Weak}::into_raw` to only work with `A = Global`) - rust-lang/rust#142212 (bootstrap: validate `rust.codegen-backends` & `target.<triple>.codegen-backends`) - rust-lang/rust#142237 (Detect more cases of unused_parens around types) - rust-lang/rust#142964 (Attribute rework: a parser for single attributes without arguments) - rust-lang/rust#143070 (Rewrite `macro_rules!` parser to not use the MBE engine itself) - rust-lang/rust#143235 (Assemble const bounds via normal item bounds in old solver too) - rust-lang/rust#143261 (Feed `explicit_predicates_of` instead of `predicates_of`) - rust-lang/rust#143276 (loop match: handle opaque patterns) - rust-lang/rust#143306 (Add `track_caller` attributes to trace origin of Clippy lints) r? `@ghost` `@rustbot` modify labels: rollup try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-gnu try-job: dist-i586-gnu-i586-i686-musl try-job: test-various
2025-07-02Auto merge of #143337 - matthiaskrgr:rollup-lqwhe0i, r=matthiaskrgrbors-11/+64
Rollup of 9 pull requests Successful merges: - rust-lang/rust#141847 (Explain `TOCTOU` on the top of `std::fs`, and reference it in functions) - rust-lang/rust#142138 (Add `Vec::into_chunks`) - rust-lang/rust#142321 (Expose elf abi on ppc64 targets) - rust-lang/rust#142886 (ci: aarch64-gnu: Stop skipping `panic_abort_doc_tests`) - rust-lang/rust#143194 (fix bitcast of single-element SIMD vectors) - rust-lang/rust#143231 (Suggest use another lifetime specifier instead of underscore lifetime) - rust-lang/rust#143232 ([COMPILETEST-UNTANGLE 3/N] Use "directives" consistently within compiletest) - rust-lang/rust#143258 (Don't recompute `DisambiguatorState` for every RPITIT in trait definition) - rust-lang/rust#143274 (ci: support optional jobs) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-02Rollup merge of #143276 - folkertdev:loop-match-opaque-pattern, r=NadrierilMatthias Krüger-135/+220
loop match: handle opaque patterns tracking issue https://github.com/rust-lang/rust/issues/132306 fixes https://github.com/rust-lang/rust/issues/143203 I believe the `Opaque` comes up because the range pattern is invalid? Because we do handle float patterns already so those should be fine. r? `@Nadrieril`
2025-07-02Rollup merge of #143235 - compiler-errors:const-item-bound, r=oli-obkMatthias Krüger-0/+19
Assemble const bounds via normal item bounds in old solver too Fixes the first example in https://rust-lang.zulipchat.com/#narrow/channel/144729-t-types/topic/elaboration.20of.20const.20bounds.3F/with/526378135 The code duplication here is not that nice, but it's at least very localized. cc `@davidtwco` r? oli-obk
2025-07-02Rollup merge of #143070 - joshtriplett:macro-rules-parse, r=petrochenkovMatthias Krüger-10/+12
Rewrite `macro_rules!` parser to not use the MBE engine itself The `macro_rules!` parser was written to match the series of rules using the macros-by-example (MBE) engine and a hand-written equivalent of the left-hand side of a MBE macro. This was complex to read, difficult to extend, and produced confusing error messages. Because it was using the MBE engine, any parse failure would be reported as if some macro was being applied to the `macro_rules!` invocation itself; for instance, errors would talk about "macro invocation", "macro arguments", and "macro call", when they were actually about the macro *definition*. And in practice, the `macro_rules!` parser only used the MBE engine to extract the left-hand side and right-hand side of each rule as a token tree, and then parsed the rest using a separate parser. Rewrite it to parse the series of rules using a simple loop, instead. This makes it more extensible in the future, and improves error messages. For instance, omitting a semicolon between rules will result in "expected `;`" and "unexpected token", rather than the confusing "no rules expected this token in macro call". This work was greatly aided by pair programming with Vincenzo Palazzo (`@vincenzopalazzo)` and Eric Holk (`@eholk).` For review, I recommend reading the two commits separately.
2025-07-02Rollup merge of #142964 - GrigorenkoPV:attributes/argless, r=oli-obkMatthias Krüger-8/+8
Attribute rework: a parser for single attributes without arguments Part of rust-lang/rust#131229 r? `@jdonszelmann` I think code (with comments) speaks for itself. The only subtlety: now `#[cold]`, `#[no_mangle]`, & `#[track_caller]` do not get thrown away when malformed (i.e. have arguments). This doesn't matter too much (I think), because an error gets emitted either way, so the compilation will not finish.
2025-07-02Rollup merge of #142237 - benschulz:unused-parens-fn, r=fee1-deadMatthias Krüger-55/+422
Detect more cases of unused_parens around types With this change, more unused parentheses around bounds and types nested within bounds are detected.
2025-07-02Rollup merge of #143231 - xizheyin:143152, r=fee1-deadMatthias Krüger-0/+18
Suggest use another lifetime specifier instead of underscore lifetime cc rust-lang/rust#143152 r? compiler
2025-07-02Rollup merge of #143194 - folkertdev:fix-single-element-simd-bitcast, ↵Matthias Krüger-10/+45
r=workingjubilee fix bitcast of single-element SIMD vectors in effect this reverts https://github.com/rust-lang/rust/pull/142768 and adds additional tests. That PR relaxed the conditions on an early return in an incorrect way that would create broken LLVM IR. https://godbolt.org/z/PaaGWTv5a ```rust #![feature(repr_simd)] #[repr(simd)] #[derive(Clone, Copy)] struct S([i64; 1]); #[no_mangle] pub extern "C" fn single_element_simd(b: S) -> i64 { unsafe { std::mem::transmute(b) } } ``` at the time of writing generates this LLVM IR, where the type of the return is different from the function's return type. ```llvm define noundef i64 ``````@single_element_simd(<1`````` x i64> %b) unnamed_addr { start: ret <1 x i64> %b } ``` The test output is actually the same for the existing tests, showing that the change didn't actually matter for any tested behavior. It is probably a bit faster to do the early return, but, well, it's incorrect in general. zullip thread: [#t-compiler > Is transmuting a &#96;T&#96; to &#96;Tx1&#96; (one-element SIMD vector) UB?](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Is.20transmuting.20a.20.60T.60.20to.20.60Tx1.60.20.28one-element.20SIMD.20vector.29.20UB.3F/with/526262799) cc ``````@sayantn`````` r? ``````@scottmcm``````
2025-07-02Rollup merge of #142321 - ostylk:fix/ppc64_abi, r=workingjubileeMatthias Krüger-1/+1
Expose elf abi on ppc64 targets Fixes https://github.com/rust-lang/rust/issues/60617 (after MCP https://github.com/rust-lang/compiler-team/issues/885 is accepted) by exposing the abi information on ppc64 targets. Conditional compilation can now use `cfg(target_abi = "elfv1")` or `cfg(target_abi = "elfv2")` to determine the abi in use. Technical details are included in the other PR https://github.com/rust-lang/rust/pull/142598
2025-07-02Auto merge of #143214 - camsteffen:remove-let-chains-feature, r=est31bors-1190/+1037
Remove let_chains unstable feature Per https://github.com/rust-lang/rust/issues/53667#issuecomment-3016742982 (but then I also noticed rust-lang/rust#140722) This replaces the feature gate with a parser error that says let chains require 2024. A lot of tests were using the unstable feature. I either added edition:2024 to the test or split out the parts that require 2024.
2025-07-02Make the enum check work for negative discriminantsBastian Kersting-0/+67
The discriminant check was not working correctly for negative numbers. This change fixes that by masking out the relevant bits correctly.
2025-07-02Auto merge of #142974 - cuviper:stage0-bump, r=Mark-Simulacrumbors-1/+1
Update stage0 to 1.89.0-beta.1 - Update version placeholders - Update stage0 to 1.89.0-beta.1 - Update `STAGE0_MISSING_TARGETS` - Update `cfg(bootstrap)` r? `@Mark-Simulacrum` try-job: dist-i586-gnu-i586-i686-musl
2025-07-02Consider polarity in sizedness fast pathMichael Goulet-0/+23
2025-07-01Auto merge of #143036 - compiler-errors:no-dyn-star, r=oli-obkbors-1481/+62
Remove support for `dyn*` from the compiler This PR removes support for `dyn*` (https://github.com/rust-lang/rust/issues/102425), which are a currently un-RFC'd experiment that was opened a few years ago to explore a component that we thought was necessary for AFIDT (async fn in dyn trait). It doesn't seem like we are going to need `dyn*` types -- even in an not-exposed-to-the-user way[^1] -- for us to implement AFIDT. Given that AFIDT was the original motivating purpose of `dyn*` types, I don't really see a compelling reason to have to maintain their implementation in the compiler. [^1]: Compared to, e.g., generators whih are an unstable building block we use to implement stable syntax like `async {}`. We've learned quite a lot from `dyn*`, but I think at this point its current behavior leads to more questions than answers. For example, `dyn*` support today remains somewhat fragile; it ICEs in many cases where the current "normal" `dyn Trait` types rely on their unsizedness for their vtable-based implementation to be sound I wouldn't be surprised if it's unsound in other ways, though I didn't play around with it too much. See the examples below. ```rust #![feature(dyn_star)] trait Foo { fn hello(self); } impl Foo for usize { fn hello(self) { println!("hello, world"); } } fn main() { let x: dyn* Foo = 1usize; x.hello(); } ``` And: ```rust #![feature(dyn_star)] trait Trait { type Out where Self: Sized; } fn main() { let x: <dyn* Trait as Trait>::Out; } ``` ...and probably many more problems having to do with the intersection of dyn-compatibility and `Self: Sized` bounds that I was too lazy to look into like: * GATs * Methods with invalid signatures * Associated consts Generally, `dyn*` types also end up getting in the way of working with [normal `dyn` types](https://github.com/rust-lang/rust/issues/102425#issuecomment-1712604409) to an extent that IMO outweighs the benefit of experimentation. I recognize that there are probably other, more creative usages of `dyn*` that are orthogonal to AFIDT. However, I think any work along those lines should first have to think through some of the more fundamental interactions between `dyn*` and dyn-compatibility before we think about reimplementing them in the type system. --- I'm planning on removing the `DynKind` enum and the `PointerLike` built-in trait from the compiler after this PR lands. Closes rust-lang/rust#102425. cc `@eholk` `@rust-lang/lang` `@rust-lang/types` Closes rust-lang/rust#116979. Closes rust-lang/rust#119694. Closes rust-lang/rust#134591. Closes rust-lang/rust#104800.
2025-07-01Remove support for dyn*Michael Goulet-1481/+62
2025-07-01Auto merge of #143287 - GuillaumeGomez:rollup-fdjcti9, r=GuillaumeGomezbors-456/+1361
Rollup of 12 pull requests Successful merges: - rust-lang/rust#136801 (Implement `Random` for tuple) - rust-lang/rust#141867 (Describe Future invariants more precisely) - rust-lang/rust#142760 (docs(fs): Touch up grammar on lock api) - rust-lang/rust#143181 (Improve testing and error messages for malformed attributes) - rust-lang/rust#143210 (`tests/ui`: A New Order [19/N] ) - rust-lang/rust#143212 (`tests/ui`: A New Order [20/N]) - rust-lang/rust#143230 ([COMPILETEST-UNTANGLE 2/N] Make some compiletest errors/warnings/help more visually obvious) - rust-lang/rust#143240 (Port `#[rustc_object_lifetime_default]` to the new attribute parsing …) - rust-lang/rust#143255 (Do not enable LLD by default in the dist profile) - rust-lang/rust#143262 (mir: Mark `Statement` and `BasicBlockData` as `#[non_exhaustive]`) - rust-lang/rust#143269 (bootstrap: make comment more clear) - rust-lang/rust#143279 (Remove `ItemKind::descr` method) Failed merges: - rust-lang/rust#143237 (Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-01Update version placeholdersJosh Stone-1/+1
2025-07-01Rollup merge of #143279 - GuillaumeGomez:rm-itemkind-descr, r=oli-obkGuillaume Gomez-1/+1
Remove `ItemKind::descr` method Follow-up of rust-lang/rust#143234. After this PR is merged, it will remain two `descr` methods: * `hir::GenericArg::descr` * `hir::AssocItemConstraintKind::descr` For both these enums, I don't think there is the right equivalent in `hir::DefKind` so unless I missed something, we can't remove these two methods because we can't convert these enums into `hir::DefKind`. r? `@oli-obk`
2025-07-01Rollup merge of #143212 - Kivooeo:tf20, r=tgross35Guillaume Gomez-223/+253
`tests/ui`: A New Order [20/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@tgross35`
2025-07-01Rollup merge of #143210 - Kivooeo:tf19, r=tgross35Guillaume Gomez-222/+265
`tests/ui`: A New Order [19/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@tgross35`
2025-07-01Auto merge of #142030 - oli-obk:wfck-less-hir, r=compiler-errorsbors-628/+827
Start moving wf checking away from HIR I'm trying to only access the HIR in the error path. My hope is that once we move significant portions of wfcheck off HIR that incremental will be able to cache wfcheck queries significantly better. I think I am reaching a blocker because we normally need to provide good spans to `ObligationCause`, so that the trait solver can report good errors. In some cases I have been able to use bad spans and improve them depending on the `ObligationCauseCode` (by loading HIR in the case where we actually want to error). To scale that further we'll likely need to remove spans from the `ObligationCause` entirely (leaving it to some variants of `ObligationCauseCode` to have a span when they can't recompute the information later). Unsure this is the right approach, but we've already been using it. I will create an MCP about it, but that should not affect this PR, which is fairly limited in where it does those kind of tricks. Especially https://github.com/rust-lang/rust/commit/b862d8828e375ab8c128a9d9e93bf98b77cb5928 is interesting here, because I think it improves spans in all cases
2025-07-01Fix duplicate errors for `link_section`, ↵Jonathan Brouwer-20/+36
`rustc_layout_scalar_valid_range_start` and `rustc_layout_scalar_valid_range_end`
2025-07-01Fix duplicate help on export_name and othersJonathan Brouwer-21/+5
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01Fix `#[rustc_macro_transparency]` giving two errorsJonathan Brouwer-75/+68
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01Fix `#[must_use = 1]` not giving an errorJonathan Brouwer-43/+71
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01Fix double error for `export_name`Jonathan Brouwer-88/+74
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01New test for malformed attributesJonathan Brouwer-0/+825
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>