about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
AgeCommit message (Collapse)AuthorLines
2023-07-22Rollup merge of #112508 - compiler-errors:trait-sig-lifetime-sugg-ice, ↵Matthias Krüger-10/+7
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-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-14/+3
This reverts commit 557359f92512ca88b62a602ebda291f17a953002, reversing changes made to 1e6c09a803fd543a98bfbe1624d697a55300a786.
2023-07-21Track ABI info. in `NaiveLayout`, and use it for `PointerLike` checksMoulins-3/+14
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-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)
2023-07-19Use `?` in `prepare_vtable_segments`Maybe Waffle-9/+15
2023-07-17Rename arg_iter to iter_instantiatedMichael Goulet-1/+1
2023-07-17Rollup merge of #113651 - lcnr:parent-def-id, r=compiler-errorsMatthias Krüger-7/+4
self type param infer, avoid ICE fixes #113610, which is caused by https://github.com/rust-lang/rust/blob/33a2c2487ac5d9927830ea4c1844335c6b9f77db/compiler/rustc_hir_analysis/src/collect/generics_of.rs#L190-L205
2023-07-17Auto merge of #113336 - compiler-errors:new-solver-iat, r=lcnrbors-4/+12
Add support for inherent projections in new solver Not hard to support these, and it cuts out a really big chunk of failing UI tests with `--compare-mode=next-solver` r? `@lcnr` (feel free to reassign, anyone can review this)
2023-07-16Auto merge of #113769 - matthiaskrgr:rollup-p6i1rco, r=matthiaskrgrbors-1/+1
Rollup of 7 pull requests Successful merges: - #113042 (Add Platform Support documentation for MIPS Release 6 targets) - #113539 (fixed typo) - #113614 (platform-support.md: It's now verified that NetBSD/riscv64 can self-h…) - #113750 (Add missing italicization to `sort_unstable_by_key` complexity ) - #113755 (Normalize lazy type aliases when probing for ADTs) - #113756 (fix wrong link) - #113762 (Fix typo) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-17Rollup merge of #113539 - agnarrarendelle:master, r=workingjubileeMatthias Krüger-1/+1
fixed typo Hi, I have fixed a few typos in commands. Please review my pr.
2023-07-16Auto merge of #113742 - ↵bors-2/+2
compiler-errors:dont-short-circuit-intercrate-global-preds, r=lcnr Don't call `predicate_must_hold`-esque functions during fulfillment in intercrate Fixes #113415 Given that this only happens in `translate_substs`, I don't actually think that this is something that you can weaponize, but it's still sketchy regardless. r? `@lcnr`
2023-07-16Check GAT, IAT, and weak type where clauses during projectionMichael Goulet-3/+11
2023-07-16Add support for inherent projectionsMichael Goulet-1/+1
2023-07-16stop mentioning number of applicate implementationslcnr-7/+4
2023-07-16Don't call predicate_must_hold during fulfillment in intercrateMichael Goulet-2/+2
2023-07-14Auto merge of #113471 - compiler-errors:new-solver-norm-escaping, r=lcnrbors-20/+21
Allow escaping bound vars during `normalize_erasing_regions` in new solver Add `AllowEscapingBoundVars` to `deeply_normalize`, and use it in the new solver in the `query_normalize` routine. Ideally, we'd make all `query_normalize` calls handle pass in `AllowEscapingBoundVars` individually, because really the only `query_normalize` call that needs `AllowEscapingBoundVars::Yes` is the one in `try_normalize_generic_arg_after_erasing_regions`, but I think that's kind of overkill. I am happy to be convinced otherwise, though. r? `@lcnr`
2023-07-14Rollup merge of #113698 - compiler-errors:rpitit-check, r=spastorinoMatthias Krüger-2/+2
Make it clearer that we're just checking for an RPITIT Tiny nit to use `is_impl_trait_in_trait` more, to make it clearer that we're just checking whether a def-id is an RPITIT, rather than doing something meaningful with the `opt_rpitit_info`. r? `@spastorino`
2023-07-14Make it clearer that we're just checking for an RPITITMichael Goulet-2/+2
2023-07-14Allow escaping bound vars during normalize_erasing_regions in new solverMichael Goulet-20/+21
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-536/+513
2023-07-13Rollup merge of #113536 - lcnr:proof-tree-select, r=BoxyUwUMatthias Krüger-1/+1
avoid building proof trees in select otherwise we ICE because select isn't currently set up to print proof trees. r? `````@BoxyUwU`````
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-121/+190
2023-07-12Flip cfg's for bootstrap bumpMark Rousskov-2/+2
2023-07-12fixed typosagnarrarendelle-1/+1
2023-07-11Auto merge of #113470 - compiler-errors:new-solver-structurally-resolve-pat, ↵bors-0/+2
r=lcnr Structurally resolve in pattern matching when peeling refs in new solver Let me know if you want me to commit the minimized test: ```rust fn test() {} fn test2() {} fn main() { let tests: &[(_, fn())] = &[ ("test", test), ("test2", test2), ]; for (a, b) in tests { todo!(); } } ``` In that test above, the match scrutinee is `<std::vec::Iter<(&'static str, fn())> as Iterator>::Item`, which we cannot peel the refs from. We also need to structurally resolve in the loop, since structural resolve is inherently shallow. I haven't come up with a test where this matters, but I can if you care. Also, I removed two other calls to `resolve_vars_with_obligations` in diagnostics code that I'm pretty convinced are not useful. r? `@lcnr`
2023-07-11Structurally resolve in pattern matching when peeling refs in new solverMichael Goulet-0/+2
2023-07-10Auto merge of #112988 - spastorino:new-rpitit-24, r=compiler-errorsbors-153/+2
Replace RPITIT current impl with new strategy that lowers as a GAT This PR replaces the current implementation of RPITITs with the new implementation that we had under -Zlower-impl-trait-in-trait-to-assoc-ty flag that lowers the RPIT as a GAT on the trait and on the impls that implement that trait. Opening this PR as a draft because this goes after #112682, ~#112981~ and ~#112983~. As soon as those are merged, I can rebase and we should run perf, crater and test a lot. r? `@compiler-errors`
2023-07-10avoid building proof trees in selectlcnr-1/+1
2023-07-08Replace RPITIT current impl with new strategy that lowers as a GATSantiago Pastorino-153/+2
2023-07-08Rollup merge of #113005 - compiler-errors:dont-query-normalize, r=cjgillotMatthias Krüger-32/+34
Don't call `query_normalize` when reporting similar impls Firstly, It's sketchy to be using `query_normalize` at all during HIR typeck -- it's asking for an ICE 😅. Secondly, we're normalizing an impl trait ref that potentially has parameter types in `ty::ParamEnv::empty()`, which is kinda sketchy as well. The only UI test change from removing this normalization is that we don't evaluate anonymous constants in impls, which end up giving us really ugly suggestions: ``` error[E0277]: the trait bound `[X; 35]: Default` is not satisfied --> /home/gh-compiler-errors/test.rs:4:5 | 4 | <[X; 35] as Default>::default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[X; 35]` | = help: the following other types implement trait `Default`: &[T] &mut [T] [T; 32] [T; core::::array::{impl#30}::{constant#0}] [T; core::::array::{impl#31}::{constant#0}] [T; core::::array::{impl#32}::{constant#0}] [T; core::::array::{impl#33}::{constant#0}] [T; core::::array::{impl#34}::{constant#0}] and 27 others ``` So just fold the impls with a `BottomUpFolder` that calls `ty::Const::eval`. This doesn't work totally correctly with generic-const-exprs, but it's fine for stable code, and this is error reporting after all.
2023-07-08Auto merge of #113474 - compiler-errors:rollup-07x1up7, r=compiler-errorsbors-19/+1
Rollup of 8 pull requests Successful merges: - #113413 (Add needs-triage to all new issues) - #113426 (Don't ICE in `resolve_bound_vars` when associated return-type bounds are in bad positions) - #113427 (Remove `variances_of` on RPITIT GATs, remove its one use-case) - #113441 (miri: check that assignments do not self-overlap) - #113453 (Remove unused from_method from rustc_on_unimplemented) - #113456 (Avoid calling report_forbidden_specialization for RPITITs) - #113466 (Update cargo) - #113467 (Fix comment of `fn_can_unwind`) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-07Rollup merge of #113453 - spastorino:new-rpitit-30, r=compiler-errorsMichael Goulet-19/+1
Remove unused from_method from rustc_on_unimplemented Fixes #113439 `on_unimplemented_note` was calling `item_name` for RPITITs and that produced ICEs. I've added a regression test for that but also have removed `from_method` symbol entirely because it wasn't even used and by doing that the `item_name` call was also removed. r? ``@compiler-errors``
2023-07-08Auto merge of #112652 - oli-obk:tait_only_in_sig, r=compiler-errorsbors-1/+1
Require TAITs to be mentioned in the signatures of functions that register hidden types for them r? `@lcnr` `@compiler-errors` This implements the lang team decision from [the TAIT design meeting](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/design.20meeting.202023-05-31.20TAITs/near/362518164).
2023-07-07Remove unused from_method symbolSantiago Pastorino-19/+1
2023-07-07Auto merge of #113245 - lukas-code:unsizing-sanity-check, r=the8472bors-6/+1
sanity check field offsets in unsizeable structs As promised in https://github.com/rust-lang/rust/pull/112062#issuecomment-1567494994, this PR extends the layout sanity checks to ensure that structs fields don't move around when unsizing and prevent issues like https://github.com/rust-lang/rust/issues/112048 in the future. Like most other layout sanity checks, this only runs on compilers with debug assertions enabled. Here is how it looks when it fails: ```text error: internal compiler error: compiler/rustc_ty_utils/src/layout.rs:533:21: unsizing GcNode<std::boxed::Box<i32>> changed field order! Layout { size: Size(32 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Aggregate { sized: true }, fields: Arbitrary { offsets: [Size(0 bytes), Size(8 bytes), Size(24 bytes)], memory_index: [0, 1, 2] }, largest_niche: Some(Niche { offset: Size(24 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 } } Layout { size: Size(24 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Aggregate { sized: false }, fields: Arbitrary { offsets: [Size(16 bytes), Size(0 bytes), Size(24 bytes)], memory_index: [1, 0, 2] }, largest_niche: None, variants: Single { index: 0 } } ``` r? `@the8472`
2023-07-07Require TAITs to be mentioned in the signatures of functions that register ↵Oli Scherer-1/+1
hidden types for them
2023-07-06get rid of a bit more calls to poly_selectMichael Goulet-4/+4
2023-07-06Separate select calls that don't need a binderMichael Goulet-24/+36
2023-07-06TraitObligation -> PolyTraitObligationMichael Goulet-64/+64
2023-07-06add helper methods for accessing struct tailLukas Markeffsky-6/+1
2023-07-06always emit consider `AutoImplCandidates` for them if they don't also have a ↵Oleksandr Babak-1/+1
`ProjectionCandidate`
2023-07-06deal with opaque types without cyclinglcnr-10/+24
2023-07-06update auto trait handlinglcnr-14/+63
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-44/+54