about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-10-21Auto merge of #131988 - matthiaskrgr:rollup-tx173wn, r=matthiaskrgrbors-4/+51
Rollup of 4 pull requests Successful merges: - #126588 (Added more scenarios where comma to be removed in the function arg) - #131728 (bootstrap: extract builder cargo to its own module) - #131968 (Rip out old effects var handling code from traits) - #131981 (Remove the `BoundConstness::NotConst` variant) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-21Rollup merge of #126588 - linyihai:trim-extra-comma, r=petrochenkovMatthias Krüger-4/+51
Added more scenarios where comma to be removed in the function arg This is an attempt to address the problem methion in https://github.com/rust-lang/rust/issues/106304#issuecomment-1837273666. Copy the annotation to explain the fix If the next Error::Extra ("next") doesn't next to current ("current") ``` fn foo(_: (), _: u32) {} - foo("current", (), 1u32, "next") + foo((), 1u32) ``` If the previous error is not a `Error::Extra`, then do not trim the next comma ``` - foo((), "current", 42u32, "next") + foo((), 42u32) ``` Frankly, this is a fix from a test case and may not cover all scenarios
2024-10-21Auto merge of #130950 - compiler-errors:yeet-eval, r=BoxyUwUbors-0/+53
Continue to get rid of `ty::Const::{try_}eval*` This PR mostly does: * Removes all of the `try_eval_*` and `eval_*` helpers from `ty::Const`, and replace their usages with `try_to_*`. * Remove `ty::Const::eval`. * Rename `ty::Const::normalize` to `ty::Const::normalize_internal`. This function is still used in the normalization code itself. * Fix some weirdness around the `TransmuteFrom` goal. I'm happy to split it out further; for example, I could probably land the first part which removes the helpers, or the changes to codegen which are more obvious than the changes to tools. r? BoxyUwU Part of https://github.com/rust-lang/rust/issues/130704
2024-10-20Auto merge of #131980 - matthiaskrgr:rollup-iy5nw71, r=matthiaskrgrbors-49/+91
Rollup of 5 pull requests Successful merges: - #131814 (`optimize` attribute applied to things other than methods/functions/c…) - #131927 (Check for filecheck directives in files marked `skip-filecheck`) - #131967 (Remove `lower_mono_bounds`) - #131973 (fix(rustdoc-json-types): document rustc-hash feature) - #131976 (feat(rustdoc-json-types): mark simple enums as copy) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-20Rollup merge of #131927 - clubby789:skip-filecheck-directives, r=Mark-SimulacrumMatthias Krüger-3/+1
Check for filecheck directives in files marked `skip-filecheck` cc #116971
2024-10-20Rollup merge of #131814 - Borgerr:misapplied-optimize-attribute, r=jieyouxuMatthias Krüger-46/+90
`optimize` attribute applied to things other than methods/functions/c… …losures gives an error (#128488) Duplicate of #128943, which I had accidentally closed when rebasing. cc. `@jieyouxu` `@compiler-errors` `@nikomatsakis` `@traviscross` `@pnkfelix.`
2024-10-20Auto merge of #131949 - Noratrieb:fxhashup-thanks-alona, r=WaffleLapkinbors-45/+45
Update rustc-hash to version 2 but again it's like #129533 but not closed by bors and rebased r? WaffleLapkin meow
2024-10-20Rollup merge of #131964 - matthiaskrgr:crashes2010, r=jieyouxuMatthias Krüger-0/+76
add latest crash tests r? `@jieyouxu`
2024-10-20Rollup merge of #131843 - workingjubilee:thaw-impossible-reprs, r=lukas-codeMatthias Krüger-4/+107
compiler: Error on layout of enums with invalid reprs Surprising no one, the ICEs with the same message have the same root cause. Invalid reprs can reach layout computation for various reasons. For instance, the compiler may want to use its layout computations to discern if a combination of layout-affecting attributes results in a valid type to begin with by e.g. computing its size. When the input is bad, return an error reflecting that the answer to the question is not a useful one.
2024-10-20Rollup merge of #121560 - Noratrieb:stop-lint-macro-nonsense, r=jieyouxuMatthias Krüger-29/+255
Allow `#[deny]` inside `#[forbid]` as a no-op Forbid cannot be overriden. When someome tries to do this anyways, it results in a hard error. That makes sense. Except it doesn't, because macros. Macros may reasonably use `#[deny]` (or `#[warn]` for an allow-by-default lint) in their expansion to assert that their expanded code follows the lint. This is doesn't work when the output gets expanded into a `forbid()` context. This is pretty silly, since both the macros and the code agree on the lint! By making it a warning instead, we remove the problem with the macro, which is now nothing as warnings are suppressed in macro expanded code, while still telling users that something is up. fixes #121483
2024-10-20misapplied optimize attribute throws a compilation error (#128488)ash-46/+90
2024-10-20Added more scenarios where commas need to be removedLin Yihai-4/+51
2024-10-20compiler: Reject impossible reprs during enum layoutJubilee Young-4/+107
2024-10-20compiler: pre-move code for fixing enum layout ICEsJubilee Young-0/+0
2024-10-20add latest crash testsMatthias Krüger-0/+76
2024-10-20Stop relying on hashmap iteration for unused macro rules armsNoratrieb-22/+22
2024-10-20Stop relying on hashmap iteration for hir stat printingNoratrieb-23/+23
Just because the code says it's OK does not mean that it actually is OK. Nodes with the same total size were not sorted, their order relied on hashmap iteration.
2024-10-19Rollup merge of #131925 - clubby789:redundant-revision-cfg, r=jieyouxuMatthias Krüger-11/+9
Warn on redundant `--cfg` directive when revisions are used r? ``@jieyouxu`` Fixes #131390 Not sure of the best way to test this
2024-10-19Rollup merge of #131920 - clubby789:108395-test, r=jieyouxuMatthias Krüger-0/+27
Add codegen test for branchy bool match Closes #108395
2024-10-19Rollup merge of #131795 - compiler-errors:expectation, r=NadrierilMatthias Krüger-61/+44
Stop inverting expectation in normalization errors We have some funky special case logic to invert the expectation and actual type for normalization errors depending on their cause code. IMO most of the error messages get better, except for `try {}` blocks' type expectations. I think that these need to be special cased in some other way, rather than via this hack. Fixes #131763
2024-10-19Rollup merge of #131789 - compiler-errors:capture-more, r=fmeaseMatthias Krüger-0/+37
Make sure that outer opaques capture inner opaques's lifetimes even with precise capturing syntax When lowering an opaque, we must capture and duplicate all of the lifetimes in the opaque's bounds to correctly lower the opaque's bounds. We do this *even if* the lifetime is not captured according to the `+ use<>` precise capturing bound; in that case, we will later reject that captured lifetime. For example, Given an opaque like `impl Sized + 'a + use<>`, we will still duplicate `'a` but later error that it is not mentioned in the `use<>` bound. The current heuristic was not properly handling cases like: ``` //@ edition: 2024 fn foo<'a>() -> impl Trait<Assoc = impl Trait2> + use<> {} ``` Which forces the outer `impl Trait` to capture `'a` since `impl Trait2` *implicitly* captures `'a` due to the new lifetime capture rules for edition 2024. We were only capturing lifetimes syntactically mentioned in the bounds. (Note that this still is an error; we just need to capture `'a` so it is handled later in the compiler correctly -- hence the ICE in #131769 where a late-bound lifetime was being referenced outside of its binder). This PR reworks the way we collect lifetimes to capture and duplicate in AST lowering to fix this. Fixes #131769
2024-10-19Rollup merge of #127675 - chenyukang:yukang-fix-127562-addr, r=petrochenkovMatthias Krüger-0/+16
Remove invalid help diagnostics for const pointer Partially addresses #127562
2024-10-19Rollup merge of #116863 - workingjubilee:non-exhaustive-is-not-ffi-unsafe, ↵Matthias Krüger-6/+25
r=jieyouxu warn less about non-exhaustive in ffi Bindgen allows generating `#[non_exhaustive] #[repr(u32)]` enums. This results in nonintuitive nonlocal `improper_ctypes` warnings, even when the types are otherwise perfectly valid in C. Adjust for actual tooling expectations by avoiding warning on simple enums with only unit variants. Closes https://github.com/rust-lang/rust/issues/116831
2024-10-19Fix transmute goalMichael Goulet-0/+53
2024-10-19Make sure that outer opaques capture inner opaques's lifetimes even with ↵Michael Goulet-0/+37
precise capturing syntax
2024-10-19Auto merge of #131934 - matthiaskrgr:rollup-pd3dwxu, r=matthiaskrgrbors-0/+17
Rollup of 8 pull requests Successful merges: - #127462 (std: uefi: Add basic Env variables) - #131537 (Fix range misleading field access) - #131838 (bootstrap: allow setting `--jobs` in config.toml) - #131890 (Update `use` keyword docs to describe precise capturing) - #131899 (Mark unexpected variant res suggestion as having placeholders) - #131908 (rustdoc: Switch from FxHash to sha256 for static file hashing.) - #131916 (small interpreter error cleanup) - #131919 (zero-sized accesses are fine on null pointers) r? `@ghost` `@rustbot` modify labels: rollup
2024-10-19Rollup merge of #131537 - hirschenberger:master, r=compiler-errorsMatthias Krüger-0/+17
Fix range misleading field access Fixes #131471 by checking if the range-start is a literal.
2024-10-19Auto merge of #131211 - bjorn3:rust_abi_follow_c_rules, r=nikic,jieyouxubors-74/+173
Return values larger than 2 registers using a return area pointer LLVM and Cranelift disagree about how to return values that don't fit in the registers designated for return values. LLVM will force the entire return value to be passed by return area pointer, while Cranelift will look at each IR level return value independently and decide to pass it in a register or not, which would result in the return value being passed partially in registers and partially through a return area pointer. While Cranelift may need to be fixed as the LLVM behavior is generally more correct with respect to the surface language, forcing this behavior in rustc itself makes it easier for other backends to conform to the Rust ABI and for the C ABI rustc already handles this behavior anyway. In addition LLVM's decision to pass the return value in registers or using a return area pointer depends on how exactly the return type is lowered to an LLVM IR type. For example `Option<u128>` can be lowered as `{ i128, i128 }` in which case the x86_64 backend would use a return area pointer, or it could be passed as `{ i32, i128 }` in which case the x86_64 backend would pass it in registers by taking advantage of an LLVM ABI extension that allows using 3 registers for the x86_64 sysv call conv rather than the officially specified 2 registers. This adjustment is only necessary for the Rust ABI as for other ABI's the calling convention implementations in rustc_target already ensure any return value which doesn't fit in the available amount of return registers is passed in the right way for the current target. Helps with https://github.com/rust-lang/rustc_codegen_cranelift/issues/1525 cc https://github.com/bytecodealliance/wasmtime/issues/9250
2024-10-19Emit error on `skip-filecheck` test containing filecheck directivesclubby789-3/+1
2024-10-19Fix test expectations for 32bit x86bjorn3-16/+12
2024-10-19Warn on redundant `--cfg` directive when revisions are usedclubby789-11/+9
2024-10-19Add codegen test for branchy bool matchclubby789-0/+27
2024-10-18Expand test coverage for deny-inside-forbid interactions许杰友 Jieyou Xu (Joe)-12/+188
2024-10-18Allow `#[deny(..)]` inside `#[forbid(..)]` as a no-op with a warningNoratrieb-29/+79
Forbid cannot be overriden. When someome tries to do this anyways, it results in a hard error. That makes sense. Except it doesn't, because macros. Macros may reasonably use `#[deny]` in their expansion to assert that their expanded code follows the lint. This is doesn't work when the output gets expanded into a `forbid()` context. This is pretty silly, since both the macros and the code agree on the lint! Therefore, we allow `#[deny(..)]`ing a lint that's already forbidden, keeping the level at forbid.
2024-10-18Fix #131471, range misleading field accessFalco Hirschenberger-0/+17
Fixes #131471 by checking if the range-start is a literal.
2024-10-18Rollup merge of #131864 - lrh2000:upcast_reorder, r=WaffleLapkin许杰友 Jieyou Xu (Joe)-8/+31
Never emit `vptr` for empty/auto traits Emiting `vptr`s for empty/auto traits is unnecessary (#114942) and causes unsoundness in `trait_upcasting` (#131813). This PR should ensure that we never emit vtables for such traits. See the linked issues for more details. I'm not sure if I can add tests for the vtable layout. So this PR only adds tests for the soundness hole (i.e., the segmentation fault will disappear after this PR). Fixes #114942 Fixes #131813 Cc #65991 (tracking issue for `trait_upcasting`) r? `@WaffleLapkin` (per https://github.com/rust-lang/rust/issues/131813#issuecomment-2419969745)
2024-10-18Rollup merge of #131802 - compiler-errors:fnonce-coverage, r=Zalathar许杰友 Jieyou Xu (Joe)-19/+95
Dont ICE when computing coverage of synthetic async closure body I'm not totally certain if this is *right*, but at least it doesn't ICE. The issue is that we end up generating two MIR bodies for each async closure, since the `FnOnce` and `Fn`/`FnMut` implementations have different borrowing behavior of their captured variables. They should ideally both contribute to the coverage, since those MIR bodies are (*to the user*) the same code and should have no behavioral differences. This PR at least suppresses the ICEs, and then I guess worst case we can fix this the right way later. r? Zalathar or re-roll Fixes #131190
2024-10-18Rollup merge of #131755 - jfrimmel:avr-rjmp-offset-regression-test, r=jieyouxu许杰友 Jieyou Xu (Joe)-0/+107
Regression test for AVR `rjmp` offset This adds a regression test for #129301 by minimizing the code in the linked issue and putting it into a `#![no_core]`-compatible format, so that it can easily be used within an `rmake`-test. This needs to be a `rmake` test (opposed to a `tests/assembly` one), since the linked issue describes, that the problem only occurs if the code is directly compiled. Note, that `lld` is used instead of `avr-gcc`; see the [comments](https://github.com/rust-lang/rust/pull/131755#issuecomment-2416469675) [below](https://github.com/rust-lang/rust/pull/131755#issuecomment-2417160045). Closes #129301. To show, that the test actually catches the wrong behavior, this can be tested with a faulty rustc: ```bash $ rustup install nightly-2024-08-19 $ rustc +nightly-2024-08-19 -C opt-level=s -C panic=abort --target avr-unknown-gnu-atmega328 -Clinker=build/x86_64-unknown-linux-gnu/ci-llvm/bin/lld -Clink-arg='--entry=main' -o compiled tests/run-make/avr-rjmp-offset/avr-rjmp-offsets.rs $ llvm-objdump -d compiled | grep '<main>' -A 6 000110b4 <main>: 110b4: 81 e0 ldi r24, 0x1 110b6: 92 e0 ldi r25, 0x2 110b8: 85 b9 out 0x5, r24 110ba: 95 b9 out 0x5, r25 110bc: fe cf rjmp .-4 ``` One can see, that the wrong label offset (`4` instead of `6`) is produced, which would trigger an assertion in the test case. This would be a good candidate for using the `minicore` proposed in #130693. Since this is not yet merged, there is a FIXME. r? Patryk27 I think, you are the yet-to-be official target maintainer, hence I'll assign to you. `@rustbot` label +O-AVR
2024-10-18Dont ICE when computing coverage of synthetic async closure bodyMichael Goulet-19/+95
2024-10-18Rollup merge of #131857 - WaffleLapkin:dyn-drop-principal-3, r=compiler-errorsMatthias Krüger-30/+99
Allow dropping dyn principal Revival of #126660, which was a revival of #114679. Fixes #126313. Allows dropping principal when coercing trait objects, e.g. `dyn Debug + Send` -> `dyn Send`. cc `@compiler-errors` `@Jules-Bertholet` r? `@lcnr`
2024-10-18Never emit `vptr` for empty/auto traitsRuihan Li-8/+31
2024-10-18Add more testsJules Bertholet-1/+30
2024-10-17Auto merge of #131572 - cuviper:ub-index_range, r=thomccbors-0/+5
Avoid superfluous UB checks in `IndexRange` `IndexRange::len` is justified as an overall invariant, and `take_prefix` and `take_suffix` are justified by local branch conditions. A few more UB-checked calls remain in cases that are only supported locally by `debug_assert!`, which won't do anything in distributed builds, so those UB checks may still be useful. We generally expect core's `#![rustc_preserve_ub_checks]` to optimize away in user's release builds, but the mere presence of that extra code can sometimes inhibit optimization, as seen in #131563.
2024-10-17Rollup merge of #131833 - c-ryan747:patch-1, r=NoratriebMatthias Krüger-4/+4
Add `must_use` to `CommandExt::exec` [CommandExt::exec](https://fburl.com/0qhpo7nu) returns a `std::io::Error` in the case exec fails, but its not currently marked as `must_use` making it easy to accidentally ignore it. This PR adds the `must_use` attributed here as i think it fits the definition in the guide of [When to add #[must_use]](https://std-dev-guide.rust-lang.org/policy/must-use.html#when-to-add-must_use)
2024-10-17Allow dropping dyn principalMichael Goulet-30/+70
2024-10-17Fix must_use lint for command exec testsCallum Ryan-4/+4
2024-10-17Rollup merge of #131798 - maurer:range-inlining, r=durin42Matthias Krüger-1/+1
llvm: Tolerate propagated range metadata llvm/llvm-project#91101 propagates range information across inlining, resulting in more metadata in this test. Tolerate the range metadata if it appears. ``@rustbot:`` label +llvm-main r? ``@durin42`` Please wait a moment before approving, putting the llvm-main tag on it to make sure it fixes the integration test.
2024-10-17Rollup merge of #131748 - lcnr:typing-mode, r=compiler-errorsMatthias Krüger-44/+44
cleanup canonical queries best reviewed commit by commit. adding `CanonicalQueryInput` to stop returning `defining_opaque_types` in query responses is the most involved change here. r? ``@compiler-errors``
2024-10-17Rollup merge of #131595 - fmease:rustdoc-json-mv-obj-safe-dyn-compat, ↵Matthias Krüger-19/+19
r=aDotInTheVoid rustdoc-JSON: Rename "object safe" to "dyn compatible" ~~Blocked: Sits atop #131594. Only the last commit is relevant.~~ (rebased) Part of #130852. r? aDotInTheVoid or rustdoc
2024-10-17Rollup merge of #128391 - cafce25:issue-128390, r=lcnrMatthias Krüger-193/+250
Change orphan hint from "only" to "any uncovered type inside..." Fix #128390