about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2023-02-18Don't ICE on bound types in sized conditionsMichael Goulet-4/+5
2023-02-18Add consider_implied_clauseMichael Goulet-102/+97
2023-02-18Check that built-in callable types validate their output type is `Sized` (in ↵Michael Goulet-14/+45
new solver)
2023-02-18Remove default trait RPITIT candidatesMichael Goulet-33/+3
2023-02-18Auto merge of #108112 - nnethercote:clarify-iterator-interners, ↵bors-9/+7
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-12/+12
Remove `arena_cache` modifier from `associated_item` query & copy `ty::AssocItem` instead of passing by ref r? `@ghost`
2023-02-17Avoid double-interning some `BoundVariableKind`s.Nicholas Nethercote-2/+0
This function has this line twice: ``` let bound_vars = tcx.intern_bound_variable_kinds(&bound_vars); ``` The second occurrence is effectively a no-op, because the first occurrence interned any that needed it.
2023-02-17Replace more `mk_foo` calls with `infer_foo`.Nicholas Nethercote-2/+2
2023-02-17Use `IntoIterator` for `mk_fn_sig`.Nicholas Nethercote-2/+2
This makes a lot of call sites nicer.
2023-02-17Remove the `InternIteratorElement` impl for `&'a T`.Nicholas Nethercote-1/+1
`InternIteratorElement` is a trait used to intern values produces by iterators. There are three impls, corresponding to iterators that produce different types: - One for `T`, which operates straightforwardly. - One for `Result<T, E>`, which is fallible, and will fail early with an error result if any of the iterator elements are errors. - One for `&'a T`, which clones the items as it iterates. That last one is bad: it's extremely easy to use it without realizing that it clones, which goes against Rust's normal "explicit is better" approach to cloning. So this commit just removes it. In practice, there weren't many use sites. For all but one of them `into_iter()` could be used, which avoids the need for cloning. And for the one remaining case `copied()` is used.
2023-02-17Replace `mk_foo` calls with `infer_foo` where possible.Nicholas Nethercote-3/+3
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-17add predicate evaluation logicBoxy-10/+38
2023-02-17Add `Clause::ConstArgHasType` variantBoxy-0/+26
2023-02-17Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwUbors-19/+36
Switch to `EarlyBinder` for `type_of` query Part of the work to finish #105779 and implement https://github.com/rust-lang/types-team/issues/78. Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `type_of` query and removes `bound_type_of`. r? `@lcnr`
2023-02-16changes from reviewKyle Matsuda-1/+3
2023-02-16remove bound_type_of query; make type_of return EarlyBinder; change type_of ↵Kyle Matsuda-19/+19
in metadata
2023-02-16change usages of type_of to bound_type_ofKyle Matsuda-9/+24
2023-02-17Rollup merge of #108136 - eggyal:unmet_trait_alias_bound_on_generic_impl, ↵Matthias Krüger-3/+3
r=compiler-errors Do not ICE on unmet trait alias impl bounds Fixes #108132 I've also added some documentation to the `impl_def_id` field of `DerivedObligationCause` to try and minimise the risk of such errors in future. r? `@compiler-errors`
2023-02-17Rollup merge of #107489 - compiler-errors:non_lifetime_binders, r=cjgillotMatthias Krüger-3/+10
Implement partial support for non-lifetime binders This implements support for non-lifetime binders. It's pretty useless currently, but I wanted to put this up so the implementation can be discussed. Specifically, this piggybacks off of the late-bound lifetime collection code in `rustc_hir_typeck::collect::lifetimes`. This seems like a necessary step given the fact we don't resolve late-bound regions until this point, and binders are sometimes merged. Q: I'm not sure if I should go along this route, or try to modify the earlier nameres code to compute the right bound var indices for type and const binders eagerly... If so, I'll need to rename all these queries to something more appropriate (I've done this for `resolve_lifetime::Region` -> `resolve_lifetime::ResolvedArg`) cc rust-lang/types-team#81 r? `@ghost`
2023-02-16Clarify `DerivedObligationCause` may hold alias idAlan Egerton-3/+3
2023-02-16Properly check for builtin derivesclubby789-1/+1
2023-02-16Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgrbors-30/+16
Rollup of 7 pull requests Successful merges: - #106347 (More accurate spans for arg removal suggestion) - #108057 (Prevent some attributes from being merged with others on reexports) - #108090 (`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`) - #108092 (note issue for feature(packed_bundled_libs)) - #108099 (use chars instead of strings where applicable) - #108115 (Do not ICE on unmet trait alias bounds) - #108125 (Add new people to the compiletest review rotation) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-16Auto merge of #108020 - nnethercote:opt-mk_region, r=compiler-errorsbors-7/+6
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-16Replace some `then`s with some `then_some`sMaybe Waffle-4/+4
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-30/+16
2023-02-16Rollup merge of #108101 - matthiaskrgr:noclonecopy, r=compiler-errorsDylan DPC-2/+2
don't clone types that are copy
2023-02-16Be better about bound varsMichael Goulet-3/+10
2023-02-15don't clone types that are copyMatthias Krüger-2/+2
2023-02-15Rollup merge of #108047 - oli-obk:machine->🞋, r=RalfJungMatthias Krüger-1/+1
Use `target` instead of `machine` for mir interpreter integer handling. The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform. As per https://github.com/rust-lang/rust/pull/108029#issuecomment-1429791015 r? `@RalfJung`
2023-02-15Rollup merge of #108010 - compiler-errors:can_eq-returns-bool, r=lcnrMatthias Krüger-10/+11
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-12/+12
2023-02-15Use target instead of machine for mir interpreter integer handling.Oli Scherer-1/+1
The naming of `machine` only makes sense from a mir interpreter internals perspective, but outside users talk about the `target` platform
2023-02-15Auto merge of #107940 - BoxyUwU:const_ty_assertion_use_semantic_equality, ↵bors-2/+22
r=compiler-errors use semantic equality for const param type equality assertion Fixes #107898 See added test for what caused this ICE --- The current in assertion in `relate.rs` is rather inadequate when keeping in mind future expansions to const generics: - it will ICE when there are infer vars in a projection in a const param ty - it will spurriously return false when either ty has infer vars because of using `==` instead of `infcx.at(..).eq` - i am also unsure if it would be possible with `adt_const_params` to craft a situation where the const param type is not wf causing `normalize_erasing_regions` to `bug!` when we would have emitted a diagnostic. This impl feels pretty Not Great to me although i am not sure what a better idea would be. - We have to have the logic behind a query because neither `relate.rs` or `combine.rs` have access to trait solving machinery (without evaluating nested obligations this assert will become _far_ less useful under lazy norm, which consts are already doing) - `relate.rs` does not have access to canonicalization machinery which is necessary in order to have types potentially containing infer vars in query arguments. We could possible add a method to `TypeRelation` to do this assertion rather than a query but to avoid implementing the same logic over and over we'd probably end up with the logic in a free function somewhere in `rustc_trait_selection` _anyway_ so I don't think that would be much better. We could also just remove this assertion, it should not actually be necessary for it to be present. It has caught some bugs in the past though so if possible I would like to keep it. r? `@compiler-errors`
2023-02-15Add specialized variants of `mk_region`.Nicholas Nethercote-7/+6
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-14Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgrbors-2/+26
Rollup of 9 pull requests Successful merges: - #107573 (Update the minimum external LLVM to 14) - #107626 (Fix `x fix` on the standard library itself) - #107673 (update ICU4X to 1.1.0) - #107733 (Store metrics from `metrics.json` to CI PGO timer) - #108007 (Use `is_str` instead of string kind comparison) - #108033 (add an unstable `#[rustc_coinductive]` attribute) - #108039 (Refactor refcounted structural_impls via functors) - #108040 (Use derive attributes for uninteresting traversals) - #108044 (interpret: rename Pointer::from_addr → from_addr_invalid) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-14Rollup merge of #108033 - lcnr:coinductive-attr, r=compiler-errorsMatthias Krüger-2/+26
add an unstable `#[rustc_coinductive]` attribute useful to test coinduction, especially in the new solver. as this attribute should remain permanently unstable I don't think this needs any official approval. cc ``@rust-lang/types`` had to weaken the check for stable query results in the solver to prevent an ICE if there's a coinductive cycle with constraints. r? ``@compiler-errors``
2023-02-14Rollup merge of #108029 - oli-obk:🞋_usize, r=RalfJungMatthias Krüger-1/+1
s/eval_usize/eval_target_usize/ for clarity r? `@nnethercote` as discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60Const.60.20and.20.60usize.60.2F.60u64.60 it is unclear what `usize` means and why we use a `u64` for something talking about `usize`. This renaming should make it clear that we're talking about `usize`s on the target platform, irrespective of the compiler host platform.
2023-02-14Rollup merge of #107739 - spastorino:check-overflow-evaluate_canonical_goal, ↵Matthias Krüger-88/+139
r=lcnr Check for overflow in evaluate_canonical_goal r? `@lcnr`
2023-02-14Reduce visibility of some itemsSantiago Pastorino-9/+9
2023-02-14Check for overflow in evaluate_canonical_goalSantiago Pastorino-24/+46
2023-02-14add test for coinduction in new solverlcnr-2/+26
2023-02-14Auto merge of #103695 - LYF1999:yf/103563, r=lcnrbors-1/+46
fix: Unexpected trait bound not satisfied in HRTB and Associated Type fix https://github.com/rust-lang/rust/issues/103563
2023-02-14s/eval_usize/eval_target_usize/ for clarityOli Scherer-1/+1
2023-02-13Make can_eq and can_sub return booleansMichael Goulet-10/+11
2023-02-13Implement repeat_while_none for both SearchGraph and EvalCtxtSantiago Pastorino-24/+38
2023-02-13Extract try_move_finished_goal_to_global_cache from try_finalize_goalSantiago Pastorino-23/+34
2023-02-13Make Ok value of repeat_while_none more generalSantiago Pastorino-28/+32
2023-02-13fix: Unexpected trait bound not satisfied in HRTByifei-1/+46
2023-02-13Rename folder traits' `tcx` method to `interner`Alan Egerton-16/+16
2023-02-13Make folding traits generic over the InternerAlan Egerton-7/+7