Commit graph

257992 commits

Author SHA1 Message Date
Nicholas Nethercote 9828e960ab Remove __rust_force_expr.
This was added (with a different name) to improve an error message. It
is no longer needed -- removing it changes the error message, but overall
I think the new message is no worse:
- the mention of `#` in the first line is a little worse,
- but the extra context makes it very clear what the problem is, perhaps
  even clearer than the old message,
- and the removal of the note about the `expr` fragment (an internal
  detail of `__rust_force_expr`) is an improvement.

Overall I think the error is quite clear and still far better than the
old message that prompted #61933, which didn't even mention patterns.

The motivation for this is #124141, which will cause pasted
metavariables to be tokenized and reparsed instead of the AST node being
cached. This change in behaviour occasionally has a non-zero perf cost,
and `__rust_force_expr` causes the tokenize/reparse step to occur twice.
Removing `__rust_force_expr` greatly reduces the extra overhead for the
`deep-vector` benchmark.
2024-06-25 14:35:09 +10:00
bors 684b3553f7 Auto merge of #124032 - Voultapher:a-new-sort, r=thomcc
Replace sort implementations

This PR replaces the sort implementations with tailor-made ones that strike a balance of run-time, compile-time and binary-size, yielding run-time and compile-time improvements. Regressing binary-size for `slice::sort` while improving it for `slice::sort_unstable`. All while upholding the existing soft and hard safety guarantees, and even extending the soft guarantees, detecting strict weak ordering violations with a high chance and reporting it to users via a panic.

* `slice::sort` -> driftsort [design document](https://github.com/Voultapher/sort-research-rs/blob/main/writeup/driftsort_introduction/text.md), includes detailed benchmarks and analysis.

* `slice::sort_unstable` -> ipnsort [design document](https://github.com/Voultapher/sort-research-rs/blob/main/writeup/ipnsort_introduction/text.md), includes detailed benchmarks and analysis.

#### Why should we change the sort implementations?

In the [2023 Rust survey](https://blog.rust-lang.org/2024/02/19/2023-Rust-Annual-Survey-2023-results.html#challenges), one of the questions was: "In your opinion, how should work on the following aspects of Rust be prioritized?". The second place was "Runtime performance" and the third one "Compile Times". This PR aims to improve both.

#### Why is this one big PR and not multiple?

* The current documentation gives performance recommendations for `slice::sort` and `slice::sort_unstable`. If for example only one of them were to be changed, this advice would be misleading for some Rust versions. By replacing them atomically, the advice remains largely unchanged, and users don't have to change their code.
* driftsort and ipnsort share a substantial part of their implementations.
* The implementation of `select_nth_unstable` uses internals of `slice::sort_unstable`, which makes it impractical to split changes.

---

This PR is a collaboration with `@orlp.`
2024-06-20 20:40:43 +00:00
bors 433355166d Auto merge of #126745 - matthiaskrgr:rollup-xagplef, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #126095 (Migrate `link-args-order`, `ls-metadata` and `lto-readonly-lib` `run-make` tests to `rmake`)
 - #126629 (Migrate `run-make/compressed-debuginfo` to `rmake.rs`)
 - #126644 (Rewrite `extern-flag-rename-transitive`. `debugger-visualizer-dep-info`, `metadata-flag-frobs-symbols`, `extern-overrides-distribution` and `forced-unwind-terminate-pof` `run-make` tests to rmake)
 - #126735 (collect attrs in const block expr)
 - #126737 (Remove `feature(const_closures)` from libcore)
 - #126740 (add `needs-unwind` to UI test)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-20 18:21:01 +00:00
Matthias Krüger 7b5ed5a66c
Rollup merge of #126740 - ferrocene:ja-ui-test-needs-unwind, r=lcnr
add `needs-unwind` to UI test

the `tail-expr-lock-poisoning` UI test uses the `panic::catch_unwind` API so it relies on unwinding being implemented. this test ought not to run on targets that do not support unwinding. add the `needs-unwind` attribute to signal this
2024-06-20 18:20:14 +02:00
Matthias Krüger b0b2082432
Rollup merge of #126737 - fee1-dead-contrib:rm-const-closures, r=compiler-errors
Remove `feature(const_closures)` from libcore

This is an incomplete feature and apparently it has no uses in `core`. Incomplete features should generally not be used in our standard library.
2024-06-20 18:20:13 +02:00
Matthias Krüger 2fa148e11a
Rollup merge of #126735 - bvanjoi:fix-126647, r=petrochenkov
collect attrs in const block expr

Fixes #126516
Fixes #126647

It was forgotten to collect these attributes in the const block expression.

r? `@petrochenkov`
2024-06-20 18:20:12 +02:00
Matthias Krüger bbf94b29fb
Rollup merge of #126644 - Oneirical:testla-coil, r=jieyouxu
Rewrite `extern-flag-rename-transitive`. `debugger-visualizer-dep-info`, `metadata-flag-frobs-symbols`, `extern-overrides-distribution` and `forced-unwind-terminate-pof` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: dist-x86_64-apple
2024-06-20 18:20:12 +02:00
Matthias Krüger 54e097d5ef
Rollup merge of #126629 - GuillaumeGomez:migrate-run-make-compressed-debuginfo, r=jieyouxu
Migrate `run-make/compressed-debuginfo` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ````@jieyouxu````
2024-06-20 18:20:11 +02:00
Matthias Krüger 440504726c
Rollup merge of #126095 - Oneirical:final-testination, r=jieyouxu
Migrate `link-args-order`, `ls-metadata` and `lto-readonly-lib` `run-make` tests to `rmake`

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Guaranteed to fail CI until #125736 gets merged. Will require addition of `fs_wrapper::set_permissions` in the associated module.

try-job: x86_64-msvc
2024-06-20 18:20:11 +02:00
bors cb8a7ea0ed Auto merge of #124807 - GuillaumeGomez:migrate-rustdoc-io-error, r=jieyouxu
Migrate `run-make/rustdoc-io-error` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`

try-job: armhf-gnu
2024-06-20 16:09:14 +00:00
Lukas Bergdoll a895ef77f0 Fix wrong big O star bracing in the doc comments 2024-06-20 18:07:04 +02:00
Lukas Bergdoll 5caa7f9a4a Improve html-checker error message
The previous message omits which of the dozens of tools called tidy is
meant. And it's written in a way that one can easily miss the *not*,
thinking it reads "Note that `tidy` is the in-tree `src/tools/tidy` but
needs to be installed". The error message should hopefully help future
contributors.
2024-06-20 18:03:42 +02:00
Jorge Aparicio f42fa4f6e0 add needs-unwind to UI test
the `tail-expr-lock-poisoning` UI test uses the `panic::catch_unwind`
API so it relies on unwinding being implemented. this test ought not to
run on targets that do not support unwinding. add the `needs-unwind`
attribute to signal this
2024-06-20 17:42:40 +02:00
Deadbeef d3091df79b Remove feature(const_closures) from libcore 2024-06-20 15:15:48 +00:00
bors 1ca578e68e Auto merge of #126736 - matthiaskrgr:rollup-rb20oe3, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #126380 (Add std Xtensa targets support)
 - #126636 (Resolve Clippy `f16` and `f128` `unimplemented!`/`FIXME`s )
 - #126659 (More status-quo tests for the `#[coverage(..)]` attribute)
 - #126711 (Make Option::as_[mut_]slice const)
 - #126717 (Clean up some comments near `use` declarations)
 - #126719 (Fix assertion failure for some `Expect` diagnostics.)
 - #126730 (Add opaque type corner case test)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-20 13:36:42 +00:00
Matthias Krüger b099c05b3a
Rollup merge of #126730 - oli-obk:opaque_type_diff_next_solver, r=lcnr
Add opaque type corner case test

r? ``@lcnr``

I can't make sense of the new solver tracing logs yet, so I just added the test without explanation.

The old solver does not yet figure out that `Foo == ()` from the where bounds. Unfortunately, even if we make it understand that, it will later try to prove `<X as Trait<'static>>::Out<Foo>: Sized` via the `is_sized_raw` query, which does not take a list of defineable opaque types, causing that check to fail with an ICE.

Thus I'm submitting this test case on its own just to ensure we handle it correctly in the future with any new solver or old solver changes.
2024-06-20 14:07:05 +02:00
Matthias Krüger f511f2b18d
Rollup merge of #126719 - nnethercote:fix-126521, r=oli-obk
Fix assertion failure for some `Expect` diagnostics.

In #120699 I moved some code dealing with `has_future_breakage` earlier in `emit_diagnostic`. Issue #126521 identified a case where that reordering was invalid (leading to an assertion failure) for some `Expect` diagnostics.

This commit partially undoes the change, by moving the handling of unstable `Expect` diagnostics earlier again. This makes `emit_diagnostic` a bit uglier, but is necessary to fix the problem.

Fixes #126521.

r? ``@oli-obk``
2024-06-20 14:07:04 +02:00
Matthias Krüger ef2e8bfcbf
Rollup merge of #126717 - nnethercote:rustfmt-use-pre-cleanups, r=jieyouxu
Clean up some comments near `use` declarations

#125443 will reformat all `use` declarations in the repository. There are a few edge cases involving comments on `use` declarations that require care. This PR cleans up some clumsy comment cases, taking us a step closer to #125443 being able to merge.

r? ``@lqd``
2024-06-20 14:07:04 +02:00
Matthias Krüger 7b91d11abb
Rollup merge of #126711 - GKFX:const-option-as-slice, r=oli-obk
Make Option::as_[mut_]slice const

These two functions can both be made `const`. I have added them to the `const_option_ext` feature, #91930. I don't believe there is anything blocking stabilization of `as_slice`, but `as_mut_slice` contains mutable references so depends on `const_mut_refs`.
2024-06-20 14:07:03 +02:00
Matthias Krüger 9cbfbda165
Rollup merge of #126659 - Zalathar:test-coverage-attr, r=cjgillot
More status-quo tests for the `#[coverage(..)]` attribute

Follow-up to #126621, after I found even more weird corner-cases in the handling of the coverage attribute.

These tests reveal some inconsistencies that are tracked by #126658.
2024-06-20 14:07:02 +02:00
Matthias Krüger d3f5e7b2d6
Rollup merge of #126636 - tgross35:clippy-f16-f128-fixme, r=flip1995
Resolve Clippy `f16` and `f128` `unimplemented!`/`FIXME`s

This was originally a PR against the Clippy repo, https://github.com/rust-lang/rust-clippy/pull/12950

r? ``@flip1995``

Tracking issue: https://github.com/rust-lang/rust/issues/116909
Fixes: https://github.com/rust-lang/rust/pull/126636
2024-06-20 14:07:01 +02:00
Matthias Krüger 586154b946
Rollup merge of #126380 - SergioGasquez:feat/std-xtensa, r=davidtwco
Add std Xtensa targets support

Adds std Xtensa targets. This enables using Rust on ESP32, ESP32-S2 and ESP32-S3 chips.

Tier 3 policy:

> A tier 3 target must have a designated developer or developers (the "target maintainers") on
record to be CCed when issues arise regarding the target. (The mechanism to track and CC such
developers may evolve over time.)

`@MabezDev,` `@ivmarkov` and I (`@SergioGasquez)` will maintain the targets.

> Targets must use naming consistent with any existing targets; for instance, a target for the same
CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should
normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond
Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the
name of a target can be highly disruptive, especially once the target reaches a higher tier, so
getting the name right is important even for a tier 3 target.

The target triple is consistent with other targets.

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to
maintain ecosystem compatibility. For example, if the name of the target makes people extremely
likely to form incorrect beliefs about what it targets, the name should be changed or augmented to
disambiguate it.
> If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known
to cause issues in Cargo.

We follow the same naming convention as other targets.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or
impose onerous legal terms for the Rust project or for Rust developers or users.

The target does not introduce any legal issues.

> The target must not introduce license incompatibilities.

There are no license incompatibilities

> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).
Everything added is under that licenses

> The target must not cause the Rust tools or libraries built for any other host (even when
supporting cross-compilation to the target) to depend on any new dependency less permissive than the
Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding
new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether
the dependency is a native library or binary. In other words, the introduction of the target must
not cause a user installing or running a version of Rust or the Rust tools to be subject to any new
license requirements.

Requirements are not changed for any other target.

> Compiling, linking, and emitting functional binaries, libraries, or other code for the target
(whether hosted on the target itself or cross-compiling from another target) must not depend on
proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary
runtime libraries supplied by the platform and commonly used by other applications built for the
target, but those libraries must not be required for code generation for the target;
cross-compilation to the target must not require such libraries at all. For instance, rustc built
for the target may depend on a common proprietary C runtime library or console output library, but
must not depend on a proprietary code generation library or code optimization library. Rust's
license permits such combinations, but the Rust project has no interest in maintaining such
combinations within the scope of Rust itself, even at tier 3.

The linker used by the targets is the GCC linker from the GCC toolchain cross-compiled for Xtensa.
GNU GPL.

> "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms
include but are not limited to: non-disclosure requirements, non-compete requirements, contributor
license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements
conditional on the employer or employment of any particular Rust developers, revocable terms, any
requirements that create liability for the Rust project or its developers or users, or any
requirements that adversely affect the livelihood or prospects of the Rust project or its developers
or users.

No such terms exist for this target

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or
estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a
target, or has any legal or employment requirement (explicit or implicit) that might affect their
decisions regarding a target, they must recuse themselves from any approval decisions regarding the
target's tier status, though they may otherwise participate in discussions.

> This requirement does not prevent part or all of this policy from being cited in an explicit
contract or work agreement (e.g. to implement or maintain support for a target). This requirement
exists to ensure that a developer or team responsible for reviewing and approving a target does not
face any legal threats or obligations that would prevent them from freely exercising their judgment
in such approval, even if such judgment involves subjective matters or goes beyond the letter of
these requirements.

Understood

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and
appropriate (core for most targets, alloc for targets that can support dynamic memory allocation,
std for targets with an operating system or equivalent layer of system-provided functionality), but
may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether
because the target makes it impossible to implement or challenging to implement. The authors of pull
requests are not obligated to avoid calling any portions of the standard library on the basis of a
tier 3 target not implementing those portions.

The targets implement libStd almost in its entirety, except for the missing support for process, as
this is a bare metal platform. The process `sys\unix` module is currently stubbed to return "not
implemented" errors.

> The target must provide documentation for the Rust community explaining how to build for the
target, using cross-compilation if possible. If the target supports running binaries, or running
tests (even if they do not pass), the documentation must explain how to run such binaries or tests
for the target, using emulation if possible or dedicated hardware if necessary.

Here is how to build for the target https://docs.esp-rs.org/book/installation/riscv-and-xtensa.html
and it also covers how to run binaries on the target.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the
community, to maintain the target. In particular, do not post comments (automated or manual) on a PR
that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or
notifications (via any medium, including via `@)` to a PR author or others involved with a PR
regarding a tier 3 target, unless they have opted into such messages.

> Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not
considered a violation of this policy, within reason. However, such messages (even on a separate
repository) must not generate notifications to anyone involved with a PR who has not requested such
notifications.

Understood

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and
must not knowingly break another tier 3 target without approval of either the compiler team or the
maintainers of the other tier 3 target.

> In particular, this may come up when working on closely related targets, such as variations of the
same architecture with different features. Avoid introducing unconditional uses of features that
another variation of the target may not have; use conditional compilation or runtime detection, as
appropriate, to let each target run code supported by that target.

No other targets should be affected

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends
from any host target.

It can produce assembly, but it requires a custom LLVM with Xtensa support
(https://github.com/espressif/llvm-project/). The patches are trying to be upstreamed
(https://github.com/espressif/llvm-project/issues/4)
2024-06-20 14:07:01 +02:00
Guillaume Gomez b30ef41833 Ignore arm targets as well for run-make/rustdoc-io-error tests 2024-06-20 14:06:37 +02:00
bohan 1e42bb606d collect attrs in const block expr 2024-06-20 19:59:27 +08:00
bors 1aaab8b9f8 Auto merge of #116088 - nbdd0121:unwind, r=Amanieu,RalfJung
Stabilise `c_unwind`

Fix #74990
Fix #115285 (that's also where FCP is happening)

Marking as draft PR for now due to `compiler_builtins` issues

r? `@Amanieu`
2024-06-20 11:22:59 +00:00
Oli Scherer 53f10b936b Add opaque type test 2024-06-20 09:20:45 +00:00
bors 1d96de2a20 Auto merge of #126409 - pacak:incr-uplorry, r=michaelwoerister
Trying to address an incremental compilation issues

This pull request contains two independent changes, one makes it so when `try_force_from_dep_node` fails to recover a query - it marks the node as "red" instead of "green" and the second one makes Debug impl for `DepNode` less panicky if it encounters something from the previous compilation that doesn't map to anything in the current one.

I'm not 100% confident that this is the correct approach, but so far I managed to find a bunch of comments suggesting that some things are allowed to fail in a certain way and changes I made are allowing for those things to fail this way and it fixes all the small reproducers I managed to find.

Compilation panic this pull request avoids is caused by an automatically generated code on an associated type and it is not happening if something else marks it as outdated first (or close like that, but scenario is quite obscure).

Fixes https://github.com/rust-lang/rust/issues/107226
Fixes https://github.com/rust-lang/rust/issues/125367
2024-06-20 09:06:16 +00:00
Zalathar ebb3aa0d46 Also test that yes/no must be bare words 2024-06-20 17:11:53 +10:00
Zalathar 388aea471f More status-quo tests for the #[coverage(..)] attribute
These tests reveal some inconsistencies that are tracked by
<https://github.com/rust-lang/rust/issues/126658>.
2024-06-20 17:11:53 +10:00
bors 1208eddaff Auto merge of #126726 - matthiaskrgr:rollup-ppe8ve3, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #126620 (Actually taint InferCtxt when a fulfillment error is emitted)
 - #126649 (Fix `feature = "nightly"` in the new trait solver)
 - #126652 (Clarify that anonymous consts still do introduce a new scope)
 - #126703 (reword the hint::blackbox non-guarantees)
 - #126708 (Minimize `can_begin_literal_maybe_minus` usage)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-20 06:54:19 +00:00
Matthias Krüger c979535aa5
Rollup merge of #126708 - nnethercote:minimize-can_begin_literal_maybe_minus, r=compiler-errors
Minimize `can_begin_literal_maybe_minus` usage

`can_begin_literal_maybe_minus` is used in a few confusing ways. This PR makes them clearer.

r? ``@spastorino``
2024-06-20 07:52:45 +02:00
Matthias Krüger af073e4e88
Rollup merge of #126703 - the8472:on-blackbox-crypto-use, r=scottmcm
reword the hint::blackbox non-guarantees

People were tripped up by the "precludes", interpreting it that this function must not ever be used in cryptographic contexts rather than the std lib merely making zero promises about it being fit-for-purpose.

What remains unchanged is that if someone does try to use it *despite the warnings* then it is on them to pin their compiler versions and verify the assembly of every single binary build they do.
2024-06-20 07:52:45 +02:00
Matthias Krüger 03d558f5b6
Rollup merge of #126652 - Manishearth:anon-const-scope, r=bjorn3,Urgau
Clarify that anonymous consts still do introduce a new scope

See https://github.com/rust-lang/rust/issues/120363#issuecomment-2177064702

This error message is misleading: it's trying to say that `const _ : () = ...` is a workaround for the lint, but by saying that anonymous constants are treated as being in the parent scope, it makes them appear useless for scope-hiding.

They *are* useful for scope-hiding, they are simply treated as part of the parent scope when it comes to this lint.
2024-06-20 07:52:44 +02:00
Matthias Krüger 8ddc8921ff
Rollup merge of #126649 - compiler-errors:nightly, r=lcnr
Fix `feature = "nightly"` in the new trait solver

r? lcnr
2024-06-20 07:52:44 +02:00
Matthias Krüger e7be3562b7
Rollup merge of #126620 - oli-obk:taint_errors, r=fee1-dead
Actually taint InferCtxt when a fulfillment error is emitted

And avoid checking the global error counter

fixes #122044
fixes #123255
fixes #123276
fixes #125799
2024-06-20 07:52:43 +02:00
bors 54fcd5bb92 Auto merge of #126534 - Rejyr:comment-section-migration, r=jieyouxu
Migrate `run-make/comment-section` to `rmake.rs`

Part of #121876.

r? `@jieyouxu`

try-job: x86_64-msvc
try-job: aarch64-gnu
try-job: aarch64-apple
2024-06-20 04:40:44 +00:00
Manish Goregaokar e8a9af9ad9 Clarify that anonymous consts still do introduce a new scope 2024-06-19 18:34:15 -07:00
Nicholas Nethercote 19b7192c72 Fix assertion failure for some Expect diagnostics.
In #120699 I moved some code dealing with `has_future_breakage` earlier
in `emit_diagnostic`. Issue #126521 identified a case where that
reordering was invalid (leading to an assertion failure) for some `Expect`
diagnostics.

This commit partially undoes the change, by moving the handling of
unstable `Expect` diagnostics earlier again. This makes
`emit_diagnostic` a bit uglier, but is necessary to fix the problem.

Fixes #126521.
2024-06-20 10:17:40 +10:00
Nicholas Nethercote b5a5647ee0 Move an EMIT_MIR comment.
This belongs on a function, not a `use` declaration.
2024-06-20 09:23:20 +10:00
Nicholas Nethercote 9981d61cdb Remove useless tidy-alphabetical markers.
rustfmt already sorts `use` declarations within the same group.
2024-06-20 09:23:20 +10:00
Nicholas Nethercote b104fbec85 Add blank lines after module-level // comments.
Similar to the previous commit.
2024-06-20 09:23:20 +10:00
Nicholas Nethercote 665821cb60 Add blank lines after module-level //! comments.
Most modules have such a blank line, but some don't. Inserting the blank
line makes it clearer that the `//!` comments are describing the entire
module, rather than the `use` declaration(s) that immediately follows.
2024-06-20 09:23:20 +10:00
Nicholas Nethercote 09006d6a88 Convert some module-level // and /// comments to //!.
This makes their intent and expected location clearer. We see some
examples where these comments were not clearly separate from `use`
declarations, which made it hard to understand what the comment is
describing.
2024-06-20 09:23:18 +10:00
bors 3d5d7a24f7 Auto merge of #126308 - scottmcm:ban-some-coercions, r=saethlin
Ban `ArrayToPointer` and `MutToConstPointer` from runtime MIR

Zulip conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/CastKind.3A.3APointerCoercion.20in.20Runtime.20MIR/near/443955195>

Apparently MIR borrowck cares about at least one of these for checking variance.

In runtime MIR, though, there's no need for them as `PtrToPtr` does the same thing.

(Banning them simplifies passes like GVN that no longer need to handle multiple cast possibilities.)

r? mir
2024-06-19 22:34:11 +00:00
George Bateman 35c65a8c0c
Make Option::as_[mut_]slice const 2024-06-19 21:44:47 +01:00
Gary Guo bb2716effd Fix wasm_exceptions test 2024-06-19 21:26:48 +01:00
Jerry Wang f44494cb3a
Migrate run-make/comment-section to rmake.rs 2024-06-19 15:55:57 -04:00
Nicholas Nethercote c6f78270b6 Introduce can_begin_string_literal.
We currently use `can_begin_literal_maybe_minus` in a couple of places
where only string literals are allowed. This commit introduces a
more specific function, which makes things clearer. It doesn't change
behaviour because the two functions affected (`is_unsafe_foreign_mod`
and `check_keyword_case`) are always followed by a call to `parse_abi`,
which checks again for a string literal.
2024-06-20 04:50:40 +10:00
Nicholas Nethercote 7d9a92ba31 Inline can_begin_literal_maybe_minus call into two places.
It's clearer this way, because the `Interpolated` cases in
`can_begin_const_arg` and `is_pat_range_end_start` are more permissive
than the `Interpolated` cases in `can_begin_literal_maybe_minus`.
2024-06-20 04:50:38 +10:00
bors d8a38b0002 Auto merge of #119127 - joboet:array_repeat, r=scottmcm
Implement `array::repeat`

See rust-lang/libs-team#310.

I've decided to make the function use the input value as last element instead of cloning it to every position and dropping it, and to make this part of the API so that callers are not surprised by this behaviour.

TODO: open a tracking issue. I'll wait for the ACP to be accepted, first.

`@rustbot` label +T-libs-api +T-libs
r? libs
2024-06-19 18:47:04 +00:00