about summary refs log tree commit diff
path: root/tests/ui
AgeCommit message (Collapse)AuthorLines
2025-03-11Rollup merge of #138284 - compiler-errors:const-param-ty-annotation, r=BoxyUwUMatthias Krüger-0/+21
Do not write user type annotation for const param value path As I noted in the code comment, `DefKind::ConstParam` isn't actually *generic* over its own args, we just use the identity args from the body when lowering the value path so we have something to plug into the `EarlyBinder` we get back from `type_of` for the const param. So skip over it in `write_user_type_annotation_from_args`. Somewhat unrelated, but I left an explanation for a somewhat mysterious quirk in the THIR lowering of user type annotations for patterns having to do with ctors and their `type_of` not actually being the type of the pattern node it's ascribing. Fixes #138048 r? ``@BoxyUwU``
2025-03-11Rollup merge of #138256 - compiler-errors:anon-const-ty, r=BoxyUwUMatthias Krüger-0/+59
Do not feed anon const a type that references generics that it does not have Fixes #137865 See the comment I left in the code. We could alternatively give these anon consts the generics from the parent, but that would be moving in a GCE-esque direction that we may not want. Open to tweaks here. r? BoxyUwU
2025-03-11Rollup merge of #138231 - Sa4dUs:autodiff-ice, r=ZuseZ4Matthias Krüger-30/+74
Prevent ICE in autodiff validation by emitting user-friendly errors This PR moves `valid_ret_activity` and `valid_input_activity` checks to the macro expansion phase in compiler/rustc_builtin_macros/src/autodiff.rs, replacing the following internal compiler error (ICE): ``` error: internal compiler error: compiler/rustc_codegen_ssa/src/codegen_attrs.rs:935:13: Invalid input activity Dual for Reverse mode ``` with a more user-friendly message. The issue specifically affected the test file `tests/ui/autodiff/autodiff_illegal.rs`, impacting the functions `f5` and `f6`. The ICE can be reproduced by following [Enzyme's Rustbook](https://enzymead.github.io/rustbook/installation.html) installation guide. Additionally, this PR adds tests for invalid return activity in `autodiff_illegal.rs`, which previously triggered an unnoticed ICE before these fixes. r? ``@oli-obk``
2025-03-11Rollup merge of #137715 - oli-obk:pattern-type-literals, r=BoxyUwUMatthias Krüger-10/+470
Allow int literals for pattern types with int base types r? ``@BoxyUwU`` I also added an error at layout computation time for layouts that contain wrapping ranges (happens at monomorphization time). This is obviously hacky, but at least prevents such types from making it to codegen for now. It made writing the tests for int literals easier as I didn't have to think about that edge case Basically this PR allows you to stop using transmutes for creating pattern types and instead just use literals: ```rust let x: pattern_type!(u32 is 5..10) = 7; ``` works, and if the literal is out of range you get a type mismatch because it just stays at the base type and the base type can't be coerced to the pattern type. cc ``@joshtriplett`` ``@scottmcm``
2025-03-11Auto merge of #128440 - oli-obk:defines, r=lcnrbors-2131/+2404
Add `#[define_opaques]` attribute and require it for all type-alias-impl-trait sites that register a hidden type Instead of relying on the signature of items to decide whether they are constraining an opaque type, the opaque types that the item constrains must be explicitly listed. A previous version of this PR used an actual attribute, but had to keep the resolved `DefId`s in a side table. Now we just lower to fields in the AST that have no surface syntax, instead a builtin attribute macro fills in those fields where applicable. Note that for convenience referencing opaque types in associated types from associated methods on the same impl will not require an attribute. If that causes problems `#[defines()]` can be used to overwrite the default of searching for opaques in the signature. One wart of this design is that closures and static items do not have generics. So since I stored the opaques in the generics of functions, consts and methods, I would need to add a custom field to closures and statics to track this information. During a T-types discussion we decided to just not do this for now. fixes #131298
2025-03-11Migrate alloc to Rust 2024Eric Huss-20/+2
2025-03-11Migrate core to Rust 2024Eric Huss-33/+3
2025-03-11Add a test for new 2024 standard library behaviorEric Huss-0/+61
When migrating the standard library to 2024, there will be some behavior changes that users will be able to observe. This test should cover that (I cannot think of any other observable differences).
2025-03-11Elaborate param-env built for checking DispatchFromDyn for dyn compatMichael Goulet-5/+93
2025-03-11merge `TypeChecker` and `TypeVerifier`lcnr-6/+6
2025-03-11change `TypeChecker` to a MIR visitorlcnr-2/+2
2025-03-11Rollup merge of #138300 - RalfJung:unqualified-local-imports, r=jieyouxuJakub Beránek-0/+1
add tracking issue for unqualified_local_imports Tracking issue: https://github.com/rust-lang/rust/issues/138299 r? ``````@jieyouxu``````
2025-03-11Rollup merge of #138288 - jyn514:crate-attr, r=NoratriebJakub Beránek-0/+108
Document -Z crate-attr and also add a bunch of tests
2025-03-11Rollup merge of #138063 - compiler-errors:improve-attr-unpretty, r=jdonszelmannJakub Beránek-14/+9
Improve `-Zunpretty=hir` for parsed attrs 0. Rename `print_something` to `should_render` to make it distinct from `print_attribute` in that it doesn't print anything, it's just a way to probe if a type renders anything. 1. Fixes a few bugs in the `PrintAttribute` derive. Namely, the `__printed_anything` variable was entangled with the `should_render` call, leading us to always render field names but never render commas. 2. Remove the outermost `""` from the attr. 3. Debug print `Symbol`s. I know that this is redundant for some parsed attributes, but there's no good way to distinguish symbols that are ident-like and symbols which are cooked string literals. We could perhaps *conditionally* to fall back to a debug printing if the symbol doesn't match an ident? But seems like overkill. Based on #138060, only review the commits not in that one.
2025-03-11Rollup merge of #137967 - mustartt:fix-aix-test-hangs, r=workingjubileeJakub Beránek-3/+9
[AIX] Fix hangs during testing Fixes all current test hangs experienced during CI runs. 1. ipv6 link-local (the loopback device) gets assigned an automatic zone id of 1, causing the assert to fail and hang in `library/std/src/net/udp/tests.rs` 2. Const alloc does not fail gracefully 3. Debuginfo test has problem with gdb auto load safe path
2025-03-11Error on `define_opaques` entries without any opaques actually referencedOli Scherer-2/+9
2025-03-11Keep items around even if builtin macros on them fail to parseOli Scherer-9/+1
2025-03-11Test invalid `define_opaques` attributesOli Scherer-0/+106
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-2131/+2299
2025-03-11Fix ICE for invalid return activity and proper error handlingMarcelo Domínguez-30/+74
2025-03-11add more -Z crate-attr testsjyn-0/+108
2025-03-11Auto merge of #138302 - matthiaskrgr:rollup-an2up80, r=matthiaskrgrbors-7/+83
Rollup of 8 pull requests Successful merges: - #136395 (Update to rand 0.9.0) - #137279 (Make some invalid codegen attr errors structured/translatable) - #137585 (Update documentation to consistently use 'm' in atomic synchronization example) - #137926 (Add a test for `-znostart-stop-gc` usage with LLD) - #138074 (Support `File::seek` for Hermit) - #138238 (Fix dyn -> param suggestion in struct ICEs) - #138270 (chore: Fix some comments) - #138286 (triagebot.toml: Don't label `test/rustdoc-json` as A-rustdoc-search (…) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-10Rollup merge of #138278 - Bryanskiy:delegation-ice-1, r=petrochenkovMatthias Krüger-0/+19
Delegation: fix ICE with invalid `MethodCall` generation `ExprKind::MethodCall` is now generated instead of `ExprKind::Call` if - the resolved function has a `&self` argument - the resolved function is an associated item <- was missed before Fixes https://github.com/rust-lang/rust/issues/128190 Fixes https://github.com/rust-lang/rust/issues/128119 Fixes https://github.com/rust-lang/rust/issues/127916 r? `@petrochenkov`
2025-03-10Pass InferCtxt to InlineAsmCtxt to properly taint on errorMichael Goulet-14/+49
Split up some of the tests bc tainting causes some errors to become suppressed
2025-03-10Delegation: fix ICE with invalid MethodCall generationBryanskiy-0/+19
2025-03-10Allow int literals for pattern types with int base typesOli Scherer-128/+35
2025-03-10Add tests for pattern type literalsOli Scherer-0/+419
2025-03-10Reject wrapping ranges of pattern typesOli Scherer-106/+13
2025-03-10Add some layout tests for pattern type edge casesOli Scherer-2/+229
2025-03-10Implement default methods for io::Empty and io::SinkThalia Archibald-2/+2
Eliminate any redundant, unobservable logic from the their default method implementations. The observable changes are that `Write::write_fmt` for both types now ignores the formatting arguments, so a user fmt impl which has side effects is not invoked, and `Write::write_all_vectored` for both types does not advance the borrowed buffers. Neither behavior is guaranteed by the docs and the latter is documented as unspecified. `Empty` is not marked as vectored, so that `Chain<Empty, _>` and `Chain<_, Empty>` are not forced to be vectored.
2025-03-10Rollup merge of #138270 - StevenMia:master, r=compiler-errorsMatthias Krüger-1/+1
chore: Fix some comments Fix some comments
2025-03-10Rollup merge of #138238 - compiler-errors:dyn-suggestion-in-struct, ↵Matthias Krüger-5/+56
r=nnethercote Fix dyn -> param suggestion in struct ICEs Makes the logic from #138042 a bit less ICEy and more clean. Also fixes an incorrect suggestion when the struct already has generics. I'll point out the major changes and observations in the code. Fixes #138229 Fixes #138211 r? nnethercote since you reviewed the original pr, or re-roll if you don't want to review this
2025-03-10Rollup merge of #137926 - Kobzol:lld-no-start-stop-test, r=lqdMatthias Krüger-0/+25
Add a test for `-znostart-stop-gc` usage with LLD This test replicates the behavior of https://github.com/dtolnay/linkme, to test that it still works even with LLD. Without `-znostart-stop-gc` the test fails. r? ``@lqd`` try-job: x86_64-gnu try-job: x86_64-msvc-1
2025-03-10Rollup merge of #137279 - estebank:codegen-structured-errors, r=nnethercoteMatthias Krüger-1/+1
Make some invalid codegen attr errors structured/translatable
2025-03-10add tracking issue for unqualified_local_importsRalf Jung-0/+1
2025-03-10Fix pretty printing of parsed attrs in hir_prettyMichael Goulet-14/+9
2025-03-09Do not feed anon const a type that references generics that it does not haveMichael Goulet-0/+59
2025-03-09Do not write user type annotation for const param value pathMichael Goulet-0/+21
2025-03-09Rollup merge of #138253 - mu001999-contrib:fix-138241, r=jdonszelmannMatthias Krüger-0/+36
Continue to check attr if meet empty repr for adt Fixes #138241 Returning while checking ReprEmpty results in missing the check for the next repr
2025-03-09chore: Fix some commentsStevenMia-1/+1
Signed-off-by: StevenMia <flite@foxmail.com>
2025-03-09Rollup merge of #138158 - moulins:move-layout-to-rustc_abi, r=workingjubileeMatthias Krüger-7/+4
Move more layouting logic to `rustc_abi` Move all `LayoutData`-constructing code to `rustc_abi`: - Infaillible operations get a new `LayoutData` constructor method; - Faillible ones get a new method on `LayoutCalculator`.
2025-03-09Rollup merge of #137319 - Kixunil:stabilize-const-vec-string-slice, r=dtolnayMatthias Krüger-1/+1
Stabilize `const_vec_string_slice` This feature was approved for stabilization in https://github.com/rust-lang/rust/issues/129041#issuecomment-2508940661 so this change stabilizes it.
2025-03-09Rollup merge of #136968 - oli-obk:bye-bye, r=compiler-errorsMatthias Krüger-160/+30
Turn order dependent trait objects future incompat warning into a hard error fixes #56484 r? ``@ghost`` will FCP when we have a crater result
2025-03-09Rollup merge of #136127 - WaffleLapkin:dyn_ptr_unwrap_cast, r=compiler-errorsMatthias Krüger-0/+377
Allow `*const W<dyn A> -> *const dyn A` ptr cast Followup of https://github.com/rust-lang/rust/pull/120248#discussion_r1487936000. This PR allows casting pointers from something wrapping a trait object, to the trait object, i.e. `*const W<dyn A> -> *const dyn A` where `W` is `struct W<T: ?Sized>(T);`. r? compiler-errors Fixes https://github.com/rust-lang/rust/issues/128625
2025-03-09continue to check attr if meet empty repr for adtMu001999-0/+36
2025-03-09Do not register `Self: AutoTrait` when confirming auto traitMichael Goulet-28/+3
2025-03-08Auto merge of #137502 - compiler-errors:global-asm-aint-mir-body, r=oli-obkbors-0/+46
Don't include global asm in `mir_keys`, fix error body synthesis r? oli-obk Fixes #137470 Fixes #137471 Fixes #137472 Fixes #137473 try-job: test-various try-job: x86_64-apple-2
2025-03-08Fix suggestion when there are generics, inline some thingsMichael Goulet-1/+20
2025-03-08Rework maybe_suggest_add_generic_impl_traitMichael Goulet-5/+37
2025-03-08Add test for garbage collection of encapsulation symbolsJakub Beránek-0/+25