about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-04-11Auto merge of #95125 - JakobDegen:uninit-variant-rvalue, r=oli-obkbors-200/+565
Add new `Deinit` statement This rvalue replaces `SetDiscriminant` for ADTs. This PR is an alternative to #94590 , which only specifies that the behavior of `SetDiscriminant` is the same as what this rvalue would do. The motivation for this change are discussed in that PR and [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/SetDiscriminant.20and.20aggregate.20initialization.20.2394590) r? `@oli-obk`
2022-04-11Remove inlining cost of `Deinit` statementsJakob Degen-109/+263
2022-04-11Add new `MutatatingUseContext`s for deinit and `SetDiscriminant`Jakob Degen-13/+26
2022-04-11Add const eval tests ensuring padding gets correctly marked as deinit on ↵Jakob Degen-0/+37
deaggregation
2022-04-11Fix tests broken by deaggregation changeJakob Degen-465/+619
2022-04-11Bless tests that broke in a trivial way due to change in deaggregationJakob Degen-11/+18
2022-04-11Auto merge of #95931 - matthiaskrgr:rollup-1c5zhit, r=matthiaskrgrbors-6/+25
Rollup of 7 pull requests Successful merges: - #95743 (Update binary_search example to instead redirect to partition_point) - #95771 (Update linker-plugin-lto.md to 1.60) - #95861 (Note that CI tests Windows 10) - #95875 (bootstrap: show available paths help text for aliased subcommands) - #95876 (Add a note for unsatisfied `~const Drop` bounds) - #95907 (address fixme for diagnostic variable name) - #95917 (thin_box test: import from std, not alloc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-11Rollup merge of #95876 - fee1-dead:note-const-drop, r=oli-obkMatthias Krüger-6/+25
Add a note for unsatisfied `~const Drop` bounds r? ``@oli-obk``
2022-04-11Auto merge of #95758 - compiler-errors:issue-54771, r=estebankbors-21/+75
Only suggest removing semicolon when expression is compatible with `impl Trait` https://github.com/rust-lang/rust/issues/54771#issuecomment-476423690 > It still needs checking that the last statement's expr can actually conform to the trait, but the naïve behavior is there. Only suggest removing a semicolon when the type behind the semicolon actually implements the trait in an RPIT `-> impl Trait`. Also upgrade the label that suggests removing the semicolon to a suggestion (should it be verbose?). cc #54771
2022-04-11Auto merge of #95754 - compiler-errors:binder-assoc-ty, r=nagisabors-0/+19
Better error for `for<...>` on associated type bound With GATs just around the corner, we'll probably see more people trying out `Trait<for<'a> Assoc<'a> = ..>`. This PR improves the syntax error slightly, and also makes it slightly easier to make this into real syntax in the future. Feel free to push back if the reviewer thinks this should have a suggestion on how to fix it (i.e. push the `for<'a>` outside of the angle brackets), but that can also be handled in a follow-up PR.
2022-04-11Add a note for unsatisfied `~const Drop` boundsDeadbeef-6/+25
2022-04-11Auto merge of #94243 - compiler-errors:compiler-flags-typo, r=Mark-Simulacrumbors-3/+3
`s/compiler-flags/compile-flags` in compiletest Also make compiletest panic so this doesn't happen in the future! I literally always forget which it's called, so I wanted to make my life easier in the future. Also open to the possibility of parsing both.
2022-04-10better error for binder on associated type boundMichael Goulet-0/+19
2022-04-10only suggest removing semicolon when expr implements traitMichael Goulet-21/+75
2022-04-10Rollup merge of #95857 - ouz-a:mir-opt, r=oli-obkDylan DPC-0/+109
Allow multiple derefs to be splitted in deref_separator Previously in #95649 only a single deref within projection was supported and multiple derefs caused a bunch of issues, this PR fixes those issues. ```@oli-obk``` helped a ton again ❤️
2022-04-10Rollup merge of #95852 - niluxv:strict-provenance-lint-fixup, r=Dylan-DPCDylan DPC-2/+2
Fix missing space in lossy provenance cast lint See https://github.com/rust-lang/rust/pull/95599#discussion_r846425050
2022-04-10Rollup merge of #95807 - TaKO8Ki:suggest-local-var-for-vector, r=fee1-deadDylan DPC-0/+78
Suggest adding a local for vector to fix borrowck errors closes #95574
2022-04-10Rollup merge of #95784 - WaffleLapkin:typeof_cool_suggestion, r=compiler-errorsDylan DPC-0/+15
Suggest replacing `typeof(...)` with an actual type This PR adds suggestion to replace `typeof(...)` with an actual type of `...`, for example in case of `typeof(1)` we suggest replacing it with `i32`. If the expression 1. Is not const (`{ let a = 1; let _: typeof(a); }`) 2. Can't be found (`let _: typeof(this_variable_does_not_exist)`) 3. Or has non-suggestable type (closure, generator, error, etc) we don't suggest anything. The 1 one is sad, but it's not clear how to support non-consts expressions for `typeof`. _This PR is inspired by [this tweet]._ [this tweet]: https://twitter.com/compiler_errors/status/1511945354752638976
2022-04-10--bless testsMaybe Waffle-0/+15
2022-04-09Auto merge of #95435 - cjgillot:one-name, r=oli-obkbors-0/+3
Make def names and HIR names consistent. The name in the `DefKey` is interned to create the `DefId`, so it does not require any query to access. This can be leveraged to avoid a few useless HIR accesses for names. ~In order to achieve that, generic parameters created from universal impl-trait are given the pretty-printed ast as a name, instead of `{{opaque}}`.~ ~Drive-by: the `TyCtxt::opt_item_name` used a dummy span for non-local definitions. We have access to `def_ident_span`, so we use it.~
2022-04-09support multiple derefsouz-a-0/+109
2022-04-09Rollup merge of #95808 - petrochenkov:fragspec, r=nnethercoteDylan DPC-9/+116
expand: Remove `ParseSess::missing_fragment_specifiers` It was used for deduplicating some errors for legacy code which are mostly deduplicated even without that, but at cost of global mutable state, which is not a good tradeoff. cc https://github.com/rust-lang/rust/pull/95747#issuecomment-1091619403 r? ``@nnethercote``
2022-04-09Rollup merge of #95361 - scottmcm:valid-align, r=Mark-SimulacrumDylan DPC-9/+36
Make non-power-of-two alignments a validity error in `Layout` Inspired by the zulip conversation about how `Layout` should better enforce `size <= isize::MAX as usize`, this uses an N-variant enum on N-bit platforms to require at the validity level that the existing invariant of "must be a power of two" is upheld. This was MIRI can catch it, and means there's a more-specific type for `Layout` to store than just `NonZeroUsize`. It's left as `pub(crate)` here; a future PR could consider giving it a tracking issue for non-internal usage.
2022-04-09Fix missing space in lossy provenance cast lintniluxv-2/+2
2022-04-09expand: Remove `ParseSess::missing_fragment_specifiers`Vadim Petrochenkov-9/+116
It was used for deduplicating some errors for legacy code which are mostly deduplicated even without that, but at cost of global mutable state, which is not a good tradeoff.
2022-04-09Rollup merge of #95769 - fmease:fix-issue-95717, r=GuillaumeGomezDylan DPC-0/+42
Hide cross-crate `#[doc(hidden)]` associated items in trait impls Fixes #95717. r? ```@GuillaumeGomez``` This is the bug I ran into in #95316. ```@rustbot``` label T-rustdoc A-cross-crate-reexports
2022-04-09Bless tests.Camille GILLOT-0/+3
2022-04-09Rollup merge of #95804 - GuillaumeGomez:empty-doc-comment-with-backline, ↵Dylan DPC-0/+22
r=notriddle rustdoc: Fix empty doc comment with backline ICE Fixes #95800. r? ```@notriddle```
2022-04-09Rollup merge of #95764 - c410-f3r:metavar-test, r=petrochenkovDylan DPC-1/+117
[macro_metavar_expr] Add tests to ensure the feature requirement These tests should have been added in the initial implementation they were unintentionally forgotten cc #83527 r? ````@petrochenkov````
2022-04-09Rollup merge of #95751 - compiler-errors:ambig-int, r=jackh726Dylan DPC-32/+29
Don't report numeric inference ambiguity when we have previous errors Fixes #95648
2022-04-09Rollup merge of #95599 - niluxv:strict-provenance-lint, r=michaelwoeristerDylan DPC-0/+142
Strict provenance lints See #95488. This PR introduces two unstable (allow by default) lints to which lint on int2ptr and ptr2int casts, as the former is not possible in the strict provenance model and the latter can be written nicer using the `.addr()` API. Based on an initial version of the lint by ```@Gankra``` in #95199.
2022-04-09Rollup merge of #95374 - RalfJung:assert_uninit_valid, r=Mark-SimulacrumDylan DPC-0/+28
assert_uninit_valid: ensure we detect at least arrays of uninhabited types We can't easily extend this check to *all* arrays (Cc https://github.com/rust-lang/rust/pull/87041), but it turns out the existing check already catches arrays of uninhabited types. So let's make sure it stays that way by adding them to the test.
2022-04-09Rollup merge of #90066 - yaahc:thinbox, r=joshtriplettDylan DPC-2/+129
Add new ThinBox type for 1 stack pointer wide heap allocated trait objects **Zulip Thread**: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/ThinBox Based on https://github.com/matthieu-m/rfc2580/blob/b58d1d3cba0d4b5e859d3617ea2d0943aaa31329/examples/thin.rs Tracking Issue: https://github.com/rust-lang/rust/issues/92791 Usage Trial: https://github.com/yaahc/pgx/pull/1/files ## TODO - [x] make sure to test with #[repr(align(1024))] structs etc
2022-04-08Make non-power-of-two alignments a validity error in `Layout`Scott McMurray-9/+36
Inspired by the zulip conversation about how `Layout` should better enforce `size < isize::MAX as usize`, this uses an N-variant enum on N-bit platforms to require at the validity level that the existing invariant of "must be a power of two" is upheld. This was MIRI can catch it, and means there's a more-specific type for `Layout` to store than just `NonZeroUsize`.
2022-04-08Auto merge of #95519 - oli-obk:tait_ub2, r=compiler-errorsbors-0/+101
Enforce well formedness for type alias impl trait's hidden type fixes #84657 This was not an issue with return-position-impl-trait because the generic bounds of the function are the same as those of the opaque type, and the hidden type must already be well formed within the function. With type-alias-impl-trait the hidden type could be defined in a function that has *more* lifetime bounds than the type alias. This is fine, but the hidden type must still be well formed without those additional bounds.
2022-04-08Add ThinBox type for 1 stack pointer sized heap allocated trait objectsJane Lusby-2/+129
Relevant commit messages from squashed history in order: Add initial version of ThinBox update test to actually capture failure swap to middle ptr impl based on matthieu-m's design Fix stack overflow in debug impl The previous version would take a `&ThinBox<T>` and deref it once, which resulted in a no-op and the same type, which it would then print causing an endless recursion. I've switched to calling `deref` by name to let method resolution handle deref the correct number of times. I've also updated the Drop impl for good measure since it seemed like it could be falling prey to the same bug, and I'll be adding some tests to verify that the drop is happening correctly. add test to verify drop is behaving add doc examples and remove unnecessary Pointee bounds ThinBox: use NonNull ThinBox: tests for size Apply suggestions from code review Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com> use handle_alloc_error and fix drop signature update niche and size tests add cfg for allocating APIs check null before calculating offset add test for zst and trial usage prevent optimizer induced ub in drop and cleanup metadata gathering account for arbitrary size and alignment metadata Thank you nika and thomcc! Update library/alloc/src/boxed/thin.rs Co-authored-by: Josh Triplett <josh@joshtriplett.org> Update library/alloc/src/boxed/thin.rs Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-04-08Split `fuzzy_provenance_casts` into lossy and fuzzy, feature gate and test itniluxv-0/+142
* split `fuzzy_provenance_casts` into a ptr2int and a int2ptr lint * feature gate both lints * update documentation to be more realistic short term * add tests for these lints
2022-04-08suggest adding a local for vector to fix borrowck errorsTakayuki Maeda-0/+78
2022-04-08Add test for empty doc comments with a backlineGuillaume Gomez-0/+22
2022-04-08Rollup merge of #95102 - compiler-errors:issue-94034-bug, r=jackh726Dylan DPC-0/+97
Add known-bug for #95034 Couldn't fix the issue, since I am no type theorist and inference variables in universes above U0 scare me. But I at least wanted to add a known-bug test for it. cc #95034 (does not fix)
2022-04-07Hide cross-crate doc-hidden assoc items in trait implsLeón Orell Valerian Liehr-0/+42
2022-04-07Auto merge of #95706 - petrochenkov:doclink4, r=GuillaumeGomezbors-0/+30
rustdoc: Early doc link resolution fixes and refactorings A subset of https://github.com/rust-lang/rust/pull/94857 that shouldn't cause perf regressions, but should fix some issues like https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/ICE.20in.20collect_intra_doc_links.2Ers https://github.com/rust-lang/rust/pull/95290 and improve performance in cases like https://github.com/rust-lang/rust/issues/95694.
2022-04-07[macro_metavar_expr] Add tests to ensure the feature requirementCaio-1/+117
2022-04-07Auto merge of #95760 - Dylan-DPC:rollup-uskzggh, r=Dylan-DPCbors-10/+55
Rollup of 4 pull requests Successful merges: - #95189 (Stop flagging unexpected inner attributes as outer ones in certain diagnostics) - #95752 (Regression test for #82866) - #95753 (Correct safety reasoning in `str::make_ascii_{lower,upper}case()`) - #95757 (Use gender neutral terms) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-07Rollup merge of #95752 - compiler-errors:issue-82866, r=Dylan-DPCDylan DPC-0/+23
Regression test for #82866 Saw that this issue was open when i was cleaning my old branch for #92237. I am also not opposed to not adding an extra test and just closing #82866. Fixes #82866
2022-04-07Rollup merge of #95189 - fmease:fix-issue-94340, r=estebankDylan DPC-10/+32
Stop flagging unexpected inner attributes as outer ones in certain diagnostics Fixes #94340. In the issue to-be-fixed I write that the general message _an inner attribute is not permitted in this context_ should be more specific noting that the “context” is the `include` macro. This, however, cannot be achieved without touching a lot of things and passing a flag to the `parse_expr` and `parse_item` calls in `expand_include`. This seems rather hacky to me. That's why I left it as it. `Span::from_expansion` does not apply either AFAIK. `@rustbot` label A-diagnostics T-compiler
2022-04-07Auto merge of #95678 - pietroalbini:pa-1.62.0-bootstrap, r=Mark-Simulacrumbors-20/+9
Bump bootstrap compiler to 1.61.0 beta This PR bumps the bootstrap compiler to the 1.61.0 beta. The first commit changes the stage0 compiler, the second commit applies the "mechanical" changes and the third and fourth commits apply changes explained in the relevant comments. r? `@Mark-Simulacrum`
2022-04-06regression test for #82866Michael Goulet-0/+23
2022-04-06don't report int/float ambiguity when we have previous errorsMichael Goulet-32/+29
2022-04-07Rollup merge of #95714 - KSBilodeau:master, r=Dylan-DPCDylan DPC-4/+20
Add test for issue #83474 Adds test for https://github.com/rust-lang/rust/issues/83474 - second attempt at PR https://github.com/rust-lang/rust/pull/91821 which was abandoned.