about summary refs log tree commit diff
path: root/tests/ui/consts
AgeCommit message (Collapse)AuthorLines
2023-10-16add oversized-ref test backRalf Jung-1/+15
2023-10-15more precise error for 'based on misaligned pointer' caseRalf Jung-7/+7
2023-10-15place evaluation: require the original pointer to be aligned if an access ↵Ralf Jung-2/+20
happens
2023-10-15avoid re-checking the offset while iterating an array/sliceRalf Jung-0/+3
2023-10-15don't UB on dangling ptr deref, instead check inbounds on projectionsRalf Jung-118/+150
2023-10-14Rollup merge of #116576 - eduardosm:const-eval-wasm-target-features, r=RalfJungGuillaume Gomez-0/+14
const-eval: allow calling functions with targat features disabled at compile time in WASM This is not unsafe on WASM, see https://github.com/rust-lang/rust/pull/84988 r? `@RalfJung` Fixes https://github.com/rust-lang/rust/issues/116516
2023-10-14const-eval: allow calling functions with targat features disabled at compile ↵Eduardo Sánchez Muñoz-0/+14
time in WASM This is not unsafe on WASM, see https://github.com/rust-lang/rust/pull/84988
2023-10-14Auto merge of #116015 - EvanMerlock:master, r=oli-obkbors-0/+53
const_eval: allow function pointer signatures containing &mut T in const contexts potentially fixes #114994 We utilize a `TypeVisitor` here in order to more easily handle control flow. - In the event the typekind the Visitor sees is a function pointer, we skip over it - However, otherwise we do one of two things: - If we find a mutable reference, check it, then continue visiting types - If we find any other type, continue visiting types This means we will check if the function pointer _itself_ is mutable, but not if any of the types _within_ are.
2023-10-14Auto merge of #115524 - RalfJung:misalign, r=wesleywiserbors-0/+72
const-eval: make misalignment a hard error It's been a future-incompat error (showing up in cargo's reports) since https://github.com/rust-lang/rust/pull/104616, Rust 1.68, released in March. That should be long enough. The question for the lang team is simply -- should we move ahead with this, making const-eval alignment failures a hard error? (It turns out some of them accidentally already were hard errors since #104616. But not all so this is still a breaking change. Crater found no regression.)
2023-10-11Avoid emitting the non_exhaustive error if other errors already occurredOli Scherer-21/+2
2023-10-11Prevent spurious `unreachable pattern` lintsOli Scherer-19/+22
Means you'll get more `non-exhaustive` patterns
2023-10-10Rollup merge of #116444 - RalfJung:broken-unused-const, r=oli-obkGuillaume Gomez-0/+31
add test for const-eval error in dead code during monomorphization
2023-10-09Rollup merge of #115882 - aliemjay:diag-name-region-1, r=compiler-errorsMatthias Krüger-4/+10
improve the suggestion of `generic_bound_failure` - Fixes #115375 - suggest the bound in the correct scope: trait or impl header vs assoc item. See `tests/ui/suggestions/lifetimes/type-param-bound-scope.rs` - don't suggest a lifetime name that conflicts with the other late-bound regions of the function: ```rust type Inv<'a> = *mut &'a (); fn check_bound<'a, T: 'a>(_: T, _: Inv<'a>) {} fn test<'a, T>(_: &'a str, t: T, lt: Inv<'_>) { // suggests a new name `'a` check_bound(t, lt); //~ ERROR } ```
2023-10-08add test for const-eval error in dead code during monomorphizationRalf Jung-0/+31
2023-10-08Do not run optimizations on trivial MIR.Camille GILLOT-1/+1
2023-10-08remove trailing dotsAli MJ Al-Nasrawy-2/+2
2023-10-08always show and explain sub regionAli MJ Al-Nasrawy-2/+8
2023-10-06Rollup merge of #116329 - RalfJung:swap-comments, r=scottmcmGuillaume Gomez-1/+2
update some comments around swap() Based on ``@eddyb's`` comment [here](https://github.com/rust-lang/unsafe-code-guidelines/issues/461#issuecomment-1742156410). And then I noticed the wrong capitalization for Miri and fixed it in some other places as well.
2023-10-05Rollup merge of #116428 - Alexendoo:note-duplicate-diagnostics, ↵Matthias Krüger-29/+48
r=compiler-errors,estebank Add a note to duplicate diagnostics Helps explain why there may be a difference between manual testing and the test suite output and highlights them as something to potentially look into For existing duplicate diagnostics I just blessed them other than a few files that had other `NOTE` annotations in
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-29/+48
2023-10-04Fix misuses of a vs ancui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-10-02MIRI -> MiriRalf Jung-1/+2
2023-09-28Const stabilize mem::discriminantDavid Tolnay-2/+1
2023-09-26add misalignment const-eval testRalf Jung-0/+72
and some other raw pointer shenanigans while we are at it
2023-09-25rename lint; add tracking issueRalf Jung-4/+4
2023-09-24work towards rejecting consts in patterns that do not implement PartialEqRalf Jung-1/+25
2023-09-22test(const_eval): add test cases for #114994Evan Merlock-0/+53
- add new testcase for TypeVisitor on const-eval mutable ref check
2023-09-22Auto merge of #114776 - fee1-dead-contrib:enable-effects-in-libcore, r=oli-obkbors-34/+70
Enable effects for libcore ~~r? `@oli-obk~~` forgot you are on vacation, oops
2023-09-20Auto merge of #115486 - compiler-errors:dont-capture-late-pls, r=cjgillotbors-0/+33
Correctly deny late-bound lifetimes from parent in anon consts and TAITs Reuse the `AnonConstBoundary` scope (introduced in #108553, renamed in this PR to `LateBoundary`) to deny late-bound vars of *all* kinds (ty/const/lifetime) in anon consts and TAITs. Side-note, but I would like to consolidate this with the error reporting for RPITs (E0657): https://github.com/rust-lang/rust/blob/c4f25777a08cd64b710e8a9a6159e67cbb35e6f5/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs#L733-L754 but the semantics about what we're allowed to capture there are slightly different, so I'm leaving that untouched. Fixes #115474
2023-09-20bless the known-bug testsDeadbeef-28/+7
2023-09-20Enable effects for libcoreDeadbeef-40/+97
2023-09-14don't point at const usage site for resolution-time errorsRalf Jung-55/+49
also share the code that emits the actual error
2023-09-14move required_consts check to general post-mono-check functionRalf Jung-2/+18
2023-09-14add regression test for something we fixedRalf Jung-0/+31
2023-09-07Auto merge of #115527 - oli-obk:drop_maybe_uninit_in_const, r=lcnrbors-0/+17
Don't require `Drop` for `[PhantomData<T>; N]` where `N` and `T` are generic, if `T` requires `Drop` fixes https://github.com/rust-lang/rust/issues/115403 fixes https://github.com/rust-lang/rust/issues/115410 This was accidentally regressed in https://github.com/rust-lang/rust/pull/114134, because it was accidentally stabilized in #102204 (cc `@rust-lang/lang,` seems like an innocent stabilization, considering this PR is more of a bugfix than a feature). While we have a whole month to beta backport this change before the regression hits stable, I'd still prefer not to go through an FCP on this PR (which fixes a regression), if T-lang wants an FCP, I can can open an issue about the change itself.
2023-09-07Don't require `Drop` for `[PhantomData<T>; N]` where `N` and `T` are ↵Oli Scherer-0/+17
generic, if `T` requires `Drop`
2023-09-05Correctly deny late-bound lifetimes from parent in anon consts and TAITsMichael Goulet-0/+33
2023-09-05Auto merge of #115531 - RalfJung:read_via_copy, r=scottmcmbors-4/+26
read_via_copy: don't prematurely optimize away the read Always do the read to ensure consistent UB error messages in const-eval/Miri. r? `@scottmcm`
2023-09-04read_via_copy: don't prematurely optimize away the readRalf Jung-4/+26
2023-09-04Auto merge of #115513 - Urgau:normalize-msg-after-translate, r=petrochenkovbors-0/+16
Don't forget to normalize the translated message This PR adds a missing call to `normalize_whitespace` after translating an label. Fixes https://github.com/rust-lang/rust/issues/115498
2023-09-03Don't forget to normalize the translated messageUrgau-0/+16
2023-08-25Handle Self in paths tooMichael Goulet-2/+2
2023-08-25Rollup merge of #115169 - RalfJung:do-not-ignore-debug, r=cjgillotMatthias Krüger-5/+4
remove some unnecessary ignore-debug clauses ignore-debug is only needed when the debug assertions *in the standard library* somehow affect the test. This can happen with inlining but otherwise should be rare. ignore-debug is problematic since PR CI is only run with debug assertions. r? `@cjgillot` since it looks like you added most of these
2023-08-24remove some unnecessary ignore-debug clausesRalf Jung-5/+4
2023-08-24Fix ub-int-array test for big-endian platformsUlrich Weigand-42/+10
As of commit 7767cbb3b0b332fd0a46e347ea7f68f20109d768, the tests/ui/consts/const-eval/ub-int-array.rs test is failing on big-endian platforms (in particular s390x), as the stderr output contains a hex dump that depends on endianness. Since this point intentionally verifies the hex dump to check the uninitialized byte markers, I think we should not simply standardize away the hex dump as is done with some of the other tests in this directory. However, most of the test is already endian-independent. The only exception is one line of hex dump, which can also be made endian-independent by choosing appropriate constants in the source code. Since the 32bit and 64bit stderr outputs were already (and remain) identical, I've merged them and removed the stderr-per-bitwidth marker. Fixes (again) https://github.com/rust-lang/rust/issues/105383.
2023-08-22Rollup merge of #115011 - compiler-errors:warn-on-elided-assoc-ct-lt, r=cjgillotMichael Goulet-0/+52
Warn on elided lifetimes in associated constants (`ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT`) Elided lifetimes in associated constants (in impls) erroneously resolve to fresh lifetime parameters on the impl since #97313. This is not correct behavior (see #38831). I originally opened #114716 to fix this, but given the time that has passed, the crater results seem pretty bad: https://github.com/rust-lang/rust/pull/114716#issuecomment-1682091952 This PR alternatively implements a lint against this behavior, and I'm hoping to bump this to deny in a few versions.
2023-08-20interpret: have assert_* intrinsics call the panic machinery instead of a ↵Ralf Jung-3/+3
direct abort
2023-08-20Warn on elided lifetimes in associated constantsMichael Goulet-0/+52
2023-08-08Auto merge of #114545 - fee1-dead-contrib:lower-impl-effect, r=oli-obkbors-14/+33
correctly lower `impl const` to bind to host effect param r? `@oli-obk`
2023-08-07Fix ICEDeadbeef-9/+2