about summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval
AgeCommit message (Collapse)AuthorLines
2022-06-28Rollup merge of #98560 - TaKO8Ki:add-regression-test-for-85907, ↵Matthias Krüger-0/+17
r=Mark-Simulacrum Add regression test for #85907 closes #85907
2022-06-27add regression test for #85907Takayuki Maeda-0/+17
2022-06-25bless after rebaseRalf Jung-22/+598
2022-06-25make const_err show up in future breakage reportsRalf Jung-0/+1246
2022-06-19Mention formatting macros when encountering ArgumentV1::new in constMichael Goulet-0/+99
2022-06-19Bless 32bit ui tests.Camille GILLOT-12/+12
2022-06-19Make some lints incremental.Camille GILLOT-12/+12
2022-06-14rebaseb-naber-32/+104
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-8/+19
2022-06-05interpret: better control over whether we read data with provenance, and ↵Ralf Jung-355/+388
implicit provenance stripping where possible
2022-05-19bless 32bitRalf Jung-10/+10
2022-05-19interpret/validity: separately control checking numbers for being init and ↵Ralf Jung-23/+23
non-ptr
2022-05-17bless 32bitRalf Jung-1/+1
2022-05-17interpret/validity: reject references to uninhabited typesRalf Jung-1/+1
2022-04-30Also report the call site of PME errors locally.Oli Scherer-0/+12
Note this does not produce a full stack all the way to the first call that specifies all monomorphic parameters, it's just shallowly mentioning the last call site.
2022-04-21Update `validate_uninhabited_zsts.rs` test after MIR building changesTomasz Miąsko-34/+55
to ensure that it still tests validation, instead of failing earlier on during evaluation.
2022-04-20Rollup merge of #93313 - tmiasko:uninhabited, r=tmandryDylan DPC-47/+21
Check if call return type is visibly uninhabited when building MIR The main motivation behind the change is to expose information about diverging calls to the generator transform and match the precision of drop range tracking which already understands that call expressions with visibly uninhabited types diverges. This change should also accept strictly more programs than before. That is programs that were previously rejected due to errors raised by control-flow sensitive checks in a code that is no longer considered reachable. Fixes #93161.
2022-04-11Add const eval tests ensuring padding gets correctly marked as deinit on ↵Jakob Degen-0/+37
deaggregation
2022-04-11Bless tests that broke in a trivial way due to change in deaggregationJakob Degen-8/+8
2022-04-04Refer to the TraitRef::identity in the message to be clearerEsteban Kuber-2/+2
2022-04-04Dedup logic and improve output for other types that impl traitEsteban Kuber-10/+10
2022-04-04Fix list lengthEsteban Kuber-0/+8
2022-04-04Mention implementers of unsatisfied traitEsteban Kuber-0/+12
When encountering an unsatisfied trait bound, if there are no other suggestions, mention all the types that *do* implement that trait: ``` error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/impl_wf.rs:22:6 | LL | impl Baz<f32> for f32 { } | ^^^^^^^^ the trait `Foo` is not implemented for `f32` | = help: the following other types implement trait `Foo`: Option<T> i32 str note: required by a bound in `Baz` --> $DIR/impl_wf.rs:18:31 | LL | trait Baz<U: ?Sized> where U: Foo { } | ^^^ required by this bound in `Baz` ``` Mention implementers of traits in `ImplObligation`s. Do not mention other `impl`s for closures, ranges and `?`.
2022-04-02diagnostics: add test case for bogus T:Sized suggestionMichael Howell-0/+24
Closes #69228
2022-04-02Rollup merge of #95354 - dtolnay:rustc_const_stable, r=lcnrDylan DPC-1/+1
Handle rustc_const_stable attribute in library feature collector The library feature collector in [compiler/rustc_passes/src/lib_features.rs](https://github.com/rust-lang/rust/blob/551b4fa395fa588d91cbecfb0cdfe1baa02670cf/compiler/rustc_passes/src/lib_features.rs) has only been looking at `#[stable(…)]`, `#[unstable(…)]`, and `#[rustc_const_unstable(…)]` attributes, while ignoring `#[rustc_const_stable(…)]`. The consequences of this were: - When any const feature got stabilized (changing one or more `rustc_const_unstable` to `rustc_const_stable`), users who had previously enabled that unstable feature using `#![feature(…)]` would get told "unknown feature", rather than rustc's nicer "the feature … has been stable since … and no longer requires an attribute to enable". This can be seen in the way that https://github.com/rust-lang/rust/pull/93957#issuecomment-1079794660 failed after rebase: ```console error[E0635]: unknown feature `const_ptr_offset` --> $DIR/offset_from_ub.rs:1:35 | LL | #![feature(const_ptr_offset_from, const_ptr_offset)] | ^^^^^^^^^^^^^^^^ ``` - We weren't enforcing that a particular feature is either stable everywhere or unstable everywhere, and that a feature that has been stabilized has the same stabilization version everywhere, both of which we enforce for the other stability attributes. This PR updates the library feature collector to handle `rustc_const_stable`, and fixes places in the standard library and test suite where `rustc_const_stable` was being used in a way that does not meet the rules for a stability attribute.
2022-03-31Adjust feature names that disagree on const stabilization versionDavid Tolnay-1/+1
2022-03-31catch overflow in slice size computationRalf Jung-42/+67
2022-03-24Check if call return type is visibly uninhabited when building MIRTomasz Miąsko-47/+21
2022-03-24Auto merge of #94934 - Lireer:const-prop-lint, r=oli-obkbors-16/+162
Separate const prop lints from optimizations r? `@oli-obk` Separates lints and optimizations during const prop by moving the lints into their own file and checking them during post borrowck cleanup. Thanks to `@oli-obk` for mentoring me.
2022-03-23separate const prop lint from optimizationsCarl Scherer-16/+162
2022-03-22bless 32bitRalf Jung-1/+1
2022-03-22interpret/memory: simplify check_and_deref_ptrRalf Jung-3/+3
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-18/+8
2022-03-09bless testsb-naber-7/+18
2022-03-07Update tests after feature stabilizationEric Holk-27/+2
2022-03-03Cleanup feature gates.Camille GILLOT-3/+1
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-12Update chalk testsMatthew Jasper-0/+18
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-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-01-31Fix invalid special casing of the unreachable! macroLoïc BRANSTETT-5/+5
2022-01-29Document about some behaviors of `const_(de)allocate` and add some tests.woppopo-0/+33
2022-01-26`const_deallocate`: Don't deallocate memory allocated in an another const. ↵woppopo-4/+27
Does nothing at runtime. `const_allocate`: Returns a null pointer at runtime.
2022-01-25#91939: integer to char cast error, make more targetedGeorge Bateman-0/+6
2022-01-23Add `intrinsics::const_deallocate`woppopo-0/+127
2021-12-21Use panic() instead of panic!() in some places in core.Mara Bos-10/+10
2021-12-15miri: lift restriction on extern types being the only field in a structTomasz Miąsko-0/+58