about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-09-21Auto merge of #74040 - lcnr:const-occurs-check, r=nikomatsakisbors-0/+205
fix unification of const variables r? `@nikomatsakis` `@varkor` `@eddyb` let's just ping everyone here :sweat_smile:
2020-09-21add testsBastian Kauschke-0/+205
2020-09-21Auto merge of #77004 - RalfJung:rollup-usac4nv, r=RalfJungbors-14/+16
Rollup of 13 pull requests Successful merges: - #76135 (Stabilize some Option methods as const) - #76628 (Add sample defaults for config.toml ) - #76846 (Avoiding unnecesary allocations at rustc_errors) - #76867 (Use intra-doc links in core/src/iter when possible) - #76868 (Finish moving to intra doc links for std::sync) - #76872 (Remove DeclareMethods) - #76936 (Add non-`unsafe` `.get_mut()` for `Unsafecell`) - #76958 (Replace manual as_nanos and as_secs_f64 reimplementations) - #76959 (Replace write_fmt with write!) - #76961 (Add test for issue #34634) - #76962 (Use const_cstr macro in consts.rs) - #76963 (Remove unused static_assert macro) - #77000 (update Miri) Failed merges: r? `@ghost`
2020-09-21Rollup merge of #76961 - bugadani:test-34634, r=Mark-SimulacrumRalf Jung-0/+16
Add test for issue #34634 Closes #34634
2020-09-21Rollup merge of #76135 - CDirkx:const-option, r=dtolnay,oli-obkRalf Jung-14/+0
Stabilize some Option methods as const Stabilize the following methods of `Option` as const: - `is_some` - `is_none` - `as_ref` These methods are currently const under the unstable feature `const_option` (tracking issue: #67441). I believe these methods to be eligible for stabilization because of the stabilization of #49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](https://github.com/rust-lang/rust/pull/75463). Related: #76225
2020-09-21Auto merge of #76843 - kornelski:longtypetofile, r=ecstatic-morsebors-14/+31
Let user see the full type of type-length limit error Seeing the full type of the error is sometimes essential to diagnosing the problem, but the type itself is too long to be displayed in the terminal in a useful fashion. This change solves this dilemma by writing the full offending type name to a file, and displays this filename as a note. > note: the full type name been written to '$TEST_BUILD_DIR/issues/issue-22638/issue-22638.long-type.txt' Closes #76777
2020-09-21Auto merge of #76295 - mati865:remove-mmx, r=Amanieu,oli-obkbors-33/+4
Remove MMX from Rust Follow-up to https://github.com/rust-lang/stdarch/pull/890 This removes most of MMX from Rust (tests pass with small changes), keeping stable `is_x86_feature_detected!("mmx")` working.
2020-09-21Let user see the full type of type-length limit errorKornel Lesiński-14/+31
2020-09-20Auto merge of #76544 - Mark-Simulacrum:less-python, r=alexcrichtonbors-3/+3
De-couple Python and bootstrap slightly This revises rustbuild's entry points from Python to rely less on magic environment variables, preferring to use Cargo-provided environment variables where feasible. Notably, BUILD_DIR and BOOTSTRAP_CONFIG are *not* moved, because both more-or-less have some non-trivial discovery logic and replicating it in rustbuild seems unfortunate; if it moved to Cargo that would be a different story. Best reviewed by-commit.
2020-09-20Move const tests for `Option` to `library\core`Christiaan Dirkx-12/+0
Part of #76268
2020-09-20Stabilize some Option methods as constCDirkx-2/+0
Stabilize the following methods of `Option` as const: - `is_some` - `is_none` - `as_ref` Possible because of stabilization of #49146 (Allow if and match in constants).
2020-09-20Provide bootstrap tools with RUSTC in environmentMark Rousskov-3/+3
2020-09-20Auto merge of #75119 - simonvandel:early-otherwise, r=oli-obkbors-0/+1046
New MIR optimization pass to reduce branches on match of tuples of enums Fixes #68867 by adding a new pass that turns something like ```rust let x: Option<()>; let y: Option<()>; match (x,y) { (Some(_), Some(_)) => {0}, _ => {1} } ``` into something like ```rust let x: Option<()>; let y: Option<()>; let discriminant_x = // get discriminant of x let discriminant_y = // get discriminant of x if discriminant_x != discriminant_y {1} else {0} ``` The opt-diffs still have the old basic blocks like ``` bb3: { _8 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:21:21: 21:30 switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:21:21: 21:30 } bb4: { _9 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:22:23: 22:34 switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:22:23: 22:34 } bb5: { _10 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:23:23: 23:34 switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:23:23: 23:34 } ``` These do get removed on later passes. I'm not sure if I should include those passes in the test to make it clear?
2020-09-20emit diff after SimplifyBranches-after-copy-propSimon Vandel Sillesen-168/+480
2020-09-20Rollup merge of #76940 - Aaron1011:fix/trait-on-tait, r=oli-obkRalf Jung-0/+37
Don't allow implementing trait directly on type-alias-impl-trait This is specifically disallowed by the RFC, but we never added a check for it. Fixes #76202
2020-09-20Remove MMX from RustMateusz Mikuła-33/+4
2020-09-20add cleanup of cfgSimon Vandel Sillesen-104/+103
2020-09-20insert storageDead for not equal tempSimon Vandel Sillesen-0/+10
2020-09-20correct commentSimon Vandel Sillesen-992/+0
2020-09-20blessSimon Vandel Sillesen-349/+265
2020-09-20replace usize with u32 to make it easier to blessSimon Vandel Sillesen-18/+15
2020-09-20New MIR optimization pass to reduce branches on match of tuples of enumsSimon Vandel Sillesen-0/+1804
2020-09-20Add test for issue #34634Dániel Buga-0/+16
2020-09-20Auto merge of #74949 - oli-obk:validate_const_eval_raw, r=RalfJungbors-160/+136
Validate constants during `const_eval_raw` This PR implements the groundwork for https://github.com/rust-lang/rust/issues/72396 * constants are now validated during `const_eval_raw` * to prevent cycle errors, we do not validate references to statics anymore beyond the fact that they are not dangling * the `const_eval` query ICEs if used on `static` items * as a side effect promoteds are now evaluated to `ConstValue::Scalar` again (since they are just a reference to the actual promoted allocation in most cases).
2020-09-20Make codegen test bitwidth-independentOliver Scherer-2/+2
2020-09-20Auto merge of #76411 - RalfJung:promote-in-const-fn, r=ecstatic-morsebors-15/+55
Some promotion cleanup Based on top of both https://github.com/rust-lang/rust/pull/75502 and https://github.com/rust-lang/rust/pull/75585, this does some cleanup of the promotion code. The last 2 commits are new. * Remove the remaining cases where `const fn` is treated different from `fn`. This means no longer promoting ptr-to-int casts, raw ptr operations, and union field accesses in `const fn` -- or anywhere, for that matter. These are all unstable in const-context so this should not break any stable code. Fixes https://github.com/rust-lang/rust/issues/75586. * ~~Promote references to statics even outside statics (i.e., in functions) for consistency.~~ * Promote `&mut []` everywhere, not just in non-`const` functions, for consistency. * Explain why we do not promote deref's of statics outside statics. ~~(This is the only remaining direct user of `const_kind`.)~~ This can only land once the other two PRs land; I am mostly putting this up already because I couldn't wait ;) and to get some feedback from `@rust-lang/wg-const-eval` .
2020-09-20Auto merge of #75346 - ↵bors-2/+2
davidtwco:issue-69925-polymorphic-instancedef-fnptrshim, r=nikomatsakis shim: monomorphic `FnPtrShim`s during construction Fixes #69925. This PR adjusts MIR shim construction so that substitutions are applied to function pointer shims during construction, rather than during codegen (as determined by `substs_for_mir_body`). r? `@eddyb`
2020-09-20Auto merge of #72632 - jonas-schievink:dest-prop, r=oli-obkbors-455/+852
Implement a generic Destination Propagation optimization on MIR This takes the work that was originally started by `@eddyb` in https://github.com/rust-lang/rust/pull/47954, and then explored by me in https://github.com/rust-lang/rust/pull/71003, and implements it in a general (ie. not limited to acyclic CFGs) and dataflow-driven way (so that no additional infrastructure in rustc is needed). The pass is configured to run at `mir-opt-level=2` and higher only. To enable it by default, some followup work on it is still needed: * Performance needs to be evaluated. I did some light optimization work and tested against `tuple-stress`, which caused trouble in my last attempt, but didn't go much in depth here. * We can also enable the pass only at `opt-level=2` and higher, if it is too slow to run in debug mode, but fine when optimizations run anyways. * Debuginfo needs to be fixed after locals are merged. I did not look into what is required for this. * Live ranges of locals (aka `StorageLive` and `StorageDead`) are currently deleted. We either need to decide that this is fine, or if not, merge the variable's live ranges (or remove these statements entirely – https://github.com/rust-lang/rust/issues/68622). Some benchmarks of the pass were done in https://github.com/rust-lang/rust/pull/72635.
2020-09-19Don't allow implementing trait directly on type-alias-impl-traitAaron Hill-0/+37
This is specifically disallowed by the RFC, but we never added a check for it. Fixes #76202
2020-09-19cleanup promotion const_kind checksRalf Jung-15/+55
in particular allow a few more promotions for consistency when they were already allowed in other contexts
2020-09-19Rollup merge of #76749 - guswynn:hir_ranges, r=estebankRalf Jung-2/+29
give *even better* suggestion when matching a const range notice that the err already has "constant defined here" so this is now *exceedingly clear* extension to #76222 r? @estebank
2020-09-19Rollup merge of #76434 - RalfJung:black-box, r=Mark-SimulacrumRalf Jung-18/+13
do not inline black_box when building for Miri We cannot do the assembly trick in Miri, but let's at least make sure MIR inlining does not circumvent the black_box. Also use black_box instead of local optimization barriers in a few const tests.
2020-09-19Rollup merge of #75580 - JulianKnodt:or_pattern, r=wesleywiserRalf Jung-0/+108
Add test for checking duplicated branch or-patterns This adds a regression test for checking `or-patterns` in MIR as shown in #75439. This doesn't introduce a fix as I'm not sure where it would go(I suspect maybe here: src/librustc_mir_build/build/matches/mod.rs), and I'm not particularly able to fix it. cc: @lzutao
2020-09-19Reflect the "do not call this query directly" mentality in its nameOliver Scherer-2/+2
2020-09-19Update incremental testsOliver Scherer-1/+1
2020-09-19Update compile-fail testsOliver Scherer-1/+1
2020-09-19Address review commentsOliver Scherer-95/+100
2020-09-19Fix rebase fallout and make the test work with debug infoOliver Scherer-3/+3
2020-09-19We can make const eval sound, it's just super expensiveOliver Scherer-7/+3
2020-09-19Clarify a statement in UB testOliver Scherer-1/+3
2020-09-19Update codegen testsOliver Scherer-3/+3
2020-09-19Stop using the `const_eval` query for initializers of staticsOliver Scherer-32/+16
As a side effect, we now represent most promoteds as `ConstValue::Scalar` again. This is useful because all implict promoteds are just references anyway and most explicit promoteds are numeric arguments to `asm!` or SIMD instructions.
2020-09-19Validate constants during `const_eval_raw`Oliver Scherer-28/+17
2020-09-18Properly inherit conflicts when merging localsJonas Schievink-0/+24
2020-09-18Fix dest-prop mir-opt testsJonas Schievink-81/+25
2020-09-18Add a few dest-prop MIR testsJonas Schievink-0/+362
2020-09-18Bless mir-opt testsJonas Schievink-342/+259
2020-09-18Make nrvo-simple set mir-opt-level=1Jonas Schievink-26/+31
The additional copies are due to the lack of copy propagation
2020-09-18simplify_try: clean up testJonas Schievink-158/+157
2020-09-18simplify_try: print dest_prop diff and blessJonas Schievink-2/+148
The new diff is to convince me that this is correct and nothing funky is going on.