about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2022-03-23separate const prop lint from optimizationsCarl Scherer-22/+196
2022-03-23Auto merge of #94901 - fee1-dead:destructable, r=oli-obkbors-15/+19
Rename `~const Drop` to `~const Destruct` r? `@oli-obk` Completely switching to `~const Destructible` would be rather complicated, so it seems best to add it for now and wait for it to be backported to beta in the next release. The rationale is to prevent complications such as #92149 and #94803 by introducing an entirely new trait. And `~const Destructible` reads a bit better than `~const Drop`. Name Bikesheddable.
2022-03-22bless 32bitRalf Jung-1/+1
2022-03-22interpret/memory: simplify check_and_deref_ptrRalf Jung-7/+7
2022-03-21move `adt_const_params` to its own tracking issuelcnr-1/+1
2022-03-21Rename `~const Drop` to `~const Destruct`Deadbeef-15/+19
2022-03-15Update stderrs referencing `IntoIterator`mbartlett21-2/+2
2022-03-15Update const-fn-error.stderrmbartlett21-2/+2
2022-03-11Rollup merge of #94827 - RalfJung:offset-from-ub, r=oli-obkDylan DPC-6/+50
CTFE/Miri: detect out-of-bounds pointers in offset_from Also I became uneasy with aggressively doing `try_to_int` here -- this will always succeed on Miri, leading to the wrong codepath being taken. We should rather try to convert them both to pointers, and use the integer path as a fallback, so that's what I implemented now. Hiding whitespaces helps with the diff. Fixes https://github.com/rust-lang/miri/issues/1950 r? ``@oli-obk``
2022-03-10adjust offset_from logic: check that both pointers are in-boundsRalf Jung-6/+50
2022-03-10Revert accidental stabilizationOli Scherer-0/+15
2022-03-10Auto merge of #94059 - b-naber:constantkind-val-transformation, r=lcnrbors-1/+1
Treat constant values as mir::ConstantKind::Val Another step that is necessary for the introduction of Valtrees: we don't want to treat `ty::Const` instances of kind `ty::ConstKind::Value` as `mir::ConstantKind::Ty` anymore. r? `@oli-obk`
2022-03-09Rollup merge of #94739 - estebank:suggest-let-else, r=oli-obkMatthias Krüger-18/+18
Suggest `if let`/`let_else` for refutable pat in `let` r? `````@oli-obk`````
2022-03-09keep ERROR in messageb-naber-3/+3
2022-03-09manually bless 32-bit stderrb-naber-1/+0
2022-03-09normalization change and rebaseb-naber-133/+65
2022-03-09bless testsb-naber-64/+133
2022-03-08Rollup merge of #94689 - compiler-errors:on-unimplemented-substs, r=petrochenkovDylan DPC-0/+54
Use impl substs in `#[rustc_on_unimplemented]` We were using the trait-ref substs instead of impl substs in `rustc_on_unimplemented`, even when computing the `rustc_on_unimplemented` attached to an impl block. Let's not do that. This PR also untangles impl and trait def-ids in the logic in `on_unimplemented` a bit. Fixes #94675
2022-03-08Do not suggest `let_else` if no bindings would be introducedEsteban Kuber-24/+0
2022-03-08Suggest `if let`/`let_else` for refutable pat in `let`Esteban Kuber-18/+42
2022-03-07Update testsEric Holk-3/+3
2022-03-07Stabilize const_impl_trait as wellEric Holk-31/+0
2022-03-07Update tests after feature stabilizationEric Holk-537/+43
2022-03-06use impl substs in on_unimplementedMichael Goulet-0/+54
2022-03-03Cleanup feature gates.Camille GILLOT-26/+17
2022-03-01Miri/CTFE: properly treat overflow in (signed) division/rem as UBRalf Jung-2/+2
2022-02-26Rollup merge of #93870 - tmiasko:const-precise-live-drops-with-coverage, ↵Matthias Krüger-0/+16
r=ecstatic-morse Fix switch on discriminant detection in a presence of coverage counters Fixes #93848. r? ``@ecstatic-morse``
2022-02-24Miri fn ptr check: don't use conservative null checkRalf Jung-2/+2
2022-02-23Miri: relax fn ptr checkRalf Jung-18/+92
2022-02-13update stderr messagesSaltyKitkat-35/+35
2022-02-13stabilize const_ptr_offsetSaltyKitkat-7/+2
2022-02-13Rollup merge of #93810 - matthewjasper:chalk-and-canonical-universes, r=jackh726Matthias Krüger-0/+18
Improve chalk integration - Support subtype bounds in chalk lowering - Handle universes in canonicalization - Handle type parameters in chalk responses - Use `chalk_ir::LifetimeData::Empty` for `ty::ReEmpty` - Remove `ignore-compare-mode-chalk` for tests that no longer hang (they may still fail or ICE) This is enough to get a hello world program to compile with `-Zchalk` now. Some of the remaining issues that are needed to get Chalk integration working on larger programs are: - rust-lang/chalk#234 - rust-lang/chalk#548 - rust-lang/chalk#734 - Generators are handled differently in chalk and rustc r? `@jackh726`
2022-02-12Update chalk testsMatthew Jasper-0/+18
2022-02-12ReblessDeadbeef-1/+0
2022-02-12Handle Fn family trait call errrorDeadbeef-7/+14
2022-02-12Rebased and improved errorsDeadbeef-9/+12
2022-02-12bless youDeadbeef-40/+92
2022-02-12Auto merge of #93691 - compiler-errors:mir-tainted-by-errors, r=oli-obkbors-56/+11
Implement `tainted_by_errors` in MIR borrowck, use it to skip CTFE Putting this up for initial review. The issue that I found is when we're evaluating a const, we're doing borrowck, but doing nothing with the fact that borrowck fails. This implements a `tainted_by_errors` field for MIR borrowck like we have in infcx, so we can use that information to return an `Err` during const eval if our const fails to borrowck. This PR needs some cleaning up. I should probably just use `Result` in more places, instead of `.expect`ing in the places I am, but I just wanted it to compile so I could see if it worked! Fixes #93646 r? `@oli-obk` feel free to reassign
2022-02-11Rollup merge of #91607 - FabianWolff:issue-91560-const-span, r=jackh726Matthias Krüger-0/+63
Make `span_extend_to_prev_str()` more robust Fixes #91560. The logic in `span_extend_to_prev_str()` is currently quite brittle and fails if there is extra whitespace or something else in between, and it also should return an `Option` but doesn't currently.
2022-02-11use body.tainted_by_error to skip loading MIRMichael Goulet-16/+3
2022-02-11fix tests, add new tests checking borrowck CFTE ICEMichael Goulet-40/+8
2022-02-10Fix switch on discriminant detection in a presence of coverage countersTomasz Miąsko-0/+16
2022-02-07Rollup merge of #93682 - ↵Mara Bos-17/+17
PatchMixolydic:where-in-the-world-is-const_fn_trait_bound, r=oli-obk Update tracking issue for `const_fn_trait_bound` It previously pointed to #57563, the conglomerate issue for `const fn` (presumably under the feature gate `const_fn`). This tracking issue doesn't mention anything about `const_fn_trait_bound`(the only occurrence of "trait bound" is for the now-removed `?const Trait` syntax), which can be confusing to people who want to find out more about trait bounds on `const fn`s. This pull request changes the tracking issue to one meant specifically for `const_fn_trait_bound`, #93706, which can help collect information on this feature's stabilization and point users towards `const_trait_impl` if they're looking for const-in-const-contexts trait bounds. Fixes #93679. `````@rustbot````` modify labels +A-const-fn +F-const_trait_impl
2022-02-07Rollup merge of #91530 - bobrippling:suggest-1-tuple-parens, r=camelidMara Bos-0/+4
Suggest 1-tuple parentheses on exprs without existing parens A follow-on from #86116, split out from #90677. This alters the suggestion to add a trailing comma to create a 1-tuple - previously we would only apply this if the relevant expression was parenthesised. We now make the suggestion regardless of parentheses, which reduces the fragility of the check (w.r.t formatting). e.g. ```rust let a: Option<(i32,)> = Some(3); ``` gets the below suggestion: ```rust let a: Option<(i32,)> = Some((3,)); // ^ ^^ ``` This change also improves the suggestion in other ways, such as by only making the suggestion if the types would match after the suggestion is applied and making the suggestion a multipart suggestion.
2022-02-07Auto merge of #93179 - Urgau:unreachable-2021, r=m-ou-se,oli-obkbors-5/+5
Fix invalid special casing of the unreachable! macro This pull-request fix an invalid special casing of the `unreachable!` macro in the same way the `panic!` macro was solved, by adding two new internal only macros `unreachable_2015` and `unreachable_2021` edition dependent and turn `unreachable!` into a built-in macro that do dispatching. This logic is stolen from the `panic!` macro. ~~This pull-request also adds an internal feature `format_args_capture_non_literal` that allows capturing arguments from formatted string that expanded from macros. The original RFC #2795 mentioned this as a future possibility. This feature is [required](https://github.com/rust-lang/rust/issues/92137#issuecomment-1018630522) because of concatenation that needs to be done inside the macro:~~ ```rust $crate::concat!("internal error: entered unreachable code: ", $fmt) ``` **In summary** the new behavior for the `unreachable!` macro with this pr is: Edition 2021: ```rust let x = 5; unreachable!("x is {x}"); ``` ``` internal error: entered unreachable code: x is 5 ``` Edition <= 2018: ```rust let x = 5; unreachable!("x is {x}"); ``` ``` internal error: entered unreachable code: x is {x} ``` Also note that the change in this PR are **insta-stable** and **breaking changes** but this a considered as being a [bug](https://github.com/rust-lang/rust/issues/92137#issuecomment-998441613). If someone could start a perf run and then a crater run this would be appreciated. Fixes https://github.com/rust-lang/rust/issues/92137
2022-02-06Fix tracking issue for `const_fn_trait_bound`Ruby Lazuli-17/+17
It previously pointed to #57563, the conglomerate issue for `const fn` (presumably under the feature gate `const_fn`). `const_fn_trait_bounds` weren't mentioned here, so this commit changes its tracking issue to a new one.
2022-02-06Rollup merge of #91939 - GKFX:feature-91866, r=cjgillotMatthias Krüger-0/+6
Clarify error on casting larger integers to char Closes #91836 with changes to E0604.md and a `span_help`.
2022-02-03Rollup merge of #92802 - compiler-errors:deduplicate-stack-trace, r=oli-obkYuki Okushi-0/+42
Deduplicate lines in long const-eval stack trace Lemme know if this is kinda overkill, lol. Fixes #92796
2022-01-31Make `span_extend_to_prev_str()` more robustFabian Wolff-0/+63
2022-01-31Fix invalid special casing of the unreachable! macroLoïc BRANSTETT-5/+5