summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
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-2/+2
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-2/+2
2022-03-31test const size_of_val_raw on big valueRalf Jung-1/+5
2022-03-31catch overflow in slice size computationRalf Jung-42/+67
2022-03-27Remove duplicated test filesCaio-36/+0
2022-02-13update stderr messagesSaltyKitkat-35/+35
2022-02-13stabilize const_ptr_offsetSaltyKitkat-7/+2
2022-03-24Auto merge of #94934 - Lireer:const-prop-lint, r=oli-obkbors-22/+195
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-23Rollup merge of #95221 - RalfJung:check_and_deref_ptr, r=oli-obkMatthias Krüger-8/+8
interpret/memory: simplify check_and_deref_ptr *Finally* I saw a way to make this code simpler. The odd preprocessing in `let ptr_or_addr =` has bothered me since forever, but it actually became unnecessary in the last provenance refactoring. :) This also leads to slightly more explicit error messages as a nice side-effect. :tada: r? `@oli-obk`
2022-03-23Remove line instead of just commenting outCarl Scherer-1/+0
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
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-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-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