about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2023-07-08Auto merge of #112652 - oli-obk:tait_only_in_sig, r=compiler-errorsbors-41/+144
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-07Auto merge of #113245 - lukas-code:unsizing-sanity-check, r=the8472bors-56/+107
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-07Treat closures as part of their parentOli Scherer-10/+10
2023-07-07Fix one layer of closures not being able to constrain opaque typesOli Scherer-1/+4
2023-07-07Only match on the `DefKind` once.Oli Scherer-29/+19
2023-07-07Collect nested items immediately instead of collecting them into an ↵Oli Scherer-15/+10
intermediate `Vec` first
2023-07-07Move some logic into a method on `OpaqueTypeCollector`Oli Scherer-29/+33
2023-07-07Remove one layer of nested matching on the same thingOli Scherer-55/+39
2023-07-07liar liar find_taits_declared_in_body on fireOli Scherer-10/+10
2023-07-07We don't need to track binders if we aren't normalizingOli Scherer-20/+1
2023-07-07Remove normalization from `opaque_types_defined_by`Oli Scherer-41/+2
2023-07-07Require TAITs to be mentioned in the signatures of functions that register ↵Oli Scherer-36/+221
hidden types for them
2023-07-07Auto merge of #113308 - compiler-errors:poly-select, r=lcnrbors-112/+125
Split `SelectionContext::select` into fns that take a binder and don't *most* usages of `SelectionContext::select` don't need to use a binder, but wrap them in a dummy because of the signature. Let's split this out into `SelectionContext::{select,poly_select}` and limit the usages of the latter. Right now, we only have 3 places where we're calling `poly_select` -- fulfillment, internally within the old solver, and the auto-trait finder. r? `@lcnr`
2023-07-07Auto merge of #113270 - the8472:opt-macro-tts, r=nnethercotebors-5/+13
perform TokenStream replacement in-place when possible in expand_macro
2023-07-06Rollup merge of #113421 - spastorino:new-rpitit-29, r=compiler-errorsMichael Goulet-5/+7
Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tys Fixes #113403 Assert on collect_return_position_impl_trait_in_trait_tys is not correct when we call it from type_of(GAT). The included test is an example of a situation that collector collects 0 types. r? `@compiler-errors`
2023-07-06Rollup merge of #113419 - spastorino:new-rpitit-28, r=compiler-errorsMichael Goulet-3/+5
Avoid calling item_name for RPITIT Fixes #113405 r? `@compiler-errors`
2023-07-06Rollup merge of #113397 - compiler-errors:new-select-prefer-obj, r=lcnrMichael Goulet-0/+8
Prefer object candidates in new selection `dyn Any` shouldn't be using [this implementation](https://doc.rust-lang.org/std/any/trait.Any.html#impl-Any-for-T) during codegen. Prefer object candidates over other candidates, except for other object candidates.
2023-07-06Rollup merge of #112825 - compiler-errors:tait-defining-cycle, r=lcnrMichael Goulet-1/+28
Don't call `type_of` on TAIT in defining scope in new solver It's *never* productive to call `consider_auto_trait_candidate` on a TAIT in the defining scope, since it will always lead to a query cycle since we call `type_of` on the TAIT. So let's just don't. I've reserved this behavior just to `SolverMode::Normal` just to avoid any future problems, since this is *technically* incomplete since we're discarding a candidate that could *theoretically* apply. But given such candidate assembly *always* leads to a query cycle, I think it's relatively low risk, and I could be convinced otherwise and make this apply to both solver mode. I assume it's far less likely to be encountered in coherence, though. This is much more likely to encounter in the new solver, though it can also be encountered in the old solver too, so I'm happy to discuss whether this new behavior we even want in the first place... I encountered this in a couple of failing UI tests: * `tests/ui/type-alias-impl-trait/issue-62000-associate-impl-trait-lifetimes.rs` * `tests/ui/type-alias-impl-trait/issue-93411.rs` r? `@lcnr`
2023-07-06Rollup merge of #111917 - WaffleLapkin:validate_unalloc, r=oli-obkMichael Goulet-14/+9
Simplify duplicate checks for mir validator This removes unnecessary allocations & is less code.
2023-07-06Don't call type_of on TAIT in defining scope in new solverMichael Goulet-1/+28
2023-07-06Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tysSantiago Pastorino-5/+7
2023-07-06Avoid calling item_name for RPITITSantiago Pastorino-3/+5
2023-07-06get rid of a bit more calls to poly_selectMichael Goulet-12/+12
2023-07-06Coercion doesn't need binders eitherMichael Goulet-7/+6
2023-07-06Separate select calls that don't need a binderMichael Goulet-44/+58
2023-07-06TraitObligation -> PolyTraitObligationMichael Goulet-70/+70
2023-07-06add helper methods for accessing struct tailLukas Markeffsky-34/+31
2023-07-06sanity check field offsets in unsizeable structsLukas Markeffsky-0/+49
2023-07-06clean up struct layout codeLukas Markeffsky-36/+41
2023-07-06Auto merge of #113406 - matthiaskrgr:rollup-0rprs5k, r=matthiaskrgrbors-5/+13
Rollup of 4 pull requests Successful merges: - #112295 (Fix the tests-listing-format-json test on Windows) - #113246 (fix compiletest crash) - #113395 (Dont ICE for `dyn* Trait: Trait` (built-in object) goals during selection in new trait solver) - #113402 (Diagnose unsorted CGUs.) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-06Rollup merge of #113402 - nnethercote:diagnose-unsorted-CGUs, r=lqdMatthias Krüger-1/+7
Diagnose unsorted CGUs. An assertion failure was reported in #112946. This extra information will help diagnose the problem. r? `@lqd`
2023-07-06Rollup merge of #113395 - compiler-errors:new-solver-dyn-star-selection, ↵Matthias Krüger-4/+6
r=oli-obk Dont ICE for `dyn* Trait: Trait` (built-in object) goals during selection in new trait solver We were ICEing too eagerly during selection for `dyn*` goals -- both for dyn unsizing candidates and for built-in object candidates. The former should only be performed on `dyn` objects, but the latter are totally fine.
2023-07-06Diagnose unsorted CGUs.Nicholas Nethercote-1/+7
An assertion failure was reported in #112946. This extra information will help diagnose the problem.
2023-07-06Auto merge of #113377 - BoxyUwU:move_ty_ctors_to_ty, r=compiler-errorsbors-1156/+1353
Move `TyCtxt::mk_x` to `Ty::new_x` where applicable Part of rust-lang/compiler-team#616 turns out there's a lot of places we construct `Ty` this is a ridiculously huge PR :S r? `@oli-obk`
2023-07-06Fix up doc linksOli Scherer-2/+2
2023-07-06Prefer object candidates over impl candidates in new selectionMichael Goulet-0/+8
2023-07-06Dont ICE for `dyn* Trait: Trait` goals during selection in new trait solverMichael Goulet-4/+6
2023-07-06Auto merge of #113391 - fee1-dead-contrib:rollup-9bqlw9z, r=fee1-deadbors-315/+330
Rollup of 9 pull requests Successful merges: - #111119 (style-guide: Add chapter about formatting for nightly-only syntax) - #112791 (llvm ffi: Expose `CallInst->setTailCallKind`) - #113145 (style-guide: Document newline rules for assignment operators) - #113163 (Add a regression test for #112895) - #113332 (resolve: Use `Interned` for some interned structures) - #113334 (Revert the lexing of `c"…"` string literals) - #113350 (Fix the issue of wrong diagnosis for extern pub fn) - #113371 (Fix submodule handling when the current branch is named after a tag) - #113384 (style-guide: Clarify grammar for small patterns (not a semantic change)) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-06Rollup merge of #113350 - chenyukang:yukang-fix-113342-parser, r=compiler-errorsfee1-dead-1/+5
Fix the issue of wrong diagnosis for extern pub fn Fixes #113342
2023-07-06Rollup merge of #113334 - fmease:revert-lexing-c-str-lits, r=compiler-errorsfee1-dead-59/+64
Revert the lexing of `c"…"` string literals Fixes \[after beta-backport\] #113235. Further progress is tracked in #113333. This PR *manually* reverts parts of #108801 (since a git-revert would've been too coarse-grained & messy) and git-reverts #111647. CC `@fee1-dead` (#108801) `@klensy` (#111647) r? `@compiler-errors` `@rustbot` label F-c_str_literals beta-nominated
2023-07-06Rollup merge of #113332 - petrochenkov:bindintern, r=cjgillotfee1-dead-255/+224
resolve: Use `Interned` for some interned structures Enough to get rid of all existing `ptr::eq`s and "partial" uses of `Interned`.
2023-07-06Rollup merge of #112791 - WaffleLapkin:wag_the_llvm, r=cuviperfee1-dead-0/+37
llvm ffi: Expose `CallInst->setTailCallKind` This is needed for the explicit tail calls experiment.
2023-07-06Auto merge of #113291 - oli-obk:pretty_print_mir_const, r=RalfJungbors-83/+68
Specialize `try_destructure_mir_constant` for its sole user (pretty printing) We can't remove the query, as we need to invoke it from rustc_middle, but can only implement it in mir interpretation/const eval. r? `@RalfJung` for a first round. While we could move all the logic into pretty printing, that would end up duplicating a bit of code with const eval, which doesn't seem great either.
2023-07-05Change comment on `TyCtxt::mk_ty_from_kind`Michael Goulet-1/+1
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-1154/+1351
2023-07-05Auto merge of #113370 - compiler-errors:rollup-8gvyy8e, r=compiler-errorsbors-542/+748
Rollup of 8 pull requests Successful merges: - #113010 (rust-installer & rls: remove exclusion from rustfmt & tidy ) - #113317 ( -Ztrait-solver=next: stop depending on old solver) - #113319 (`TypeParameterDefinition` always require a `DefId`) - #113320 (Add some extra information to opaque type cycle errors) - #113321 (Move `ty::ConstKind` to `rustc_type_ir`) - #113337 (Winnow specialized impls during selection in new solver) - #113355 (Move most coverage code out of `rustc_codegen_ssa`) - #113356 (Add support for NetBSD/riscv64 aka. riscv64gc-unknown-netbsd.) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-05Document magic booleanOli Scherer-1/+3
2023-07-05Name the destructure_mir_constant query appropriatelyOli Scherer-6/+6
2023-07-05Use options instead of errors if the errors are never neededOli Scherer-13/+11
2023-07-05Remove a function argument that is always passed with the same value.Oli Scherer-46/+21