Commit Graph

219150 Commits

Author SHA1 Message Date
Michael Goulet
cbf4d4e3a5 Deny capturing late-bound non-lifetime param in anon const 2023-02-28 05:59:54 +00:00
bors
fd1f1fa0d1 Auto merge of #106774 - Nugine:master, r=Amanieu
Stabilize cmpxchg16b_target_feature

Tracking issue for target features
+ #44839

stdarch issue
+ https://github.com/rust-lang/stdarch/issues/827

stdarch PR
+ https://github.com/rust-lang/stdarch/pull/1358

reference PR
+ https://github.com/rust-lang/reference/pull/1331

It's my first time contributing to rust-lang/rust. Please tell me if I missed something.
2023-02-28 04:12:34 +00:00
Michael Goulet
ecac8fd5af Descriptive error when users try to combine RPITIT/AFIT with specialization 2023-02-28 02:03:43 +00:00
Ben Kimock
5448123a11 Remove or justify use of #[rustc_box] 2023-02-27 20:54:55 -05:00
clubby789
f83ce99c32 Remove the capture_disjoint_fields feature 2023-02-28 01:21:15 +00:00
bors
b583ede652 Auto merge of #99767 - LeSeulArtichaut:stable-target-feature-11, r=estebank
Stabilize `#![feature(target_feature_11)]`

## Stabilization report

### Summary

Allows for safe functions to be marked with `#[target_feature]` attributes.

Functions marked with `#[target_feature]` are generally considered as unsafe functions: they are unsafe to call, cannot be assigned to safe function pointers, and don't implement the `Fn*` traits.

However, calling them from other `#[target_feature]` functions with a superset of features is safe.

```rust
// Demonstration function
#[target_feature(enable = "avx2")]
fn avx2() {}

fn foo() {
    // Calling `avx2` here is unsafe, as we must ensure
    // that AVX is available first.
    unsafe {
        avx2();
    }
}

#[target_feature(enable = "avx2")]
fn bar() {
    // Calling `avx2` here is safe.
    avx2();
}
```

### Test cases

Tests for this feature can be found in [`src/test/ui/rfcs/rfc-2396-target_feature-11/`](b67ba9ba20/src/test/ui/rfcs/rfc-2396-target_feature-11/).

### Edge cases

- https://github.com/rust-lang/rust/issues/73631

Closures defined inside functions marked with `#[target_feature]` inherit the target features of their parent function. They can still be assigned to safe function pointers and implement the appropriate `Fn*` traits.

```rust
#[target_feature(enable = "avx2")]
fn qux() {
    let my_closure = || avx2(); // this call to `avx2` is safe
    let f: fn() = my_closure;
}
```

This means that in order to call a function with `#[target_feature]`, you must show that the target-feature is available while the function executes *and* for as long as whatever may escape from that function lives.

### Documentation

- Reference: https://github.com/rust-lang/reference/pull/1181

---
cc tracking issue #69098
r? `@ghost`
2023-02-28 01:14:56 +00:00
bors
6290ae92b2 Auto merge of #108487 - cjgillot:no-typeck-mir, r=oli-obk
Avoid invoking typeck from borrowck

This PR attempts to reduce direct dependencies between typeck and MIR-related queries. The goal is to have all the information transit either through THIR or through dedicated queries that avoid depending on the whole `TypeckResults`.

In a first commit, we store the type information that MIR building requires into THIR. This avoids edges between mir_built and typeck.

In the second and third commit, we wrap informations around closures (upvars, kind origin and user-provided signature) to avoid borrowck depending on typeck information.

There should be a single remaining borrowck -> typeck edge in the good path, due to inline consts.
2023-02-27 21:48:10 +00:00
Camille GILLOT
209eb8ae83 Do not grow assignment_order needlessly. 2023-02-27 20:02:18 +00:00
Camille GILLOT
2a32a2b64f Special case deref projections in SsaVisitor. 2023-02-27 20:02:18 +00:00
Maybe Waffle
4a2c555904 Add Atomic*::from_ptr 2023-02-27 19:05:19 +00:00
bors
7281249a19 Auto merge of #108538 - matthiaskrgr:rollup-vw6h5ea, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104265 (Move IpAddr, SocketAddr and V4+V6 related types to `core`)
 - #107110 ([stdio][windows] Use MBTWC and WCTMB)
 - #108308 (Allow building serde and serde_derive in parallel)
 - #108363 (Move the unused extern crate check back to the resolver.)
 - #108519 (Bages for easy access links to Rust community)
 - #108522 (Commit some new solver tests)
 - #108523 (Avoid `&str` to `String` conversions)
 - #108533 (diagnostics: avoid querying `associated_item` in the resolver)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-27 18:02:10 +00:00
Matthias Krüger
a184150247
Rollup merge of #108533 - notriddle:notriddle/resolver-def-descr, r=compiler-errors
diagnostics: avoid querying `associated_item` in the resolver

Fixes #108529

CC #108324
2023-02-27 18:48:51 +01:00
Matthias Krüger
828b66e6de
Rollup merge of #108523 - TaKO8Ki:avoid-str-to-string-conversions, r=Nilstrieb
Avoid `&str` to `String` conversions

This patch removes some unnecessary `&str` to `String` conversions.
2023-02-27 18:48:50 +01:00
Matthias Krüger
585d33e704
Rollup merge of #108522 - compiler-errors:new-solver-more-tests, r=jackh726
Commit some new solver tests

Lazy norm is hard.

`<?0 as Trait>::Assoc = ?0` ... probably should emit an alias-eq goal, but currently we don't do that. Right now it fails with a cyclical ty error.

Also committed a check-pass test that broken when I attempted to fix this (unsuccessfully).

r? types
2023-02-27 18:48:50 +01:00
Matthias Krüger
2596bd26cc
Rollup merge of #108519 - 0xf333:0xf333_branch, r=Mark-Simulacrum
Bages for easy access links to Rust community

r? `@Mark-Simulacrum`
2023-02-27 18:48:49 +01:00
Matthias Krüger
660f184966
Rollup merge of #108363 - cjgillot:unused-crate, r=WaffleLapkin
Move the unused extern crate check back to the resolver.

It doesn't have anything to do in `rustc_hir_typeck`.
2023-02-27 18:48:49 +01:00
Matthias Krüger
2375d7f386
Rollup merge of #108308 - bjorn3:faster_bootstrap_build, r=albertlarsan68
Allow building serde and serde_derive in parallel

This reduces build time of bootstrap by ~6s
2023-02-27 18:48:48 +01:00
Matthias Krüger
3fe4023370
Rollup merge of #107110 - strega-nil:mbtwc-wctmb, r=ChrisDenton
[stdio][windows] Use MBTWC and WCTMB

`MultiByteToWideChar` and `WideCharToMultiByte` are extremely well optimized, and therefore should probably be used when we know we can (specifically in the Windows stdio stuff).

Fixes #107092
2023-02-27 18:48:48 +01:00
Matthias Krüger
cf04603dca
Rollup merge of #104265 - faern:move-ipaddr-to-core, r=joshtriplett
Move IpAddr, SocketAddr and V4+V6 related types to `core`

Implements RFC https://github.com/rust-lang/rfcs/pull/2832. The RFC has completed FCP with disposition merge, but is not yet merged.

Moves IP types to `core` as specified in the RFC.

The full list of moved types is: `IpAddr`, `Ipv4Addr`, `Ipv6Addr`, `SocketAddr`, `SocketAddrV4`, `SocketAddrV6`, `Ipv6MulticastScope` and `AddrParseError`.

Doing this move was one of the main driving arguments behind #78802.
2023-02-27 18:48:47 +01:00
nx2k3
a4830266b0 handle only postfix decrement 2023-02-27 17:31:55 +00:00
rustbot
8732fcd0c9 Update books 2023-02-27 12:00:26 -05:00
Michael Howell
f058bb0fcf diagnostics: avoid querying associated_item in the resolver
Fixes #108529
2023-02-27 09:22:51 -07:00
Coca162
22b65fc275
Clarify that Copy is a trait in array docs 2023-02-27 15:16:39 +00:00
bors
f540a25745 Auto merge of #108493 - cjgillot:thir-print, r=compiler-errors
Move THIR printing to rustc_mir_build.

https://github.com/rust-lang/rust/pull/107451 increased the compilation time of `rustc_middle` by 10% = 3s.

As https://github.com/rust-lang/rust/pull/107006 adds quite a lot of code to rustc_middle, I suspect it to be the cause.

This PR moves the THIR printing code to `rustc_mir_build`, where the query provider lives, in order to benefit from higher parallelism when compiling rustc.
2023-02-27 15:07:47 +00:00
Coca162
dc9732620d
Update docs to show [expr; N] can repeat const expr 2023-02-27 13:51:10 +00:00
Nilstrieb
5f593da4e6 Unify all validity check intrinsics
Also merges the inhabitedness check into the query to further unify the
code paths.
2023-02-27 13:30:44 +00:00
nx2k3
0883973d2a check double negation 2023-02-27 13:25:03 +00:00
clubby789
ef434f04e9 Allow using bool for optional diagnostics 2023-02-27 12:54:11 +00:00
bors
7d782b7ff4 Auto merge of #108175 - cjgillot:validate-storage, r=tmiasko
MIR-Validate StorageLive.

`StorageLive` statements on a local which already has storage is banned by miri.

This check is easy enough, and can detect bugs in MIR opts.
2023-02-27 11:41:41 +00:00
bjorn3
fdbc3c2dcf Allow building serde and serde_derive in parallel
This reduces build time of bootstrap by ~6s
2023-02-27 11:19:02 +00:00
Benoît du Garreau
351c154cb4 Add vectored positioned I/O on Unix 2023-02-27 10:10:13 +01:00
bors
49b9cc5139 Auto merge of #108521 - matthiaskrgr:rollup-exkviev, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #108319 (Don't project specializable RPITIT projection)
 - #108364 (Unify validity checks into a single query)
 - #108463 (bootstrap: Update the output of the `check` descriptions)
 - #108477 (Make `match` arm comma suggestion more clear)
 - #108486 (Merge diagnostic_items duplicate diagnostics)
 - #108494 (Clean up JS files code a bit)
 - #108500 (update Miri)
 - #108502 (Don't trigger error for ReError when other region is empty.)
 - #108513 (Remove `@nagisa` from review rotation)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-27 07:00:27 +00:00
Takayuki Maeda
934c8c2299 avoid &str to String conversions 2023-02-27 14:27:13 +09:00
Michael Goulet
e1485202ac Commit some new solver tests 2023-02-27 05:23:26 +00:00
Matthias Krüger
ce3397503b
Rollup merge of #108513 - nagisa:unrotate, r=joshtriplett
Remove @nagisa from review rotation

I have been reviewing PRs for a long while during weekends, however recently I’ve been having trouble commiting to that as well. Every weekend I’ve been spending working on a house.

I may return myself to the rotation in a couple of months. I may also just start ninja'ing up some PRs from the PR list whenever I find some time for reviews again, without putting myself back into the rotation, in acknowledgement that me being able to review every weekend or every second weekend is not a great experience for the contributors waiting on reviews from me.
2023-02-27 06:11:55 +01:00
Matthias Krüger
bade5566da
Rollup merge of #108502 - lenko-d:cannot_relate_region, r=compiler-errors
Don't trigger error for ReError when other region is empty.

Fixes [#107988](https://github.com/rust-lang/rust/issues/107988)
2023-02-27 06:11:55 +01:00
Matthias Krüger
37338b8d99
Rollup merge of #108500 - RalfJung:miri, r=RalfJung
update Miri

r? ``@ghost``
2023-02-27 06:11:54 +01:00
Matthias Krüger
c813994f7a
Rollup merge of #108494 - GuillaumeGomez:cleanup-js, r=notriddle
Clean up JS files code a bit

I mostly moved values closer to where they are used to make the code reading easier.

r? ```@notriddle```
2023-02-27 06:11:54 +01:00
Matthias Krüger
abc82484d4
Rollup merge of #108486 - cjgillot:owner-ditem, r=Nilstrieb
Merge diagnostic_items duplicate diagnostics

To deduplicate how we diagnose duplication.
2023-02-27 06:11:53 +01:00
Matthias Krüger
69b1b94d0c
Rollup merge of #108477 - y21:replace-semi-with-comma-sugg, r=compiler-errors
Make `match` arm comma suggestion more clear

Fixes #108472
2023-02-27 06:11:53 +01:00
Matthias Krüger
2f6ba7b4da
Rollup merge of #108463 - clubby789:update-check-output, r=albertlarsan68
bootstrap: Update the output of the `check` descriptions

This should bring the output from `x check` in line with the changes in #108171
2023-02-27 06:11:52 +01:00
Matthias Krüger
3fcc79f04a
Rollup merge of #108364 - Nilstrieb:validity-checks-refactor, r=compiler-errors
Unify validity checks into a single query

Previously, there were two queries to check whether a type allows the 0x01 or zeroed bitpattern.

I am planning on adding a further initness to check in #100423, truly uninit for MaybeUninit, which would make this three queries. This seems overkill for such a small feature, so this PR unifies them into one.

I am not entirely happy with the naming and key type and open for improvements.

r? oli-obk
2023-02-27 06:11:52 +01:00
Matthias Krüger
3a6c5429c2
Rollup merge of #108319 - compiler-errors:dont-project-to-specializable-rpitits, r=lcnr
Don't project specializable RPITIT projection

This effective rejects specialization + RPITIT/AFIT (usages of `impl Trait` in traits) because the implementation is significantly complicated over making regular "default" trait method bodies work.

I have another PR that experimentally fixes all this, but the code may not be worth investing in.
2023-02-27 06:11:51 +01:00
0xf333
56d7b9ce1b Bages for easy access links to Rust community 2023-02-26 22:20:09 -05:00
Lenko Donchev
65e56616fc Don't trigger ICE for ReError when the other region is empty. 2023-02-26 20:47:18 -06:00
Michael Goulet
ff336aa6f9 Small cleanup to one_bound_for_assoc_type 2023-02-26 23:51:49 +00:00
Simonas Kazlauskas
4afb2d467e Remove @nagisa from review rotation
I have been reviewing PRs for a long while during weekends, however
recently I’ve been having trouble commiting to that as well. Every
weekend I’ve been spending working on a house.

I may return myself to the rotation in a couple of months. I may also
just start ninja'ing up some PRs from the PR list whenever I find some
time for reviews again, without putting myself back into the rotation,
in acknowledgement that me being able to review every weekend or every
second weekend is not a great experience for the contributors waiting on
reviews from me.
2023-02-27 01:21:49 +02:00
John Kåre Alsaker
d1c8430a34 Derive Default for query structs 2023-02-26 23:45:29 +01:00
John Kåre Alsaker
3b26d71e04 Avoid implementing Debug for QueryConfig 2023-02-26 23:35:52 +01:00
John Kåre Alsaker
3fd7c4a17d Make rustc_query_system take QueryConfig by instance. 2023-02-26 23:35:47 +01:00