about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
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-10Fix crate_type attribute to not warn on duplicatesEric Huss-60/+44
2022-04-10only suggest removing semicolon when expr implements traitMichael Goulet-21/+75
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-10resolve: Create dummy bindings for all unresolved importsVadim Petrochenkov-15/+3
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-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-09Bless tests.Camille GILLOT-0/+3
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-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-07Stabilize `derive_default_enum`Jacob Pratt-53/+29
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-5/+4
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-06only downgrade Error -> Ambiguous if type error is in predicateMichael Goulet-25/+23
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.
2022-04-06Fix unit struct/enum variant in destructuring assignmentMichael Goulet-0/+34
2022-04-06Stop flagging certain inner attrs as outer onesLeón Orell Valerian Liehr-10/+32
2022-04-06Check that all hidden types are the same and then deduplicate them.Oli Scherer-0/+30
2022-04-06bless testsPietro Albini-4/+4
2022-04-05Merge remote-tracking branch 'origin/master'kangarooCoder-504/+1133
2022-04-05Add test for issue rust-lang/rust#83474kangarooCoder-4/+20
2022-04-05trivial cfg(bootstrap) changesPietro Albini-1/+0
2022-04-05Rollup merge of #95663 - notriddle:notriddle/unsafe-fn-closure, ↵Dylan DPC-10/+17
r=compiler-errors diagnostics: give a special note for unsafe fn / Fn/FnOnce/FnMut Fixes #90073
2022-04-05Rollup merge of #95591 - jackh726:nll-revisions-1, r=oli-obkDylan DPC-328/+588
Use revisions to track NLL test output (part 1) The idea here is 2 fold: 1) When we eventually do make NLL default on, that PR should be systematic in "delete revisions and corresponding error annotations" 2) This allows us to look at test NLL outputs in chunks. (Though, I've opted here not to "mark" these tests. There are some tests with NLL revisions *now* that will be missed. I expect we do a second pass once we have all the tests with NLL revisions; these tests should be easy enough to eyeball.) The actual review here should be "easy", but a bit tedious. I expect we should manually go through each test output and confirm it's okay. The majority of these are either: 1) Only span change (the one I see most common is highlighting an entire function call, rather than just the function name in that call) 2) "E0308 mismatched types" -> "lifetime does not live long enough" 3) "E0495 cannot infer an appropriate lifetime for lifetime parameter" -> "lifetime does not live long enough" 4) "E0312 lifetime of reference outlives lifetime of borrowed content" -> "lifetime does not live long enough" 5) "E0759 `XXX` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement" -> "lifetime does not live long enough" 6) "E0623 lifetime mismatch" -> "lifetime does not live long enough" Other than the now lack of an error code, most of these look fine (with most giving more helpful suggestions now). `rfc1623` output isn't great. cc ``@marmeladema`` if you want to look through these Let's r? ``@oli-obk`` since you've commented on the Zulip thread ;)
2022-04-05Rollup merge of #95585 - compiler-errors:ref-clone, r=estebankDylan DPC-0/+31
Explain why `&T` is cloned when `T` is not `Clone` Fixes #95535
2022-04-05diagnostics: tweak error message to give more rationale to unsafe FnMichael Howell-17/+17
2022-04-05Auto merge of #94527 - oli-obk:undef_scalars, r=nagisa,erikdesjardinbors-111/+137
Let CTFE to handle partially uninitialized unions without marking the entire value as uninitialized. follow up to #94411 To fix https://github.com/rust-lang/rust/issues/69488 and by extension fix https://github.com/rust-lang/rust/issues/94371, we should stop treating types like `MaybeUninit<usize>` as something that the `Scalar` type in the interpreter engine can represent. So we add a new field to `abi::Primitive` that records whether the primitive is nested in a union cc `@RalfJung` r? `@ghost`
2022-04-05Explain why `&T` is cloned when `T` is not `Clone`Michael Goulet-0/+31
2022-04-05unboxed-closures and type-alias-impl-trait nll revisionsJack Huey-20/+42