about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2021-09-01Fix drop handling for `if let` expressionsMatthew Jasper-16/+19
MIR lowering for `if let` expressions is now more complicated now that `if let` exists in HIR. This PR adds a scope for the variables bound in an `if let` expression and then uses an approach similar to how we handle loops to ensure that we reliably drop the correct variables.
2021-09-01Rollup merge of #88525 - notriddle:notriddle/coherence-dyn-auto-trait, ↵Mara Bos-0/+29
r=petrochenkov fix(rustc_typeck): produce better errors for dyn auto trait Fixes #85026
2021-09-01Rollup merge of #86376 - asquared31415:extern-no-mangle-84204, r=Mark-SimulacrumMara Bos-0/+72
Emit specific warning to clarify that `#[no_mangle]` should not be applied on foreign statics or functions Foreign statics and foreign functions should not have `#[no_mangle]` applied, as it does nothing to the name and has some extra hidden behavior that is normally unwanted. There was an existing warning for this, but it says the attribute is only allowed on "statics or functions", which to the user can be confusing. This PR adds a specific version of the unused `#[no_mangle]` warning that explains that the target is a *foreign* static or function and that they do not need the attribute. Fixes #78989
2021-09-01Auto merge of #88121 - camelid:better-recursive-alias-error, r=estebankbors-18/+113
Improve errors for recursive type aliases Fixes #17539.
2021-09-01Auto merge of #87688 - camsteffen:let-else, r=cjgillotbors-45/+395
Introduce `let...else` Tracking issue: #87335 The trickiest part for me was enforcing the diverging else block with clear diagnostics. Perhaps the obvious solution is to expand to `let _: ! = ..`, but I decided against this because, when a "mismatched type" error is found in typeck, there is no way to trace where in the HIR the expected type originated, AFAICT. In order to pass down this information, I believe we should introduce `Expectation::LetElseNever(HirId)` or maybe add `HirId` to `Expectation::HasType`, but I left that as a future enhancement. For now, I simply assert that the block is `!` with a custom `ObligationCauseCode`, and I think this is clear enough, at least to start. The downside here is that the error points at the entire block rather than the specific expression with the wrong type. I left a todo to this effect. Overall, I believe this PR is feature-complete with regard to the RFC.
2021-08-31Rollup merge of #88504 - m-ou-se:turbofish-please-stay, r=oli-obkMara Bos-0/+81
Keep turbofish in prelude collision lint. Fixes https://github.com/rust-lang/rust/issues/88442
2021-08-31Rollup merge of #88501 - m-ou-se:prelude-collusion-oh-no-macros-help, r=estebankMara Bos-0/+115
Use right span in prelude collision suggestions with macros. Fixes https://github.com/rust-lang/rust/issues/88347 r? `@estebank`
2021-08-31Rollup merge of #88418 - fee1-dead:trait-assoc-tilde-const, r=oli-obkMara Bos-6/+178
Allow `~const` bounds on trait assoc functions r? `@oli-obk`
2021-08-31Rollup merge of #88399 - nagisa:nagisa/aapcs-on-aarch, r=petrochenkovMara Bos-27/+99
Disallow the aapcs CC on Aarch64 This never really worked and makes LLVM assert.
2021-08-31Change wording to less jaron-y "non-auto trait"Michael Howell-2/+2
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2021-08-31Add macro test for prelude collision suggestions.Mara Bos-0/+115
2021-08-31Rollup merge of #88509 - ↵Mara Bos-0/+71
m-ou-se:dyn-no-left-shift-right-shift-just-single-angle-brackets-please-thanks, r=petrochenkov Don't suggest extra <> in dyn suggestion. Fixes https://github.com/rust-lang/rust/issues/88508
2021-08-31Rollup merge of #88503 - m-ou-se:array-into-inter-ambiguous, r=cjgillotMara Bos-0/+70
Warn when [T; N].into_iter() is ambiguous in the new edition. Fixes https://github.com/rust-lang/rust/issues/88475 In https://github.com/rust-lang/rust/issues/88475, a situation was found where `[T; N].into_iter()` becomes *ambiguous* in the new edition. This is different than the case where `(&[T; N]).into_iter()` resolves differently, which was the only case handled by the `array_into_iter` lint. This is almost identical to the new-traits-in-the-prelude problem. Effectively, due to the array-into-iter hack disappearing in Rust 2021, we effectively added `IntoIterator` to the 'prelude' in Rust 2021 specifically for arrays. This modifies the prelude collisions lint to detect that case and emit a `array_into_iter` lint in that case.
2021-08-31Rollup merge of #88497 - m-ou-se:prelude-collision-glob, r=nikomatsakisMara Bos-1/+32
Fix prelude collision suggestions for glob imported traits. Fixes https://github.com/rust-lang/rust/issues/88471 cc `@nikomatsakis`
2021-08-31Rollup merge of #88496 - m-ou-se:prelude-collision-lifetime-generics, ↵Mara Bos-20/+96
r=petrochenkov Fix prelude collision lint suggestion for generics with lifetimes Fixes https://github.com/rust-lang/rust/issues/88470 cc `@nikomatsakis`
2021-08-31Rollup merge of #88450 - notriddle:notriddle/maybe_whole_expr, r=cjgillotMara Bos-0/+62
fix(rustc_parse): correct span in `maybe_whole_expr!` Fixes #87812
2021-08-31Rollup merge of #88413 - spastorino:weird-return-types-tait-test, r=oli-obkMara Bos-0/+16
Add weird return types TAIT test r? `@oli-obk` Related to #86727
2021-08-31Rollup merge of #88409 - spastorino:autoleakage-tait-test, r=oli-obkMara Bos-0/+100
Add auto trait leakage TAIT test r? `@oli-obk` Related to #86727
2021-08-31Rollup merge of #88408 - spastorino:inference-cycle-tait-test, r=oli-obkMara Bos-0/+63
Add inference cycle TAIT test r? `@oli-obk` Related to #86727
2021-08-31Rollup merge of #88406 - spastorino:tait-nest-infer-test, r=oli-obkMara Bos-0/+56
Tait nest infer test r? `@oli-obk` Related to #86727
2021-08-31Auto merge of #88467 - sexxi-goose:issue-88431, r=nikomatsakisbors-34/+70
2229: Drop any deref in move closure Fixes: #88431 r? `@nikomatsakis`
2021-08-30fix(rustc_typeck): produce better errors for dyn auto traitMichael Howell-0/+29
Fixes #85026
2021-08-31Auto merge of #88414 - Aaron1011:guess-foreign-head-span, r=estebankbors-14/+46
Don't use `guess_head_span` in `predicates_of` for foreign span Previously, the result of `predicates_of` for a foreign trait would depend on the *current* state of the corresponding source file in the foreign crate. This could lead to ICEs during incremental compilation, since the on-disk contents of the upstream source file could potentially change without the upstream crate being recompiled. Additionally, this ensure that that the metadata we produce for a crate only depends on its *compiled* upstream dependencies (e.g an rlib or rmeta file), *not* the current on-disk state of the upstream crate source files.
2021-08-30Fix testsCameron Steffen-33/+33
2021-08-30Add let-else testsCameron Steffen-0/+322
2021-08-30Handle irrufutable or unreachable let-elseCameron Steffen-12/+21
2021-08-30Add let_else feature gateCameron Steffen-0/+19
2021-08-31Auto merge of #88100 - HTG-YT:edition2021-compopt-stabilization, r=m-ou-sebors-25/+25
Make Edition 2021 Stable An item of #87959. This is an "on-demand" pull request, which means it will be merged when it is the right time to.
2021-08-30Auto merge of #88369 - lcnr:cec-rename, r=oli-obkbors-4332/+829
update const generics feature gates **tl;dr: split const generics into three features: `adt_const_params`, `const_generics_defaults` and `generic_const_exprs`** continuing the work of `@BoxyUwU` in #88324, this PR - renames `feature(const_evaluatable_checked)` to `feature(generic_const_exprs)` which now doesn't need any other feature gate to work. Previously `feature(const_evaluatable_checked)` was only useful in combination with `feature(const_generics)`. - completely removes `feature(lazy_normalization_consts)`. This feature only supplied the parents generics to anonymous constants, which is pretty useless as generic anon consts are only allowed with `feature(generic_const_exprs)` anyways. - moves the ability to use additional const param types from `feature(const_generics)` into `feature(adt_const_params)`. As `feature(const_generics)` is now mostly useless without `feature(generic_const_exprs)` we also remove that feature flag. - updates tests, removing duplicates and unnecessary revisions in some cases and also deletes all unused `*.stderr` files. I not also remove the ordering restriction for const and type parameters if any of the three const generics features is active. This ordering restriction feels like the only "real" use of the current `feature(const_generics)` right now so this change isn't a perfect solution, but as I intend to stabilize the ordering - and `feature(const_generics_defaults)` - in the very near future, I think this is acceptable for now. --- cc `@rust-lang/project-const-generics` about the new feature names and this change in general. I don't think we need any external approval for this change but I do intend to publish an update to the const generics tracking issue the day this PR lands, so I don't want this merged yet. Apologies to whoever ends up reviewing this PR :sweat_smile: :heart: r? rust-lang/project-const-generics
2021-08-30Add test for extra <> in dyn suggestion.Mara Bos-0/+71
2021-08-30Test that turbofish does not swim away in prelude collusion suggestion.Mara Bos-0/+81
2021-08-30Add test for 2021 ambiguous [T; N].into_iter().Mara Bos-0/+70
2021-08-30No longer pass -Z unstable-options for edition 2021 in test.Mara Bos-1/+1
2021-08-30Update test output for stable Rust 2021.Mara Bos-24/+24
2021-08-30Auto merge of #88466 - sexxi-goose:issue-88372, r=nikomatsakisbors-0/+19
2229: Handle update to capture kind properly Fixes: #88372 r? `@nikomatsakis`
2021-08-30Add test for glob imported prelude collision trait.Mara Bos-1/+32
2021-08-30Add and update tests.Mara Bos-20/+96
2021-08-30Disallow the aapcs CC on Aarch64Simonas Kazlauskas-27/+99
This never really worked and makes LLVM assert.
2021-08-30`feature(const_param_types)` -> `feature(adt_const_params)`lcnr-93/+93
2021-08-30allow unordered const/ty params if any cg feature is activelcnr-2/+0
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-4154/+790
2021-08-30remove lazy_normalization_constsEllen-107/+6
2021-08-30rename const_evaluatable_checked to generic_const_exprsEllen-170/+134
:sparkles:
2021-08-29emit specific warning to clarify that foreign items can't have no_mangleasquared31415-0/+72
remove extra commented code Deduplicate some diagnostics code add code symbols, machine applicable suggestion clarify error message
2021-08-292229: Drop any deref in move closureAman Arora-34/+70
2021-08-29Auto merge of #88280 - sexxi-goose:non-exhaustive, r=nikomatsakisbors-0/+168
Handle match statements with non exhaustive variants in closures This PR ensures that the behavior for match statements with non exhaustive variants is the same inside and outside closures. If we have a non-exhaustive SingleVariant which is defined in a different crate, then we should handle the case the same way we would handle a MultiVariant: borrow the match discriminant. Closes https://github.com/rust-lang/project-rfc-2229/issues/59 r? `@nikomatsakis`
2021-08-292229: Handle update to capture kind properlyAman Arora-0/+19
2021-08-29Rollup merge of #88411 - Aaron1011:remove-session-if-let, r=estebankGuillaume Gomez-1/+13
Remove `Session.if_let_suggestions` We can instead if either the LHS or RHS types contain `TyKind::Error`. In addition to covering the case where we would have previously updated `if_let_suggestions`, this might also prevent redundant errors in other cases as well.
2021-08-29Rollup merge of #88357 - lcnr:stabilize-relaxed_struct_unsize, r=Mark-SimulacrumGuillaume Gomez-0/+24
add unsized coercion test we had no tests in our test suite for this case
2021-08-29Rollup merge of #88349 - spastorino:const-static-types-tait-test, r=oli-obkGuillaume Gomez-0/+49
Add const and static TAIT tests r? ``@oli-obk`` Related to #86727