about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-05-14Auto merge of #97039 - cjgillot:no-rpit-hrtb, r=jackh726bors-98/+221
Forbid nested opaque types to reference HRTB from opaque types. Avoids https://github.com/rust-lang/rust/issues/96194 Alternative to https://github.com/rust-lang/rust/pull/96970 r? `@oli-obk`
2022-05-14Add a test with both passing and erroneous cases.Camille GILLOT-0/+146
2022-05-14Auto merge of #95826 - carbotaniuman:miri-permissive-provenance, r=RalfJungbors-2/+2
Initial work on Miri permissive-exposed-provenance Rustc portion of the changes for portions of a permissive ptr-to-int model for Miri. The main changes here are changing `ptr_get_alloc` and `get_alloc_id` to return an Option, and also making ptr-to-int casts have an expose side effect.
2022-05-14Forbid nested opaque types to reference HRTB from opaque types.Camille GILLOT-98/+75
2022-05-14Auto merge of #97035 - JohnTitor:rollup-00ko07z, r=JohnTitorbors-0/+25
Rollup of 6 pull requests Successful merges: - #95365 (Use default alloc_error_handler for hermit) - #96986 ([save-analysis] Reference the variant not enum at struct-literal cons…) - #96998 (rustdoc: remove weird, unused variable from source-files.js) - #97005 (Two small improvements of rustc_expand) - #97018 (Ensure that test fail if a JS error occurs) - #97031 (Drop tracking: handle invalid assignments better) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-14Rollup merge of #97031 - eholk:drop-tracking-type-error, r=compiler-errorsYuki Okushi-0/+25
Drop tracking: handle invalid assignments better Previously this test case was crashing with an index out of bounds error deep in the call to `needs_drop`. We avoid this by detecting clearly invalid assignees in the `mutate` callback and ignoring these.
2022-05-14Auto merge of #95602 - scottmcm:faster-array-intoiter-fold, r=the8472bors-0/+54
Fix `array::IntoIter::fold` to use the optimized `Range::fold` It was using `Iterator::by_ref` in the implementation, which ended up pessimizing it enough that, for example, it didn't vectorize when we tried it in the <https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/Reducing.20sum.20into.20wider.20types> conversation. Demonstration that the codegen test doesn't pass on the current nightly: <https://rust.godbolt.org/z/Taxev5eMn>
2022-05-13Drop tracking: handle invalid assignments betterEric Holk-0/+25
Previously this test case was crashing with an index out of bounds error deep in the call to `needs_drop`. We avoid this by detecting clearly invalid assignees in the `mutate` callback and ignoring these.
2022-05-13Rustc changes for permissive provenancecarbotaniuman-2/+2
2022-05-13Rollup merge of #97011 - JohnTitor:issue-28935, r=compiler-errorsMatthias Krüger-0/+9
Add regression test for #28935 Closes #28935, one of the ancient issues can be closed :) r? `@compiler-errors`
2022-05-13Rollup merge of #96615 - JohnTitor:test-54779, r=compiler-errorsMatthias Krüger-0/+62
Add a regression test for #54779 Closes #54779 r? `@jackh726`
2022-05-13Add regression test for #28935Yuki Okushi-0/+9
2022-05-13For non-defining opaque type usage errors, don't try to also prove all trait ↵Oli Scherer-184/+6
bounds
2022-05-13Check that closures satisfy their where boundsOli Scherer-14/+327
2022-05-13Rollup merge of #96993 - notriddle:notriddle/prototype, r=GuillaumeGomezMatthias Krüger-0/+20
rustdoc: fix GUI crash when searching for magic JS property values
2022-05-13Rollup merge of #96989 - cjgillot:defpath-use, r=davidtwcoMatthias Krüger-24/+100
Be more precise than DefPathData::Misc. This variant was used for two unrelated things. Let's make this cleaner.
2022-05-13Rollup merge of #96948 - ludfo774:macro-trailing-comma-test, r=joshtriplettMatthias Krüger-0/+6
Add test of matches macro for trailing commas Almost all macros are tested for trailing commas. The macro matches! was however not tested. This PR adds that test case. Related to #46238
2022-05-12rustdoc: fix GUI crash when searching for magic JS property valuesMichael Howell-0/+20
2022-05-12Bless mir-opt tests.Camille GILLOT-18/+94
2022-05-12Bless tests.Camille GILLOT-6/+6
2022-05-12Rollup merge of #96968 - cjgillot:codegen-fulfill-nice, r=oli-obkMatthias Krüger-0/+346
Add tests for #96806 I messed up the rebase in https://github.com/rust-lang/rust/pull/96806. I took the opportunity to add an extra mir-opt test from https://github.com/rust-lang/rust/pull/91743. r? `@oli-obk`
2022-05-12Rollup merge of #96939 - GuillaumeGomez:settings-css, r=notriddleMatthias Krüger-0/+5
Fix settings page CSS In https://github.com/rust-lang/rust/pull/96741, I moved the CSS loading outside of `settings.js`. The result was that on the settings page, there isn't the settings CSS anymore: ![Screenshot from 2022-05-11 11-09-24](https://user-images.githubusercontent.com/3050060/167817969-6750931b-3e6e-4178-b5a9-ee3851e983be.png) I also used this opportunity to remove unused CSS rules (we don't have `<select>` elements anymore in the settings). cc `@jsha` r? `@notriddle`
2022-05-12Add mir-opt test.Camille GILLOT-0/+157
2022-05-12Auto merge of #96853 - ↵bors-8/+39
davidtwco:diagnostic-translation-unit-and-more-porting, r=oli-obk diagnostics: port more diagnostics to derive + support for `()` fields - Extend diagnostic derive so that spanless subdiagnostics (e.g. some uses of `help`/`note`) can be applied via attributes to fields of type `()` (currently spanless subdiagnostics are applied via attributes on the diagnostic struct itself). A consequence of this is that `Option<()>` fields can be used to represent optional spanless subdiagnostics, which are sometimes useful (e.g. for a `help` that should only show on nightly builds). - Simplify the "explicit generic args with impl trait" diagnostic struct (from #96760) using support for `Option<()>` spanless subdiagnostics. - Change `DiagnosticBuilder::set_arg`, used to provide context for Fluent messages, so that it takes anything that implements `IntoDiagnosticArg`, rather than `DiagnosticArgValue` - this improves the ergonomics of manual implementations of `SessionDiagnostic` which are translatable. - Port "the type parameter `T` must be explicitly specified", "manual implementations of `X` are experimental", "could not resolve substs on overridden impl" diagnostics to diagnostic structs. - When testing macros from `rustc_macros` in `ui-fulldeps` tests, sometimes paths from the compiler source tree can be shown in error messages - these need to be normalized in `compiletest`. r? `@oli-obk` cc `@pvdrz`
2022-05-12Add tests.Camille GILLOT-0/+189
2022-05-12Auto merge of #96940 - TaKO8Ki:stop-suggesting-wrong-fully-qualified-path, ↵bors-0/+59
r=estebank Stop suggesting non-existing fully qualified paths This patch fixes a part of #96295. r? `@estebank`
2022-05-12errors: `set_arg` takes `IntoDiagnosticArg`David Wood-8/+17
Manual implementors of translatable diagnostics will need to call `set_arg`, not just the derive, so make this function a bit more ergonomic by taking `IntoDiagnosticArg` rather than `DiagnosticArgValue`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-12macros: spanless subdiagnostics from `()` fieldsDavid Wood-0/+22
Type attributes could previously be used to support spanless subdiagnostics but these couldn't easily be made optional in the same way that spanned subdiagnostics could by using a field attribute on a field with an `Option<Span>` type. Spanless subdiagnostics can now be specified on fields with `()` type or `Option<()>` type. Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-12Auto merge of #95837 - scottmcm:ptr-offset-from-unsigned, r=oli-obkbors-3/+77
Add `sub_ptr` on pointers (the `usize` version of `offset_from`) We have `add`/`sub` which are the `usize` versions of `offset`, this adds the `usize` equivalent of `offset_from`. Like how `.add(d)` replaced a whole bunch of `.offset(d as isize)`, you can see from the changes here that it's fairly common that code actually knows the order between the pointers and *wants* a `usize`, not an `isize`. As a bonus, this can do `sub nuw`+`udiv exact`, rather than `sub`+`sdiv exact`, which can be optimized slightly better because it doesn't have to worry about negatives. That's why the slice iterators weren't using `offset_from`, though I haven't updated that code in this PR because slices are so perf-critical that I'll do it as its own change. This is an intrinsic, like `offset_from`, so that it can eventually be allowed in CTFE. It also allows checking the extra safety condition -- see the test confirming that CTFE catches it if you pass the pointers in the wrong order.
2022-05-11Apply CR suggestions; add real tracking issueScott McMurray-1/+2
2022-05-11Rename `unsigned_offset_from` to `sub_ptr`Scott McMurray-1/+1
2022-05-11Add `unsigned_offset_from` on pointersScott McMurray-3/+76
Like we have `add`/`sub` which are the `usize` version of `offset`, this adds the `usize` equivalent of `offset_from`. Like how `.add(d)` replaced a whole bunch of `.offset(d as isize)`, you can see from the changes here that it's fairly common that code actually knows the order between the pointers and *wants* a `usize`, not an `isize`. As a bonus, this can do `sub nuw`+`udiv exact`, rather than `sub`+`sdiv exact`, which can be optimized slightly better because it doesn't have to worry about negatives. That's why the slice iterators weren't using `offset_from`, though I haven't updated that code in this PR because slices are so perf-critical that I'll do it as its own change. This is an intrinsic, like `offset_from`, so that it can eventually be allowed in CTFE. It also allows checking the extra safety condition -- see the test confirming that CTFE catches it if you pass the pointers in the wrong order.
2022-05-12Auto merge of #96150 - est31:unused_macro_rules, r=petrochenkovbors-46/+209
Implement a lint to warn about unused macro rules This implements a new lint to warn about unused macro rules (arms/matchers), similar to the `unused_macros` lint added by #41907 that warns about entire macros. ```rust macro_rules! unused_empty { (hello) => { println!("Hello, world!") }; () => { println!("empty") }; //~ ERROR: 1st rule of macro `unused_empty` is never used } fn main() { unused_empty!(hello); } ``` Builds upon #96149 and #96156. Fixes #73576
2022-05-11Auto merge of #96806 - cjgillot:codegen-fulfill-nice, r=oli-obkbors-10/+47
Gracefully fail to resolve associated items instead of `delay_span_bug`. `codegen_fulfill_obligation` is used during instance resolution for trait items. In case of insufficient normalization issues during MIR inlining, it caused ICEs. It's better to gracefully refuse to resolve the associated item, and let the caller decide what to do with this. Split from https://github.com/rust-lang/rust/pull/91743 Closes #69121 Closes #73021 Closes #88599 Closes #93008 Closes #93248 Closes #94680 Closes #96170 r? `@oli-obk`
2022-05-11Add test of matches macro for trailing commasludfo774-0/+6
2022-05-11stop suggesting non-existing fully qualified pathsTakayuki Maeda-0/+59
2022-05-11Ensure that the settings CSS is loaded on the settings pageGuillaume Gomez-0/+5
2022-05-11Auto merge of #96931 - JohnTitor:rollup-3um8o4j, r=JohnTitorbors-2/+86
Rollup of 7 pull requests Successful merges: - #96543 (Remove hacks in `make_token_stream`.) - #96887 (rustdoc: correct path to type alias methods) - #96896 (Add regression test for #68408) - #96900 (Fix js error) - #96903 (Use lifetimes on type-alias-impl-trait used in function signatures to infer output type lifetimes) - #96916 (simplify length count) - #96925 (Fix issue #95151) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-11Gracefully fail to resolve associated items instead of `delay_span_bug`.Camille GILLOT-10/+47
2022-05-11Rollup merge of #96925 - c410-f3r:z-errors, r=JohnTitorYuki Okushi-0/+10
Fix issue #95151 Fixes #95151 Nothing special here, just a test for a thing that used to ICE.
2022-05-11Rollup merge of #96903 - oli-obk:opaque_type_lifetime_constraints, ↵Yuki Okushi-0/+17
r=compiler-errors Use lifetimes on type-alias-impl-trait used in function signatures to infer output type lifetimes fixes https://github.com/rust-lang/rust/issues/96564 TLDR: ```rust fn execute(ty: Ty<'_>) -> &str { todo!() } ``` (`Ty` being a type alias impl trait) used to produce the following error before this PR ``` error[E0581]: return type references an anonymous lifetime, which is not constrained by the fn input types --> src/lib.rs:4:27 | 4 | fn execute(ty: Ty<'_>) -> &str { todo!() } | ^^^^ | = note: lifetimes appearing in an associated type are not considered constrained ```
2022-05-11Rollup merge of #96900 - GuillaumeGomez:fix-js-error, r=notriddleYuki Okushi-2/+1
Fix js error On the source code pages, we get a JS error: ![Screenshot from 2022-05-10 16-26-53](https://user-images.githubusercontent.com/3050060/167656292-51e0b0e9-6b0c-4f94-82e0-dd8fb77adf52.png) It's fixed in the first commit. The second one is removing an unused CSS rule and the third one is a little cleanup of a GUI test. cc ``@jsha`` r? ``@notriddle``
2022-05-11Rollup merge of #96896 - JohnTitor:issue-68408, r=compiler-errorsYuki Okushi-0/+22
Add regression test for #68408 Closes https://github.com/rust-lang/rust/issues/68408
2022-05-11Rollup merge of #96887 - notriddle:notriddle/as-raw-fd, r=jshaYuki Okushi-0/+36
rustdoc: correct path to type alias methods Fixes #83991
2022-05-11Auto merge of #96888 - Aaron1011:fake-borrow-no-sort, r=petrochenkovbors-4/+4
Use `FxIndexSet` to avoid sorting fake borrows This fixes #96449, but I haven't yet been able to make the reproducer work using `#[cfg]` attributes, so we can't use the 'revision' infra to write a test The previous implementation relied on sorting by `PlaceRef`. This requires sorting by a `DefId`, which uses untracked state (see #93315)
2022-05-10Ignore orderMichael Howell-1/+1
This isn't an ordering test really, anyway...
2022-05-10Fix issue #95151Caio-0/+10
2022-05-10rustdoc: clean up method path indexMichael Howell-0/+22
This removes a special case that doesn't seem to do anything any more.
2022-05-10Auto merge of #96904 - JohnTitor:rollup-f1sz5x0, r=JohnTitorbors-15/+187
Rollup of 6 pull requests Successful merges: - #96717 (Handle mismatched generic param kinds in trait impls betterly) - #96725 (Expose process windows_process_extensions_main_thread_handle on Windows) - #96849 (Move some tests to more reasonable places) - #96861 (Use Rust 2021 prelude in std itself.) - #96879 (rustdoc: search result ranking fix) - #96882 (Don't subst an AdtDef with its own substs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-05-11Rollup merge of #96879 - notriddle:notriddle/search-ranking, r=GuillaumeGomezYuki Okushi-0/+35
rustdoc: search result ranking fix # Before ![image](https://user-images.githubusercontent.com/1593513/167477286-91049761-67f9-4a73-8fb7-09dbb19ca76c.png) # After ![image](https://user-images.githubusercontent.com/1593513/167477345-6733bc0f-4bb2-4625-9f7f-094031e36414.png)