about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2022-10-14more dupe word typosRageking8-3/+3
2022-10-14Allow dyn* upcastingMichael Goulet-2/+10
2022-10-14Make dyn* cast into a coercionMichael Goulet-60/+60
2022-10-14Auto merge of #103026 - matthiaskrgr:rollup-gfmlfkt, r=matthiaskrgrbors-5/+15
Rollup of 7 pull requests Successful merges: - #103000 (Add suggestion to the "missing native library" error) - #103006 (rustdoc: don't ICE on `TyKind::Typeof`) - #103008 (replace ReErased with fresh region vars in opaque types) - #103011 (Improve rustdoc `unsafe-fn` GUI test) - #103013 (Add new bootstrap entrypoints to triagebot) - #103016 (Ensure enum cast moves) - #103021 (Add links to relevant pages to find constraint information) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-14Rollup merge of #103008 - aliemjay:opaque-parent-substs, r=oli-obkMatthias Krüger-5/+15
replace ReErased with fresh region vars in opaque types See inline comments. Prior art #102943. cc ``@compiler-errors`` ``@oli-obk`` Fixes #100267 Fixes #101940 Fixes #102649 Fixes #102510
2022-10-13Auto merge of #102700 - oli-obk:0xDEAD_TAIT, r=compiler-errorsbors-50/+68
Check hidden types in dead code fixes #99490 r? `@compiler-errors` best reviewed commit by commit
2022-10-13Make overlapping_impls non-genericCameron Steffen-6/+5
This improves perf
2022-10-13Report duplicate definition in impls with overlap check.Camille GILLOT-45/+36
2022-10-13replace ReErased with fresh region vars in opaque typesAli MJ Al-Nasrawy-5/+15
2022-10-13Rollup merge of #102765 - TaKO8Ki:follow-up-to-102708, r=compiler-errorsDylan DPC-0/+12
Suggest `==` to the first expr which has `ExprKind::Assign` kind follow-up to #102708 [playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=4241dc33ed8af02e1ef530d6b14903fd)
2022-10-12Auto merge of #101679 - compiler-errors:rpitit-default-body, r=nikomatsakisbors-26/+35
Support default-body trait functions with return-position `impl Trait` in traits Introduce a new `Trait` candidate kind for the `ImplTraitInTrait` projection candidate, which just projects an RPITIT down to its opaque type form. This is a hack until we lower RPITITs to regular associated types, after which we will need to rework how these default bodies are type-checked, so comments are left in a few places for us to clean up later. Fixes #101665
2022-10-12Auto merge of #102732 - RalfJung:assert_unsafe_precondition2, r=bjorn3bors-8/+1
nicer errors from assert_unsafe_precondition This makes the errors shown by cargo-careful nicer, and since `panic_no_unwind` is `nounwind noreturn` it hopefully doesn't have bad codegen impact. Thanks to `@bjorn3` for the hint! Would be nice if we could somehow supply our own (static) message to print, currently it always prints `panic in a function that cannot unwind`. But still, this is better than before.
2022-10-12Rollup merge of #102890 - camsteffen:adt-sized-representability, r=cjgillotDylan DPC-3/+2
Check representability in adt_sized_constraint Now that representability is a query, we can use it to preemptively avoid a cycle in `adt_sized_constraint`. I moved the representability check into `check_mod_type_wf` to avoid a scenario where rustc quits before checking all the types for representability. This also removes the check from rustdoc, which is alright AFAIK. r? ``@cjgillot``
2022-10-11add panic_fmt_nounwind for panicing without unwinding, and use it for ↵Ralf Jung-7/+0
panic_no_unwind
2022-10-11rename rustc_allocator_nounwind to rustc_nounwindRalf Jung-1/+1
2022-10-11Rollup merge of #100387 - cjgillot:hygiene-trait-impl, r=petrochenkovMatthias Krüger-0/+3
Check uniqueness of impl items by trait item when applicable. When checking uniqueness of item names in impl blocks, we currently use the same definition of hygiene as for toplevel items. This means that a plain item and one generated by a macro 2.0 do not collide. This hygiene rule does not match with how impl items resolve to associated trait items. As a consequence, we misdiagnose the trait impls. This PR proposes to consider that trait impl items are uses of the corresponding trait items during resolution, instead of checking for duplicates later. An error is emitted when a trait impl item is used twice. There should be no stable breakage, since macros 2.0 are still unstable. r? ``@petrochenkov`` cc ``@RalfJung`` Fixes https://github.com/rust-lang/rust/issues/71614.
2022-10-11Rollup merge of #102859 - cjgillot:collect-lifetimes, r=oli-obkYuki Okushi-0/+1890
Move lifetime resolution module to rustc_hir_analysis. Now that lifetime resolution has been removed from it, this file has nothing to do in `rustc_resolve`. It's purpose is to compute Debruijn indices for lifetimes, so let's put it in type collection.
2022-10-11Report duplicate definitions in trait impls during resolution.Camille GILLOT-0/+3
2022-10-10Check representability in adt_sized_constraintCameron Steffen-3/+2
2022-10-10Move lifetime resolution module to rustc_hir_analysis.Camille GILLOT-0/+1890
2022-10-10Fix compiler docsGuillaume Gomez-5/+19
2022-10-10Rollup merge of #102829 - compiler-errors:rename-impl-item-kind, r=TaKO8KiYuki Okushi-6/+6
rename `ImplItemKind::TyAlias` to `ImplItemKind::Type` The naming of this variant seems inconsistent given that this is not really a "type alias", and the associated type variant for `TraitItemKind` is just called `Type`.
2022-10-09ImplItemKind::TyAlias => ImplItemKind::TypeMichael Goulet-6/+6
2022-10-08Auto merge of #102809 - matthiaskrgr:rollup-qq62vuv, r=matthiaskrgrbors-5/+15
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-5/+15
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-26/+3
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-07Check hidden types in dead codeOli Scherer-20/+38
2022-10-07Remap hidden types from typeck before storing them in the TypeckResultOli Scherer-1/+10
2022-10-07Unconditionally encode hidden types in typeck resultsOli Scherer-38/+29
2022-10-07Auto merge of #102787 - Dylan-DPC:rollup-fvbb4t9, r=Dylan-DPCbors-2/+4
Rollup of 6 pull requests Successful merges: - #102300 (Use a macro to not have to copy-paste `ConstFnMutClosure::new(&mut fold, NeverShortCircuit::wrap_mut_2_imp)).0` everywhere) - #102475 (unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update) - #102760 (Avoid repeated re-initialization of the BufReader buffer) - #102764 (Check `WhereClauseReferencesSelf` after all other object safety checks) - #102779 (Fix `type_of` ICE) - #102780 (run Miri CI when std::sys changes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-07Allow transmutes between the same types after erasing lifetimesOli Scherer-5/+15
2022-10-07Rewrite representabilityCameron Steffen-26/+3
2022-10-07Change InferCtxtBuilder from enter to buildCameron Steffen-1102/+1057
2022-10-07fix a ICE #102768Takayuki Maeda-2/+4
2022-10-07Remove a reference from InheritedCameron Steffen-13/+13
2022-10-07Remove TypeckResults from InferCtxtCameron Steffen-15/+19
2022-10-07Introduce TypeErrCtxtCameron Steffen-57/+89
TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't need to.
2022-10-07Rollup merge of #102720 - lyming2007:issue-102397-fix, r=compiler-errorsMatthias Krüger-1/+1
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-0/+12
2022-10-06Rollup merge of #98496 - BoxyUwU:instancers_bad_equality, r=lcnrMatthias Krüger-37/+36
make `compare_const_impl` a query and use it in `instance.rs` Fixes #88365 the bug in #88365 was caused by some `instance.rs` code using the `PartialEq` impl on `Ty` to check that the type of the associated const in an impl is the same as the type of the associated const in the trait definition. This was wrong for two reasons: - the check typeck does is that the impl type is a subtype of the trait definition's type (see `mismatched_impl_ty_2.rs` which [was ICEing](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f6d60ebe6745011f0d52ab2bc712025d) before this PR on stable) - it assumes that if two types are equal then the `PartialEq` impl will reflect that which isnt true for higher ranked types or type level constants when `feature(generic_const_exprs)` is enabled (see `mismatched_impl_ty_3.rs` for higher ranked types which was [ICEing on stable](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d7af131a655ed515b035624626c62c71)) r? `@lcnr`
2022-10-06reviewsBoxy-41/+41
2022-10-06Rollup merge of #102708 - TaKO8Ki:improve-eqeq-suggestion, r=estebankMatthias Krüger-2/+10
Suggest `==` to wrong assign expr Given the following code: ```rust fn main() { let x = 3; let y = 3; if x == x && y = y { println!("{}", x); } } ``` Current output is: ``` error[E0308]: mismatched types --> src/main.rs:4:18 | 4 | if x == x && y = y { | ^ expected `bool`, found integer error[E0308]: mismatched types --> src/main.rs:4:8 | 4 | if x == x && y = y { | ^^^^^^^^^^^^^^^ expected `bool`, found `()` ``` This adds a suggestion: ```diff error[E0308]: mismatched types --> src/main.rs:6:18 | 6 | if x == x && y = y { | ^ expected `bool`, found integer error[E0308]: mismatched types --> src/main.rs:6:8 | 6 | if x == x && y = y { | ^^^^^^^^^^^^^^^ expected `bool`, found `()` | + help: you might have meant to compare for equality + | + 6 | if x == x && y == y { + | + ``` And this fixes a part of #97469
2022-10-06Rollup merge of #102694 - compiler-errors:fn-to-method, r=davidtwcoMatthias Krüger-6/+136
Suggest calling method if fn does not exist I tried to split this up into two commits, the first where we stash the resolution error until typeck (which causes a bunch of diagnostics changes because the ordering of error messages change), then the second commit is the actual logic that actually implements the suggestion. I am not in love with the presentation of the suggestion, so I could use some advice for how to format the actual messaging. r? diagnostics Fixes #102518
2022-10-05do not reverse the expected type and found type for ObligationCauseCode of ↵Yiming Lei-1/+1
IfExpressionWithNoElse this will fix #102397
2022-10-05Update compiler/rustc_hir_analysis/src/check/callee.rsMichael Goulet-1/+1
Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
2022-10-05suggest `==` to the rest of assign exprTakayuki Maeda-0/+8
2022-10-05use smaller spanTakayuki Maeda-2/+2
2022-10-05Rollup merge of #102496 - compiler-errors:into-suggestion, r=davidtwcoDylan DPC-36/+119
Suggest `.into()` when all other coercion suggestions fail Also removes some bogus suggestions because we now short-circuit when offering coercion suggestions(instead of, for example, suggesting every one that could possibly apply) Fixes #102415
2022-10-05Suggest calling method if fn does not existMichael Goulet-6/+120
2022-10-05Delay function resolution error until typeckMichael Goulet-1/+17