Commit Graph

20874 Commits

Author SHA1 Message Date
Michael Goulet
16cfadbfe8 Suggest lifetime bound in illegal Copy impl 2023-01-13 23:06:29 +00:00
Michael Goulet
333c6bf523 copy self type is implied wf 2023-01-13 23:06:29 +00:00
Michael Goulet
8cf7f40a89 Check ADT fields for copy implementations considering regions 2023-01-13 23:06:29 +00:00
bors
0b90256ada Auto merge of #106776 - oli-obk:om_nom_nom_nom_nom, r=cjgillot
Feed a bunch of queries instead of tracking fields on TyCtxt

r? `@cjgillot`

pulled out of https://github.com/rust-lang/rust/pull/105462
2023-01-13 13:57:21 +00:00
bors
5ca6f7d2c3 Auto merge of #106801 - JohnTitor:rollup-xqkraw0, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #106608 (Render missing generics suggestion verbosely)
 - #106716 ([RFC 2397] Deny incorrect locations)
 - #106754 (Rename `Ty::is_ty_infer` -> `Ty::is_ty_or_numeric_infer`)
 - #106782 (Ignore tests move in git blame)
 - #106785 (Make blame spans better for impl wfcheck)
 - #106791 (Fix ICE formatting)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-13 10:56:53 +00:00
Yuki Okushi
c06d57eb19
Rollup merge of #106791 - estebank:fix-ice, r=compiler-errors
Fix ICE formatting
2023-01-13 16:54:25 +09:00
Yuki Okushi
5adc7a5e37
Rollup merge of #106785 - compiler-errors:better-impl-wf-spans, r=estebank
Make blame spans better for impl wfcheck

r? types
2023-01-13 16:54:24 +09:00
Yuki Okushi
d4ad96cf6e
Rollup merge of #106754 - compiler-errors:ty-infer-method-is-confusing, r=lcnr
Rename `Ty::is_ty_infer` -> `Ty::is_ty_or_numeric_infer`

Makes sure people are aware that they may have a type variable *or* an int/float variable.

r? `@oli-obk` https://github.com/rust-lang/rust/pull/106322#issuecomment-1376913539 but I could instead implement your solution, let me know.

(This will conflict with #106322 for now, ignore that 😄)
2023-01-13 16:54:23 +09:00
Yuki Okushi
f6f362c332
Rollup merge of #106716 - c410-f3r:rfc-2397-1, r=davidtwco
[RFC 2397] Deny incorrect locations

cc #51992

As declared in the RFC, `#[do_not_recommend]` should only be applicable on trait implementations.
2023-01-13 16:54:23 +09:00
Yuki Okushi
9a2f3937fc
Rollup merge of #106608 - compiler-errors:missing-generics-verbose, r=estebank
Render missing generics suggestion verbosely

It's a bit easier to read like this, especially ones that are appending new generics onto an existing list, like ": `, T`" which render somewhat poorly inline.

Also don't suggest `dyn` as a type parameter to add, even if technically that's valid in edition 2015.
2023-01-13 16:54:22 +09:00
bors
4a04f252f9 Auto merge of #106092 - asquared31415:start_lang_item_checks, r=davidtwco
Add checks for the signature of the `start` lang item

Closes #105963
2023-01-13 07:45:34 +00:00
bors
279f1c9d8c Auto merge of #106004 - fee1-dead-contrib:const-closures, r=oli-obk
Const closures

cc https://github.com/rust-lang/rust/issues/106003
2023-01-13 05:04:48 +00:00
bors
bfffe406fb Auto merge of #101138 - Rejyr:diagnostic-migration-rustc-lint-pt2, r=davidtwco
Migrate `rustc_lint` lint diagnostics

Part 2 of [Migrate `rustc_lint` errors to `SessionDiagnostic`](https://github.com/rust-lang/rust/pull/100776)

r? `@davidtwco`

# TODO
- [x] Refactor some lints manually implementing `DecorateLint` to use `Option<Subdiagnostic>`.
- [x] Add `#[rustc_lint_diagnostics]` to lint functions in `context.rs`.
- [x] Migrate `hidden_unicode_codepoints.rs`.
- [x] Migrate `UnsafeCode` in `builtin.rs`.
- [x] Migrate the rest of `builtin.rs`.
2023-01-13 02:13:00 +00:00
Michael Goulet
8e27211dbc is_ty_infer -> is_ty_or_numeric_infer 2023-01-12 23:57:41 +00:00
Esteban Küber
06a2d2d001 Fix ICE formatting 2023-01-12 23:46:58 +00:00
Michael Goulet
5924c2511e Only point at impl self ty in WF if trait predicate shares self ty 2023-01-12 22:25:30 +00:00
Michael Goulet
bf0623e363 Don't suggest dyn as parameter to add 2023-01-12 22:04:30 +00:00
Michael Goulet
950b47fb96 Render missing generics suggestion verbosely 2023-01-12 22:04:30 +00:00
Yuki Okushi
bbb2a22ced
Rollup merge of #106759 - compiler-errors:revert-105255, r=cjgillot
Revert "Make nested RPITIT inherit the parent opaque's generics."

This reverts commit e2d41f4c97, and adjusts the `tests/ui/async-await/in-trait/nested-rpit.rs` test.

r? `@cjgillot`

fixes #106332, manually verified because it had no minimization :/

reopens #105197
cc #106729
2023-01-13 05:47:24 +09:00
Yuki Okushi
19ba4305b9
Rollup merge of #106675 - krtab:fix_improper_ctypes, r=davidtwco
Mark ZST as FFI-safe if all its fields are PhantomData

This presents one possible solution to issue: #106629.

This is my first (tentative) contribution to the compiler itself.

I'm looking forward for comments and feedback

Closes: #106629
2023-01-13 05:47:22 +09:00
Yuki Okushi
fa8f77a1de
Rollup merge of #105795 - nicholasbishop:bishop-stabilize-efiapi, r=joshtriplett
Stabilize `abi_efiapi` feature

Tracking issue: https://github.com/rust-lang/rust/issues/65815
Closes #65815
2023-01-13 05:47:21 +09:00
Michael Goulet
2aabb0fd5d Point at impl self type for impl wf obligations 2023-01-12 20:44:47 +00:00
Michael Goulet
d76e168f01 Point at HIR types when impl trait ref doesn't normalize 2023-01-12 20:44:47 +00:00
Oli Scherer
d36db0d2a0 Feed the features_query instead of grabbing it from the session lazily 2023-01-12 17:14:17 +00:00
Oli Scherer
fbe2d5aad2 Remove output_filenames field from TyCtxt and feed the query instead 2023-01-12 17:14:17 +00:00
Oli Scherer
33b6a7790e Remove untracked_crate field and instead pass it along with the resolver. 2023-01-12 17:14:17 +00:00
Oli Scherer
194b4a2adb Feed crate_name query 2023-01-12 17:14:17 +00:00
Oli Scherer
408ae0fcb9 Feed resolutions query instead of it being a thin wrapper around an untracked field 2023-01-12 17:14:17 +00:00
bors
1bc3683b32 Auto merge of #106773 - Nilstrieb:rollup-sq73pyg, r=Nilstrieb
Rollup of 6 pull requests

Successful merges:

 - #105806 (Support eager subdiagnostics again)
 - #106322 (Handle inference variables in `CollectAllMismatches` correctly)
 - #106579 (Suggest making private tuple struct field public)
 - #106714 (remove unreachable error code `E0490`)
 - #106751 (Fix rendering 'const' in header for intrinsics)
 - #106761 (Add `WaffleLapkin` to compiler reviewers)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-12 17:11:03 +00:00
nils
c61f29ca52
Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
remove unreachable error code `E0490`

AFAIK, the untested and undocumented error code `E0490` is now unreachable, it was from the days of the original borrow checker.

cc ``@GuillaumeGomez`` #61137
2023-01-12 15:44:52 +01:00
nils
25fd633828
Rollup merge of #106579 - estebank:issue-52144, r=Nilstrieb
Suggest making private tuple struct field public

Fix #52144.
2023-01-12 15:44:51 +01:00
nils
35cf81d707
Rollup merge of #106322 - compiler-errors:CollectAllMismatches-infer-vars, r=oli-obk
Handle inference variables in `CollectAllMismatches` correctly

1. Fix #106240
2. Treat int/float type variables correctly (see `src/test/ui/iterators/invalid-iterator-chain-with-int-infer.rs`), so we can point out things like "`Iterator::Item` changed to `{integer}` here"
2023-01-12 15:44:51 +01:00
nils
6bf57b8110
Rollup merge of #105806 - mejrs:eager2, r=davidtwco
Support eager subdiagnostics again

See https://github.com/rust-lang/rust/pull/104941#discussion_r1051135746

I'm not sure how to add a test for this. But I did pick some of the diagnostic structs in the mentioned PR and it works with them.
2023-01-12 15:44:50 +01:00
bors
222d1ff68d Auto merge of #105603 - oli-obk:non_repeatable_queries, r=petrochenkov
Harden the pre-tyctxt query system against accidental recomputation

While the current compiler has no issues where we `take` and then compute the query again, in https://github.com/rust-lang/rust/pull/105462 I accidentally introduced such a case.

I also took the opportunity to remove `peek_mut`, which is only ever used for `global_tcx` to then invoke `enter`. I added an `enter` method directly on the query.
2023-01-12 13:59:30 +00:00
Caio
7dd45bafb4 [RFC 2397] Deny incorrect locations 2023-01-12 08:41:21 -03:00
Arthur Carcano
797f247997 Mark ZST as FFI-safe if all its fields are PhantomData
Modify the linting behavior and add the corresponding
regression test
2023-01-12 12:21:35 +01:00
bors
606c390725 Auto merge of #106760 - compiler-errors:rollup-0bogyco, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #103236 (doc: rewrite doc for signed int::{carrying_add,borrowing_sub})
 - #103800 (Stabilize `::{core,std}::pin::pin!`)
 - #106097 (Migrate mir_build diagnostics 2 of 3)
 - #106170 (Move autoderef to `rustc_hir_analysis`)
 - #106323 (Stabilize f16c_target_feature)
 - #106360 (Tweak E0277 `&`-removal suggestions)
 - #106524 (Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch)
 - #106739 (Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-12 10:46:19 +00:00
Oli Scherer
58782a8842 Harden the pre-tyctxt query system against accidental recomputation 2023-01-12 09:26:28 +00:00
Michael Goulet
9ec36f5668
Rollup merge of #106739 - WaffleLapkin:astconv, r=estebank
Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`

This removes the need for <>><><><<>> dances and makes the code a bit nicer.

Not sure if `astconv` is the best name though, maybe someone has a better idea?
2023-01-11 22:25:50 -08:00
Michael Goulet
d7113948d3
Rollup merge of #106524 - compiler-errors:constructor-note, r=cjgillot
Label `struct/enum constructor` instead of `fn item`, mention that it should be called on type mismatch

Fixes #106516
2023-01-11 22:25:49 -08:00
Michael Goulet
54f6fea818
Rollup merge of #106360 - estebank:remove-borrow-suggestion, r=compiler-errors
Tweak E0277 `&`-removal suggestions

Fix #64068, fix #84837.
2023-01-11 22:25:49 -08:00
Michael Goulet
244b90edee
Rollup merge of #106323 - starkat99:stabilize-f16c_target_feature, r=petrochenkov
Stabilize f16c_target_feature

Resolves https://github.com/rust-lang/stdarch/issues/1234

Library PR for stabilizing corresponding intrinsics: https://github.com/rust-lang/stdarch/pull/1366

See also #44839 tracking issue for target_feature
2023-01-11 22:25:48 -08:00
Michael Goulet
9928b14772
Rollup merge of #106170 - compiler-errors:autoderef-to-analysis, r=lcnr
Move autoderef to `rustc_hir_analysis`

Not sure if this is a change we actually want, but autoderef really is only (functionally) used by `rustc_hir_analysis` and `rustc_hir_typeck`, so it probably should live there.

Instead, implement a separate autoderef helper in `TypeErrCtxt` for the one use-case that  goes against the ordering of the crate graph..
2023-01-11 22:25:48 -08:00
Michael Goulet
83d3b76ac2
Rollup merge of #106097 - mejrs:mir_build2, r=oli-obk
Migrate mir_build diagnostics 2 of 3

The first three commits are fairly boring, however I've made some changes to the output of the match checking diagnostics.
2023-01-11 22:25:47 -08:00
Michael Goulet
0a2b55d4c8 Revert "Make nested RPITIT inherit the parent opaque's generics." and adjust test
This reverts commit e2d41f4c97.
2023-01-12 06:07:53 +00:00
Matthias Krüger
e8ef83e4c0
Rollup merge of #106748 - clubby789:on-unimplemented-fmt-verify, r=compiler-errors
Clean up `OnUnimplementedFormatString::verify`

Lift the always-allowed symbols to a static array and replace a `match iter().find(...)` with `iter().any(...)`
2023-01-12 06:52:39 +01:00
Matthias Krüger
a90742ac98
Rollup merge of #106732 - durin42:dmitrig-arrayref-ctor, r=nikic
rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.

LLVM upstream has deprecated llvm::makeArrayRef and will remove it.
2023-01-12 06:52:38 +01:00
Matthias Krüger
8a13157c16
Rollup merge of #106702 - estebank:trait-bounds, r=compiler-errors
Conserve cause of `ImplDerivedObligation` in E0599

CC #86377.
2023-01-12 06:52:38 +01:00
Matthias Krüger
890bc3ca90
Rollup merge of #106596 - estebank:verbose-e0271, r=compiler-errors
Hide more of long types in E0271

Fix #40186.
2023-01-12 06:52:36 +01:00
Matthias Krüger
e664cb2154
Rollup merge of #106532 - compiler-errors:dyn-star-to-dyn, r=jackh726
Allow codegen to unsize `dyn*` to `dyn`

`dyn* Trait` is just another type that implements `Trait`, so we should be able to unsize `&dyn* Trait` into `&dyn Trait` perfectly fine, same for `Box` and other unsizeable types.

Fixes #106488
2023-01-12 06:52:35 +01:00