about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
AgeCommit message (Collapse)AuthorLines
2023-06-20Merge attrs, better validationMichael Goulet-0/+8
2023-06-19Rollup merge of #112783 - compiler-errors:nlb-fnptr-reject-ice, r=fee1-deadMatthias Krüger-5/+3
Don't ICE on bound var in `reject_fn_ptr_impls` We may try to use an impl like `impl<T: FnPtr> PartialEq {}` to satisfy a predicate like `for<T> T: PartialEq` -- don't ICE in that case. Fixes #112735
2023-06-19s/Clause/ClauseKindMichael Goulet-122/+131
2023-06-19Don't ICE on bound var in reject_fn_ptr_implsMichael Goulet-5/+3
2023-06-18Continue folding in query normalizer on weak aliasesMichael Goulet-2/+6
2023-06-17Move ConstEvaluatable to ClauseMichael Goulet-17/+19
2023-06-17Move WF goal to clauseMichael Goulet-18/+25
2023-06-17Remove even more redundant builtin candidatesMichael Goulet-15/+27
2023-06-17Simplify even more candidatesMichael Goulet-27/+36
2023-06-17Simplify an ObjectData fieldMichael Goulet-4/+8
2023-06-17Simplify some impl source candidatesMichael Goulet-19/+15
2023-06-17Remove some ImplSource candidatesMichael Goulet-19/+16
2023-06-16Add `AliasKind::Weak` for type aliases.Oli Scherer-13/+70
Only use it when the type alias contains an opaque type. Also does wf-checking on such type aliases.
2023-06-16fix: inline `predicate_may_hold_fatal`bohan-14/+6
2023-06-15Auto merge of #104455 - the8472:dont-drain-on-drop, r=Amanieubors-4/+4
Don't drain-on-drop in DrainFilter impls of various collections. This removes drain-on-drop behavior from various unstable DrainFilter impls (not yet for HashSet/Map) because that behavior [is problematic](https://github.com/rust-lang/rust/issues/43244#issuecomment-641638196) (because it can lead to panic-in-drop when user closures panic) and may become forbidden if [this draft RFC passes](https://github.com/rust-lang/rfcs/pull/3288). closes #101122 [ACP](https://github.com/rust-lang/libs-team/issues/136) affected tracking issues * #43244 * #70530 * #59618 Related hashbrown update: https://github.com/rust-lang/hashbrown/pull/374
2023-06-14Rollup merge of #112605 - compiler-errors:negative-docs, r=spastorinoMatthias Krüger-83/+85
Improve docs/clean up negative overlap functions Clean up some functions in ways that should not affect behavior, change some names to be clearer (`negative_impl` and `implicit_negative` are not really clear imo), and add some documentation examples. r? `@spastorino`
2023-06-14Auto merge of #112400 - WaffleLapkin:vtable_stats, r=compiler-errorsbors-3/+3
Collect VTable stats & add `-Zprint-vtable-sizes` This is a bit hacky/buggy, but I'm not entirely sure how to fix it, so I want to ask reviewers for help... To try this, use either of those: - `cargo clean && RUSTFLAGS="-Zprint-vtable-sizes" cargo +toolchain b` - `cargo clean && cargo rustc +toolchain -Zprint-vtable-sizes` - `rustc +toolchain -Zprint-vtable-sizes ./file.rs`
2023-06-14Auto merge of #110662 - bryangarza:safe-transmute-reference-types, ↵bors-21/+109
r=compiler-errors Safe Transmute: Enable handling references This patch enables support for references in Safe Transmute, by generating nested obligations during trait selection. Specifically, when we call `confirm_transmutability_candidate(...)`, we now recursively traverse the `rustc_transmute::Answer` tree and create obligations for all the `Answer` variants, some of which include multiple nested `Answer`s.
2023-06-14s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedListThe 8472-1/+1
2023-06-14remove drain-on-drop behavior from vec::DrainFilter and add #[must_use]The 8472-3/+3
2023-06-14Improve docs/clean up negative overlap functionsMichael Goulet-83/+85
2023-06-13Rollup merge of #111885 - compiler-errors:rust-call-abi-sized, r=eholkMatthias Krüger-1/+7
Don't ICE on unsized `extern "rust-call"` call Conceptually builds on #111864, but doesn't depend on it.
2023-06-12Safe Transmute: Refactor error handling and Answer typeBryan Garza-30/+46
- Create `Answer` type that is not just a type alias of `Result` - Remove a usage of `map_layouts` to make the code easier to read - Don't hide errors related to Unknown Layout when computing transmutability
2023-06-12Collect VTable stats & add `-Zprint-vtable-sizes`Maybe Waffle-3/+3
2023-06-07Rollup merge of #112122 - compiler-errors:next-coherence, r=lcnrDylan DPC-20/+39
Add `-Ztrait-solver=next-coherence` Flag that conditionally uses the trait solver *only* during coherence, for more testing and/or eventual partial-migration onto the trait solver (in the medium- to long-term). * This still uses the selection context in some of the coherence methods I think, so it's not "complete". Putting this up for review and/or for further work in-tree. * I probably need to spend a bit more time making sure that we don't sneakily create any other infcx's during coherence that also need the new solver enabled. r? `@lcnr`
2023-06-06Note why rust-call abi requires sized oblMichael Goulet-1/+7
2023-06-06Make TraitEngine::new use the right solver, add compare modeMichael Goulet-16/+32
2023-06-06Add -Ztrait-solver=next-coherenceMichael Goulet-0/+3
2023-06-06New trait solver is a property of inference contextMichael Goulet-6/+6
2023-06-06Rollup merge of #112325 - notriddle:notriddle/issue-111932, r=compiler-errorsMatthias Krüger-2/+2
diagnostics: do not suggest type name tweaks on type-inferred closure args Fixes #111932
2023-06-05diagnostics: do not suggest type name tweaks on type-inferred closure argsMichael Howell-2/+2
Fixes #111932
2023-06-05Rollup merge of #112318 - oli-obk:assoc_ty_sized_bound_for_object_safety, ↵Matthias Krüger-51/+43
r=compiler-errors Merge method, type and const object safety checks cc `@spastorino` and `@compiler-errors` on the first commit. I believe it to be correct, as the field is only `Some` for assoc types, so just checking the field without checking the assoc kind to be `Type` is fine. The second commit avoids going through all associated items thrice and just goes over all of them once, running the object safety checks per assoc item kind.
2023-06-05Rollup merge of #112303 - Nilstrieb:as-deref, r=compiler-errorsMatthias Krüger-2/+3
Normalize in infcx instead of globally for `Option::as_deref` suggestion fixes #112293 The projection may contain inference variables. These inference variables are local to the local inference context. Using `tcx.normalize_erasing_regions` doesn't work here because this method is global and does not have access to the inference context. It's therefore unable to deal with the inference variables. We normalize in the local inference context instead, which knowns about the inference variables. The test looks a little different than the issue example, I made it more minimal and verified that it still ICEs on nightly. Also contains a drive-by fix to properly compare the types. r? `@compiler-errors`
2023-06-05Resolve vars in result from scrape_region_constraintsMichael Goulet-3/+12
2023-06-05Merge method, type and const object safety checksOli Scherer-51/+43
2023-06-05Avoid going through queries if a value of type `AssocItem` is already availableOli Scherer-1/+1
2023-06-05Normalize in infcx instead of globally for `Option::as_deref` suggestionNilstrieb-1/+2
The projection may contain inference variables. These inference variables are local to the local inference context. Using `tcx.normalize_erasing_regions` doesn't work here because this method is global and does not have access to the inference context. It's therefore unable to deal with the inference variables. We normalize in the local inference context instead, which knowns about the inference variables.
2023-06-05Properly compare types for `Option::as_deref` suggestionNilstrieb-1/+1
2023-06-03Rollup merge of #111659 - y21:suggest-as-deref, r=cjgillotMatthias Krüger-9/+95
suggest `Option::as_deref(_mut)` on type mismatch in option combinator if it passes typeck Fixes #106342. This adds a suggestion to call `.as_deref()` (or `.as_deref_mut()` resp.) if typeck fails due to a type mismatch in the function passed to an `Option` combinator such as `.map()` or `.and_then()`. For example: ```rs fn foo(_: &str) {} Some(String::new()).map(foo); ``` The `.map()` method requires its argument to satisfy `F: FnOnce(String)`, but it received `fn(&str)`, which won't pass. However, placing a `.as_deref()` before the `.map()` call fixes this since `&str == &<String as Deref>::Target`
2023-06-03do not use ty_adt_id from internal traity21-3/+2
2023-06-02No more TyCtxt::lazy_normalizationMichael Goulet-1/+3
2023-06-02Rollup merge of #112165 - fee1-dead-contrib:rn-defualtness, r=compiler-errorsMatthias Krüger-1/+1
Rename `impl_defaultness` to `defaultness` Since this isn't just about the `impl`.
2023-06-02Auto merge of #112198 - compiler-errors:rollup-o2xe4of, r=compiler-errorsbors-57/+133
Rollup of 7 pull requests Successful merges: - #111670 (Require that const param tys implement `ConstParamTy`) - #111914 (CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi…) - #112030 (Migrate `item_trait_alias` to Askama) - #112150 (Support 128-bit atomics on all x86_64 Apple targets) - #112174 (Fix broken link) - #112190 (Improve comments on `TyCtxt` and `GlobalCtxt`.) - #112193 (Check tuple elements are `Sized` in `offset_of`) Failed merges: - #112071 (Group rfcs tests) r? `@ghost` `@rustbot` modify labels: rollup
2023-06-01Implement custom diagnostic for ConstParamTyMichael Goulet-1/+112
2023-06-01Impl ConstParamTy for tuples, make PartialStructuralEq a supertrait tooMichael Goulet-1/+2
2023-06-01remove search_for_adt_const_param_violationMichael Goulet-55/+19
2023-06-01Use translatable diagnostics in `rustc_const_eval`Deadbeef-1/+1
2023-06-01Rename `impl_defaultness` to `defaultness`Deadbeef-1/+1
2023-05-31Auto merge of #111076 - ↵bors-0/+1
notriddle:notriddle/silence-private-dep-trait-impl-suggestions, r=cjgillot diagnostics: exclude indirect private deps from trait impl suggest Fixes #88696
2023-05-31move hack to `normalize_param_env_or_error`Boxy-3/+57