about summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2019-12-23Constants reading or referencing statics is illegalOliver Scherer-4/+4
and some uses of it will be illegal forever (e.g. mutable or interior mutable statics)
2019-12-23Dynamically prevent constants from accessing staticsOliver Scherer-3/+144
2019-12-23Panic on mutable allocs in constantsOliver Scherer-0/+44
2019-12-23Fix ICE in mir interpretationOliver Scherer-0/+9
2019-12-22Auto merge of #67505 - Centril:rollup-7win7ty, r=Centrilbors-16/+16
Rollup of 6 pull requests Successful merges: - #67148 ( Refactor type & bounds parsing thoroughly) - #67410 (Reenable static linking of libstdc++ on windows-gnu) - #67439 (Cleanup `lower_pattern_unadjusted` & Improve slice pat typeck) - #67480 (Require issue = "none" over issue = "0" in unstable attributes) - #67500 (Tweak non_shorthand_field_patterns' suggestion) - #67504 (Warn against relying on ?Sized being last) Failed merges: r? @ghost
2019-12-21fix rebase falloutMazdak Farrokhzad-8/+9
2019-12-21rework run-fail and support check,build-failMazdak Farrokhzad-77/+117
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-16/+16
2019-12-20Require const stability attributes on intrinsics to be able to use them in ↵Oliver Scherer-0/+5
constant contexts
2019-12-20Rollup merge of #67163 - TheSamsa:split-up-ptr-mod, r=Mark-SimulacrumMazdak Farrokhzad-10/+10
Split up ptr/mod.rs in libcore... ...one with implementation detail for const ptr and the other with mut ptr I am not sure if the "stable since 1.0.0" flags are the correct choice for the two additional mods. Also, is it necessary for them to be "pub"? If so, there should be a good description for them. Closes #66891
2019-12-20Rollup merge of #64588 - matthewjasper:mir-address-of, r=oli-obkMazdak Farrokhzad-23/+255
Add a raw "address of" operator * Parse and feature gate `&raw [const | mut] expr` (feature gate name is `raw_address_of`) * Add `mir::Rvalue::AddressOf` * Use the new `Rvalue` for: * the new syntax * reference to pointer casts * drop shims for slices and arrays * Stop using `mir::Rvalue::Cast` with a reference as the operand * Correctly evaluate `mir::Rvalue::{Ref, AddressOf}` in constant propagation cc @Centril @RalfJung @oli-obk @eddyb cc #64490
2019-12-20Rollup merge of #67285 - ohadravid:indicate-origin-of-where-type-parameter, ↵Mazdak Farrokhzad-2/+2
r=estebank Indicate origin of where type parameter for uninferred types Based on #65951 (which is not merge yet), fixes #67277. This PR improves a little the diagnostic for code like: ``` async fn foo() { bar().await; } async fn bar<T>() -> () {} ``` by showing: ``` error[E0698]: type inside `async fn` body must be known in this context --> unresolved_type_param.rs:9:5 | 9 | bar().await; | ^^^ cannot infer type for type parameter `T` declared on the function `bar` | ... ``` (The ``` declared on the function `bar` ``` part is new) A small side note: `Vec` and `slice` seem to resist this change, because querying `item_name()` panics, and `get_opt_name()` returns `None`. r? @estebank
2019-12-19Split up ptr/mod.rs in libcore, one with implementation detail for const ptr ↵Christoph Schmidler-10/+10
and the other with mut ptr
2019-12-18Add more tests for raw_ref_opMatthew Jasper-0/+202
2019-12-18Update test now that reference to pointer casts have more checksMatthew Jasper-23/+46
2019-12-18Check const-propagation of borrows of unsized placesMatthew Jasper-0/+7
2019-12-15Auto merge of #67216 - ecstatic-morse:const-loop, r=oli-obkbors-102/+454
Enable `loop` and `while` in constants behind a feature flag This PR is an initial implementation of #52000. It adds a `const_loop` feature gate, which allows `while` and `loop` expressions through both HIR and MIR const-checkers if enabled. `for` expressions remain forbidden by the HIR const-checker, since they desugar to a call to `IntoIterator::into_iter`, which will be rejected anyways. `while` loops also require [`#![feature(const_if_match)]`](https://github.com/rust-lang/rust/pull/66507), since they have a conditional built into them. The diagnostics from the HIR const checker will suggest this to the user. r? @oli-obk cc @rust-lang/wg-const-eval
2019-12-14Auto merge of #67224 - nikomatsakis:revert-stabilization-of-never-type, ↵bors-9/+12
r=centril Revert stabilization of never type Fixes https://github.com/rust-lang/rust/issues/66757 I decided to keep the separate `never-type-fallback` feature gate, but tried to otherwise revert https://github.com/rust-lang/rust/pull/65355. Seemed pretty clean. ( cc @Centril, author of #65355, you may want to check this over briefly )
2019-12-14add `#![feature(never_type)]` to tests as neededNiko Matsakis-8/+11
2019-12-14Revert "Remove `#![feature(never_type)]` from tests."Niko Matsakis-1/+1
This reverts commit 8f6197f39f7d468dfc5b2bd41dae4769992a2f83.
2019-12-14Auto merge of #67136 - oli-obk:const_stability, r=Centrilbors-23/+39
Require stable/unstable annotations for the constness of all stable fns with a const modifier r? @RalfJung @Centril Every `#[stable]` const fn now needs either a `#[rustc_const_unstable]` attribute or a `#[rustc_const_stable]` attribute. You can't silently stabilize the constness of a function anymore.
2019-12-14Indicate origin of where type parameter for uninferred typesOhad Ravid-2/+2
2019-12-13Auto merge of #65951 - estebank:type-inference-error, r=nikomatsakisbors-2/+2
Point at method call when type annotations are needed - Point at method call instead of whole expression when type annotations are needed. - Suggest use of turbofish on function and methods. Fix #49391, fix #46333, fix #48089. CC #58517, #63502, #63082. Fixes https://github.com/rust-lang/rust/issues/40015 r? @nikomatsakis
2019-12-13Ensure test actually uses dataflow, not simulationDylan MacKenzie-3/+7
2019-12-13Apply suggestions from reviewDylan MacKenzie-0/+2
2019-12-13Fix grammar in test descriptionecstatic-morse-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-12-13Bless modified testsDylan MacKenzie-80/+298
2019-12-13Bless unrelated tests with new help messageDylan MacKenzie-13/+37
2019-12-13Add qualif smoke tests for const loopsDylan MacKenzie-0/+61
2019-12-13Extend control flow basics tests with loopsDylan MacKenzie-9/+52
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-18/+34
functions with a `const` modifier
2019-12-13Reuse the `staged_api` feature for `rustc_const_unstable`Oliver Scherer-5/+5
2019-12-12Require `allow_internal_unstable` for stable min_const_fn using unstable ↵Oliver Scherer-27/+32
features
2019-12-11Add more context for type parametersEsteban Küber-2/+2
2019-12-11Rollup merge of #67164 - matthewjasper:never-remove-const, r=oli-obkMazdak Farrokhzad-0/+114
Ensure that panicking in constants eventually errors based on #67134 closes #66975 r? @oli-obk
2019-12-11Rollup merge of #67134 - oli-obk:const_prop_zst, r=wesleywiserYuki Okushi-0/+41
Ensure that we get a hard error on generic ZST constants if their bod… …y causes an error during evaluation cc #67083 (does not fix because we still need the beta backport) r? @wesleywiser cc @RalfJung
2019-12-09Ensure that unevaluated constants of type `!` are present in the MIRMatthew Jasper-0/+114
2019-12-09Show const_err lint in addition to the hard errorOliver Scherer-2/+16
2019-12-08Ensure that we get a hard error on generic ZST constants if their body ↵Oliver Scherer-0/+27
causes an error during evaluation
2019-12-07Auto merge of #65881 - anp:implicit-caller-location, r=eddyb,oli-obkbors-23/+0
Implement #[track_caller] attribute. (RFC 2091 4/N) Implements the `#[track_caller]` attribute in both const and codegen contexts. The const implementation walks up the stack to find the nearest untracked callsite. The codegen implementation adds an implicit argument to tracked function calls, and populates it with either a call to the previously-landed intrinsic or if the caller has `#[track_caller]` with a copy of the location passed to the current function. Also includes a little cleanup and a few comments in the other caller location areas. [Depends on: 65664](https://github.com/rust-lang/rust/pull/65664) [RFC 2091 text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md) [Tracking issue](https://github.com/rust-lang/rust/issues/47809) [Tracking doc](https://paper.dropbox.com/doc/track_rfc_2091_impl-notes--Anf1NwnIb0xcRv31YLIadyj0Ag-rwCdRc2fi2yvRZ7syGZ9q#:uid=863513134494965680023183&h2=TODO-actually-pass-location-to)
2019-12-07Auto merge of #66927 - RalfJung:engines-dont-panic, r=oli-obkbors-69/+20
Miri core engine: use throw_ub instead of throw_panic See https://github.com/rust-lang/rust/issues/66902 for context: panicking is not really an "interpreter error", but just part of a normal Rust execution. This is a first step towards removing the `InterpError::Panic` variant: the core Miri engine does not use it any more. ConstProp and ConstEval still use it, though. This will be addressed in future PRs. From what I can tell, all the error messages this removes are actually duplicates. r? @oli-obk @wesleywiser
2019-12-06Rollup merge of #66606 - christianpoveda:mut-refs-in-const-fn, r=oli-obkMazdak Farrokhzad-68/+152
Add feature gate for mut refs in const fn r? @oli-obk
2019-12-05Rename test filename to match others.Adam Perry-41/+0
2019-12-05Implement #[track_caller] in const.Adam Perry-9/+27
2019-12-05add regression test for issue 67053Remy Rakic-0/+51
2019-12-04Auto merge of #66275 - oli-obk:organize-intrinsics-promotion-checks, r=RalfJungbors-4/+23
Organize intrinsics promotion checks cc @vertexclique supersedes #61835 r? @RalfJung
2019-12-03Rollup merge of #66960 - wesleywiser:fix_66787_take2, r=oli-obk,RalfJungMazdak Farrokhzad-0/+39
[const-prop] Fix ICE calculating enum discriminant Fixes #66787 Different approach than #66857 r? @oli-obk cc @RalfJung @eddyb
2019-12-03[const-prop] Fix ICE calculating enum discriminantWesley Wiser-0/+39
Fixes #66787
2019-12-03Move all intrinsic whitelists into the constness check fileOliver Scherer-4/+4
2019-12-03Check intrinsics for callability in const fnsMahmut Bulut-0/+19