about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2023-03-07Error code E0794 for late-bound lifetime parameter error.Christopher Acosta-1/+1
2023-03-07Rollup merge of #108460 - obeis:hir-analysis-migrate-diagnostics-2, ↵Matthias Krüger-28/+60
r=compiler-errors migrate `rustc_hir_analysis` to session diagnostic [Part Two] migrate `rustc_hir_analysis` to session diagnostic (part two) files list: - rustc_hir_analysis/variance/* - rustc_hir_analysis/missing_cast_for_variadic_arg.rs - rustc_hir_analysis/sized_unsized_cast.rs Updates #100717
2023-03-07Auto merge of #95317 - Jules-Bertholet:round_ties_to_even, ↵bors-0/+2
r=pnkfelix,m-ou-se,scottmcm Add `round_ties_even` to `f32` and `f64` Tracking issue: #96710 Redux of #82273. See also #55107 Adds a new method, `round_ties_even`, to `f32` and `f64`, that rounds the float to the nearest integer , rounding halfway cases to the number with an even least significant bit. Uses the `roundeven` LLVM intrinsic to do this. Of the five IEEE 754 rounding modes, this is the only one that doesn't already have a round-to-integer function exposed by Rust (others are `round`, `floor`, `ceil`, and `trunc`). Ties-to-even is also the rounding mode used for int-to-float and float-to-float `as` casts, as well as float arithmentic operations. So not having an explicit rounding method for it seems like an oversight. Bikeshed: this PR currently uses `round_ties_even` for the name of the method. But maybe `round_ties_to_even` is better, or `round_even`, or `round_to_even`?
2023-03-06Implement type_of for RPITITs assoc typeSantiago Pastorino-1/+20
2023-03-06Properly implement explicit_item_bounds for RPITITs trait assoc tySantiago Pastorino-11/+23
2023-03-06Map to new synthesized assoc ty for RPITITs in astconvSantiago Pastorino-1/+9
2023-03-06Collect newly synthesized RPITITs on ImplTraitInTraitCollectorSantiago Pastorino-1/+1
2023-03-06Avoid accessing HIR for RPITITs on check_type_boundsSantiago Pastorino-7/+14
2023-03-06emit the suspicious_auto_trait_impls for negative impls as wellMu42-4/+0
2023-03-05Rollup merge of #108764 - cjgillot:dpm-adapt, r=compiler-errorsMatthias Krüger-0/+8
Tweaks to -Zdrop-tracking-mir Split from https://github.com/rust-lang/rust/pull/107421 3 commits: 1 diagnostic improvement and 2 ICEs.
2023-03-05Rollup merge of #108746 - ↵Matthias Krüger-2/+2
compiler-errors:rpitit-dont-project-default-w-no-valu, r=cjgillot Don't project to RPITIT that has no default value Replicates this behavior, but for RPITIT projection logic (which currently is separate) https://github.com/rust-lang/rust/blob/b1719530f44e3c8ec903f76020a52bd8764d5d10/compiler/rustc_trait_selection/src/traits/project.rs#L2105-L2115 Fixes #108738
2023-03-05Auto merge of #108351 - petrochenkov:rmdit, r=cjgillotbors-10/+8
rustc_middle: Remove trait `DefIdTree` This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-05drop_tracking_mir: diagnose recursive generator.Camille GILLOT-0/+8
2023-03-05migrate `rustc_hir_analysis` to session diagnosticObei Sideg-28/+60
part two files list: rustc_hir_analysis/variance/* rustc_hir_analysis/missing_cast_for_variadic_arg.rs rustc_hir_analysis/sized_unsized_cast.rs
2023-03-04Don't project to RPITIT that has no default valueMichael Goulet-2/+2
2023-03-03Rollup merge of #108694 - est31:backticks_matchmaking_comments, r=NilstriebMatthias Krüger-2/+2
Match unmatched backticks in compiler/ comments r? ``@Nilstrieb`` as per [advice](https://github.com/rust-lang/rust/pull/108685#issuecomment-1453018499)
2023-03-03Rollup merge of #108553 - compiler-errors:non-lt-late-bound-in-anon-ct, ↵Matthias Krüger-5/+75
r=petrochenkov Deny capturing late-bound non-lifetime param in anon const Introduce a new AnonConstBoundary so we can detect when we capture a late-bound non-lifetime param with `non_lifetime_binders` enabled. In the future, we could technically do something like introduce an early-bound parameter on the anon const, and stick the late-bound param in its substs (kinda like how we turn late-bound lifetimes in opaques into early-bound ones). But for now, just deny it so we don't ICE. Fixes #108191
2023-03-03Match unmatched backticks in comments in compiler/est31-2/+2
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-10/+8
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-02Rollup merge of #108575 - compiler-errors:erase, r=estebankMatthias Krüger-2/+4
Erase **all** regions when probing for associated types on ambiguity in astconv Fixes #108562
2023-03-01Remove last instances of HashSet in query result types.Michael Woerister-1/+1
2023-03-01Use FxIndexSet instead of FxHashSet for asm_target_features query.Michael Woerister-3/+3
2023-03-01Auto merge of #108587 - matthiaskrgr:rollup-rw6po59, r=matthiaskrgrbors-20/+16
Rollup of 10 pull requests Successful merges: - #108376 (compiler/rustc_session: fix sysroot detection logic) - #108400 (add llvm cgu instructions stats to perf) - #108496 (fix #108495, postfix decrement and prefix decrement has no warning) - #108505 (Further unify validity intrinsics) - #108520 (Small cleanup to `one_bound_for_assoc_type`) - #108560 (Some `infer/mod.rs` cleanups) - #108563 (Make mailmap more correct) - #108564 (Fix `x clean` with specific paths) - #108571 (Add contains_key to SortedIndexMultiMap) - #108578 (Update Fuchsia platform team members) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-01Rollup merge of #108520 - compiler-errors:one-bound-nit, r=jackh726Matthias Krüger-20/+16
Small cleanup to `one_bound_for_assoc_type` Use fewer closures :)
2023-03-01Rollup merge of #108554 - compiler-errors:late-bound-object-default, r=oli-obkMatthias Krüger-36/+45
Only look for param in item's generics if it actually comes from generics Record whether a `hir::GenericParam` comes from an item's generics, or from a `for<...>` binder. Then, only look for the param in `object_lifetime_default` if it actually comes from the item's generics. Fixes #108177
2023-02-28Erase **all** regions when probing for associated types in astconvMichael Goulet-2/+4
2023-02-28Only look for param in generics if it actually comes from genericsMichael Goulet-36/+45
2023-02-28Deny capturing late-bound non-lifetime param in anon constMichael Goulet-5/+75
2023-02-28Descriptive error when users try to combine RPITIT/AFIT with specializationMichael Goulet-4/+36
2023-02-27Rollup merge of #108363 - cjgillot:unused-crate, r=WaffleLapkinMatthias Krüger-153/+2
Move the unused extern crate check back to the resolver. It doesn't have anything to do in `rustc_hir_typeck`.
2023-02-27Rollup merge of #108319 - ↵Matthias Krüger-0/+7
compiler-errors:dont-project-to-specializable-rpitits, r=lcnr Don't project specializable RPITIT projection This effective rejects specialization + RPITIT/AFIT (usages of `impl Trait` in traits) because the implementation is significantly complicated over making regular "default" trait method bodies work. I have another PR that experimentally fixes all this, but the code may not be worth investing in.
2023-02-26Small cleanup to one_bound_for_assoc_typeMichael Goulet-20/+16
2023-02-26Rollup merge of #108379 - compiler-errors:hir-error-guaranteed, r=cjgillotMatthias Krüger-1/+1
Add `ErrorGuaranteed` to `hir::{Expr,Ty}Kind::Err` variants First step in making the `Err` variants of `ExprKind` and `TyKind` require an `ErrorGuaranteed` during parsing. Making the corresponding AST versions require `ErrorGuaranteed` is a bit harder, whereas it was pretty easy to do this for HIR, so let's do that first. The only weird thing about this PR is that `ErrorGuaranteed` is moved to `rustc_span`. This is *certainly* not the right place to put it, but `rustc_hir` cannot depend on `rustc_error` because the latter already depends on the former. Should I just pull out some of the error machinery from `rustc_error` into an even more minimal crate that `rustc_hir` can depend on? Advice would be appreciated.
2023-02-26hir-analysis: make a helpful noteTshepang Mbambo-1/+2
2023-02-25Add ErrorGuaranteed to HIR TyKind::ErrMichael Goulet-1/+1
2023-02-25Auto merge of #108450 - matthiaskrgr:rollup-rqvfgu3, r=matthiaskrgrbors-63/+84
Rollup of 7 pull requests Successful merges: - #108354 (Update `fuchsia-test-runner.py` and docs) - #108404 (support `x fmt` for sub and outside of rust directories) - #108407 (docs: use intra-doc links for `Vec::get(_mut)`) - #108410 (rustdoc: avoid including `<li>` tags in item table short desc) - #108412 (Fix GUI test navigation bug) - #108433 (Wrap missing provider message correctly) - #108434 (Migrate `rustc_hir_analysis` to session diagnostic [Part One]) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-25Auto merge of #108250 - nnethercote:rename-interner-funcs, r=compiler-errorsbors-26/+25
Rename interner funcs This PR cleans up some inconsistencies in interner naming. Best reviewed one commit at a time. r? `@compiler-errors`
2023-02-25Rollup merge of #108434 - obeis:hir-analysis-migrate-diagnostics, r=NilstriebMatthias Krüger-63/+84
Migrate `rustc_hir_analysis` to session diagnostic [Part One] Finishing `lib.rs` file Updates #100717 r? ``@davidtwco``
2023-02-24Migrate `rustc_hir_analysis` to session diagnosticObei Sideg-63/+84
Part one, lib.rs file
2023-02-24Rollup merge of #108401 - notriddle:notriddle/diagnostics-article, ↵Dylan DPC-1/+1
r=compiler-errors diagnostics: remove inconsistent English article "this" from E0107 Consider [`tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`][issue-102768.stderr], the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in [`tests/ui/lint/dead-code/issue-85255.stderr`][issue-85255.stderr]. They don't have articles, so it seems unnecessary to have one here. [issue-102768.stderr]: https://github.com/rust-lang/rust/blob/07c993eba8b76eae497e98433ae075b00f01be10/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr [issue-85255.stderr]: https://github.com/rust-lang/rust/blob/07c993eba8b76eae497e98433ae075b00f01be10/tests/ui/lint/dead-code/issue-85255.stderr
2023-02-24Replace a `mk_ty` call with `mk_bound`.Nicholas Nethercote-1/+1
2023-02-24Rename many interner functions.Nicholas Nethercote-25/+24
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-23diagnostics: remove inconsistent English article "this" from E0107Michael Howell-1/+1
Consider `tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`, the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in `tests/ui/lint/dead-code/issue-85255.stderr`. They don't have articles, so it seems unnecessary to have one here.
2023-02-23Auto merge of #108369 - compiler-errors:ty-error-more, r=BoxyUwUbors-31/+31
Use `tcx.ty_error_with_guaranteed` in more places, rename variants 1. Use `ty_error_with_guaranteed` more so we don't delay so many span bugs 2. Rename `ty_error_with_guaranteed` to `ty_error`, `ty_error` to `ty_error_misc`. This is to incentivize using the former over the latter in cases where we already are witness to a `ErrorGuaranteed` token. Second commit is just name replacement, so the first commit can be reviewed on its own with more scrutiny.
2023-02-23Rollup merge of #108373 - tshepang:where-clause-on-main, r=compiler-errorsMatthias Krüger-10/+13
hir-analysis: make where-clause-on-main diagnostic translatable
2023-02-23Drive-by assertion in collect_return_position_impl_trait_in_trait_tysMichael Goulet-0/+7
2023-02-23Auto merge of #108324 - notriddle:notriddle/assoc-fn-method, ↵bors-14/+11
r=compiler-errors,davidtwco,estebank,oli-obk diagnostics: if AssocFn has self argument, describe as method Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515 This commit also changes the tooltips on rustdoc intra-doc links targeting methods. For anyone not sure why this is being done, see the Reference definitions of these terms in <https://doc.rust-lang.org/1.67.1/reference/items/associated-items.html#methods> > Associated functions whose first parameter is named `self` are called methods and may be invoked using the [method call operator](https://doc.rust-lang.org/1.67.1/reference/expressions/method-call-expr.html), for example, `x.foo()`, as well as the usual function call notation. In particular, while this means it's technically correct for rustc to refer to a method as an associated function (and there are a few cases where it'll still do so), rustc *must never* use the term "method" to refer to an associated function that does not have a `self` parameter.
2023-02-23hir-analysis: make where-clause-on-main diagnostic translatableTshepang Mbambo-10/+13
2023-02-22Rename ty_error_with_guaranteed to ty_error, ty_error to ty_error_miscMichael Goulet-27/+23
2023-02-22Use ty_error_with_guaranteed in many more placesMichael Goulet-13/+17