Commit Graph

26000 Commits

Author SHA1 Message Date
Michael Goulet
3f8919c09b get rid of a bit more calls to poly_select 2023-07-06 16:50:12 +00:00
Michael Goulet
018c3e2c09 Coercion doesn't need binders either 2023-07-06 16:50:12 +00:00
Michael Goulet
52f7384995 Separate select calls that don't need a binder 2023-07-06 16:50:12 +00:00
Michael Goulet
36453456cb TraitObligation -> PolyTraitObligation 2023-07-06 16:30:11 +00:00
bors
4b6749b21e Auto merge of #113406 - matthiaskrgr:rollup-0rprs5k, r=matthiaskrgr
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-06 10:29:49 +00:00
Matthias Krüger
a7532d9278
Rollup merge of #113402 - nnethercote:diagnose-unsorted-CGUs, r=lqd
Diagnose unsorted CGUs.

An assertion failure was reported in #112946. This extra information will help diagnose the problem.

r? `@lqd`
2023-07-06 12:12:12 +02:00
Matthias Krüger
72e0e177d5
Rollup merge of #113395 - compiler-errors:new-solver-dyn-star-selection, 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-06 12:12:12 +02:00
Nicholas Nethercote
fc8536669c Diagnose unsorted CGUs.
An assertion failure was reported in #112946. This extra information
will help diagnose the problem.
2023-07-06 18:27:25 +10:00
bors
4dd1719b34 Auto merge of #113377 - BoxyUwU:move_ty_ctors_to_ty, r=compiler-errors
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-06 08:10:42 +00:00
Oli Scherer
deda49e7b7 Fix up doc links 2023-07-06 07:32:08 +00:00
Michael Goulet
cd26d10edf Dont ICE for dyn* Trait: Trait goals during selection in new trait solver 2023-07-06 03:10:11 +00:00
bors
0d50ab7739 Auto merge of #113391 - fee1-dead-contrib:rollup-9bqlw9z, r=fee1-dead
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-06 02:34:11 +00:00
fee1-dead
2bc0ae3f33
Rollup merge of #113350 - chenyukang:yukang-fix-113342-parser, r=compiler-errors
Fix the issue of wrong diagnosis for extern pub fn

Fixes #113342
2023-07-06 09:20:34 +08:00
fee1-dead
1830b80c2d
Rollup merge of #113334 - fmease:revert-lexing-c-str-lits, r=compiler-errors
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-06 09:20:33 +08:00
fee1-dead
01627265e3
Rollup merge of #113332 - petrochenkov:bindintern, r=cjgillot
resolve: Use `Interned` for some interned structures

Enough to get rid of all existing `ptr::eq`s and "partial" uses of `Interned`.
2023-07-06 09:20:32 +08:00
fee1-dead
e461502e06
Rollup merge of #112791 - WaffleLapkin:wag_the_llvm, r=cuviper
llvm ffi: Expose `CallInst->setTailCallKind`

This is needed for the explicit tail calls experiment.
2023-07-06 09:20:31 +08:00
bors
bd8aabef31 Auto merge of #113291 - oli-obk:pretty_print_mir_const, r=RalfJung
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-06 00:00:38 +00:00
Michael Goulet
6ce1c89d64
Change comment on TyCtxt::mk_ty_from_kind 2023-07-05 13:58:04 -07:00
Boxy
12138b8e5e Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
bors
5dac6b320b Auto merge of #113370 - compiler-errors:rollup-8gvyy8e, r=compiler-errors
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-05 16:08:43 +00:00
Oli Scherer
e1e04a8bee Document magic boolean 2023-07-05 15:58:19 +00:00
Oli Scherer
8ac1a67d11 Name the destructure_mir_constant query appropriately 2023-07-05 15:54:43 +00:00
Oli Scherer
46cce98134 Use options instead of errors if the errors are never needed 2023-07-05 15:54:43 +00:00
Oli Scherer
09b89efa70 Remove a function argument that is always passed with the same value. 2023-07-05 15:54:43 +00:00
Oli Scherer
a0eb348d38 Specialize DestructuredConstant to its one user (pretty printing) 2023-07-05 15:54:43 +00:00
Oli Scherer
4dcf988360 Specialize try_destructure_mir_constant for its sole user 2023-07-05 15:54:43 +00:00
Michael Goulet
560136f15d
Rollup merge of #113356 - he32:netbsd-riscv64, r=oli-obk
Add support for NetBSD/riscv64 aka. riscv64gc-unknown-netbsd.
2023-07-05 08:45:46 -07:00
Michael Goulet
6f9addf6ed
Rollup merge of #113355 - Zalathar:ssa, r=oli-obk
Move most coverage code out of `rustc_codegen_ssa`

*This is one step in my larger coverage refactoring ambitions described at <https://github.com/rust-lang/compiler-team/issues/645>.*

The backend implementation of coverage instrumentation was originally split between SSA and LLVM, perhaps in the hopes that it could be used by other backends.

In practice, this split mostly just makes the coverage implementation harder to navigate and harder to modify. It seems unlikely that any backend will actually implement coverage instrumentation in the foreseeable future, especially since many parts of the existing implementation (outside the LLVM backend) are heavily tied to the specific details of LLVM's coverage instrumentation features.

The current shared implementation of `codegen_coverage` is heavily tied to the details of `StatementKind::Coverage`, which makes those details difficult to change. I have reason to want to change those details as part of future fixes/improvements, so this will reduce the amount of interface churn caused by those later changes.

---

This is intended to be a pure refactoring change, with no changes to actual behaviour. All of the “added” code has really just been moved from other files.
2023-07-05 08:45:46 -07:00
Michael Goulet
c31fe41453
Rollup merge of #113337 - compiler-errors:next-solver-winnow-specializing, r=lcnr
Winnow specialized impls during selection in new solver

We need to be able to winnow impls that are specialized by more specific impls in order for codegen to be able to proceed.

r? ``@lcnr``
2023-07-05 08:45:45 -07:00
Michael Goulet
b2b1a50751
Rollup merge of #113321 - BoxyUwU:move_constkind_to_typeir, r=oli-obk
Move `ty::ConstKind` to `rustc_type_ir`

Needed this in another PR for custom debug impls, and this will also be required to move the new solver into a separate crate that does not use `TyCtxt` so that r-a and friends can depend on the trait solver.

Rebased on top of #113325, only the second and third commits needs reviewing
2023-07-05 08:45:45 -07:00
Michael Goulet
0334b64cbb
Rollup merge of #113320 - oli-obk:eval_obligation_query, r=petrochenkov,BoxyUwU
Add some extra information to opaque type cycle errors

Plus a bunch of cleanups.

This should help users debug query cycles due to auto trait checking. We'll probably want to fix cycle errors in most (or all?) cases by looking at the current item's hidden types (new solver does this), and by delaying the auto trait checks to after typeck.
2023-07-05 08:45:44 -07:00
Michael Goulet
5c7a7d9ed4
Rollup merge of #113319 - lcnr:type-param-def-def-id, r=compiler-errors
`TypeParameterDefinition` always require a `DefId`

the `None` case never actually reaches diagnostics so it feels better for diagnostics to be able to rely on the `DefId` being there, cc #113310
2023-07-05 08:45:43 -07:00
Michael Goulet
a1f8edb5d5
Rollup merge of #113317 - lcnr:sketchy-new-select, r=oli-obk
-Ztrait-solver=next: stop depending on old solver

removes the final dependencies on the old solver when `-Ztrait-solver=next` is enabled.
2023-07-05 08:45:43 -07:00
Havard Eidnes
6cc37bbee0 Add support for NetBSD/riscv64 aka. riscv64gc-unknown-netbsd. 2023-07-05 13:49:01 +00:00
bors
e4cd161006 Auto merge of #113210 - fee1-dead-contrib:effects-mvp, r=oli-obk
Effects/keyword generics MVP

This adds `feature(effects)`, which adds `const host: bool` to the generics of const functions, const traits and const impls. This will be used to replace the current logic around const traits.

r? `@oli-obk`
2023-07-05 13:42:00 +00:00
León Orell Valerian Liehr
3788b7ab32
Revert "use new c literals instead of cstr! macro"
This reverts commit a17561ffc9.
2023-07-05 13:11:27 +02:00
León Orell Valerian Liehr
c6643b50ea
Revert the lexing of c_str_literals 2023-07-05 13:11:17 +02:00
Vadim Petrochenkov
9f3fba8da8 resolve: Add comments explaining use of Interned 2023-07-05 13:47:37 +03:00
Vadim Petrochenkov
c1f412f9a9 resolve: Use Interned for Module 2023-07-05 13:47:36 +03:00
Vadim Petrochenkov
4abdaeb67e resolve: Use Interned for Import 2023-07-05 13:47:36 +03:00
Vadim Petrochenkov
8efd9cc30d resolve: Use Interned for NameBinding 2023-07-05 13:47:36 +03:00
Zalathar
cb570d6bc1 Move coverageinfo::ffi and coverageinfo::map out of SSA 2023-07-05 20:40:40 +10:00
Zalathar
9c430d38cf Remove trait CoverageInfoMethods, since non-LLVM backends don't need it
These methods are only ever called from within `rustc_codegen_llvm`, so they
can just be declared there as well.
2023-07-05 20:40:40 +10:00
Zalathar
4169d0f756 Narrow trait CoverageInfoBuilderMethods down to just one method
This effectively inlines most of `FunctionCx::codegen_coverage` into the LLVM
implementation of `CoverageInfoBuilderMethods`.
2023-07-05 20:40:39 +10:00
bors
99f7d368c0 Auto merge of #112319 - oli-obk:assoc_ty_sized_bound_for_object_safety2, r=compiler-errors
Don't require associated types with Self: Sized bounds in `dyn Trait` objects

Trait objects require *all* associated types to be specified, even if the associated type has an explicit `where Self: Sized` bound. The following snippet does not compile on master, but does with this PR.

```rust
fn _assert_is_object_safe(_: &dyn Foo) {}

pub trait Foo {
    type Bar where Self: Sized;
}
```

In contrast, if a `Self: Sized` bound is added to a method, the methodjust isn't callable on trait objects, but the trait can be made object safe just fine.

```rust
fn _assert_is_object_safe(_: &dyn Foo) {}

pub trait Foo {
    fn foo() where Self: Sized;
}
```

This PR closes this inconsistency (though it still exists for associated constants).

Additionally this PR adds a new lint that informs users they can remove associated type bounds from their trait objects if those associated type bounds have a `where Self: Sized` bound, and are thus useless.

r? `@compiler-errors`
2023-07-05 08:48:04 +00:00
Boxy
62174bfe72 Deal with fallout 2023-07-05 09:46:30 +01:00
Boxy
8ac3ffe834 move ConstKind to typeir and move inherent impls to Const 2023-07-05 09:46:30 +01:00
yukang
f25463e848 Fix the issue of wrong diagnosis for extern pub fn 2023-07-05 16:25:46 +08:00
Oli Scherer
3219993fa8 Only use a single loop over the associated types 2023-07-05 07:46:05 +00:00
Oli Scherer
243687a37c Prefer retain over hand-rolling an inefficient version of it 2023-07-05 07:46:05 +00:00