Commit Graph

255772 Commits

Author SHA1 Message Date
Lzu Tao
c7d2f4592f addresss reviews 2024-05-21 18:17:55 +00:00
Lzu Tao
73602bf408 Update check-cfg lists for std 2024-05-21 18:17:55 +00:00
Lzu Tao
0734ae22f5 Update check-cfg lists for alloc 2024-05-21 18:17:55 +00:00
Lzu Tao
63fe640f5d Update check-cfg lists for core 2024-05-21 18:17:55 +00:00
Philipp Krones
bb1481a72a
Merge commit '2efebd2f0c03dabbe5c3ad7b4ebfbd99238d1fb2' into clippy-subtree-update 2024-05-21 10:39:30 -07:00
bors
506512391b Auto merge of #124676 - djkoloski:relax_multiple_sanitizers, r=cuviper,rcvalle
Relax restrictions on multiple sanitizers

Most combinations of LLVM sanitizers are legal-enough to enable simultaneously. This change will allow simultaneously enabling ASAN and shadow call stacks on supported platforms.

I used this python script to generate the mutually-exclusive sanitizer combinations:

```python
#!/usr/bin/python3

import subprocess

flags = [
    ["-fsanitize=address"],
    ["-fsanitize=leak"],
    ["-fsanitize=memory"],
    ["-fsanitize=thread"],
    ["-fsanitize=hwaddress"],
    ["-fsanitize=cfi", "-flto", "-fvisibility=hidden"],
    ["-fsanitize=memtag", "--target=aarch64-linux-android", "-march=armv8a+memtag"],
    ["-fsanitize=shadow-call-stack"],
    ["-fsanitize=kcfi", "-flto", "-fvisibility=hidden"],
    ["-fsanitize=kernel-address"],
    ["-fsanitize=safe-stack"],
    ["-fsanitize=dataflow"],
]

for i in range(len(flags)):
    for j in range(i):
        command = ["clang++"] + flags[i] + flags[j] + ["-o", "main.o", "-c", "main.cpp"]
        completed = subprocess.run(command, stderr=subprocess.DEVNULL)
        if completed.returncode != 0:
            first = flags[i][0][11:].replace('-', '').upper()
            second = flags[j][0][11:].replace('-', '').upper()
            print(f"(SanitizerSet::{first}, SanitizerSet::{second}),")
```
2024-05-21 15:35:29 +00:00
Ben Kimock
51cf3815ce Don't do cc detection for synthetic targets 2024-05-21 11:24:19 -04:00
joboet
fde4a22da2
core: actually use TAIT instead of emulating it 2024-05-21 15:59:48 +02:00
Ralf Jung
c0b4b454c3 interpret: make overflowing binops just normal binops 2024-05-21 14:50:09 +02:00
bors
6715446db6 Auto merge of #125358 - matthiaskrgr:rollup-mx841tg, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #124570 (Miscellaneous cleanups)
 - #124772 (Refactor documentation for Apple targets)
 - #125011 (Add opt-for-size core lib feature flag)
 - #125218 (Migrate `run-make/no-intermediate-extras` to new `rmake.rs`)
 - #125225 (Use functions from `crt_externs.h` on iOS/tvOS/watchOS/visionOS)
 - #125266 (compiler: add simd_ctpop intrinsic)
 - #125348 (Small fixes to `std::path::absolute` docs)

Failed merges:

 - #125296 (Fix `unexpected_cfgs` lint on std)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-21 12:50:09 +00:00
bors
2efebd2f0c Auto merge of #12765 - yusufraji:while-float, r=llogiq
Add new lint `while_float`

This PR adds a nursery lint that checks for while loops comparing floating point values.

changelog:
```
changelog: [`while_float`]: Checks for while loops comparing floating point values.
```

Fixes #758
2024-05-21 11:36:31 +00:00
Georg Semmler
2cff3e90bc
Move #[do_not_recommend] to the #[diagnostic] namespace
This commit moves the `#[do_not_recommend]` attribute to the
`#[diagnostic]` namespace. It still requires
`#![feature(do_not_recommend)]` to work.
2024-05-21 13:14:41 +02:00
Matthias Krüger
e6e05d51ec
Rollup merge of #125348 - tbu-:pr_doc_path_absolute, r=jhpratt
Small fixes to `std::path::absolute` docs
2024-05-21 12:47:07 +02:00
Matthias Krüger
fd975f75fa
Rollup merge of #125266 - workingjubilee:stream-plastic-love, r=RalfJung,nikic
compiler: add simd_ctpop intrinsic

Fairly straightforward addition.

cc `@rust-lang/opsem` new (extremely boring) intrinsic
2024-05-21 12:47:06 +02:00
Matthias Krüger
a8ee8d5086
Rollup merge of #125225 - madsmtm:ios-crt_externs.h, r=workingjubilee
Use functions from `crt_externs.h` on iOS/tvOS/watchOS/visionOS

Use `_NSGetEnviron`, `_NSGetArgc` and `_NSGetArgv` on iOS/tvOS/watchOS/visionOS, see each commit and the code comments for details. This allows us to unify more code with the macOS implementation, as well as avoiding linking to the `Foundation` framework (which is good for startup performance).

The biggest problem with doing this would be if it lead to App Store rejections. After doing a bunch of research on this, while [it did happen once in 2009](https://blog.unity.com/engine-platform/unity-app-store-submissions-problem-solved), I find it fairly unlikely to happen nowadays, especially considering that Apple has later _added_ `crt_externs.h` to the iOS/tvOS/watchOS/visionOS SDKs, strongly signifying the functions therein is indeed supported on those platforms (even though they lack an availability attribute).

That we've been overly cautious here has also been noted by `@thomcc` in https://github.com/rust-lang/rust/pull/117910#issuecomment-1903372350.

r? `@workingjubilee`

`@rustbot` label O-apple
2024-05-21 12:47:05 +02:00
Matthias Krüger
7ef533bce6
Rollup merge of #125218 - Oneirical:easy-test-the-third, r=jieyouxu
Migrate `run-make/no-intermediate-extras` to new `rmake.rs`

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2024-05-21 12:47:05 +02:00
Matthias Krüger
4abf179b14
Rollup merge of #125011 - diondokter:opt-for-size, r=Amanieu,kobzol
Add opt-for-size core lib feature flag

Adds a feature flag to the core library that enables the possibility to have smaller implementations for certain algorithms.

So far, the core lib has traded performance for binary size. This is likely what most people want since they have big simd-capable machines. However, people on small machines, like embedded devices, don't enjoy the potential speedup of the bigger algorithms, but do have to pay for them. These microcontrollers often only have 16-1024kB of flash memory.

This PR is the result of some talks with project members like `@Amanieu` at RustNL.
There are some open questions of how this is eventually stabilized, but it's a similar question as with the existing `panic_immediate_abort` feature.

Speaking as someone from the embedded side, we'd rather have this unstable for a while as opposed to not having it at all. In the meantime we can try to use it and also add additional PRs to the core lib that uses the feature flag in areas where we find benefit.

Open questions from my side:
- Is this a good feature name?
  - `panic_immediate_abort` is fairly verbose, so I went with something equally verbose
  - It's easy to refactor later
- I've added the feature to `std` and `alloc` as well as they might benefit too. Do we agree?
  - I expect these to get less usage out of the flag since most size-constraint projects don't use these libraries often.
2024-05-21 12:47:04 +02:00
Matthias Krüger
4a4883bfb7
Rollup merge of #124772 - madsmtm:apple-platform-support-docs, r=oli-obk
Refactor documentation for Apple targets

Refactor the documentation for Apple targets in `rustc`'s platform support page to make it clear what the supported OS version is and which environment variables are being read (`*_DEPLOYMENT_TARGET` and `SDKROOT`). This fixes https://github.com/rust-lang/rust/issues/124215.

Note that I've expanded the `aarch64-apple-ios-sim` maintainers `@badboy` and `@deg4uss3r` to include being maintainer of all `*-apple-ios-*` targets. If you do not wish to be so, please state that, then I'll explicitly note that in the docs.

Additionally, I've added myself as co-maintainer of most of these targets.

r? `@thomcc`

I think the documentation you've previously written on tvOS is great, have mostly modified it to have a more consistent formatting with the rest of the Apple target.

I recognize that there's quite a few changes here, feel free to ask about any of them!

---

CC `@simlay` `@Nilstrieb`

`@rustbot` label O-apple
2024-05-21 12:47:04 +02:00
Matthias Krüger
df59800b08
Rollup merge of #124570 - nnethercote:misc-cleanups, r=michaelwoerister
Miscellaneous cleanups

A mix of small cleanups made while looking at various things.

r? `@wesleywiser`
2024-05-21 12:47:03 +02:00
bors
e8fbd99128 Auto merge of #124097 - compiler-errors:box-into-iter, r=WaffleLapkin
Add `IntoIterator` for `Box<[T]>` + edition 2024-specific lints

* Adds a similar method probe opt-out mechanism to the `[T;N]: IntoIterator` implementation for edition 2021.
* Adjusts the relevant lints (shadowed `.into_iter()` calls, new source of method ambiguity).
* Adds some tests.
* Took the liberty to rework the logic in the `ARRAY_INTO_ITER` lint, since it was kind of confusing.

Based mostly off of #116607.

ACP: rust-lang/libs-team#263
References #59878
Tracking for Rust 2024: https://github.com/rust-lang/rust/issues/123759

Crater run was done here: https://github.com/rust-lang/rust/pull/116607#issuecomment-1770293013
Consensus afaict was that there is too much breakage, so let's do this in an edition-dependent way much like `[T; N]: IntoIterator`.
2024-05-21 10:13:53 +00:00
Guillaume Gomez
f8c992f8b4 Migrate run-make/rustdoc-scrape-examples-multiple to rmake.rs 2024-05-21 12:11:17 +02:00
Michael Woerister
8f11f48a02 Use Backtrace::force_capture instead of Backtrace::capture in rustc_log 2024-05-21 10:54:36 +02:00
bors
e875391458 Auto merge of #123812 - compiler-errors:additional-fixes, r=fmease
Follow-up fixes to `report_return_mismatched_types`

Some renames, simplifications, fixes, etc. Follow-ups to #123804. I don't think it totally disentangles this code, but it does remove some of the worst offenders on the "I am so confused" scale (e.g. `get_node_fn_decl`).
2024-05-21 08:06:41 +00:00
bors
1d0e4afd4c Auto merge of #125298 - tesuji:arrcmp, r=nikic
Add codegen test for array comparision opt

Fixed since rust 1.55
closes #62531
2024-05-21 05:55:39 +00:00
Nicholas Nethercote
3ac816a1ca Sort rustc_middle attributes.
As is already done in several other crates, such as `rustc_errors`.
2024-05-21 14:56:57 +10:00
Nicholas Nethercote
ac847b2583 Remove unused features from rustc_middle. 2024-05-21 14:56:57 +10:00
Nicholas Nethercote
c1d5b6a480 Remove erroneous comment.
The comment was originally in `src/librustc_mir/lib.rs`, but now that
it's in `compiler/rustc_const_eval/src/lib.rs` it's no longer
appropriate.
2024-05-21 14:56:57 +10:00
Nicholas Nethercote
ce222328d7 Minor pub and whitespace cleanups. 2024-05-21 14:56:57 +10:00
Nicholas Nethercote
d8ea468994 Reorder some use items. 2024-05-21 14:55:37 +10:00
Nicholas Nethercote
eb10eb2b45 Reorder top-level attributes.
And remove an unnecessary `feature(try_blocks)`.
2024-05-21 14:55:37 +10:00
Jubilee Young
d89500843c Move 100 entries from tests/ui into subdirs
- Move super-fast-paren-parsing test into ui/parser
- Move stmt_expr_attrs test into ui/feature-gates
- Move macro tests into ui/macros
- Move global_asm tests into ui/asm
- Move env tests into ui/process
- Move xcrate tests into ui/cross-crate
- Move unop tests into ui/unop
- Move backtrace tests into ui/backtrace
- Move check-static tests into ui/statics
- Move expr tests into ui/expr
- Move optimization fuel tests into ui/fuel
- Move ffi attribute tests into ui/ffi-attrs
- Move suggestion tests into ui/suggestions
- Move main tests into ui/fn-main
- Move lint tests into ui/lint
- Move repr tests into ui/repr
- Move intrinsics tests into ui/intrinsics
- Move tool lint tests into ui/tool-attributes
- Move return tests into ui/return
- Move pattern tests into ui/patttern
- Move range tests into ui/range
- Move foreign-fn tests into ui/foreign
- Move orphan-check tests into ui/coherence
- Move inference tests into ui/inference
- Reduce ROOT_ENTRY_LIMIT
2024-05-20 19:55:59 -07:00
bors
9cb6bb8599 Auto merge of #125284 - compiler-errors:uplift-misc, r=lcnr
Uplift `RegionVid`, `TermKind` to `rustc_type_ir`, and `EagerResolver` to `rustc_next_trait_solver`

- Uplift `RegionVid`. This was complicated due to the fact that we implement `polonius_engine::Atom` for `RegionVid` -- but I just separated that into `PoloniusRegionVid`, and added `From`/`Into` impls so it can be defined in `rustc_borrowck` separately. Coherence 😵
- Change `InferCtxtLike` to expose `opportunistically_resolve_{ty,ct,lt,int,float}_var` so that we can uplift `EagerResolver` for use in the canonicalization methods.
- Uplift `TermKind` much like `GenericArgKind`

All of this is miscellaneous dependencies for making more `EvalCtxt` methods generic.
2024-05-21 02:51:38 +00:00
Oneirical
95c47d3396 simplify 2024-05-20 21:30:48 -04:00
bors
8e7517d99a Auto merge of #125349 - matthiaskrgr:rollup-p2mbdxi, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #124050 (Remove libc from MSVC targets)
 - #124283 (Note for E0599 if shadowed bindings has the method.)
 - #125123 (Fix `read_exact` and `read_buf_exact` for `&[u8]` and `io:Cursor`)
 - #125158 (hir pretty: fix block indent)
 - #125308 (track cycle participants per root)
 - #125332 (Update books)
 - #125333 (switch to the default implementation of `write_vectored`)
 - #125346 (Remove some `Path::to_str` from `rustc_codegen_llvm`)

Failed merges:

 - #125310 (Move ~100 tests from tests/ui to subdirs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-21 00:46:30 +00:00
Michael Goulet
a2a6fe7e51 Inline get_node_fn_decl into get_fn_decl, simplify/explain logic in report_return_mismatched_types 2024-05-20 20:16:29 -04:00
Lzu Tao
e7d6da3676 Add codegen test for array comparision opt 2024-05-21 00:09:25 +00:00
Michael Goulet
b826eb219c Rename confusing function name 2024-05-20 19:56:48 -04:00
Michael Goulet
d2dabeee76 Remove redundant blk_id parameter 2024-05-20 19:56:48 -04:00
Michael Goulet
5915850071 No need to pass parent of block for BlockTailExpression 2024-05-20 19:56:48 -04:00
Michael Goulet
ffdf277618 Consolidate two arms doing the same thing 2024-05-20 19:56:48 -04:00
Michael Goulet
addd931fdb Remove get_parent_fn_decl; it's redundant 2024-05-20 19:56:48 -04:00
Michael Goulet
917bb8396c Fix miri too 2024-05-20 19:21:38 -04:00
Michael Goulet
bd0d306c14 Remove a clippy test that doesn't apply anymore 2024-05-20 19:21:38 -04:00
Michael Goulet
bc6b70f1d1 Adjust the method ambiguity lint too 2024-05-20 19:21:38 -04:00
Michael Goulet
a502e7ac1d Implement BOXED_SLICE_INTO_ITER 2024-05-20 19:21:30 -04:00
Michael Goulet
1a81092531 Add the impls for Box<[T]>: IntoIterator
Co-authored-by: ltdk <usr@ltdk.xyz>
2024-05-20 19:21:30 -04:00
Michael Goulet
c86a4aa5ca Backticks 2024-05-20 19:16:36 -04:00
Matthias Krüger
63fa01eb09
Rollup merge of #125346 - tbu-:pr_rm_path_to_str, r=wesleywiser
Remove some `Path::to_str` from `rustc_codegen_llvm`

Unnecessary panic paths when there's a better option.
2024-05-21 00:47:04 +02:00
Matthias Krüger
73bb47eecd
Rollup merge of #125333 - hermit-os:fuse, r=workingjubilee
switch to the default implementation of `write_vectored`

HermitOS doesn't support write_vectored and switch to the default implementation of `write_vectored`.
2024-05-21 00:47:03 +02:00
Matthias Krüger
75728fe8e0
Rollup merge of #125332 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

8 commits in bebcf527e67755a989a1739b7cfaa8f0e6b30040..5e9051f71638aa941cd5dda465e25c61cde9594f
2024-05-16 14:58:56 UTC to 2024-05-07 23:58:22 UTC

- Convert ch01-03-hello-cargo.md Listing 1-2 using `<Listing>` (rust-lang/book#3924)
- infra: fix rendering bug in mdbook-trpl-note (rust-lang/book#3925)
- infra: support `Listing`s without `file-name` (rust-lang/book#3920)
- Add a `<Listing>` preprocessor (rust-lang/book#3918)
- Update explanation according to code listing (rust-lang/book#3916)
- infra: run package tests (rust-lang/book#3915)
- Fix workspace behavior by excluding `listings` (rust-lang/book#3914)
- Backport changes to chapter 8 (rust-lang/book#3913)

## rust-embedded/book

1 commits in 17842ebb050f62e40a4618edeb8e8ee86e758707..dd962bb82865a5284f2404e5234f1e3222b9c022
2024-05-17 23:43:59 UTC to 2024-05-17 23:43:59 UTC

- 'llvm-tools-preview' component is now named 'llvm-tools' (rust-embedded/book#372)

## rust-lang/reference

2 commits in 51817951d0d213a0011f82b62aae02c3b3f2472e..e356977fceaa8591c762312d8d446769166d4b3e
2024-05-10 12:49:15 UTC to 2024-05-07 13:32:57 UTC

- Document inline const/const block expression (rust-lang/reference#1295)
- patterns: include yet unstable exclusive range patterns (rust-lang/reference#1484)

## rust-lang/rust-by-example

7 commits in 229ad13b64d919b12e548d560f06d88963b25cd3..20482893d1a502df72f76762c97aed88854cdf81
2024-05-20 14:36:21 UTC to 2024-05-14 16:17:03 UTC

- Clarify interchangability for From and Into (rust-lang/rust-by-example#1851)
- Update ja.po based on the latest master (rust-lang/rust-by-example#1850)
- Add explicit section link (rust-lang/rust-by-example#1847)
- Adjust translation build on CI (rust-lang/rust-by-example#1849)
- Update mdbook version in CI (rust-lang/rust-by-example#1848)
- Fix some broken links in ja.po (rust-lang/rust-by-example#1844)
- Fix an external link to absolute (rust-lang/rust-by-example#1842)

## rust-lang/rustc-dev-guide

8 commits in 2d1947ff34d50ca46dfe242ad75531a4c429bb52..b6d4a4940bab85cc91eec70cc2e3096dd48da62d
2024-05-17 17:04:58 UTC to 2024-05-09 13:22:03 UTC

- Add a high level explanation of early/late bound params (rust-lang/rustc-dev-guide#1982)
- Fix broken link to "Lowering" (rust-lang/rustc-dev-guide#1981)
- Broken link fix (rust-lang/rustc-dev-guide#1980)
- Add note about how to pick up abandoned PRs (rust-lang/rustc-dev-guide#1977)
- Toc here is overkill (rust-lang/rustc-dev-guide#1976)
- Link to lint `L-*` labels (rust-lang/rustc-dev-guide#1975)
- Update the rustc_interface examples for current rustc (rust-lang/rustc-dev-guide#1974)
- Edit `Parameter Environments`'s url as it has been edited in #1953 (rust-lang/rustc-dev-guide#1973)
2024-05-21 00:47:03 +02:00