about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
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-27/+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-27/+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
2022-10-05Validate opaques in default trait bodies, don't normalize unless a body is ↵Michael Goulet-23/+33
provided
2022-10-04Rollup merge of #102650 - ↵Michael Howell-1/+1
Rageking8:slightly-improve-no-return-for-returning-function-error, r=compiler-errors Slightly improve no return for returning function error Fixes #100607 The rationale is that absolute beginners will be slightly confused as to why certain lines of code in a function does not require a semicolon. (I have actually witness a beginner having this confusion). Hence, a slight rationale is added "to return this value", which signals to the user that after removing said semicolon the value is returned resolving that error. However, if this is not desirable, I welcome any other suggestions. Thanks.
2022-10-05Suggest `.into()` when all other coercion suggestions failMichael Goulet-36/+119
2022-10-05Support default-body trait functions with RPITITMichael Goulet-3/+2
2022-10-04It's not about types or consts, but the lack of regionsOli Scherer-9/+7
2022-10-04find the correct lang item for rangesyukang-33/+46
2022-10-04slightly improve no return for returning function errorRageking8-1/+1
2022-10-04fix #102396, suggest parentheses for possible range methodsyukang-5/+95
2022-10-04Auto merge of #102644 - matthiaskrgr:rollup-rg0sw41, r=matthiaskrgrbors-2/+57
Rollup of 7 pull requests Successful merges: - #102441 (Suggest unwrap_or_else when a closure is given) - #102547 (Migrate CSS theme for search results) - #102567 (Delay evaluating lint primary message until after it would be suppressed) - #102624 (rustdoc: remove font family CSS on `.rustdoc-toggle summary::before`) - #102628 (Change the parameter name of From::from to `value`) - #102637 (Ignore fuchsia on two compiler tests) - #102639 (Improve spans when splitting multi-char operator tokens for proc macros.) Failed merges: - #102496 (Suggest `.into()` when all other coercion suggestions fail) r? `@ghost` `@rustbot` modify labels: rollup
2022-10-04Rollup merge of #102441 - chenyukang:fix-102320-unwrap_or_else, ↵Matthias Krüger-2/+57
r=compiler-errors Suggest unwrap_or_else when a closure is given Fixes #102320 r? `@compiler-errors`
2022-10-04Auto merge of #102395 - davidtwco:translation-rename-typeck, r=compiler-errorsbors-44/+45
errors: rename `typeck.ftl` to `hir_analysis.ftl` In #102306, `rustc_typeck` was renamed to `rustc_hir_analysis` but the diagnostic resources were not renamed - which is what this pull request changes.
2022-10-03errors: rename `typeck.ftl` to `hir_analysis.ftl`David Wood-44/+45
In #102306, `rustc_typeck` was renamed to `rustc_hir_analysis` but the diagnostic resources were not renamed - which is what this commit changes. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-03`HirId` for `deferred_transmute_checks`lcnr-12/+15
2022-10-02Auto merge of #98354 - camsteffen:is-some-and-by-value, r=m-ou-sebors-1/+1
Change `is_some_and` to take by value Consistent with other function-accepting `Option` methods. Tracking issue: #93050 r? `@m-ou-se`
2022-10-02fix #102320, suggest unwrap_or_else when a closure is passed to unwrap_or ↵yukang-2/+57
instead of suggesting calling it
2022-10-01Change feature name to is_some_andCameron Steffen-1/+1