about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-10-10Rollup merge of #102055 - c410-f3r:moar-errors, r=petrochenkovDylan DPC-171/+0
Move some tests to more reasonable directories r? ``@petrochenkov``
2022-10-10Rollup merge of #99696 - WaffleLapkin:uplift, r=fee1-deadDylan DPC-7/+152
Uplift `clippy::for_loops_over_fallibles` lint into rustc This PR, as the title suggests, uplifts [`clippy::for_loops_over_fallibles`] lint into rustc. This lint warns for code like this: ```rust for _ in Some(1) {} for _ in Ok::<_, ()>(1) {} ``` i.e. directly iterating over `Option` and `Result` using `for` loop. There are a number of suggestions that this PR adds (on top of what clippy suggested): 1. If the argument (? is there a better name for that expression) of a `for` loop is a `.next()` call, then we can suggest removing it (or rather replacing with `.by_ref()` to allow iterator being used later) ```rust for _ in iter.next() {} // turns into for _ in iter.by_ref() {} ``` 2. (otherwise) We can suggest using `while let`, this is useful for non-iterator, iterator-like things like [async] channels ```rust for _ in rx.recv() {} // turns into while let Some(_) = rx.recv() {} ``` 3. If the argument type is `Result<impl IntoIterator, _>` and the body has a `Result<_, _>` type, we can suggest using `?` ```rust for _ in f() {} // turns into for _ in f()? {} ``` 4. To preserve the original behavior and clear intent, we can suggest using `if let` ```rust for _ in f() {} // turns into if let Some(_) = f() {} ``` (P.S. `Some` and `Ok` are interchangeable depending on the type) I still feel that the lint wording/look is somewhat off, so I'll be happy to hear suggestions (on how to improve suggestions :D)! Resolves #99272 [`clippy::for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles
2022-10-10Point out incompatible closure boundsMichael Goulet-0/+39
2022-10-10suggest candidates for unresolved importSparrowLii-4/+83
2022-10-10Rename AssocItemKind::TyAlias to AssocItemKind::TypeMichael Goulet-2/+2
2022-10-10Rollup merge of #102862 - scottmcm:more-alignment-traits, r=thomccYuki Okushi-1/+1
From<Alignment> for usize & NonZeroUsize Since you mentioned these two in https://github.com/rust-lang/rust/pull/102072#issuecomment-1272390033, r? ``@thomcc`` Tracking Issue: https://github.com/rust-lang/rust/issues/102070
2022-10-10Rollup merge of #102845 - cjgillot:gat-object, r=fee1-deadYuki Okushi-0/+58
Elaborate trait ref to compute object safety. instead of building them manually from supertraits and associated items. This allows to have the correct substs for GATs. Fixes https://github.com/rust-lang/rust/issues/102751
2022-10-10Rollup merge of #102345 - chenyukang:fix-102182-impl-trait, r=estebankYuki Okushi-0/+17
Recover from impl Trait in type param bound Fixes #102182 r? ``@estebank``
2022-10-10Rollup merge of #102323 - Stoozy:master, r=cjgillotYuki Okushi-2/+10
Trying to suggest additional lifetime parameter ``@cjgillot`` This is what I have so far for #100615
2022-10-10Rollup merge of #102275 - Urgau:stabilize-half_open_range_patterns, r=cjgillotYuki Okushi-374/+279
Stabilize `half_open_range_patterns` This PR stabilize `feature(half_open_range_patterns)`: ``` Allows using `..=X` as a pattern. ``` And adds a new `feature(half_open_range_patterns_in_slices)` for the slice part, https://github.com/rust-lang/rust/pull/102275#issuecomment-1267422806. The FCP was completed in https://github.com/rust-lang/rust/issues/67264.
2022-10-09From<Alignment> for usize & NonZeroUsizeScott McMurray-1/+1
2022-10-09Add a regression test for #39137Ben Kimock-0/+20
2022-10-09Skip chained OpaqueCast when building captures.Camille GILLOT-0/+17
2022-10-09Elaborate trait ref to compute object safety.Camille GILLOT-0/+58
2022-10-09fixup lint nameMaybe Waffle-2/+2
2022-10-09allow or avoid for loops over option in compiler and testsMaybe Waffle-7/+8
2022-10-09`for_loop_over_fallibles`: fix suggestion for "remove `.next()`" caseMaybe Waffle-3/+2
if the iterator is used after the loop, we need to use `.by_ref()`
2022-10-09Add a test for the `for_loop_over_fallibles` lintMaybe Waffle-0/+145
2022-10-08Rollup merge of #102782 - Hosshii:issue-102124, r=Mark-SimulacrumMichael Howell-0/+20
Add regression test for #102124 closes #102124, which was already fixed on nightly.
2022-10-08Rollup merge of #102514 - b-naber:binder-print-fixes, r=jackh726Michael Howell-7/+51
Don't repeat lifetime names from outer binder in print Fixes https://github.com/rust-lang/rust/issues/102392 Fixes https://github.com/rust-lang/rust/issues/102414 r? ```@lcnr```
2022-10-08Rollup merge of #99818 - aliemjay:fix-closure-normalize, r=jackh726Michael Howell-0/+135
don't ICE when normalizing closure input tys We were ICEing while rendering diagnostics because `universe_causes` is expected to track every universe created in the typeck's infcx. `normalize_and_add_constraints` doesn't update `universe_causes` when creating new universes, causing an ICE. Remove it! Add spans to better track normalization constraints. Fix couple places where `universe_causes` is not updated correctly to track newly added universes. Fixes #102800 ~Fixess #99665~ (UPDATE: no longer true; the issue has a different failure path than when this PR was created and should be fixed by #101708, but the changes in this PR are still correct and should prevent potential future ICEs)
2022-10-08Auto merge of #102315 - RalfJung:assert_unsafe_precondition, r=thomccbors-5/+5
add a few more assert_unsafe_precondition Add debug-assertion checking for `ptr.read()`, `ptr.write(_)`, and `unreachable_unchecked.` This is quite useful for [cargo-careful](https://github.com/RalfJung/cargo-careful).
2022-10-08handle late-bound vars from inner binders correctly and add testb-naber-0/+24
2022-10-08Auto merge of #102809 - matthiaskrgr:rollup-qq62vuv, r=matthiaskrgrbors-22/+28
Rollup of 8 pull requests Successful merges: - #101520 (Allow transmutes between the same types after erasing lifetimes) - #102675 (Remove `mir::CastKind::Misc`) - #102778 (Fix MIR inlining of asm_unwind) - #102785 (Remove `DefId` from some `SelectionCandidate` variants) - #102788 (Update rustc-dev-guide) - #102789 (Update browser UI test version) - #102797 (rustdoc: remove no-op CSS `.rightside { position: initial }`) - #102798 (rustdoc: add main-heading and example-wrap link CSS to big selector) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-08Rollup merge of #101520 - oli-obk:transmute_lifetimes, r=compiler-errorsMatthias Krüger-22/+28
Allow transmutes between the same types after erasing lifetimes r? ````@compiler-errors```` on the impl fixes #101081 See discussion in the issue and at https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.23101081.3A.20Regression.20transmuting.20.60RwLockReadGuard.3CT.3A.20.3FSized.3E.E2.80.A6 I think this may need lang team signoff as its implications may go beyond the jurisdiction of T-types I'll write up a proper summary later
2022-10-08Auto merge of #100720 - camsteffen:representable, r=cjgillotbors-244/+181
Rewrite representability * Improve placement of `Box` in the suggestion * Multiple items in a cycle emit 1 error instead of an error for each item in the cycle * Introduce `representability` query to avoid traversing an item every time it is used. * Also introduce `params_in_repr` query to avoid traversing generic items every time it is used.
2022-10-08Stabilize half_open_range_patternsUrgau-368/+254
2022-10-08Split slice part of feature(half_open_range_patterns) to [...]_in_slicesUrgau-6/+25
2022-10-08don't ICE when normalizing closure input tysAli MJ Al-Nasrawy-0/+135
`normalize_and_add_constraints` doesn't add entries in `universe_causes` when creating new universes, causing an ICE. Remove it! Add spans to track normalization constraints. Fix couple places where `universe_causes` is not updated correctly to track newly added universes.
2022-10-08fix #102182, recover from impl Trait in type param boundyukang-0/+17
2022-10-07Auto merge of #102091 - RalfJung:const_err, r=oli-obkbors-5087/+1323
make const_err a hard error This lint has been deny-by-default with future incompat wording since [Rust 1.51](https://github.com/rust-lang/rust/pull/80394) and the stable release of this week starts showing it in cargo's future compat reports. I can't wait to finally get rid of at least some of the mess in our const-err-reporting-code. ;) r? `@oli-obk` Fixes https://github.com/rust-lang/rust/issues/71800 Fixes https://github.com/rust-lang/rust/issues/100114
2022-10-07Add a regression testOli Scherer-0/+26
2022-10-07Check hidden types in dead codeOli Scherer-2/+16
2022-10-07Unconditionally encode hidden types in typeck resultsOli Scherer-4/+11
2022-10-07First batch of review feedback changes from #102110Nathan Stocks-2/+2
2022-10-07Rollup merge of #102779 - TaKO8Ki:fix-type-of-ice-102768, r=fee1-deadDylan DPC-0/+47
Fix `type_of` ICE Fixes #102768
2022-10-07Rollup merge of #102764 - compiler-errors:issue-102762, r=jackh726Dylan DPC-0/+46
Check `WhereClauseReferencesSelf` after all other object safety checks This fixes the ICE because it causes us to detect another *non-lint* `MethodViolationCode` first, instead of breaking on `WhereClauseReferencesSelf`. We could also approach this issue by instead returning a vector of *all* of the `MethodViolationCode`s, and just reporting the first one we see, but treating it as a hard error if we return both `WhereClauseReferencesSelf` and some other violation code -- let me know if this is desired. Fixes #102762
2022-10-07Allow transmutes between the same types after erasing lifetimesOli Scherer-22/+28
2022-10-07make const_err a hard errorRalf Jung-5087/+1323
2022-10-07Add regression test for #102124Hosshii-0/+20
2022-10-07Rewrite representabilityCameron Steffen-244/+181
2022-10-07add a few more assert_unsafe_preconditionRalf Jung-5/+5
2022-10-07Ensure the correct tombstone file is openedFlorian Bartels-11/+11
2022-10-07fix a ICE #102768Takayuki Maeda-0/+47
2022-10-07Rollup merge of #102761 - est31:let_else_uninhabited_test, r=compiler-errorsMatthias Krüger-1/+23
let-else: test else block with non-never uninhabited type let else currently does not allow uninhabited types for the `else` block that aren't `!`. One can maybe think about relaxing this in the future, but if it is done, it should be an explicit choice and not an unexpected side effect of e.g. a refactor. Thus, I'm extending a test that will fail if the behaviour changes.
2022-10-07Rollup merge of #102720 - lyming2007:issue-102397-fix, r=compiler-errorsMatthias Krüger-8/+8
do not reverse the expected type and found type for ObligationCauseCo… …de of IfExpressionWithNoElse this will fix #102397
2022-10-07suggest `==` to the first expr which has `ExprKind::Assign`Takayuki Maeda-1/+24
2022-10-07Check WhereClauseReferencesSelf after all other object safety checksMichael Goulet-0/+46
2022-10-07let-else: test else block with non-never uninhabited typeest31-1/+23
2022-10-06Rollup merge of #102718 - compiler-errors:opaque-bound-lint-ice, r=fee1-deadMatthias Krüger-0/+22
Fix `opaque_hidden_inferred_bound` lint ICE Fixes #102705