Commit Graph

218661 Commits

Author SHA1 Message Date
Matthias Krüger
32d7024100
Rollup merge of #108400 - csmoe:cgu-instr-perf, r=bjorn3
add llvm cgu instructions stats to perf

r? ```@bjorn3```
2023-03-01 01:21:56 +01:00
Matthias Krüger
0dfbce1bb0
Rollup merge of #108376 - liushuyu:fix-sysroot-infer-103660, r=ozkanonur
compiler/rustc_session: fix sysroot detection logic

This pull request fixes the sysroot detection logic on systems where `/usr/lib` contains a multi-arch structure (e.g. installs `rustc_driver` into `/usr/lib/x86_64-linux-gnu` folder).

This fixes a regression for various Linux systems introduced in #103660. On Debian and Ubuntu systems, the logic in the pull request, as mentioned earlier, will resolve the sysroot to `/usr/lib`, making `rustc --print target-libdir` to return `/usr/lib/lib/rustlib/x86_64-unknown-linux-gnu/lib` (notice the extra `lib` at the beginning).

The fix is not very "clean" according to the standard. If you have any suggestions on improving the logic, you are more than welcome to comment below!
2023-03-01 01:21:56 +01:00
Matthias Krüger
3abc41a45c
Rollup merge of #108558 - RalfJung:core-tests, r=thomcc
add missing feature in core/tests

https://github.com/rust-lang/rust/pull/104265 introduced the `ip_in_core` feature. For some reason core tests seem to still build without that feature -- no idea how that is possible. Might be related to https://github.com/rust-lang/rust/issues/15702? I was under the impression that `pub use` with different stability doesn't actually work. That's why `intrinsics::transmute` is stable, for example.

Either way, core tests fail to build in miri-test-libstd, and adding the feature fixes that.

r? ```@thomcc```
2023-03-01 01:20:26 +01:00
Matthias Krüger
a51006b8d2
Rollup merge of #108555 - Zoxc:par-fix, r=cjgillot
Fix a race in the query system

This fixes an issue where in between the `job` removal and `complete` call the query neither has a job nor a result, allowing another thread to start executing it again.

r? ``@cjgillot``
2023-03-01 01:20:26 +01:00
Matthias Krüger
19604c2362
Rollup merge of #108554 - compiler-errors:late-bound-object-default, r=oli-obk
Only look for param in item's generics if it actually comes from generics

Record whether a `hir::GenericParam` comes from an item's generics, or from a `for<...>` binder. Then, only look for the param in `object_lifetime_default` if it actually comes from the item's generics.

Fixes #108177
2023-03-01 01:20:25 +01:00
Matthias Krüger
b2dc8c505c
Rollup merge of #108551 - compiler-errors:rpitit-bad-spec, r=oli-obk
Descriptive error when users try to combine RPITIT/AFIT with specialization

Previously we failed with some esoteric error like:

```
error[E0053]: method `foo` has an incompatible type for trait
  --> $DIR/dont-project-to-specializable-projection.rs:14:35
   |
LL |     default async fn foo(_: T) -> &'static str {
   |                                   ^^^^^^^^^^^^ expected associated type, found future
   |
note: type in trait
  --> $DIR/dont-project-to-specializable-projection.rs:10:27
   |
LL |     async fn foo(_: T) -> &'static str;
   |                           ^^^^^^^^^^^^
   = note: expected signature `fn(_) -> impl Future<Output = &'static str>`
              found signature `fn(_) -> impl Future<Output = &'static str>`
```

Now we error like:

```
error: async associated function in trait cannot be specialized
  --> $DIR/dont-project-to-specializable-projection.rs:14:5
   |
LL |     default async fn foo(_: T) -> &'static str {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: specialization behaves in inconsistent and surprising ways with `#![feature(async_fn_in_trait)]`, and for now is disallowed
```
2023-03-01 01:20:24 +01:00
Matthias Krüger
78f9bb11fe
Rollup merge of #108550 - clubby789:remove-disjoint, r=compiler-errors
Remove the `capture_disjoint_fields` feature

As best I can tell, this was stabilized for Edition 2021 in #88126 but the feature was never removed.
2023-03-01 01:20:24 +01:00
Matthias Krüger
58576663db
Rollup merge of #108536 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

1 commits in d94e03a18a2590ed3f1c67b859cb11528d2a2d5c..21a2ed14f4480dab62438dcc1130291bebc65379
2023-02-13 19:45:29 UTC to 2023-02-13 19:45:29 UTC

- Removed "," typo on ch03-01 line 85 (rust-lang/book#3537)

## rust-lang/reference

1 commits in e5adb99c04817b7fbe08f4ffce5b36702667345f..a9afb04b47a84a6753e4dc657348c324c876102c
2023-02-14 14:57:15 UTC to 2023-02-14 14:57:15 UTC

- Document the `efiapi` ABI (rust-lang/reference#1309)

## rust-lang/rust-by-example

1 commits in efe23c4fe12e06351b8dc8c3d18312c761455109..af0998b7473839ca75563ba3d3e7fd0160bef235
2023-02-15 18:17:20 UTC to 2023-02-15 18:17:20 UTC

- Typographical mistake in tuples.md (rust-lang/rust-by-example#1685)

## rust-lang/rustc-dev-guide

30 commits in 41a96ab971cb45e2a184df20619ad1829765c990..b06dab84083390e0ee1e998f466545a8a1a76a9f
2023-02-26 22:30:52 UTC to 2023-02-14 05:16:01 UTC

- Fixed typing errors (rust-lang/rustc-dev-guide#1622)
- this remains true (rust-lang/rustc-dev-guide#1620)
- diagnostics: small fixes/improvements (rust-lang/rustc-dev-guide#1618)
- typo (rust-lang/rustc-dev-guide#1616)
- typo (rust-lang/rustc-dev-guide#1617)
- keep "grey area" lint summary green (rust-lang/rustc-dev-guide#1619)
- new solver: write canonicalization chapter (rust-lang/rustc-dev-guide#1595)
- bootstrap now creates a usable toolchain when building stage0 std (rust-lang/rustc-dev-guide#1615)
- llvm 13 is now not supported (rust-lang/rustc-dev-guide#1612)
- enable AND search (rust-lang/rustc-dev-guide#1607)
- Vetting deps datecheck (rust-lang/rustc-dev-guide#1614)
- mention Dev desktops, to help with LLVM builds (rust-lang/rustc-dev-guide#1613)
- fix and clarify llvm bugfix policy (rust-lang/rustc-dev-guide#1611)
- lower-case "Compiler" in headings, for consistency (and looks) (rust-lang/rustc-dev-guide#1605)
- Explain what the rest of the backend agnostic page is about (rust-lang/rustc-dev-guide#1609)
- Bump dependencies to fix CI (rust-lang/rustc-dev-guide#1610)
- rustc_codegen_ssa feels permanent enough not to need date-check (rust-lang/rustc-dev-guide#1606)
- make use of the `host` symlink in the build directory, to ease things (rust-lang/rustc-dev-guide#1608)
- have checkboxes only point to date-check lines in files (rust-lang/rustc-dev-guide#1603)
- remove stray text (rust-lang/rustc-dev-guide#1604)
- Typo (rust-lang/rustc-dev-guide#1601)
- Typo (rust-lang/rustc-dev-guide#1602)
- Add link to vscode settings in Rust repo (rust-lang/rustc-dev-guide#1591)
- avoid code duplication by including files in docs (rust-lang/rustc-dev-guide#1598)
- howto run the examples (rust-lang/rustc-dev-guide#1593)
- Add sample CodeLLDB launch.json (rust-lang/rustc-dev-guide#1482)
- typo (rust-lang/rustc-dev-guide#1600)
- use actual names (rust-lang/rustc-dev-guide#1594)
- Fix a typo (rust-lang/rustc-dev-guide#1597)
- Add Neovim configuration information (rust-lang/rustc-dev-guide#1545)
2023-03-01 01:20:23 +01:00
Matthias Krüger
24551850a9
Rollup merge of #108531 - Coca162:rustdoc-repeat-const-array, r=thomcc
rustdoc: Show that repeated expression arrays can be made with constant values

The [rust reference](https://doc.rust-lang.org/reference/expressions/array-expr.html) currently says that repeated values for arrays can be constant or `Copy`
> repeat operand is [Copy](https://doc.rust-lang.org/reference/special-types-and-traits.html#copy) or that it must be a [path](https://doc.rust-lang.org/reference/expressions/path-expr.html) to a constant item

This updates the rust documentation on primitive arrays to reflect what the rust reference says (and also compiler suggestions if you do not use a `const` item)
2023-03-01 01:20:23 +01:00
Matthias Krüger
371904bba6
Rollup merge of #108297 - chenyukang:yukang/delim-error-exit, r=petrochenkov
Exit when there are unmatched delims to avoid noisy diagnostics

From https://github.com/rust-lang/rust/pull/104012#issuecomment-1311764832
r? ``@petrochenkov``
2023-03-01 01:20:22 +01:00
bors
ca1bc7f1f6 Auto merge of #108582 - weihanglo:update-cargo, r=weihanglo
Update cargo

10 commits in 9d5b32f503fc099c4064298465add14d4bce11e6..9880b408a3af50c08fab3dbf4aa2a972df71e951 2023-02-22 23:04:16 +0000 to 2023-02-28 19:39:39 +0000

- bump jobserver to respect `--jobserver-auth=fifo:PATH` (rust-lang/cargo#11767)
- Addition of support for -F as an alias for --features (rust-lang/cargo#11774)
- Added documentation for the configuration discovery of `cargo install` to the man pages (rust-lang/cargo#11763)
- Fix Cargo removing the sparse+ prefix from sparse URLs in .crates.toml (rust-lang/cargo#11756)
- Fix warning with tempfile (rust-lang/cargo#11771)
- Error message for transitive artifact dependencies with targets the package doesn't directly interact with (rust-lang/cargo#11643)
- Fix tests with nondeterministic ordering (rust-lang/cargo#11766)
- Make some blocking tests non-blocking (rust-lang/cargo#11650)
- Suggest cargo add when installing library crate (rust-lang/cargo#11410)
- chore: bump is-terminal to 0.4.4 (rust-lang/cargo#11759)

r? `@ghost`
2023-03-01 00:20:01 +00:00
Andre Bogus
41da875fae Add Option::as_slice(_mut)
This adds the following functions:

* `Option<T>::as_slice(&self) -> &[T]`
* `Option<T>::as_slice_mut(&mut self) -> &[T]`

The `as_slice` and `as_slice_mut` functions benefit from an
optimization that makes them completely branch-free.

Note that the optimization's soundness hinges on the fact that either
the niche optimization makes the offset of the `Some(_)` contents zero
or the mempory layout of `Option<T>` is equal to that of
`Option<MaybeUninit<T>>`.
2023-03-01 00:05:31 +01:00
Nathan Fenner
be15f174fa restore unaddressed FIXME 2023-02-28 14:59:32 -08:00
Nathan Fenner
f0212e6532 Fix error spans for arguments to tuple enum constructors 2023-02-28 14:58:14 -08:00
Weihang Lo
741f1afdd5
Update cargo
10 commits in 9d5b32f503fc099c4064298465add14d4bce11e6..9880b408a3af50c08fab3dbf4aa2a972df71e951
2023-02-22 23:04:16 +0000 to 2023-02-28 19:39:39 +0000

- bump jobserver to respect `--jobserver-auth=fifo:PATH` (rust-lang/cargo#11767)
- Addition of support for -F as an alias for --features (rust-lang/cargo#11774)
- Added documentation for the configuration discovery of `cargo install` to the man pages (rust-lang/cargo#11763)
- Fix Cargo removing the sparse+ prefix from sparse URLs in .crates.toml (rust-lang/cargo#11756)
- Fix warning with tempfile (rust-lang/cargo#11771)
- Error message for transitive artifact dependencies with targets the package doesn't directly interact with (rust-lang/cargo#11643)
- Fix tests with nondeterministic ordering (rust-lang/cargo#11766)
- Make some blocking tests non-blocking (rust-lang/cargo#11650)
- Suggest cargo add when installing library crate (rust-lang/cargo#11410)
- chore: bump is-terminal to 0.4.4 (rust-lang/cargo#11759)
2023-02-28 21:10:55 +00:00
Rune Tynan
79f0021c16
Update header comment 2023-02-28 15:52:00 -05:00
Rune Tynan
3a87a18857
Make zeroed return an Option 2023-02-28 15:39:17 -05:00
Josh Stone
565de58dd7 Skip test download_ci_llvm with modified LLVM 2023-02-28 12:02:14 -08:00
David Koloski
8c6c8b14b8 Update Fuchsia platform team members 2023-02-28 14:40:13 -05:00
Michael Goulet
cb9852b8e6 Erase **all** regions when probing for associated types in astconv 2023-02-28 17:29:46 +00:00
liushuyu
2186358e5a
compiler/rustc_session: fix sysroot detection logic ...
... on systems where /usr/lib contains a multi-arch structure
2023-02-28 10:02:38 -07:00
Kornel
2407b0c578 Explain compile-time vs run-time difference in env!() error message 2023-02-28 16:44:59 +00:00
Jesse Bakker
edf053036f Add contains_key to SortedIndexMultiMap 2023-02-28 17:15:00 +01:00
Maybe Waffle
031206bc1d micro fmt changes 2023-02-28 19:28:14 +04:00
Florian Bartels
cef9d4cbc1
Retry to spawn/fork up to 3 times when it failed because of an interruption 2023-02-28 15:59:53 +01:00
Florian Bartels
f1a399cc40
Mark stdlib for QNX as fully available 2023-02-28 15:59:53 +01:00
Florian Bartels
3ce2cd059f
Add QNX Neutrino support to libstd
Co-authored-by: gh-tr <troach@qnx.com>
2023-02-28 15:59:47 +01:00
clubby789
a321013f3e
Fix x clean with specific paths 2023-02-28 14:53:36 +00:00
Albert Larsan
b26371c21a
Make mailmap more correct 2023-02-28 15:25:09 +01:00
bors
31f858d9a5 Auto merge of #107987 - EFanZh:inline-poll-methods, r=Mark-Simulacrum
Inline `Poll` methods

With `opt-level="z"`, the `Poll::map*` methods are sometimes not inlined (see <https://godbolt.org/z/ca5ajKTEK>). This PR adds `#[inline]` to these methods. I have a project that can benefit from this change, but do we want to enable this behavior universally?

Fixes #101080.
2023-02-28 12:32:04 +00:00
Nilstrieb
e326777cca Some infer/mod.rs cleanups 2023-02-28 11:49:05 +00:00
Ralf Jung
229aef1f7d add missing feature in core/tests 2023-02-28 10:07:57 +01:00
Nathan Fenner
2566b4105d Point error span at Some constructor argument when trait resolution fails 2023-02-27 23:58:35 -08:00
yukang
f808877bbf refactor parse_token_trees to not return unmatched_delims 2023-02-28 07:57:17 +00:00
yukang
88de2e1115 no need to return unmatched_delims from tokentrees 2023-02-28 07:57:17 +00:00
yukang
9ce7472db4 rename unmatched_braces to unmatched_delims 2023-02-28 07:57:17 +00:00
yukang
65ad5f8de7 remove duplicated diagnostic for unclosed delimiter 2023-02-28 07:57:17 +00:00
yukang
f01d0c02e7 Exit when there are unmatched delims to avoid noisy diagnostics 2023-02-28 07:55:19 +00:00
bors
5157d938c4 Auto merge of #108098 - notriddle:notriddle/rustdoc-tooltip-alloc, r=GuillaumeGomez
rustdoc: reduce allocations when generating tooltips

An attempt to reduce the perf regression in
https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
2023-02-28 07:27:32 +00:00
John Kåre Alsaker
10b08e3c9c Fix a race in the query system 2023-02-28 07:47:58 +01:00
Michael Goulet
f851a8aefa Only look for param in generics if it actually comes from generics 2023-02-28 06:27:56 +00:00
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
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