about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2023-07-28dropck_outlives commentslcnr-10/+0
2023-07-28fix commentlcnr-2/+2
2023-07-28refactor builtin unsize handling, extend commentslcnr-217/+257
2023-07-28Auto merge of #113312 - Ddystopia:auto-trait-fun, r=lcnrbors-14/+77
discard default auto trait impls if explicit ones exist (rebase of #85048) Rebase of #85048
2023-07-28Auto merge of #114134 - fee1-dead-contrib:rm-constness-from-param-env, r=oli-obkbors-115/+30
Remove `constness` from `ParamEnv` This should be replaced by keyword generics/effects. cc #110395 r? `@oli-obk`
2023-07-27Remove `constness` from `ParamEnv`Deadbeef-115/+30
2023-07-27Rollup merge of #114117 - compiler-errors:return-to-uniq, r=lcnrGuillaume Gomez-12/+15
Restore region uniquification in the new solver 🎉 All of the bugs that were "due" to uniquification have been settled via other means (e.g. bidirectional alias-relate, param-env incompleteness, etc). Firstly, revert the functional changes in #110180. 😸 Secondly, we need to ignore regions when considering if a goal has changed (the "has_changed" boolean returned from `evaluate_goal`) -- otherwise, because we're doing region uniquification, we may perpetually consider a goal to be changed. See the UI test I committed for an explanation.
2023-07-27Auto merge of #114080 - compiler-errors:negative, r=spastorinobors-1/+1
Don't treat negative trait predicates as always knowable We don't need this. It was added in #90104 but I don't really know why. It's not sound afaict -- negative trait predicates need the same coherence-ambiguity/orphan check rules as positive ones. r? `@lcnr` cc `@spastorino,` do you remember why?
2023-07-27Consider a goal as NOT changed if its response is identity modulo regionsMichael Goulet-1/+1
2023-07-27Revert "don't uniquify regions when canonicalizing"Michael Goulet-11/+14
This reverts commit 171f5414705194067557cd7b70bd680308b9cced.
2023-07-26Don't treat negative trait predicates as always knowableMichael Goulet-1/+1
2023-07-25Rollup merge of #113661 - oli-obk:tait_wtf, r=lcnrMatthias Krüger-0/+1
Double check that hidden types match the expected hidden type Fixes https://github.com/rust-lang/rust/issues/113278 specifically, but I left a TODO for where we should also add some hardening. It feels a bit like papering over the issue, but at least this way we don't get unsoundness, but just surprising errors. Errors will be improved and given spans before this PR lands. r? `@compiler-errors` `@lcnr`
2023-07-25Make everything builtin!Michael Goulet-328/+274
2023-07-25Consolidate trait upcasting and unsize into one normalizationMichael Goulet-197/+237
2023-07-25Restore tuple unsizing feature gateMichael Goulet-11/+23
2023-07-25Make sure to detect trait upcasting coercion even after normalizationMichael Goulet-1/+7
2023-07-25Normalize the RHS of an unsize goalMichael Goulet-67/+139
2023-07-24Improve diagnostic for const ctors in array repeat expressionsclubby789-9/+20
2023-07-24Auto merge of #114024 - matthiaskrgr:rollup-uhdbq64, r=matthiaskrgrbors-23/+67
Rollup of 8 pull requests Successful merges: - #113969 (add dynamic for smir) - #113985 (Use erased self type when autoderefing for trait error suggestion) - #113987 (Comment stuff in the new solver) - #113992 (arm-none fixups) - #113993 (Optimize format usage) - #113994 (Optimize format usage) - #114006 (Update sparc-unknown-none-elf platform README) - #114021 (Add missing documentation for `Session::time`) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-24Rollup merge of #113987 - compiler-errors:comments, r=lcnrMatthias Krüger-16/+64
Comment stuff in the new solver r? `@lcnr`
2023-07-24Rollup merge of #113985 - compiler-errors:issue-113951, r=estebankMatthias Krüger-7/+3
Use erased self type when autoderefing for trait error suggestion Let's not try to pass something from `skip_binder` into autoderef. Fixes #113951
2023-07-24lcnr's suggestionsMichael Goulet-4/+5
Co-authored-by: lcnr <rust@lcnr.de>
2023-07-24Auto merge of #113956 - fmease:rustdoc-fix-x-crate-rpitits, ↵bors-3/+6
r=GuillaumeGomez,compiler-errors rustdoc: handle cross-crate RPITITs correctly Filter out the internal associated types synthesized during the desugaring of RPITITs, they really shouldn't show up in the docs. This also fixes #113929 since we're no longer invoking `is_impossible_associated_item` (renamed from `is_impossible_method`) which cannot handle them (leading to an ICE). I don't think it makes sense to try to make `is_impossible_associated_item` handle this exotic kind of associated type (CC original author `@compiler-errors).` @ T-rustdoc reviewers, currently I'm throwing out ITIT assoc tys before cleaning assoc tys at each usage-site. I'm thinking about making `clean_middle_assoc_item` return an `Option<_>` instead and doing the check inside of it to prevent any call sites from forgetting the check for ITITs. Since I wasn't sure if you would like that approach, I didn't go through with it. Let me know what you think. <details><summary>Explanation on why <code>is_impossible_associated_item(itit_assoc_ty)</code> leads to an ICE</summary> Given the following code: ```rs pub trait Trait { fn def<T>() -> impl Default {} } impl Trait for () {} ``` The generated associated type looks something like (simplified): ```rs type {opaque#0}<T>: Default = impl Default; // the name is actually `kw::Empty` but this is the `def_path_str` repr ``` The query `is_impossible_associated_item` goes through all predicates of the associated item – in this case `<T as Sized>` – to check if they contain any generic parameters from the (generic) associated type itself. For predicates that don't contain any *own* generics, it does further processing, part of which is instantiating the predicate with the generic arguments of the impl block (which is only correct if they truly don't contain any own generics since they wouldn't get instantiated this way leading to an ICE). It checks if `parent_def_id(T) == assoc_ty_def_id` to get to know if `T` is owned by the assoc ty. Unfortunately this doesn't work for ITIT assoc tys. In this case, the parent of `T` is `Trait::def` (!) which is the associated function (I'm pretty sure this is very intentional) which is of course not equal to the assoc ty `Trait::{opaque#0}`. </details> `@rustbot` label A-cross-crate-reexports
2023-07-23more clippy::style fixes:Matthias Krüger-2/+2
get_first single_char_add_str unnecessary_mut_passed manual_map manual_is_ascii_check
2023-07-23Comment stuff in the new solverMichael Goulet-16/+63
2023-07-23Use erased self type when autoderefing for trait error suggestionMichael Goulet-7/+3
2023-07-23fixDeadbeef-2/+1
2023-07-23fix clippy::useless_formatMatthias Krüger-1/+1
2023-07-23fix couple of clippy findings:Matthias Krüger-7/+2
filter_map_identity iter_kv_map needless_question_mark redundant_at_rest_pattern filter_next derivable_impls
2023-07-22Rollup merge of #113901 - compiler-errors:only-bidi-norm, r=lcnrMatthias Krüger-9/+12
Get rid of subst-relate incompleteness in new solver We shouldn't need subst-relate if we have bidirectional-normalizes-to in the new solver. The only potential issue may happen if we have an unconstrained projection like `<Wrapper<?0> as Trait>::Assoc == <Wrapper<T> as Trait>::Assoc` where they both normalize to something that doesn't mention any substs, which would possibly prefer `?0 = T` if we fall back to subst-relate. But I'd prefer if we remove incompleteness until we can determine some case where we need them, and the bidirectional-normalizes-to seems better to have in general. I can update https://github.com/rust-lang/trait-system-refactor-initiative/issues/26 and https://github.com/rust-lang/trait-system-refactor-initiative/issues/25 once this lands. r? `@lcnr`
2023-07-22Rollup merge of #112508 - compiler-errors:trait-sig-lifetime-sugg-ice, ↵Matthias Krüger-11/+42
r=cjgillot Tweak spans for self arg, fix borrow suggestion for signature mismatch 1. Adjust a suggestion message that was annoying me 2. Fix #112503 by recording the right spans for the `self` part of the `&self` 0th argument 3. Remove the suggestion for adjusting a trait signature on type mismatch, bc that's gonna probably break all the other impls of the trait even if it fixes its one usage :sweat_smile:
2023-07-22Get rid of subst-relate incompleteness in new solverMichael Goulet-9/+12
2023-07-22rustdoc: handle cross-crate RPITITs correctlyLeón Orell Valerian Liehr-3/+6
2023-07-21Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"David Tolnay-28/+6
This reverts commit 557359f92512ca88b62a602ebda291f17a953002, reversing changes made to 1e6c09a803fd543a98bfbe1624d697a55300a786.
2023-07-21Auto merge of #113922 - matthiaskrgr:rollup-90cj2vv, r=matthiaskrgrbors-13/+12
Rollup of 4 pull requests Successful merges: - #113887 (new solver: add a separate cache for coherence) - #113910 (Add FnPtr ty to SMIR) - #113913 (error/E0691: include alignment in error message) - #113914 (rustc_target: drop duplicate code) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-21Double check that hidden types match the expected hidden typeOli Scherer-0/+1
2023-07-21new solver: add a separate cache for coherencelcnr-13/+12
2023-07-21Track ABI info. in `NaiveLayout`, and use it for `PointerLike` checksMoulins-6/+28
THis significantly complicates `NaiveLayout` logic, but is necessary to ensure that bounds like `NonNull<T>: PointerLike` hold in generic contexts. Also implement exact layout computation for structs.
2023-07-20Auto merge of #113856 - WaffleLapkin:vtablin', r=oli-obkbors-67/+88
Refactor vtable encoding and optimize it for the case of multiple marker traits This PR does two things - Refactor `prepare_vtable_segments` (this was motivated by the other change, `prepare_vtable_segments` was quite hard to understand and while trying to edit it I've refactored it) - Mostly remove `loop`s labeled `break`s/`continue`s whenever there is a simpler solution - Also use `?` - Make vtable format a bit more efficient wrt to marker traits - See the tests for an example Fixes https://github.com/rust-lang/rust/issues/113840 cc `@crlf0710` ---- Review wise it's probably best to review each commit individually, as then it's more clear why the refactoring is correct. I can split the last two commits (which change behavior) into a separate PR if it makes reviewing easier
2023-07-20update doc commentslcnr-10/+17
2023-07-20reviewlcnr-4/+4
2023-07-20re-add commentlcnr-0/+6
2023-07-20assembly: only consider blanket impls oncelcnr-68/+226
2023-07-20XSimplifiedType to SimplifiedType::Xlcnr-1/+1
2023-07-19Don't emit useless vptrs for marker traitsMaybe Waffle-4/+21
2023-07-19Fix commentMaybe Waffle-1/+1
2023-07-19Simplify last `prepare_vtable_segments` loop even moreMaybe Waffle-25/+22
2023-07-19Slightly refactor 'exiting_out loop in `prepare_vtable_segments`Maybe Waffle-20/+22
1. Hide the option as an iterator, so it's nicer to work with 2. Replace a loop with `find`
2023-07-19Refactor 'diving_in loop internals in `prepare_vtable_segments`Maybe Waffle-17/+17
Less explicit loops -- easier to read.
2023-07-19Replace `if let` with `unwrap` in `prepare_vtable_segments`Maybe Waffle-25/+24
Reasoning: if the stack is empty, the loop will be infinite, so the assumption is that the stack can't be non empty. Unwrap makes the assumption more clear (and removes an indentation level)