summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2022-10-29Rollup merge of #103625 - WaffleLapkin:no_tyctxt_dogs_allowed, r=compiler-errorsGuillaume Gomez-3/+3
Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functions Functions in answer: - `Ty::is_freeze` - `Ty::is_sized` - `Ty::is_unpin` - `Ty::is_copy_modulo_regions` This allows to remove a lot of useless `.at(DUMMY_SP)`, making the code a bit nicer :3 r? `@compiler-errors`
2022-10-29Rollup merge of #103618 - nnethercote:rename-OwnerId-fields, r=compiler-errorsGuillaume Gomez-115/+116
Rename some `OwnerId` fields. `@spastorino` noticed some silly expressions like `item_id.def_id.def_id`. This commit renames several `def_id: OwnerId` fields as `owner_id`, so those expressions become `item_id.owner_id.def_id`. `item_id.owner_id.local_def_id` would be even clearer, but the use of `def_id` for values of type `LocalDefId` is *very* widespread, so I left that alone. r? `@compiler-errors`
2022-10-29Rename some `OwnerId` fields.Nicholas Nethercote-115/+116
spastorino noticed some silly expressions like `item_id.def_id.def_id`. This commit renames several `def_id: OwnerId` fields as `owner_id`, so those expressions become `item_id.owner_id.def_id`. `item_id.owner_id.local_def_id` would be even clearer, but the use of `def_id` for values of type `LocalDefId` is *very* widespread, so I left that alone.
2022-10-29Auto merge of #103714 - matthiaskrgr:rollup-kajt3i8, r=matthiaskrgrbors-0/+7
Rollup of 7 pull requests Successful merges: - #102961 (Make `CStr::from_ptr` `const`.) - #103342 (Add test for issue 98634) - #103383 (Note scope of TAIT more accurately) - #103656 (Specialize ToString for Symbol) - #103663 (rustdoc: remove redundant CSS/DOM `div.search-container`) - #103664 (rustdoc-json-types: Improve ItemSummary::path docs) - #103704 (Add a test for TAIT used with impl/dyn Trait inside RPIT) Failed merges: - #103618 (Rename some `OwnerId` fields.) r? `@ghost` `@rustbot` modify labels: rollup
2022-10-29Rollup merge of #103383 - compiler-errors:tait-scope, r=oli-obkMatthias Krüger-0/+7
Note scope of TAIT more accurately This maybe explains why the person was confused in #101897, since we say "same module" but really should've said "same impl". r? ``@oli-obk``
2022-10-29Auto merge of #102698 - michaelwoerister:unord-collections, r=lncrbors-3/+4
Introduce UnordMap, UnordSet, and UnordBag (MCP 533) This is the start of implementing [MCP 533](https://github.com/rust-lang/compiler-team/issues/533). I followed `@eddyb's` suggestion of naming the collection types `Unord(Map/Set/Bag)` which is a bit easier to type than `Unordered(Map/Set/Bag)` r? `@eddyb`
2022-10-28Auto merge of #103671 - matthiaskrgr:rollup-iuugpep, r=matthiaskrgrbors-0/+30
Rollup of 5 pull requests Successful merges: - #102642 (Add tests for static async functions in traits) - #103283 (Add suggestions for unsafe impl error codes) - #103523 (Fix unwanted merge of inline doc comments for impl blocks) - #103550 (diagnostics: do not suggest static candidates as traits to import) - #103641 (Don't carry MIR location in `ConstraintCategory::CallArgument`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-28Rollup merge of #103609 - BoxyUwU:fix_impl_self_cycle, r=compiler-errorsMatthias Krüger-2/+19
Emit a nicer error on `impl Self {` currently it emits a "cycle detected error" but this PR makes it emit a more user friendly error specifically saying that `Self` is disallowed in that position. this is a pretty hacky fix so i dont expect this to be merged (I basically only made this PR because i wanted to see if CI passes) r? ``@compiler-errors``
2022-10-28Rollup merge of #103608 - compiler-errors:rpitit-early-lt, r=cjgillotMatthias Krüger-1/+1
Remap early bound lifetimes in return-position `impl Trait` in traits too Fixes part of #103457 r? ``@cjgillot,`` though feel free to reassign, just thought you'd have sufficient context to review.
2022-10-28Rollup merge of #103283 - nbarrios1337:unsafe-impl-suggestions, r=cjgillotMatthias Krüger-0/+30
Add suggestions for unsafe impl error codes Adds suggestions for users to add `unsafe` to trait impls that should be `unsafe`, and remove `unsafe` from trait impls that do not require `unsafe` With the folllowing code: ```rust struct Foo {} struct Bar {} trait Safe {} unsafe trait Unsafe {} impl Safe for Foo {} // ok impl Unsafe for Foo {} // E0200 unsafe impl Safe for Bar {} // E0199 unsafe impl Unsafe for Bar {} // ok // omitted empty main fn ``` The current rustc output is: ``` error[E0199]: implementing the trait `Safe` is not unsafe --> e0200.rs:13:1 | 13 | unsafe impl Safe for Bar {} // E0199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0200]: the trait `Unsafe` requires an `unsafe impl` declaration --> e0200.rs:11:1 | 11 | impl Unsafe for Foo {} // E0200 | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors Some errors have detailed explanations: E0199, E0200. For more information about an error, try `rustc --explain E0199`. ``` With this PR, the future rustc output would be: ``` error[E0199]: implementing the trait `Safe` is not unsafe --> ../../temp/e0200.rs:13:1 | 13 | unsafe impl Safe for Bar {} // E0199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove `unsafe` from this trait implementation | 13 - unsafe impl Safe for Bar {} // E0199 13 + impl Safe for Bar {} // E0199 | error[E0200]: the trait `Unsafe` requires an `unsafe impl` declaration --> ../../temp/e0200.rs:11:1 | 11 | impl Unsafe for Foo {} // E0200 | ^^^^^^^^^^^^^^^^^^^^^^ | = note: the trait `Unsafe` enforces invariants that the compiler can't check. Review the trait documentation and make sure this implementation upholds those invariants before adding the `unsafe` keyword help: add `unsafe` to this trait implementation | 11 | unsafe impl Unsafe for Foo {} // E0200 | ++++++ error: aborting due to 2 previous errors Some errors have detailed explanations: E0199, E0200. For more information about an error, try `rustc --explain E0199`. ``` ``@rustbot`` label +T-compiler +A-diagnostics +A-suggestion-diagnostics
2022-10-27tidy + move logic to fnBoxy-29/+4
2022-10-27use proper spansBoxy-7/+12
2022-10-27DoItBoxy-1/+38
2022-10-27Introduce UnordMap, UnordSet, and UnordBag (see MCP 533)Michael Woerister-3/+4
MCP 533: https://github.com/rust-lang/compiler-team/issues/533 Also, as an example, substitute UnordMap for FxHashMap in used_trait_imports query result.
2022-10-27Accept `TyCtxt` instead of `TyCtxtAt` in `Ty::is_*` functionsMaybe Waffle-3/+3
Functions in answer: - `Ty::is_freeze` - `Ty::is_sized` - `Ty::is_unpin` - `Ty::is_copy_modulo_regions`
2022-10-27Rollup merge of #103586 - compiler-errors:issue-103573, r=jackh726Matthias Krüger-0/+4
Process registered region obligation in `resolve_regions_with_wf_tys` Fixes #103573
2022-10-27Rollup merge of #103525 - oli-obk:const_impl_on_non_const_trait, r=lcnrMatthias Krüger-21/+105
Move a wf-check into the site where the value is instantiated r? ``@lcnr``
2022-10-27Rollup merge of #103475 - oli-obk:generic_param_indices, r=lcnrMatthias Krüger-13/+14
Make param index generation a bit more robust r? ````@lcnr```` While not really necessary for closure and anon const ids, it's strictly more correct
2022-10-27Remap early bound lifetimes tooMichael Goulet-1/+1
2022-10-26Process registered region obligation in resolve_regions_with_wf_tysMichael Goulet-0/+4
2022-10-26Rollup merge of #95710 - ↵Dylan DPC-1/+1
fee1-dead-contrib:stabilize_arbitrary_enum_discriminant, r=joshtriplett Stabilize arbitrary_enum_discriminant, take 2 Documentation has been updated in https://github.com/rust-lang/reference/pull/1055. cc #86860 for previous stabilization report. Not yet marks https://github.com/rust-lang/rust/issues/60553 as done: need documentation in the rust reference.
2022-10-25Split diagnostic details out into a separate function and fluent filesOli Scherer-26/+48
2022-10-25Move a wf-check into the site where the value is instantiatedOli Scherer-21/+83
2022-10-24Delay span bug when we can't map lifetimes back in collect_trait_impl_trait_tysMichael Goulet-2/+10
2022-10-24Make param index generation a bit more robustOli Scherer-13/+14
2022-10-23Auto merge of #103345 - Nilstrieb:diag-flat, r=compiler-errorsbors-29/+29
Flatten diagnostic slug modules This makes it easier to grep for the slugs in the code. See https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Localization.20infra.20interferes.20with.20grepping.20for.20error for more discussion about it. This was mostly done with a few regexes and a bunch of manual work. This also exposes a pretty annoying inconsistency for the extra labels. Some of the extra labels are defined as additional properties in the fluent message (which makes them not prefixed with the crate name) and some of them are new fluent messages themselves (which makes them prefixed with the crate name). I don't know whether we want to clean this up at some point but it's useful to know. r? `@davidtwco`
2022-10-23Migrate all diagnosticsNilstrieb-29/+29
2022-10-23Rollup merge of #103123 - compiler-errors:early-binder-iter, r=cjgillotMatthias Krüger-12/+4
Introduce `subst_iter` and `subst_iter_copied` on `EarlyBinder` Makes working with bounds lists a bit easier, which I seem to do a lot. Specifically, means that we don't need to do `.transpose_iter().map(|(pred, _)| *pred)` every time we want to iterate through an `EarlyBinder<&'tcx [(Predicate, Span)]>` (and even then, still have to call `subst` later), which was a very awkward idiom imo.
2022-10-22Auto merge of #103227 - lcnr:bye-bye-unevaluated-const, r=oli-obkbors-9/+4
stop using `ty::UnevaluatedConst` directly best reviewed commit by commit. simplifies #99798 because we now don't have to expand `ty::UnevaluatedConst` to `ty::Const`. I also remember some other places where using `ty::UnevaluatedConst` directly was annoying and caused issues, though I don't quite remember what they were rn '^^ r? `@oli-obk` cc `@JulianKnodt`
2022-10-22Introduce subst_iter and subst_iter_copied on EarlyBinderMichael Goulet-12/+4
2022-10-22Stabilize arbitrary_enum_discriminant, take 2Deadbeef-1/+1
2022-10-22Note scope of TAIT more accuratelyMichael Goulet-0/+7
2022-10-22Rollup merge of #103351 - oli-obk:tilde_const_impls, r=fee1-deadMatthias Krüger-7/+1
Require Drop impls to have the same constness on its bounds as the bounds on the struct have r? ``@fee1-dead``
2022-10-21Require Drop impls to have the same constness on its bounds as the bounds on ↵Oli Scherer-7/+1
the struct have
2022-10-21Auto merge of #103344 - Dylan-DPC:rollup-d1rpfvx, r=Dylan-DPCbors-11/+14
Rollup of 6 pull requests Successful merges: - #102287 (Elaborate supertrait bounds when triggering `unused_must_use` on `impl Trait`) - #102922 (Filtering spans when emitting json) - #103051 (translation: doc comments with derives, subdiagnostic-less enum variants, more derive use) - #103111 (Account for hygiene in typo suggestions, and use them to point to shadowed names) - #103260 (Fixup a few tests needing asm support) - #103321 (rustdoc: improve appearance of source page navigation bar) Failed merges: - #103209 (Diagnostic derives: allow specifying multiple alternative suggestions) r? `@ghost` `@rustbot` modify labels: rollup
2022-10-21Rollup merge of #102922 - kper:bugfix/102902-filtering-json, r=oli-obkDylan DPC-11/+14
Filtering spans when emitting json According to the issue #102902, we shouldn't emit spans which have an empty span and no suggested replacement.
2022-10-20Add fix suggestions for E0199, E0200, and E0569Nicolas Barrios-0/+30
2022-10-20update doc linkslcnr-2/+1
2022-10-20rustc_hir_typeck: fix paths and partially mv fileslcnr-1027/+31
2022-10-20rustc_hir_typeck: move whole fileslcnr-32901/+0
2022-10-20Implement assertions and fixes to not emit empty spans without suggestionsKevin Per-11/+14
2022-10-20Auto merge of #102417 - oli-obk:opaque_lifetimes2, r=jackh726bors-0/+1
Require lifetime bounds for opaque types in order to allow hidden types to capture said lifetimes fixes #96996 cc `@aliemjay`
2022-10-19Rollup merge of #103223 - compiler-errors:deref-sugg-slow, r=wesleywiserMatthias Krüger-5/+6
Use already checked RHS ty for LHS deref suggestions There's no reason to do the `check_lhs_assignable` and RHS `check_expr_with_hint` in that order, so invert them and use the typeck results to avoid exponential blowup on error. Fixes #103219
2022-10-19Rollup merge of #103034 - nathanwhit:let-chains-rhs-temporaries, r=wesleywiserDylan DPC-2/+6
Let expressions on RHS shouldn't be terminating scopes Fixes #100276. Before this PR, we were unconditionally marking the RHS of short-circuiting binary expressions as a terminating scope. In the case of a let chain where the `let` expression was on the RHS, this meant that temporaries within the `let` expr would only live until the end of the expression. Since this only affected the RHS, this led to surprising behavior ([example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=d1b0a5d1f01882f9c89c2194a75eb19f)). After this PR, we only mark the RHS as a terminating scope if it is not a `let` expression.
2022-10-19Use already checked RHS ty for LHS deref suggestionsMichael Goulet-5/+6
2022-10-19instantiate -> constructMichael Goulet-4/+2
2022-10-19Generalize call suggestion for unsatisfied predicateMichael Goulet-7/+3
2022-10-19Standardize arg suggestions between typeck and trait selectionMichael Goulet-1/+1
2022-10-18change `ConstEvaluatable` to use `ty::Const`lcnr-9/+4
2022-10-17Rollup merge of #102454 - chenyukang:fix-102396-missing-parentheses, r=lcnrMatthias Krüger-2/+113
Suggest parentheses for possible range method calling Fixes #102396