about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/check
AgeCommit message (Collapse)AuthorLines
2023-03-08Don't report E0740 for type errorMichael Goulet-1/+3
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-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-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-05Auto merge of #108351 - petrochenkov:rmdit, r=cjgillotbors-4/+2
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-03Match unmatched backticks in comments in compiler/est31-1/+1
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-4/+2
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-01Use FxIndexSet instead of FxHashSet for asm_target_features query.Michael Woerister-3/+3
2023-02-28Descriptive error when users try to combine RPITIT/AFIT with specializationMichael Goulet-4/+36
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-24Rename many interner functions.Nicholas Nethercote-16/+13
(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-23Auto merge of #108369 - compiler-errors:ty-error-more, r=BoxyUwUbors-1/+1
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-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-3/+3
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-22Rename ty_error_with_guaranteed to ty_error, ty_error to ty_error_miscMichael Goulet-1/+1
2023-02-22Remove type-traversal trait aliasesAlan Egerton-10/+12
2023-02-22diagnostics: if AssocFn has self argument, describe as methodMichael Howell-3/+3
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.
2023-02-21Auto merge of #108138 - compiler-errors:malformed-fn-trait, r=TaKO8Kibors-51/+1
Move `Fn*` traits malformedness protections to typeck I found it strange that we were doing a custom well-formedness check just for the `Fn*` traits' `call_*` fn items. My understanding from the git history is that this is just to avoid ICEs later on in typeck. Well, that well-formedness check isn't even implemented correctly for `FnOnce::call_once`, or `FnMut::call_mut` for that matter. Instead, this PR just makes the typeck checks more robust, and leaves it up to the call-site to report errors when lang items are implemented in funny ways. This coincidentally fixes another ICE where a the `Add` lang item is implemented with a `add` item that's a const instead of a method.
2023-02-18Assume we can normalize trait default method RPITITs in param-env insteadMichael Goulet-1/+1
2023-02-18Auto merge of #108112 - nnethercote:clarify-iterator-interners, ↵bors-22/+10
r=oli-obk,compiler-errors Clarify iterator interners I found the iterator interners very confusing. This PR clarifies things. r? `@compiler-errors`
2023-02-17Auto merge of #108075 - WaffleLapkin:de-arena-allocates-you-OwO, r=Nilstriebbors-46/+46
Remove `arena_cache` modifier from `associated_item` query & copy `ty::AssocItem` instead of passing by ref r? `@ghost`
2023-02-17Replace more `mk_foo` calls with `infer_foo`.Nicholas Nethercote-9/+5
2023-02-17Use `IntoIterator` for `mk_fn_sig`.Nicholas Nethercote-12/+4
This makes a lot of call sites nicer.
2023-02-17Replace `mk_foo` calls with `infer_foo` where possible.Nicholas Nethercote-1/+1
There are several `mk_foo`/`intern_foo` pairs, where the former takes an iterator and the latter takes a slice. (This naming convention is bad, but that's a fix for another PR.) This commit changes several `mk_foo` occurrences into `intern_foo`, avoiding the need for some `.iter()`/`.into_iter()` calls. Affected cases: - mk_type_list - mk_tup - mk_substs - mk_const_list
2023-02-16fix new usage of type_ofKyle Matsuda-1/+1
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-39/+30
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-27/+40
2023-02-16Move call trait lang item malformed check to typeckMichael Goulet-51/+1
2023-02-16Auto merge of #108020 - nnethercote:opt-mk_region, r=compiler-errorsbors-40/+30
Optimize `mk_region` PR #107869 avoiding some interning under `mk_ty` by special-casing `Ty` variants with simple (integer) bodies. This PR does something similar for regions. r? `@compiler-errors`
2023-02-15Rollup merge of #108010 - compiler-errors:can_eq-returns-bool, r=lcnrMatthias Krüger-2/+2
Make `InferCtxt::can_eq` and `InferCtxt::can_sub` return booleans Nobody matches on the result, nor does the result return anything useful...
2023-02-15Copy `ty::AssocItem` all other the placeMaybe Waffle-46/+46
2023-02-15Auto merge of #108006 - cjgillot:def-impl, r=oli-obkbors-120/+77
Avoid accessing HIR when it can be avoided Experiment to see if it helps some incremental cases. Will be rebased once https://github.com/rust-lang/rust/pull/107942 gets merged. r? `@ghost`
2023-02-15Add specialized variants of `mk_region`.Nicholas Nethercote-40/+30
Much like there are specialized variants of `mk_ty`. This will enable some optimization in the next commit. Also rename the existing `re_error*` functions as `mk_re_error*`, for consistency.
2023-02-14Even less HIR.Camille GILLOT-14/+8
2023-02-14Fetch less HIR in signature check.Camille GILLOT-111/+72
2023-02-14Add `of_trait` to DefKind::Impl.Camille GILLOT-13/+15
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-1/+1
2023-02-13Make can_eq and can_sub return booleansMichael Goulet-2/+2
2023-02-13Rename folder traits' `tcx` method to `interner`Alan Egerton-5/+5
2023-02-13Make folding traits generic over the InternerAlan Egerton-2/+2
2023-02-13Make visiting traits generic over the InternerAlan Egerton-4/+4
2023-02-13Alias folding/visiting traits instead of re-exportAlan Egerton-6/+6
2023-02-13Reduce direct `mk_ty` usage.Nicholas Nethercote-4/+3
We use more specific `mk_*` functions in most places, might as well use them as much as possible.
2023-02-09Change to `ReError(ErrorGuaranteed)`Esteban Küber-7/+1
2023-02-09Introduce `ReError`Esteban Küber-1/+1
CC #69314
2023-02-09Auto merge of #106938 - GuillaumeGomez:normalize-projection-field-ty, r=oli-obkbors-1/+1
Add missing normalization for union fields types Overshadows https://github.com/rust-lang/rust/pull/106808. From the experiment https://github.com/rust-lang/rust/pull/103985. In short, it allows to use projections as a type for union's fields. cc `@compiler-errors` r? `@oli-obk`
2023-02-07Replacing bound vars is actually instantiating a binderMichael Goulet-2/+2
2023-01-31Rollup merge of #107486 - compiler-errors:bound-ty-keep-name, r=oli-obkGuillaume Gomez-1/+1
Track bound types like bound regions When we instantiate bound types into placeholder types, we throw away the names for some reason. These names are particularly useful for error reporting once we have `for<T>` binders. r? types