Commit Graph

227318 Commits

Author SHA1 Message Date
Maybe Waffle ccb71ff424 `hir`: Add `Become` expression kind 2023-06-26 08:56:32 +00:00
bors 97bf23d26b Auto merge of #112877 - Nilstrieb:rollup-5g5hegl, r=Nilstrieb
Rollup of 6 pull requests

Successful merges:

 - #112632 (Implement PartialOrd for `Vec`s over different allocators)
 - #112759 (Make closure_saved_names_of_captured_variables a query. )
 - #112772 (Add a fully fledged `Clause` type, rename old `Clause` to `ClauseKind`)
 - #112790 (Syntactically accept `become` expressions (explicit tail calls experiment))
 - #112830 (More codegen cleanups)
 - #112844 (Add retag in MIR transform: `Adt` for `Unique` may contain a reference)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-21 08:00:23 +00:00
Nilstrieb 82e6a16e33
Rollup merge of #112844 - Vanille-N:unique, r=RalfJung
Add retag in MIR transform: `Adt` for `Unique` may contain a reference

Following #112662 , `may_contain_reference` in `rustc_mir_transform::add_retag` underapproximates too much the types that require retagging.

r? ``@RalfJung``
2023-06-21 07:37:03 +02:00
Nilstrieb 904994e101
Rollup merge of #112830 - nnethercote:more-codegen-cleanups, r=oli-obk
More codegen cleanups

Some additional cleanups I found while looking closely at this code, following up from #112827.

r= `@oli-obk`
2023-06-21 07:37:03 +02:00
Nilstrieb c6710d15f1
Rollup merge of #112790 - WaffleLapkin:syntactically, r=Nilstrieb
Syntactically accept `become` expressions (explicit tail calls experiment)

This adds `ast::ExprKind::Become`, implements parsing and properly gates the feature.

cc `@scottmcm`
2023-06-21 07:37:02 +02:00
Nilstrieb a98c14f3a9
Rollup merge of #112772 - compiler-errors:clauses-1, r=lcnr
Add a fully fledged `Clause` type, rename old `Clause` to `ClauseKind`

Does two basic things before I put up a more delicate set of PRs (along the lines of #112714, but hopefully much cleaner) that migrate existing usages of `ty::Predicate` to `ty::Clause` (`predicates_of`/`item_bounds`/`ParamEnv::caller_bounds`).

1. Rename `Clause` to `ClauseKind`, so it's parallel with `PredicateKind`.
2. Add a new `Clause` type which is parallel to `Predicate`.
    * This type exposes `Clause::kind(self) -> Binder<'tcx, ClauseKind<'tcx>>` which is parallel to `Predicate::kind` 😸

The new `Clause` type essentially acts as a newtype wrapper around `Predicate` that asserts that it is specifically a `PredicateKind::Clause`. Turns out from experimentation[^1] that this is not negative performance-wise, which is wonderful, since this a much simpler design than something that requires encoding the discriminant into the alignment bits of a predicate kind, or something else like that...

r? ``@lcnr`` or ``@oli-obk``

[^1]: https://github.com/rust-lang/rust/pull/112714#issuecomment-1595653910
2023-06-21 07:37:01 +02:00
Nilstrieb 34c8e53d7a
Rollup merge of #112759 - cjgillot:closure-names, r=oli-obk
Make closure_saved_names_of_captured_variables a query.

As we will start removing debuginfo during MIR optimizations, we need to keep them somewhere.
2023-06-21 07:37:01 +02:00
Nilstrieb 78a90cb4ee
Rollup merge of #112632 - gootorov:vec_alloc_partialeq, r=dtolnay
Implement PartialOrd for `Vec`s over different allocators

It is already possible to `PartialEq` `Vec`s with different allocators, but that is not the case with `PartialOrd`.
2023-06-21 07:37:00 +02:00
bors 67da586efe Auto merge of #106450 - albertlarsan68:fix-arc-ptr-eq, r=Amanieu
Make `{Arc,Rc,Weak}::ptr_eq` ignore pointer metadata

FCP completed in https://github.com/rust-lang/rust/issues/103763#issuecomment-1362267967

Closes #103763
2023-06-21 05:13:39 +00:00
bors c55d1ee8d4 Auto merge of #112119 - zirconium-n:issue-113072-merge-borrow-kind, r=lcnr
Merge `BorrowKind::Unique` into `BorrowKind::Mut`

Fixes #112072

Might have conflict with #112070

r? `@lcnr`

I'm not sure what's the suitable change in a couple places.
2023-06-21 02:06:10 +00:00
Nicholas Nethercote 1da1348924 Remove Queries::ongoing_codegen.
There's no need to store it in `Queries`. We can just use a local
variable, because it's always used shortly after it's produced.

The commit also removes the `tcx.analysis()` call in `ongoing_codegen`,
because it's easy to ensure that's done beforehand.

All this makes the dataflow within `run_compiler` easier to follow, at
the cost of making one test slightly more verbose, which I think is a
good tradeoff.
2023-06-21 11:29:45 +10:00
Nicholas Nethercote c696307a87 Inline and remove `WorkItem::start_profiling` and `execute_work_item`.
They both match on a `WorkItem`. It's simpler to do it all in one place.
2023-06-21 10:56:19 +10:00
bors 4457658f68 Auto merge of #112859 - weihanglo:update-cargo, r=weihanglo
Update cargo

12 commits in 0c14026aa84ee2ec4c67460c0a18abc8519ca6b2..dead4b8740c4b6a8ed5211e37c99cf81d01c3b1c
2023-06-14 18:43:05 +0000 to 2023-06-20 20:07:17 +0000
- Convert valid feature name warning to an error. (rust-lang/cargo#12291)
- fix(embedded): Don't pollute script dir with lockfile (rust-lang/cargo#12284)
- fix: remove `-Zjobserver-per-rustc` again (rust-lang/cargo#12285)
- docs: some tweaks around `cargo test` (rust-lang/cargo#12288)
- Enable `doctest-in-workspace` by default (rust-lang/cargo#12221)
- fix(embedded): Don't auto-discover build.rs files (rust-lang/cargo#12283)
- fix(embeded): Don't pollute the scripts dir with `target/` (rust-lang/cargo#12282)
- feat: prepare for the next lockfile bump (rust-lang/cargo#12279)
- fix(embedded): Don't create an intermediate manifest (rust-lang/cargo#12268)
- refactor(embedded): Switch to `syn` for parsing doc comments (rust-lang/cargo#12258)
- fix(embedded): Align package name sanitization with cargo-new (rust-lang/cargo#12255)
- Clarify the default behavior of cargo-install. (rust-lang/cargo#12276)

r? `@ghost`
2023-06-20 23:15:14 +00:00
Weihang Lo 214a0d1531
Update cargo 2023-06-20 23:11:31 +01:00
bors 46514218f6 Auto merge of #112835 - lcnr:proof-tree-nits, r=BoxyUwU
proof tree nits

r? `@BoxyUwU`
2023-06-20 19:58:46 +00:00
bors a34ceade11 Auto merge of #112847 - bvanjoi:fix-112831, r=Nilstrieb
Revert #112758 and add test case

Fixes #112831.

Cannot unwrap `update_resolution` for `resolution.single_imports.remove(&Interned::new_unchecked(import));` because there is a relationship between the `Import` and `&NameBinding` in `NameResolution`. This issue caused by my unfamiliarity with the data structure and I apologize for it.

This PR had been reverted, and test case have been added.

r? `@Nilstrieb`
cc `@petrochenkov`
2023-06-20 15:52:44 +00:00
bohan 09d4a823d5 test(resolve): update_resolution for remove single import 2023-06-20 22:54:12 +08:00
bohan 629b50928c Revert "Rollup merge of #112758 - bvanjoi:clean-up-resolve, r=petrochenkov"
This reverts commit 3b059e0fdb, reversing
changes made to d70be67047.
2023-06-20 22:47:50 +08:00
Neven Villani 74aad5ce56
`Adt` for `Unique` may contain a reference 2023-06-20 16:30:44 +02:00
bors 1b6d4cdc4d Auto merge of #112839 - GuillaumeGomez:rollup-jc5nqug, r=GuillaumeGomez
Rollup of 6 pull requests

Successful merges:

 - #112464 (Fix windows `Socket::connect_timeout` overflow)
 - #112720 (Rustdoc: search: color item type and reduce size to avoid clashing)
 - #112762 (Sort the errors from arguments checking so that suggestions are handled properly)
 - #112786 (change binders from tuple structs to named fields)
 - #112794 (Fix linker failures when #[global_allocator] is used in a dependency)
 - #112819 (Disable feature(unboxed_closures, fn_traits) in weird-exprs)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-20 13:05:06 +00:00
Ziru Niu b8a250fc4f update comment on `MutBorrowKind::ClosureCapture` 2023-06-20 20:55:31 +08:00
Ziru Niu a52cc0a8c9 address most easy comments 2023-06-20 20:55:31 +08:00
Ziru Niu 8fb4c41f35 merge `BorrowKind::Unique` into `BorrowKind::Mut` 2023-06-20 20:55:31 +08:00
Guillaume Gomez 2368fa27d1
Rollup merge of #112819 - dtolnay:weirdderef, r=Nilstrieb
Disable feature(unboxed_closures, fn_traits) in weird-exprs

One shouldn't need a nightly compiler in order to ~~have fun~~ call a function many times.
2023-06-20 14:23:41 +02:00
Guillaume Gomez 0688182f9b
Rollup merge of #112794 - bjorn3:fix_lib_global_alloc, r=oli-obk
Fix linker failures when #[global_allocator] is used in a dependency

Fixes https://github.com/rust-lang/rust/issues/112715
2023-06-20 14:23:41 +02:00
Guillaume Gomez 73496fc5d5
Rollup merge of #112786 - lcnr:early-binder, r=Nilstrieb
change binders from tuple structs to named fields
2023-06-20 14:23:40 +02:00
Guillaume Gomez 6c5e212c17
Rollup merge of #112762 - chenyukang:yukang-fix-112507-argument-checking, r=compiler-errors
Sort the errors from arguments checking so that suggestions are handled properly

Fixes #112507

The algorithm of `find_issue` does not make sure the index comes out in order, which will make suggesting `remove` or `add` arguments broken in some cases.

Modifying the algorithm to obey order involves much more trivial change, so it's better to order the `errors` after iterations.
2023-06-20 14:23:40 +02:00
Guillaume Gomez a318824b43
Rollup merge of #112720 - poliorcetics:rustdoc-item-type-color-same-as-item-color, r=notriddle,GuillaumeGomez
Rustdoc: search: color item type and reduce size to avoid clashing

- rustdoc: search: color item type same as item
- rustdoc: search: reduce item type size to 0.875rem to avoid clashing with path and item
2023-06-20 14:23:39 +02:00
Guillaume Gomez 816b659157
Rollup merge of #112464 - eval-exec:exec/fix-connect_timeout-overflow, r=ChrisDenton
Fix windows `Socket::connect_timeout` overflow

This PR want to close #112405

- [x] add unit test
2023-06-20 14:23:39 +02:00
lcnr e4b171a198 inspect nits 2023-06-20 14:01:03 +02:00
Eval EXEC a0c757a13f
Remove useless unit tests 2023-06-20 18:47:31 +08:00
Eval EXEC 30e1c1a53c
Ignore `connect_timeout` unit test on SGX platform
Co-authored-by: Chris Denton <christophersdenton@gmail.com>
2023-06-20 18:43:12 +08:00
lcnr f7472aa69e cleanup imports 2023-06-20 12:41:00 +02:00
lcnr f5438d658f split probe into 2 functions for better readability 2023-06-20 12:40:43 +02:00
bors 6fc0273b5a Auto merge of #112320 - compiler-errors:do-not-impl-via-obj, r=lcnr
Add `implement_via_object` to `rustc_deny_explicit_impl` to control object candidate assembly

Some built-in traits are special, since they are used to prove facts about the program that are important for later phases of compilation such as codegen and CTFE. For example, the `Unsize` trait is used to assert to the compiler that we are able to unsize a type into another type. It doesn't have any methods because it doesn't actually *instruct* the compiler how to do this unsizing, but this is later used (alongside an exhaustive match of combinations of unsizeable types) during codegen to generate unsize coercion code.

Due to this, these built-in traits are incompatible with the type erasure provided by object types. For example, the existence of `dyn Unsize<T>` does not mean that the compiler is able to unsize `Box<dyn Unsize<T>>` into `Box<T>`, since `Unsize` is a *witness* to the fact that a type can be unsized, and it doesn't actually encode that unsizing operation in its vtable as mentioned above.

The old trait solver gets around this fact by having complex control flow that never considers object bounds for certain built-in traits:
2f896da247/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs (L61-L132)

However, candidate assembly in the new solver is much more lovely, and I'd hate to add this list of opt-out cases into the new solver. Instead of maintaining this complex and hard-coded control flow, instead we can make this a property of the trait via a built-in attribute. We already have such a build attribute that's applied to every single trait that we care about: `rustc_deny_explicit_impl`. This PR adds `implement_via_object` as a meta-item to that attribute that allows us to opt a trait out of object-bound candidate assembly as well.

r? `@lcnr`
2023-06-20 08:42:37 +00:00
Alexis (Poliorcetics) Bourget c3cdf8542d tests: add test for color of item kind 2023-06-20 08:28:56 +02:00
bors b9d608c979 Auto merge of #112821 - calebcartwright:rustfmt-sync, r=calebcartwright
update rustfmt

changes described in https://github.com/rust-lang/rustfmt/blob/master/CHANGELOG.md#153-2023-06-20

r? `@ghost`

cc `@rust-lang/rustfmt`
2023-06-20 05:58:16 +00:00
Michael Goulet ca68cf0d46 Merge attrs, better validation 2023-06-20 04:38:55 +00:00
Michael Goulet 91e5c3f2e5 Make rustc_deny_explicit_impl only local as well 2023-06-20 04:38:46 +00:00
Michael Goulet 657d3f43a9 Add rustc_do_not_implement_via_object 2023-06-20 04:38:46 +00:00
Caleb Cartwright aca66a20c6 update lockfile for rustfmt sync 2023-06-19 23:19:48 -05:00
Caleb Cartwright 08384b854f Merge commit '3f7c366fc0464e01ddcaefbd70647cb3da4202be' into rustfmt-sync 2023-06-19 23:13:56 -05:00
Caleb Cartwright 3f7c366fc0 chore: release v1.5.3 2023-06-19 22:54:36 -05:00
David Tolnay 32b98ea2a9
Disable feature(unboxed_closures, fn_traits) in weird-exprs
One shouldn't need a nightly compiler in order to ~~have fun~~ call a
function many times.
2023-06-19 20:22:35 -07:00
bors d7dcadc597 Auto merge of #112817 - compiler-errors:rollup-0eqomra, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #112232 (Better error for non const `PartialEq` call generated by `match`)
 - #112499 (Fix python linting errors)
 - #112596 (Suggest correct signature on missing fn returning RPITIT/AFIT)
 - #112606 (Alter `Display` for `Ipv6Addr` for IPv4-compatible addresses)
 - #112781 (Don't consider TAIT normalizable to hidden ty if it would result in impossible item bounds)
 - #112787 (Add gha problem matcher)
 - #112799 (Clean up "doc(hidden)" check)
 - #112803 (Format the examples directory of cg_clif)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-20 02:58:53 +00:00
Caleb Cartwright ec8a4d41f1
Merge pull request #5788 from calebcartwright/subtree-sync-2023-06-19
sync subtree in prep for next release
2023-06-19 21:57:03 -05:00
Caleb Cartwright 0b17d7ea46 chore: address merge and bump toolchain 2023-06-19 21:29:15 -05:00
Caleb Cartwright 312a86b46b Merge remote-tracking branch 'upstream/master' into subtree-sync-2023-06-19 2023-06-19 20:56:20 -05:00
Lukasz Anforowicz f4201ef2cb Handling of numbered markdown lists.
Fixes issue #5416
2023-06-19 20:50:01 -05:00
Michael Goulet 0ca3252310
Rollup merge of #112803 - bjorn3:more_formatting, r=compiler-errors
Format the examples directory of cg_clif

Formatting has been enforced in cg_clif's CI for a while now.
2023-06-19 17:53:37 -07:00