summary refs log tree commit diff
path: root/src/test/ui/consts
AgeCommit message (Collapse)AuthorLines
2022-03-17Revert accidental stabilizationOli Scherer-0/+15
(cherry picked from commit 5f7ca55df6a89e3caa3131a13490cc01956149e7)
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-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
2022-01-29Rollup merge of #92274 - woppopo:const_deallocate, r=oli-obkMatthias Krüger-3/+186
Add `intrinsics::const_deallocate` Tracking issue: #79597 Related: #91884 This allows deallocation of a memory allocated by `intrinsics::const_allocate`. At the moment, this can be only used to reduce memory usage, but in the future this may be useful to detect memory leaks (If an allocated memory remains after evaluation, raise an error...?).
2022-01-29Document about some behaviors of `const_(de)allocate` and add some tests.woppopo-0/+33
2022-01-28Replace span suggestion with multipartRob Pilling-1/+1
2022-01-28Suggest 1-tuple parentheses, without existing parensRob Pilling-0/+4
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-26Improve selection errors for `~const` trait boundsDeadbeef-9/+17
2022-01-23Add `intrinsics::const_deallocate`woppopo-0/+127
2022-01-21Override rustc version in ui and mir-opt tests to get stable hashesThe 8472-2/+2
Building a dozen separate regexps for each test in compiletest consumes significant amounts of CPU cycles. Using `RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER` stabilizes hashes calcuated for the individual tests so no test-dependent normalization is needed. Hashes for the standard library still change so some normalizations are still needed.
2022-01-18Rollup merge of #92997 - woppopo:test92114, r=Mark-SimulacrumMatthias Krüger-3/+23
Add `~const` bound test for negative impls Resolves #92114 which has been fixed in #92892.
2022-01-17Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieubors-29/+4
Remove deprecated LLVM-style inline assembly The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it is time to remove `llvm_asm!` to avoid continued maintenance cost. Closes #70173. Closes #92794. Closes #87612. Closes #82065. cc `@rust-lang/wg-inline-asm` r? `@Amanieu`
2022-01-17Add `~const` bound test for negative implswoppopo-3/+23
2022-01-14Do not fail evaluation in const blocksMichael Goulet-0/+38
2022-01-12Remove ui tests for LLVM-style inline assemblyTomasz Miąsko-29/+4
2022-01-11Deduplicate lines in long const-eval stack traceMichael Goulet-0/+42
2021-12-31Extend check for UnsafeCell in consts to cover unionsTomasz Miąsko-0/+92
A validity companion to changes from #90373.
2021-12-24Auto merge of #91342 - RalfJung:fn-abi, r=eddyb,oli-obkbors-2/+2
CTFE eval_fn_call: use FnAbi to determine argument skipping and compatibility This makes use of the `FnAbi` type in CTFE/Miri, which `@eddyb` has been saying for years is what we should do.^^ `FnAbi` is used to - determine which arguments to skip (rather than the previous heuristic of skipping ZST arguments with the Rust ABI) - impose further restrictions on whether caller and callee are consistent in how a given argument is passed I was hoping it would also simplify the code, but that is not the case -- the previous type compatibility checks are still required (AFAIK), only the ZST skipping is gone and that took barely any code. We also need some hacks because `FnAbi` assumes a certain way of implementing `caller_location` (by passing extra arguments), but Miri can just read the caller location from the call stack so it doesn't need those arguments. (The fact that every backend has to separately implement support for these arguments seems suboptimal -- looks like this might have been better implemented on the MIR level.) To avoid having to implement those unnecessary arguments in Miri, we just compute *whether* the argument is present on the caller/callee side, but don't actually pass that argument around. I have no idea if this looks the way `@eddyb` thinks it should look... but it makes Miri's test suite pass. ;) One of rustc's tests fails unfortunately (`ui/const-generics/issues/issue-67739.rs`), some const generic code that is evaluated too early -- I think that should raise `TooGeneric` but instead it ICEs. My assumption is this is some FnAbi code that has not been properly tested on polymorphic code, but it might also be me calling that FnAbi code the wrong way. r? `@oli-obk` `@eddyb` Fixes https://github.com/rust-lang/rust/issues/56166 Miri PR at https://github.com/rust-lang/miri/pull/1928
2021-12-21Use panic() instead of panic!() in some places in core.Mara Bos-10/+10
2021-12-20compare calling convention instead of call ABIRalf Jung-2/+2
2021-12-19Rollup merge of #91791 - terrarier2111:fix-float-ice, r=nagisaMatthias Krüger-0/+29
Fix an ICE when lowering a float with missing exponent magnitude This fixes: https://github.com/rust-lang/rust/issues/91434
2021-12-19Fix an ICE when lowering a float with missing exponent magnitudethreadexception-0/+29
Co-authored-by: Simonas Kazlauskas <github@kazlauskas.me>
2021-12-18Rollup merge of #91910 - tmiasko:miri-extern-type, r=RalfJungMatthias Krüger-0/+58
miri: lift restriction on extern types being the only field in a struct Fixes #91827. r? ````@RalfJung````
2021-12-16Auto merge of #89836 - pierwill:fix-85142-crate-hash, r=wesleywiserbors-2/+2
Include rustc version in `rustc_span::StableCrateId` `rustc_span::def_id::StableCrateId` is a hash of various data about a crate during compilation. This PR includes the version of `rustc` in the input when computing this hash. From a cursory reading of [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html), this appears to be acceptable within that design. In order to pass the `mir-opt` and `ui` test suites, this adds new [normalization for hashes and symbol names in `compiletest`](https://github.com/rust-lang/rust/pull/89836/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b). These are enabled by default, but we might prefer it to be configurable. In the UI tests, I had to truncate a significant amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See https://github.com/rust-lang/rust/issues/90116.) Closes #85142.
2021-12-15miri: lift restriction on extern types being the only field in a structTomasz Miąsko-0/+58
2021-12-14Auto merge of #91728 - Amanieu:stable_asm, r=joshtriplettbors-6/+8
Stabilize asm! and global_asm! Tracking issue: #72016 It's been almost 2 years since the original [RFC](https://github.com/rust-lang/rfcs/pull/2850) was posted and we're finally ready to stabilize this feature! The main changes in this PR are: - Removing `asm!` and `global_asm!` from the prelude as per the decision in #87228. - Stabilizing the `asm` and `global_asm` features. - Removing the unstable book pages for `asm` and `global_asm`. The contents are moved to the [reference](https://github.com/rust-lang/reference/pull/1105) and [rust by example](https://github.com/rust-lang/rust-by-example/pull/1483). - All links to these pages have been removed to satisfy the link checker. In a later PR these will be replaced with links to the reference or rust by example. - Removing the automatic suggestion for using `llvm_asm!` instead of `asm!` if you're still using the old syntax, since it doesn't work anymore with `asm!` no longer being in the prelude. This only affects code that predates the old LLVM-style `asm!` being renamed to `llvm_asm!`. - Updating `stdarch` and `compiler-builtins`. - Updating all the tests. r? `@joshtriplett`
2021-12-13Include rustc version in `rustc_span::StableCrateId`pierwill-2/+2
Normalize symbol hashes in compiletest. Remove DefId sorting
2021-12-12Stabilize asm! and global_asm!Amanieu d'Antras-6/+8
They are also removed from the prelude as per the decision in https://github.com/rust-lang/rust/issues/87228. stdarch and compiler-builtins are updated to work with the new, stable asm! and global_asm! macros.
2021-12-12Revert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk"Deadbeef-9/+23
This reverts commit a8387aef8c378a771686878062e544af4d5e2245, reversing changes made to 6e1211081239be62a5d0bb3bbcb29a9f14621c81.
2021-12-11Tweak assoc type obligation spansEsteban Kuber-3/+6
* Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors
2021-12-08Rollup merge of #91551 - b-naber:const-eval-normalization-ice, r=oli-obkMatthias Krüger-1/+1
Allow for failure of subst_normalize_erasing_regions in const_eval Fixes https://github.com/rust-lang/rust/issues/72845 Using associated types that cannot be normalized previously resulted in an ICE. We now allow for normalization failure and return a "TooGeneric" error in that case. r? ```@RalfJung``` maybe?
2021-12-08Rollup merge of #91272 - FabianWolff:issue-90870-const-fn-eq, r=wesleywiserMatthias Krüger-0/+104
Print a suggestion when comparing references to primitive types in `const fn` Fixes #90870.