Commit Graph

237126 Commits

Author SHA1 Message Date
Matthew Jasper
712106b122 Add regression test for #117058 2023-10-24 08:21:52 +00:00
bors
271dcc1d40 Auto merge of #116435 - compiler-errors:re-erased, r=lcnr
Handle `ReErased` in responses in new solver

There are legitimate cases in the compiler where we return `ReErased` for lifetimes that are uncaptured in the hidden type of an opaque. For example, in the test committed below, we ignore ignore the bivariant lifetimes of an opaque when it's inferred as the hidden type of another opaque. This may result in a `type_of(Opaque)` call returning a type that references `ReErased`. Let's handle this gracefully in the new solver.

Also added a `rustc_hidden_type_of_opaques` attr to print hidden types. This seems useful for opaques.

r? lcnr
2023-10-24 08:08:45 +00:00
Arpad Borsos
2b36547e9c
Introduce -C instrument-coverage=branch to gate branch coverage
This flag has to be used in combination with `-Zunstable-options`,
and is added in advance of adding branch coverage instrumentation.
2023-10-24 09:51:26 +02:00
bors
a15eb7e7d8 Auto merge of #3137 - RalfJung:data-race, r=oli-obk
Detect mixed-size and mixed-atomicity non-synchronized accesses

Fixes https://github.com/rust-lang/miri/issues/2303
2023-10-24 07:32:09 +00:00
Ralf Jung
900b5ef22e we don't support thread::scope on freebsd 2023-10-24 09:30:08 +02:00
Ralf Jung
d3a82817e2 futex text: avoid spurious non-atomic reads 2023-10-24 09:27:37 +02:00
Ralf Jung
f15b5637f2 fix error read-read reporting when there's also an unsynchronized non-atomic read (which is fine) 2023-10-24 09:27:37 +02:00
onur-ozkan
b99b93586f remove change-id assertion in bootstrap test
In the bootstrap test, the assertion of the change-id
fails whenever we update the change-id next to a breaking change
in build configurations. This commit removes the assertion,
as it's not critical or useful to have.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2023-10-24 09:46:34 +03:00
bors
cc13d045f4 Auto merge of #3138 - rust-lang:rustup-2023-10-24, r=RalfJung
Automatic Rustup
2023-10-24 06:30:10 +00:00
bors
6eb3e97d55 Auto merge of #116319 - BlackHoleFox:apple-rand-take-2, r=thomcc
Remove Apple RNG fallbacks and simplify implementation

Now that we have [higher Apple platform requirements](https://github.com/rust-lang/rust/pull/104385), the RNG code can be simplified a lot. Since `getentropy` still doesn't look to be usable outside macOS this implementation:
- Removes any macOS fallback paths and unconditionally links to `getentropy`
- Minimizes the implementation for everything else (iOS, watchOS, etc).

`CCRandomGenerateBytes` was added in iOS 8 which means that we can use it now. It and `SecRandomCopyBytes` have the exact same functionality, but the former has a simpler API and no longer requires libstd to link to `Security.framework` for one function. Its also available in all the other target's SDKs.

Why care about `getentropy` then though on macOS? Well, its still much more performant. Benchmarking shows it runs at ~2x the speed of `CCRandomGenerateBytes`, which makes sense since it directly pulls from the kernel vs going through its own generator etc.

Semi-related to a previous, but reverted, attempt at improving this logic in https://github.com/rust-lang/rust/pull/101011
2023-10-24 06:11:51 +00:00
The Miri Conjob Bot
ddc76e232a Merge from rustc 2023-10-24 05:17:56 +00:00
The Miri Conjob Bot
e42a8d82d6 Preparing for merge from rustc 2023-10-24 05:09:40 +00:00
Celina G. Val
ae86f59cc9 Add test and remove double ref 2023-10-23 21:36:43 -07:00
bors
e918db897d Auto merge of #116238 - tamird:gettimeofday, r=thomcc
time: use clock_gettime on macos

Replace `gettimeofday` with `clock_gettime(CLOCK_REALTIME)` on:

```
all(target_os = "macos", not(target_arch = "aarch64")),
    target_os = "ios",
    target_os = "watchos",
    target_os = "tvos"
))]
```

`gettimeofday` was first used in
cc367edd95
which predated the introduction of `clock_gettime` support in macOS
10.12 Sierra which became the minimum supported version in
58bbca958d.

Replace `mach_{absolute_time,timebase_info}` with
`clock_gettime(CLOCK_REALTIME)` on:

```
all(target_os = "macos", not(target_arch = "aarch64")),
    target_os = "ios",
    target_os = "watchos",
    target_os = "tvos"
))]
```

`mach_{absolute_time,timebase_info}` were first used in
cc367edd95
which predated the introduction of `clock_gettime` support in macOS
10.12 Sierra which became the minimum supported version in
58bbca958d.

Note that this change was made for aarch64 in
5008a317ce which predated 10.12 becoming
the minimum supported version. The discussion took place in
https://github.com/rust-lang/rust/issues/91417 and in particular
https://github.com/rust-lang/rust/issues/91417#issuecomment-992151582
and
https://github.com/rust-lang/rust/issues/91417#issuecomment-1033048064
are relevant.
2023-10-24 04:15:39 +00:00
WANG Rui
300d04dc70 tests/ui/abi/compatibility: Set min-llvm-version to 17 for LoongArch64 2023-10-24 11:43:46 +08:00
bors
f1a5ce19f5 Auto merge of #116998 - pcc:new-ndk2, r=onur-ozkan
Improve android-ndk property interface

Re-creating #102994 which was closed.

---
PR #105716 added support for NDK r25b, and removed support for r15. Since the switch to r25b would have broken existing r15 users anyway, let's take the opportunity to make the interface more user friendly.

Firstly move the android-ndk property to [build] instead of the targets. This is possible now that the NDK has obsoleted the concept of target-specific toolchains.

Also make the property take the NDK root directory instead of the "toolchains/llvm/prebuilt/<host tag>" subdirectory.
2023-10-24 02:20:24 +00:00
WANG Rui
6cf9423770 tests: Add features-gate for LoongArch 2023-10-24 09:36:47 +08:00
WANG Rui
cb618162b1 compiler: Add target features for LoongArch 2023-10-24 09:36:47 +08:00
BlackHoleFox
090e9de570 Remove Apple RNG fallbacks and simplify implementation 2023-10-23 20:35:45 -05:00
bors
cd674d6179 Auto merge of #116300 - cjgillot:split-move, r=petrochenkov
Separate move path tracking between borrowck and drop elaboration.

The primary goal of this PR is to skip creating a `MovePathIndex` for path that do not need dropping in drop elaboration.

The 2 first commits are cleanups.

The next 2 commits displace `move` errors from move-path builder to borrowck. Move-path builder keeps the same logic, but does not carry error information any more.

The remaining commits allow to filter `MovePathIndex` creation according to types. This is used in drop elaboration, to avoid computing dataflow for paths that do not need dropping.
2023-10-24 00:25:32 +00:00
bors
f654229c27 Auto merge of #117103 - matthiaskrgr:rollup-96zuuom, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #107159 (rand use getrandom for freebsd (available since 12.x))
 - #116859 (Make `ty::print::Printer` take `&mut self` instead of `self`)
 - #117046 (return unfixed len if pat has reported error)
 - #117070 (rustdoc: wrap Type with Box instead of Generics)
 - #117074 (Remove smir from triage and add me to stablemir)
 - #117086 (Update .mailmap to promote my livename)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-23 22:18:45 +00:00
David Carlier
1d3d5aaa88 stack_overflow: get_stackp using MAP_STACK flag on dragonflybsd too. 2023-10-23 22:51:16 +01:00
Celina G. Val
421631a3a1 Remove unsafe and Rc 2023-10-23 14:22:04 -07:00
Matthias Krüger
85e1a5b159
Rollup merge of #117086 - amandasystems:patch-1, r=Mark-Simulacrum
Update .mailmap to promote my livename

I had apparently forgotten to update the Rust mailmap file for my previous commits. I was sent here from [the about page!](https://thanks.rust-lang.org/about/).

Note that the second rule only fires for commits I do at my current place of work, but reclaim them under my personal email address that I expect to use for longer.
2023-10-23 22:26:32 +02:00
Matthias Krüger
4ffc0acdf9
Rollup merge of #117074 - ouz-a:remove_smir, r=compiler-errors
Remove smir from triage and add me to stablemir

As we discussed this in [weekly ](https://rust-lang.zulipchat.com/#narrow/stream/320896-project-stable-mir/topic/.5Bbi-weekly.5D.202023-10-20)meeting we don't really care for changes that happens in `smir`, we only care about changes that happen to `stable_mir` so I removed smir triage ping and added myself to `stable_mir` ping list
2023-10-23 22:26:31 +02:00
Matthias Krüger
22c9731ce4
Rollup merge of #117070 - notriddle:notriddle/cleanx, r=fmease
rustdoc: wrap Type with Box instead of Generics

When these `Box<Generics>` types were introduced, `Generics` was made with `Vec` and much larger. Now that it's made with `ThinVec`, `Type` is bigger and should be boxed instead.
2023-10-23 22:26:30 +02:00
Matthias Krüger
7e607e8e32
Rollup merge of #117046 - bvanjoi:fix-116186, r=oli-obk
return unfixed len if pat has reported error

- Fixes #116186
- Fixes #113021

This issue arises due to the creation of a fixed-length pattern, as a result of the mir body corruption. The corruption taints `tcx.eval_to_allocation_raw`, causing it to return `AlreadyReported`. Consequently, this prevents `len.try_eval_target_usize` from evaluating correctly and returns `None`. Lastly, it results in the return of `[usize; min_len]`.

To rectify this issue, my approach is that to return unfixed when encountering `ErrorHandled::Reported`. Additionally, in instances of `ErrorHandled::TooGeneric`, the previous logic has been reinstated.
2023-10-23 22:26:30 +02:00
Matthias Krüger
8af4a3f9cd
Rollup merge of #116859 - Nilstrieb:more-more-funny-pretty-printers, r=oli-obk
Make `ty::print::Printer` take `&mut self` instead of `self`

based on #116815

This simplifies the code by removing all the `self` assignments and
makes the flow of data clearer - always into the printer.
Especially in v0 mangling, which already used  `&mut self` in some
places, it gets a lot more uniform.
2023-10-23 22:26:29 +02:00
Matthias Krüger
d287861309
Rollup merge of #107159 - devnexen:random_fbsd_update, r=workingjubilee
rand use getrandom for freebsd (available since 12.x)
2023-10-23 22:26:29 +02:00
bors
41aa06ecf9 Auto merge of #116033 - bvanjoi:fix-116032, r=petrochenkov
report `unused_import` for empty reexports even it is pub

Fixes #116032

An easy fix. r? `@petrochenkov`

(Discovered this issue while reviewing #115993.)
2023-10-23 20:24:09 +00:00
Michael Goulet
a387a3cf9d Let's see what those opaque types actually are 2023-10-23 16:18:35 -04:00
Michael Goulet
fd92bc6021 Handle ReErased in responses in new solver 2023-10-23 16:12:32 -04:00
David Tolnay
6a02e20fb5
Update since stability attributes in tests 2023-10-23 13:04:47 -07:00
David Tolnay
82ed3f5e8b
Validate since value in stable attribute 2023-10-23 13:04:35 -07:00
David Tolnay
01b909174b
Fix stable feature names in tests 2023-10-23 13:03:11 -07:00
David Tolnay
67ea7986c7
Fix invalid stability attribute features in standard library 2023-10-23 13:03:10 -07:00
David Tolnay
9853f6132f
Validate #[stable(feature = "…")] identifier 2023-10-23 13:02:18 -07:00
Michael Goulet
269d5a322e Remove redundant type parameter 2023-10-23 16:02:05 -04:00
Michael Goulet
8951342911 Naming nits 2023-10-23 16:02:05 -04:00
Peter Collingbourne
aad44b3b54 Improve android-ndk property interface
PR #105716 added support for NDK r25b, and removed support for r15. Since
the switch to r25b would have broken existing r15 users anyway, let's
take the opportunity to make the interface more user friendly.

Firstly move the android-ndk property to [build] instead of the
targets. This is possible now that the NDK has obsoleted the concept of
target-specific toolchains.

Also make the property take the NDK root directory instead of the
"toolchains/llvm/prebuilt/<host tag>" subdirectory.
2023-10-23 12:15:20 -07:00
Celina G. Val
f613b26cfb Add internal() method counterpart to stable()
Note: We do not expect to provide internalizing methods for all
StableMIR constructs. They exist only to help migrating efforts to allow
users to mix StableMIR and internal constructs.
2023-10-23 12:11:07 -07:00
bjorn3
93a5433f17 Update Cranelift to 0.101.1
This patch release fixes an ABI incompatibility with LLVM.

Fixes #1395
2023-10-23 19:06:04 +00:00
Celina G. Val
66a554b045 Add method to convert internal to stable constructs 2023-10-23 12:01:39 -07:00
bors
1322f92634 Auto merge of #107009 - cjgillot:jump-threading, r=pnkfelix
Implement jump threading MIR opt

This pass is an attempt to generalize `ConstGoto` and `SeparateConstSwitch` passes into a more complete jump threading pass.

This pass is rather heavy, as it performs a truncated backwards DFS on MIR starting from each `SwitchInt` terminator. This backwards DFS remains very limited, as it only walks through `Goto` terminators.

It is build to support constants and discriminants, and a propagating through a very limited set of operations.

The pass successfully manages to disentangle the `Some(x?)` use case and the DFA use case. It still needs a few tests before being ready.
2023-10-23 18:05:44 +00:00
rustbot
c1fb05cdf2 Update books 2023-10-23 13:00:51 -04:00
Oli Scherer
3121576d70 Factor signature type walking out of opaque_types_defined_by 2023-10-23 16:55:26 +00:00
bors
e2068cdb09 Auto merge of #117087 - matthiaskrgr:rollup-08kkjkz, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #116960 (Location-insensitive polonius: consider a loan escaping if an SCC has member constraints applied only)
 - #116978 (Rewrite gdb pretty-printer registration)
 - #117040 (coverage: Add UI tests for values accepted by `-Cinstrument-coverage`)
 - #117064 (Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly)
 - #117073 (Fix suggestion for renamed coroutines feature)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-23 16:04:48 +00:00
Oğuz Ağcayazı
dc1cd4c2cd Remove smir from triage and add me to stablemir 2023-10-23 18:49:35 +03:00
Matthias Krüger
f4dfd8d497
Rollup merge of #117073 - yotamofek:fix-coroutines-feature-rename-suggestion, r=lqd
Fix suggestion for renamed coroutines feature

This fixes a small typo from #116958
2023-10-23 16:23:54 +02:00
Matthias Krüger
6814eb1052
Rollup merge of #117064 - dtolnay:handleerrors, r=cjgillot
Eliminate rustc_attrs::builtin::handle_errors in favor of emitting errors directly

Suggested in https://github.com/rust-lang/rust/pull/116773#pullrequestreview-1691411257.

This `handle_errors` function is originally from https://github.com/rust-lang/rust/pull/34531, in which it was useful because it allowed error messages and error codes (`E0542`) for multiple occurrences of the same error to be centralized in one place. For example rather than repeating this diagnostic in 2 places:

```rust
span_err!(diagnostic, attr.span, E0542, "missing 'since'");
```

one could repeat this instead:

```rust
handle_errors(diagnostic, attr.span, AttrError::MissingSince);
```

ensuring that all "missing 'since'" errors always remained consistent in message and error code.

Over time as error messages and error codes got factored to fluent diagnostics (https://github.com/rust-lang/rust/pull/100836), this rationale no longer applies. The new code has the same benefit while being less verbose (+73, -128).

```rust
sess.emit_err(session_diagnostics::MissingSince { span: attr.span });
```

r? `@cjgillot`
2023-10-23 16:23:53 +02:00