Commit Graph

235059 Commits

Author SHA1 Message Date
Raekye
884af362f2 Validate ~const trait bounds on associated fns.
Previously, any associated function could have `~const` trait bounds on
generic parameters, which could lead to ICEs when these bounds were used
on associated functions of non-`#[const_trait] trait` or
non-`impl const` blocks.

Includes changes as per @fee1-dead's comments in #116210.
2023-09-30 19:00:45 -04:00
bors
2f89c414f2 Auto merge of #116157 - the8472:doc-monotonoic-suspend, r=Mark-Simulacrum
Document that Instant may or may not include system-suspend time

Since people are still occasionally surprised by this let's make it more explicit. This doesn't add any new guarantees, only documents the status quo.

Related issues: #87906 #79462
2023-09-30 19:49:34 +00:00
bors
bb6c66be37 Auto merge of #116127 - onur-ozkan:sanity-checks-on-install, r=Mark-Simulacrum
add sanity checks for user write access on `x install`

Resolves #113580
2023-09-30 18:00:23 +00:00
bors
05c622138c Auto merge of #116286 - ouz-a:merge_my_commits, r=Mark-Simulacrum
Add Oğuz Ağcayazı to .mailmap

this will merge my commits under one name (hopefully)
2023-09-30 16:05:49 +00:00
bors
75d731eee9 Auto merge of #116254 - WaffleLapkin:nicen-traversal, r=cjgillot
Assorted improvements for `rustc_middle::mir::traversal`

r? `@cjgillot`

I'm not _entirely_ sure about all changes, although I do like all of them. If you'd like I can drop some commits. Best reviewed on a commit-by-commit basis, I think, since they are fairly isolated.
2023-09-30 12:38:12 +00:00
ouz-a
1008c98405 Add Oğuz Ağcayazı to .mailmap 2023-09-30 14:16:12 +03:00
bors
5282e5e120 Auto merge of #116195 - fmease:rustdoc-investigate-perf-regression, r=GuillaumeGomez
rustdoc: speed up processing of cross-crate fns to fix a perf regression

* The first commit doesn't affect perf but get's rid of a `.clone()` and a bunch of lines of code. I can drop it if you'd like me to
* The second commit, *“reduce the amount of `asyncness` query executions”*, addresses the perf regression introduced in #116084

r? `@ghost`
2023-09-30 09:18:06 +00:00
bors
177091258c Auto merge of #116280 - weihanglo:update-cargo, r=weihanglo
Update cargo

4 commits in e6aabe8b3fcf639be3a5bf68e77853bd7b3fa27d..59596f0f31a94fde48b5aa7e945cd0b7ceca9620
2023-09-26 16:31:53 +0000 to 2023-09-29 19:29:17 +0000
- refactor: Switch from termcolor to anstream (rust-lang/cargo#12751)
- Add missing `strip` entries in `dev` and `release` profiles. (rust-lang/cargo#12748)
- Add better suggestion for the unsupported silent flag (rust-lang/cargo#12723)
- docs(ref): Establish publish best practices (rust-lang/cargo#12745)

r? ghost
2023-09-30 05:53:30 +00:00
bors
9136560d32 Auto merge of #115933 - oli-obk:simd_shuffle_const, r=workingjubilee
Prototype using const generic for simd_shuffle IDX array

cc https://github.com/rust-lang/rust/issues/85229

r? `@workingjubilee` on the design

TLDR: there is now a `fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;` intrinsic that allows replacing

```rust
simd_shuffle(a, b, const { stuff })
```

with

```rust
simd_shuffle_generic::<_, _, {&stuff}>(a, b)
```

which makes the compiler implementations much simpler, if we manage to at some point eliminate `simd_shuffle`.

There are some issues with this today though (can't do math without bubbling it up in the generic arguments). With this change, we can start porting the simple cases and get better data on the others.
2023-09-30 04:05:26 +00:00
bors
4efd65571e Auto merge of #115546 - SUPERCILEX:patch-2, r=Amanieu
Weaken needlessly restrictive orderings on Arc::*_count

Follow up to https://github.com/rust-lang/rust/pull/95183 from this zulip: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Why.20does.20Arc.3A.3Astrong_count.20use.20Acquire.20instead.20of.20Relaxed.3F/near/386213850

I'd like to use the strong_count for a lockless algorithm I'm writing, but I don't need acquire semantics so that's pointlessly restrictive on arm/risc-v.
2023-09-30 02:15:19 +00:00
Weihang Lo
1ad3bb971b
Update cargo 2023-09-30 09:06:06 +08:00
bors
b8b376a287 Auto merge of #115368 - loongarch-rs:none-tier2, r=pietroalbini
Promote loongarch64-unknown-none* to Tier 2

MCP: https://github.com/rust-lang/compiler-team/issues/664
2023-09-30 00:33:43 +00:00
León Orell Valerian Liehr
841bff2e29
rustdoc: reduce the amount of asyncness query executions 2023-09-30 01:38:02 +02:00
León Orell Valerian Liehr
854cdff972
rustdoc: simplify sugared_async_return_type 2023-09-29 23:04:33 +02:00
bors
8ce4540bd6 Auto merge of #116275 - matthiaskrgr:rollup-prx5fto, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #112123 (fix(suggestion): insert projection to associated types)
 - #116024 (Implement Region for smir)
 - #116030 (run abi/compatibility test against a whole bunch of targets)
 - #116216 (ci: upgrade to crosstool-ng 1.26.0)
 - #116241 (Add Exclusive forwarding impls (FnOnce, FnMut, Generator))
 - #116263 (More fixes for running the test suite on a bare metal target)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-29 20:31:52 +00:00
Matthias Krüger
3ee2c526df
Rollup merge of #116263 - ferrocene:pa-more-bare-metal-fixes, r=oli-obk
More fixes for running the test suite on a bare metal target

This PR adds more fixes needed to run the test suite on bare metal targets (in this case, without unwinding and with static relocations). There is no CI job exercising tests without unwinds, but I can confirm this worked in Ferrocene's CI.
2023-09-29 22:27:52 +02:00
Matthias Krüger
4db2b741c8
Rollup merge of #116241 - dtolnay:exclusivefwd, r=Amanieu
Add Exclusive forwarding impls (FnOnce, FnMut, Generator)

This is adapted from #104057.
2023-09-29 22:27:51 +02:00
Matthias Krüger
60ba6b494a
Rollup merge of #116216 - heiher:crosstool, r=Kobzol
ci: upgrade to crosstool-ng 1.26.0

This PR upgrades our builders from crosstool-ng 1.25.0 to 1.26.0. Except for LoongArch64 and RISC-V 64, which have minor version upgrades, other architectures have not changed.
2023-09-29 22:27:51 +02:00
Matthias Krüger
77e9dcd3c8
Rollup merge of #116030 - RalfJung:abi-compat-test, r=wesleywiser
run abi/compatibility test against a whole bunch of targets
2023-09-29 22:27:50 +02:00
Matthias Krüger
26be5754c6
Rollup merge of #116024 - ouz-a:smir_region, r=oli-obk
Implement Region for smir

Adds Region and it's relevant types to smir and covers them with stable implementation

r? `@oli-obk`
2023-09-29 22:27:50 +02:00
Matthias Krüger
4a886462c9
Rollup merge of #112123 - bvanjoi:fix-98562, r=compiler-errors
fix(suggestion): insert projection to associated types

Fixes #98562

This PR has fixed some help suggestions for unsupported syntax, such as `fn f<T>(_:T) where T: IntoIterator, std::iter::IntoIterator::Item = () {}` to `fn f<T: IntoIterator<Item = ()>>(_T) {}`.
2023-09-29 22:27:49 +02:00
Maybe Waffle
814fbd89b6 Remove deleted docs + better link together MIR traversing docs 2023-09-29 19:16:02 +00:00
bors
56ada88e7e Auto merge of #113301 - Be-ing:stabilize_bundle_whole-archive, r=petrochenkov
stabilize combining +bundle and +whole-archive link modifiers

Per discussion on https://github.com/rust-lang/rust/issues/108081 combining +bundle and +whole-archive already works and can be stabilized independently of other aspects of the packed_bundled_libs feature. There is no risk of regression because this was not previously allowed.

r? `@petrochenkov`
2023-09-29 15:51:48 +00:00
bors
a6dfd89fa7 Auto merge of #113797 - RalfJung:offset_from_docs, r=workingjubilee
offset_from: docs improvements

This is the part of https://github.com/rust-lang/rust/pull/112837 that doesn't add a new function, just tweaks the existing docs.
2023-09-29 13:53:11 +00:00
Pietro Albini
3853774df8
mark relevant tests as requiring unwinding 2023-09-29 14:24:40 +02:00
bors
c5450191f3 Auto merge of #115759 - oli-obk:open_drop_from_non-ADT, r=lcnr
Reveal opaque types before drop elaboration

fixes https://github.com/rust-lang/rust/issues/113594

r? `@cjgillot`

cc `@JakobDegen`

This pass was introduced in https://github.com/rust-lang/rust/pull/110714

I moved it before drop elaboration (which only cares about the hidden types of things, not the opaque TAIT or RPIT type) and set it to run unconditionally (instead of depending on the optimization level and whether the inliner is active)
2023-09-29 11:59:51 +00:00
Pietro Albini
90f317b2de
add needs-relocation-model-pic to compiletest 2023-09-29 13:10:26 +02:00
bohan
b83dfb5c5a fix(suggestion): insert projection to associated types 2023-09-29 18:51:59 +08:00
bors
a66e334bc5 Auto merge of #116260 - matthiaskrgr:rollup-q3sge0i, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #116133 (ref(bootstrap.py): add `eprint` function)
 - #116201 (Fix `noop_method_call` detection)
 - #116231 (Remove `rustc_lint_defs::lint_array`)
 - #116234 (Miri subtree update)
 - #116239 (Only visit reachable nodes in SsaLocals.)
 - #116245 (Clippy backport: Move needless_raw_string_hashes to pedantic)
 - #116253 (Make `adt_const_params` feature suggestion consistent with other features and improve when it is emitted)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-09-29 09:23:45 +00:00
Matthias Krüger
95262e4602
Rollup merge of #116253 - asquared31415:adt_const_params_feature, r=compiler-errors
Make `adt_const_params` feature suggestion consistent with other features and improve when it is emitted

Makes the suggestion to add `adt_const_params` formatted like every other feature gate (notably this makes it such that the playground recognizes it). Additionally improves the situations in which that help is emitted so that it's only emitted when the type would be valid or the type *could* be valid (using a slightly incorrect heuristic that favors suggesting the feature over not) instead of, for example, implying that adding the feature would allow the use of `String`.

Also adds the "the only supported types are integers, `bool` and `char`" note to the errors on fn and raw pointers.

r? `@compiler-errors`
2023-09-29 10:11:15 +02:00
Matthias Krüger
92234f949a
Rollup merge of #116245 - flip1995:clippy-backport, r=Manishearth
Clippy backport: Move needless_raw_string_hashes to pedantic

Really small backport this time. Context: https://github.com/rust-lang/rust-clippy/pull/11415#issuecomment-1739880932

I'd rather get this in 1.74 than waiting another release cycle.

r? `@Manishearth`

cc `@Mark-Simulacrum` This should be merged before beta is branched tomorrow.
2023-09-29 10:11:14 +02:00
Matthias Krüger
4f09f80bcf
Rollup merge of #116239 - cjgillot:issue-116212, r=WaffleLapkin
Only visit reachable nodes in SsaLocals.

Fixes https://github.com/rust-lang/rust/issues/116212
2023-09-29 10:11:14 +02:00
Matthias Krüger
1ed00fe491
Rollup merge of #116234 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2023-09-29 10:11:13 +02:00
Matthias Krüger
0c45018473
Rollup merge of #116231 - DaniPopes:simpler-lint-array, r=Nilstrieb
Remove `rustc_lint_defs::lint_array`
2023-09-29 10:11:13 +02:00
Matthias Krüger
e814f1e3c0
Rollup merge of #116201 - Jarcho:noop_fix, r=fee1-dead
Fix `noop_method_call` detection

This needs to be merged before #116198 can compile. The error occurs before the compiler is built so this needs to be a separate PR.
2023-09-29 10:11:12 +02:00
Matthias Krüger
f777e8cf22
Rollup merge of #116133 - pouriya:refactor-bootstrap.py, r=albertlarsan68
ref(bootstrap.py): add `eprint` function

Implemented a 3-line function called `eprint` which is just like `print` but for `stderr`. So each `print(..., file=sys.stderr)` becomes `eprint(...)`.

<br/>

Testing `eprint` function:
```sh
$ cat eprint.py
```
```python
import sys

def eprint(*args, **kwargs):
	kwargs['file'] = sys.stderr
	print(*args, **kwargs)

eval('eprint({})'.format(sys.argv[1]))
```
```sh
$ python3 eprint.py '"hello"'
hello
$
```
```sh
$ python3 eprint.py '"hello"' 2>/dev/null
$
```
```sh
$ python3 eprint.py '"hello", "world", flush=True, file=sys.stdout'
hello world
$
```
```sh
$ python3 eprint.py '"hello", "world", flush=True, file=sys.stdout' 2>/dev/null
$
```
2023-09-29 10:11:12 +02:00
bors
b8536c1aa1 Auto merge of #116176 - FedericoStra:isqrt, r=dtolnay
Add "integer square root" method to integer primitive types

For every suffix `N` among `8`, `16`, `32`, `64`, `128` and `size`, this PR adds the methods

```rust
const fn uN::isqrt() -> uN;
const fn iN::isqrt() -> iN;
const fn iN::checked_isqrt() -> Option<iN>;
```

to compute the [integer square root](https://en.wikipedia.org/wiki/Integer_square_root), addressing issue #89273.

The implementation is based on the [base 2 digit-by-digit algorithm](https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Binary_numeral_system_(base_2)) on Wikipedia, which after some benchmarking has proved to be faster than both binary search and Heron's/Newton's method. I haven't had the time to understand and port [this code](http://atoms.alife.co.uk/sqrt/SquareRoot.java) based on lookup tables instead, but I'm not sure whether it's worth complicating such a function this much for relatively little benefit.
2023-09-29 07:35:44 +00:00
bors
c1f86f0bc8 Auto merge of #116089 - estebank:issue-115992-2, r=compiler-errors
When suggesting `self.x` for `S { x }`, use `S { x: self.x }`

Fix #115992.

r? `@compiler-errors`

Follow up to #116086.
2023-09-29 05:45:18 +00:00
bors
a327e753bc Auto merge of #115986 - onur-ozkan:fix-cross-compilation-lto-problem, r=wesleywiser
allow LTO on `proc-macro` crates with `-Zdylib-lto`

ref https://github.com/rust-lang/rust/pull/115986#issuecomment-1732316361

Fixes #110296
2023-09-29 03:57:17 +00:00
bors
60bb5192d1 Auto merge of #115843 - lcnr:bb-provisional-cache, r=compiler-errors
new solver: remove provisional cache

The provisional cache is a performance optimization if there are large, interleaving cycles. Such cycles generally do not exist. It is incredibly complex and unsound in all trait solvers which have one: the old solver, chalk, and the new solver ([link](https://github.com/rust-lang/rust/blob/master/tests/ui/traits/new-solver/cycles/inductive-not-on-stack.rs)).

Given the assumption that it is not perf-critical and also incredibly complex, remove it from the new solver, only checking whether a goal is on the stack. While writing this, I uncovered two additional soundness bugs, see the inline comments for them.

r? `@compiler-errors`
2023-09-29 02:09:40 +00:00
bors
958c2b87d8 Auto merge of #115821 - obeis:hir-analysis-migrate-diagnostics-5, r=compiler-errors
Migrate `rustc_hir_analysis` to session diagnostic [Part 5]

Finishing `coherence/builtin.rs` file
2023-09-29 00:24:57 +00:00
Maybe Waffle
27242437c7 Reverse postorder instead of using reversed postorder 2023-09-28 23:50:56 +00:00
Maybe Waffle
0e0dc59acb Use and_then instead of while let chain to clarify iter scope 2023-09-28 23:16:48 +00:00
Maybe Waffle
e0abb98e21 Remove unnecessary &mut/ref mut pair 2023-09-28 23:11:15 +00:00
asquared31415
b53a1b3808 make adt_const_params feature suggestion more consistent with others and only suggest it when the type can probably work 2023-09-28 23:10:04 +00:00
Maybe Waffle
a7f3c4e608 Don't resolve basic block data in Postorder
The only usage immediately throws out the data, so.
2023-09-28 22:48:59 +00:00
Maybe Waffle
0d8a45813c (&mut iter) -> iter.by_ref() 2023-09-28 22:30:31 +00:00
Maybe Waffle
fb0e58596f Simplify Postorder::next 2023-09-28 22:28:09 +00:00
Maybe Waffle
82e251be7d Remove ReversePostorder altogether
It was not used anywhere, instead we directly reverse postorder.
2023-09-28 22:17:13 +00:00
Maybe Waffle
f040210b31 Remove outdated comment
There is no `reset` anymore
2023-09-28 22:15:51 +00:00