about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-10-29Rollup merge of #132312 - jieyouxu:delete-crashes-23707, r=matthiaskrgrJubilee-109/+0
Delete `tests/crashes/23707.rs` because it's flaky It's conditioned on `only-x86_64` because it doesn't reliably fail on other platforms, it's optimization dependent and failed to ICE post-PGO in <https://github.com/rust-lang/rust/pull/132300#issuecomment-2443279042>. Remove this test for now without prejudice against relanding the test in a more reliable form. I removed the `S-bug-has-test` label from #23707. r? compiler
2024-10-29Rollup merge of #132266 - krasimirgg:llvm-20-testfix, ↵Jubilee-3/+8
r=hanna-kruppe,beetrees,workingjubilee riscv-soft-abi-with-float-features.rs: adapt for LLVM 20 Adapts a test for LLVM 20. No functional changes intended.
2024-10-29Rollup merge of #132194 - compiler-errors:rpitit-super-wc, r=spastorinoJubilee-0/+21
Collect item bounds for RPITITs from trait where clauses just like associated types We collect item bounds from trait where clauses for *associated types*, i.e. this: ```rust trait Foo where Self::Assoc: Send { type Assoc; } ``` Becomes this: ```rust trait Foo { type Assoc: Send; } ``` Today, with RPITITs/AFIT and return-type notation, we don't do that, i.e.: ```rust trait Foo where Self::method(..): Send { fn method() -> impl Sized; } fn is_send(_: impl Send) {} fn test<T: Foo>() { is_send(T::method()); } ``` ...which fails on nightly today. Turns out it's super easy to fix this, and we just need to use the `associated_type_bounds` lowering function in `explicit_item_bounds_with_filter`, which has that logic baked in.
2024-10-29Rollup merge of #132119 - compiler-errors:effects-old-solver, r=lcnrJubilee-168/+106
Hack out effects support for old solver Opening this for vibes ✨ Turns out that a basic, somewhat incomplete implementation of host effects is achievable in the old trait solver pretty easily. This should be sufficient for us to use in the standard library itself. Regarding incompleteness, maybe we should always treat host predicates as ambiguous in intercrate mode (at least in the old solver) to avoid any worries about accidental impl overlap or something. r? ```@lcnr``` cc ```@fee1-dead```
2024-10-29Auto merge of #132277 - workingjubilee:rollup-5e6q6e4, r=workingjubileebors-29/+30
Rollup of 9 pull requests Successful merges: - #130259 (Lower AST node id only once) - #131441 (Add a new trait `proc_macro::ToTokens`) - #132247 (stable_mir: Directly use types from rustc_abi) - #132249 (compiler: Add rustc_abi dependence to the compiler) - #132255 (Add `LayoutData::is_uninhabited` and use it) - #132258 ([rustdoc] Unify variant struct fields margins with struct fields) - #132260 (cg_llvm: Use a type-safe helper to cast `&str` and `&[u8]` to `*const c_char`) - #132261 (refactor: cleaner check to return None) - #132271 (Updating Fuchsia platform-support documentation) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-29Delete `tests/crashes/23707.rs` because it's flaky许杰友 Jieyou Xu (Joe)-109/+0
It's conditioned on `only-x86_64` because it doesn't reliably fail on other platforms, it's optimization dependent and failed to ICE post-PGO in <https://github.com/rust-lang/rust/pull/132300#issuecomment-2443279042>. Remove this test for now without prejudice against relanding the test in a more reliable form.
2024-10-29Auto merge of #128985 - GrigorenkoPV:instantly-dangling-pointer, r=Urgaubors-33/+828
Lint against getting pointers from immediately dropped temporaries Fixes #123613 ## Changes: 1. New lint: `dangling_pointers_from_temporaries`. Is a generalization of `temporary_cstring_as_ptr` for more types and more ways to get a temporary. 2. `temporary_cstring_as_ptr` is removed and marked as renamed to `dangling_pointers_from_temporaries`. 3. `clippy::temporary_cstring_as_ptr` is marked as renamed to `dangling_pointers_from_temporaries`. 4. Fixed a false positive[^fp] for when the pointer is not actually dangling because of lifetime extension for function/method call arguments. 5. `core::cell::Cell` is now `rustc_diagnostic_item = "Cell"` ## Questions: - [ ] Instead of manually checking for a list of known methods and diagnostic items, maybe add some sort of annotation to those methods in library and check for the presence of that annotation? https://github.com/rust-lang/rust/pull/128985#issuecomment-2318714312 ## Known limitations: ### False negatives[^fn]: See the comments in `compiler/rustc_lint/src/dangling.rs` 1. Method calls that are not checked for: - `temporary_unsafe_cell.get()` - `temporary_sync_unsafe_cell.get()` 2. Ways to get a temporary that are not recognized: - `owning_temporary.field` - `owning_temporary[index]` 3. No checks for ref-to-ptr conversions: - `&raw [mut] temporary` - `&temporary as *(const|mut) _` - `ptr::from_ref(&temporary)` and friends [^fn]: lint **should** be emitted, but **is not** [^fp]: lint **should not** be emitted, but **is**
2024-10-28Hack out effects support for old solverMichael Goulet-168/+106
2024-10-28Rollup merge of #132258 - GuillaumeGomez:variant-structfields-margins, ↵Jubilee-6/+7
r=notriddle [rustdoc] Unify variant struct fields margins with struct fields As discussed in https://github.com/rust-lang/rust/pull/132220. | before | after | |-|-| | ![image](https://github.com/user-attachments/assets/d8d8336d-7fe4-45fb-a5a5-36a4023223f5) | ![Screenshot from 2024-10-28 11-17-24](https://github.com/user-attachments/assets/9d0d9633-b857-45b4-9217-7d0d1aa8f770) | r? ```@notriddle```
2024-10-28Rollup merge of #130259 - adwinwhite:lower-node-id-once, r=cjgillotJubilee-23/+23
Lower AST node id only once Fixes #96346. I basically followed the given instructions except the inline part. `lower_jump_destination` can't reuse local existing `HirId` due to unknown name resolution result so I created an additional mapping for labels. r? ```@cjgillot```
2024-10-28Auto merge of #132145 - RalfJung:stdarch, r=Amanieubors-6/+21
bump stdarch This lets us remove a hack from https://github.com/rust-lang/rust/pull/131349. r? `@Amanieu` try-job: test-various
2024-10-28riscv-soft-abi-with-float-features.rs: adapt for LLVM 20Krasimir Georgiev-3/+8
2024-10-28Auto merge of #132262 - matthiaskrgr:rollup-pcphi6l, r=matthiaskrgrbors-0/+24
Rollup of 4 pull requests Successful merges: - #131391 (Stabilize `isqrt` feature) - #132248 (rustc_transmute: Directly use types from rustc_abi) - #132252 (compiler: rename LayoutS to LayoutData) - #132253 (Known-bug test for `keyword_idents` lint not propagating to other files) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-28New lint: `dangling_pointers_from_temporaries`Pavel Grigorenko-33/+828
2024-10-28Rollup merge of #132253 - Zalathar:keyword-idents-bug, r=jieyouxuMatthias Krüger-0/+24
Known-bug test for `keyword_idents` lint not propagating to other files Known-bug test for `keyword_idents` lint not propagating to other files when configured via attribute (#132218).
2024-10-28we can now enable the 'const stable fn must be stable' checkRalf Jung-6/+21
2024-10-28Auto merge of #132244 - jyn514:linker-refactors, r=bjorn3bors-176/+179
fix various linker warnings separated out from https://github.com/rust-lang/rust/pull/119286; this doesn't have anything user-facing, i just want to land these changes so i can stop rebasing them. r? `@bjorn3`
2024-10-28Add GUI regression test for variant structfields marginsGuillaume Gomez-6/+7
2024-10-28Lower AST node id only onceAdwin White-23/+23
2024-10-28Known-bug test for `keyword_idents` lint not propagating to other filesZalathar-0/+24
2024-10-28Rollup merge of #132243 - compiler-errors:no-span, r=jieyouxu许杰友 Jieyou Xu (Joe)-9/+5
Remove `ObligationCause::span()` method I think it's an incredibly confusing footgun to expose both `obligation_cause.span` and `obligation_cause.span()`. Especially because `ObligationCause::span()` (the method) seems to just be hacking around a single quirk in the way we set up obligation causes for match arms. First commit removes the need for that hack, with only one diagnostic span changing (but IMO not really getting worse -- I'd argue that it was already confusing).
2024-10-28Rollup merge of #132227 - compiler-errors:better-const-span, r=Nadrieril许杰友 Jieyou Xu (Joe)-238/+232
Pass constness with span into lower_poly_trait_ref Gives us a span to point at for ~const/const on non-const traits. Split from #132209. r? Nadrieril
2024-10-28Rollup merge of #132220 - GuillaumeGomez:gui-test-struct-fields-margins, ↵许杰友 Jieyou Xu (Joe)-10/+42
r=notriddle Add GUI regression test for doc struct fields margins Fixes #131402. r? `@notriddle`
2024-10-28Rollup merge of #132086 - estebank:long-types, r=jieyouxu许杰友 Jieyou Xu (Joe)-0/+82
Tweak E0277 highlighting and "long type" path printing Partially address #132013. ![Output from this PR for the repro case in #132013](https://github.com/user-attachments/assets/a073ba37-4adc-411e-81f7-6cb9a945ce3d)
2024-10-28Error on alignments greater than `isize::MAX`asquared31415-0/+44
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
2024-10-27port `tests/ui/linkage-attr/framework` to run-makejyn-40/+43
this makes it much easier to understand test failures. before: ``` diff of stderr: 1 error: linking with `LINKER` failed: exit status: 1 2 | - ld: Undefined symbols: 4 _CFRunLoopGetTypeID, referenced from: 5 clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` after: ``` === HAYSTACK === error: linking with `cc` failed: exit status: 1 | = note: use `--verbose` to show all linker arguments = note: Undefined symbols for architecture arm64: "_CFRunLoopGetTypeID", referenced from: main::main::hbb553f5dda62d3ea in main.main.d17f5fbe6225cf88-cgu.0.rcgu.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) error: aborting due to 1 previous error === NEEDLE === _CFRunLoopGetTypeID\.?, referenced from: thread 'main' panicked at /Users/jyn/git/rust-lang/rust/tests/run-make/linkage-attr-framework/rmake.rs:22:10: needle was not found in haystack ``` this also fixes a failure related to missing whitespace; we don't actually care about whitespace in this test.
2024-10-27give a better error for tuple structs in `derive(Diagnostic)`jyn-136/+136
2024-10-27Stop using the whole match expr span for an arm's obligation spanMichael Goulet-9/+5
2024-10-27Auto merge of #132237 - matthiaskrgr:rollup-ulogwtd, r=matthiaskrgrbors-84/+58
Rollup of 5 pull requests Successful merges: - #132043 (Simplify param handling in `resolve_bound_vars`) - #132214 (Cleanup: Move an impl-Trait check from AST validation to AST lowering) - #132221 (Clean up some comments on lint implementation) - #132228 (Revert "ci update freebsd version proposal, freebsd 12 being eol.") - #132234 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-27Rollup merge of #132214 - fmease:mv-impl-trait-val-paths, r=compiler-errorsMatthias Krüger-84/+58
Cleanup: Move an impl-Trait check from AST validation to AST lowering Namely the one that rejects `impl Trait` in qself types and non-final path segments. There's no good reason to perform this during AST validation. We have better infrastructure in place in the AST lowerer (`ImplTraitContext`). This shaves off a lot of code. We now lower `impl Trait` in bad positions to `{type error}` which allows us to remove a special case from HIR ty lowering. Coincidentally fixes #126725. Well, it only *masks* it by passing `{type error}` to HIR analysis instead of a "bad" opaque. I was able to find a new reproducer for it. See the issue.
2024-10-27Auto merge of #131284 - ↵bors-215/+231
dingxiangfei2009:rename-smart-ptr-to-coerce-referent, r=compiler-errors Rename macro `SmartPointer` to `CoercePointee` As per resolution #129104 we will rename the macro to better reflect the technical specification of the feature and clarify the communication. - `SmartPointer` is renamed to `CoerceReferent` - `#[pointee]` attribute is renamed to `#[referent]` - `#![feature(derive_smart_pointer)]` gate is renamed to `#![feature(derive_coerce_referent)]`. - Any mention of `SmartPointer` in the file names are renamed accordingly. r? `@compiler-errors` cc `@nikomatsakis` `@Darksonn`
2024-10-27Add GUI regression test for doc struct fields marginsGuillaume Gomez-10/+42
2024-10-27Move an impl-Trait check from AST validation to AST loweringLeón Orell Valerian Liehr-84/+58
2024-10-27Auto merge of #132213 - workingjubilee:rollup-tg1g3l5, r=workingjubileebors-5/+32
Rollup of 4 pull requests Successful merges: - #132123 (allow type-based search on foreign functions) - #132183 (Fix code HTML items making big blocks if too long) - #132192 (expand: Stop using artificial `ast::Item` for macros loaded from metadata) - #132205 (docs: Correctly link riscv32e from platform-support.md) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-26Rollup merge of #132183 - GuillaumeGomez:code-in-docblock, r=notriddleJubilee-5/+19
Fix code HTML items making big blocks if too long Encountered this bug randomly where `code` item in docblocks would look like this: ![Screenshot from 2024-10-26 15-44-46](https://github.com/user-attachments/assets/a9c1df9d-5007-49eb-a7dd-a2c381b2511e) With this fix it looks like this: ![image](https://github.com/user-attachments/assets/ea918595-5434-4781-b68c-6abd38689365) r? ``@notriddle``
2024-10-26Rollup merge of #132123 - lolbinarycat:rustdoc-search-foreign-func, r=notriddleJubilee-0/+13
allow type-based search on foreign functions fixes https://github.com/rust-lang/rust/issues/131804 preferably will be merged after #129708, but that may take a while to be approved due to being a new feature, whereas this is definitely a bug, and should be fixed.
2024-10-27Auto merge of #132167 - Zalathar:llvm-wrappers, r=jieyouxubors-0/+124
Replace some LLVMRust wrappers with calls to the LLVM C API This PR removes the LLVMRust wrapper functions for getting/setting linkage and visibility, and replaces them with direct calls to the corresponding functions in LLVM's C API. To make this convenient and sound, two pieces of supporting code have also been added: - A simple proc-macro that derives `TryFrom<u32>` for fieldless enums - A wrapper type for C enum values returned by LLVM functions, to ensure soundness if LLVM returns an enum value we don't know about In a few places, the use of safe wrapper functions means that an `unsafe` block is no longer needed, so the affected code has changed its indentation level.
2024-10-27Auto merge of #131900 - mrkajetanp:target-feature-pauth-lr, r=Amanieubors-2/+2
rustc_target: Add pauth-lr aarch64 target feature Add the pauth-lr target feature, corresponding to aarch64 FEAT_PAuth_LR. This feature has been added in LLVM 19. It is currently not supported by the Linux hwcap and so we cannot add runtime feature detection for it at this time. r? `@Amanieu`
2024-10-26Pass constness with span into lower_poly_trait_refMichael Goulet-238/+232
2024-10-26Update GUI testGuillaume Gomez-4/+6
2024-10-26Collect item bounds for RPITITs from trait where clauses just like ↵Michael Goulet-0/+21
associated types
2024-10-26Auto merge of #125116 - blyxyas:ignore-allowed-lints-final, r=cjgillotbors-2/+10
(Big performance change) Do not run lints that cannot emit Before this change, adding a lint was a difficult matter because it always had some overhead involved. This was because all lints would run, no matter their default level, or if the user had `#![allow]`ed them. This PR changes that. This change would improve both the Rust lint infrastructure and Clippy, but Clippy will see the most benefit, as it has about 900 registered lints (and growing!) So yeah, with this little patch we filter all lints pre-linting, and remove any lint that is either: - Manually `#![allow]`ed in the whole crate, - Allowed in the command line, or - Not manually enabled with `#[warn]` or similar, and its default level is `Allow` As some lints **need** to run, this PR also adds **loadbearing lints**. On a lint declaration, you can use the ``@eval_always` = true` marker to label it as loadbearing. A loadbearing lint will never be filtered (it will always run) Fixes #106983
2024-10-26Rollup merge of #132180 - Urgau:ast_pretty-unsafe-attr, r=compiler-errors许杰友 Jieyou Xu (Joe)-0/+22
Print unsafety of attribute in AST pretty print This PR fixes the AST pretty print, which was missing the unsafety for unsafe attributes. Related to https://github.com/rust-lang/rust/pull/131558#discussion_r1807736204
2024-10-26Rollup merge of #132169 - fee1-dead-contrib:consttraitsck, r=compiler-errors许杰友 Jieyou Xu (Joe)-314/+419
Deny calls to non-`#[const_trait]` methods in MIR constck This is a (potentially temporary) fix that closes off the mismatch in assumptions between MIR constck and typeck which does the const traits checking. Before this PR, MIR constck assumed that typeck correctly handled all calls to trait methods in const contexts if effects is enabled. That is not true because typeck only correctly handles callees that are const. For non-const callees (such as methods in a non-const_trait), typeck had never created an error. https://github.com/rust-lang/rust/blob/45089ec19ebebec88bace6ec237244ff0eaa7ad3/compiler/rustc_hir_typeck/src/callee.rs#L876-L877 I called this potentially temporary because the const checks could be moved to HIR entirely. Alongside the recent refactor in const stability checks where that component could be placed would need more discussion. (cc ```@compiler-errors``` ```@RalfJung)``` Tests are updated, mainly due to traits not being const in core, so tests that call them correctly error. This fixes https://github.com/rust-lang/project-const-traits/issues/12.
2024-10-26Add GUI regression test for code in doc blocksGuillaume Gomez-1/+13
2024-10-26Print unsafety of attribute in AST unprettyUrgau-1/+1
2024-10-26Add AST unpretty test for unsafe attributeUrgau-0/+22
2024-10-26Add a macro that derives `TryFrom<u32>` for fieldless enumsZalathar-0/+124
2024-10-26Auto merge of #132152 - lqd:revert-127731, r=compiler-errorsbors-221/+53
Revert #127731 "Emit error when calling/declaring functions with unavailable …" This reverts #127731 due to the unexpected [perf regressions](https://github.com/rust-lang/rust/pull/127731#issuecomment-2438687094) and to give time to mitigate the regressions before re-landing it. r? `@RalfJung` cc `@veluca93`
2024-10-26Deny calls to non-`#[const_trait]` methods in MIR constckDeadbeef-314/+419