Commit Graph

229291 Commits

Author SHA1 Message Date
bors
b3ab80c119 Auto merge of #113175 - bryangarza:safe-transmute-rustc-coinductive, r=compiler-errors
Enable coinduction support for Safe Transmute

This patch adds the `#[rustc_coinductive]` annotation to `BikeshedIntrinsicFrom`, so that it's possible to compute transmutability for recursive types.

## Motivation
Safe Transmute currently already supports references (#110662). However, if a type is implemented recursively, it leads to an infinite loop when we try to check if transmutation is safe.

A couple simple examples that one might want to write, that are currently not possible to check transmutability for:
```rs
#[repr(C)] struct A(&'static B);
#[repr(C)] struct B(&'static A);
```

```rs
#[repr(C)]
enum IList<'a> { Nil, Cons(isize, &'a IList<'a>) }
#[repr(C)]
enum UList<'a> { Nil, Cons(usize, &'a UList<'a>) }
```

Previously, `@jswrenn` was considering writing a co-inductive solver from scratch, just for the `rustc_tranmsute` crate. Later on as I started working on Safe Transmute myself, I came across the `#[rustc_coinductive]` annotation, which is currently only being used for the `Sized` trait. Leveraging this trait actually solved the problem entirely, and it saves a lot of duplicate work that would have had to happen in `rustc_transmute`.
2023-07-11 13:48:59 +00:00
lcnr
e386d410e0 remove unnecessary Rc 2023-07-11 15:10:21 +02:00
bors
d8899c577b Auto merge of #113130 - chriswailes:android-library-defs, r=Amanieu
Correct the Android stat struct definitions

See https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/sys/stat.h for reference.

Originally part of https://github.com/rust-lang/rust/pull/112858
2023-07-11 11:28:33 +00:00
SparrowLii
50896c13db typeck in parallel 2023-07-11 17:52:43 +08:00
bors
63ef74b6aa Auto merge of #111717 - Urgau:uplift_fn_null_check, r=oli-obk
Uplift `clippy::fn_null_check` lint

This PR aims at uplifting the `clippy::fn_null_check` lint into rustc.

## `incorrect_fn_null_checks`

(warn-by-default)

The `incorrect_fn_null_checks` lint checks for expression that checks if a function pointer is null.

### Example

```rust
let fn_ptr: fn() = /* somehow obtained nullable function pointer */

if (fn_ptr as *const ()).is_null() { /* ... */ }
```

### Explanation

Function pointers are assumed to be non-null, checking for their nullity is incorrect.

-----

Mostly followed the instructions for uplifting a clippy lint described here: https://github.com/rust-lang/rust/pull/99696#pullrequestreview-1134072751

`@rustbot` label: +I-lang-nominated
r? compiler
2023-07-11 09:34:48 +00:00
bors
5b733e2bca Auto merge of #113316 - DrMeepster:underefer_perf, r=oli-obk
Rewrite `UnDerefer`, again

This PR is intended to improve the perf regression introduced by #112882.

`UnDerefer` has been separated out again for borrowck reasons. It was a bit overzealous to remove it in the previous PR.

r? `@oli-obk`
2023-07-11 06:52:53 +00:00
DrMeepster
b0dbd60040 optimization round 2
- moved work from `find_local` to `gather_statement`
- created custom iterator for `iter_projections`
- reverted change from `IndexVec` to `FxIndexMap`
2023-07-10 20:46:01 -07:00
bors
fcaf04e715 Auto merge of #113559 - matthiaskrgr:rollup-jrqyctc, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #113386 (style-guide: Expand example of combinable expressions to include arrays)
 - #113523 (Reuse LLVMConstInBoundsGEP2)
 - #113528 (Dynamically size sigaltstk in rustc)
 - #113543 (Remove `rustc_llvm` from llvm-stamp nags)
 - #113548 (Update books)
 - #113551 (bootstrap: Don't print "Skipping" twice)
 - #113556 (Don't use serde-derive in the rls shim)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-11 02:48:49 +00:00
Michael Goulet
846d54f16c Structurally resolve in pattern matching when peeling refs in new solver 2023-07-11 02:40:59 +00:00
León Orell Valerian Liehr
b809207dec
Lint against misplaced where-clauses on assoc tys in traits 2023-07-11 01:19:11 +02:00
Matthias Krüger
ad4f303a5d
Rollup merge of #113556 - cuviper:trim-rls, r=Mark-Simulacrum
Don't use serde-derive in the rls shim

The already-small RLS shim can get a little smaller, and faster to
build, if we drop the serde-derive dependency and decode the one
"method" field it needs manually from `serde_json::Value`.
2023-07-11 00:58:18 +02:00
Matthias Krüger
40b1c5b716
Rollup merge of #113551 - jyn514:dry-run-exclude, r=ozkanonur
bootstrap: Don't print "Skipping" twice

Bootstrap executes itself twice: once with DryRun::SelfCheck and DryRun::Disabled. Change it not to print the "Skipping" message if SelfCheck is enabled.

See https://github.com/rust-lang/rust/actions/runs/5503931599/jobs/10029625567?pr=113514#step:24:772.
2023-07-11 00:58:18 +02:00
Matthias Krüger
3413ace988
Rollup merge of #113548 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

1 commits in 21cf840842bdf768a798869f06373c96c1cc5122..668c64760b5c7ea654facb4ba5fe9faddfda27cc
2023-06-29 13:50:36 UTC to 2023-06-29 13:50:36 UTC

- Remove adjective about what kind of number this is

## rust-lang/edition-guide

2 commits in f63e578b92ff43e8cc38fcaa257b660f45c8a8c2..2751bdcef125468ea2ee006c11992cd1405aebe5
2023-07-10 14:29:51 UTC to 2023-07-08 18:05:44 UTC

- Update a link to a section in the cargo workspaces. (rust-lang/edition-guide#283)
- b'...' byte strings -> byte chars (rust-lang/edition-guide#282)

## rust-embedded/book

2 commits in f2aed2fe8e9f55508c86ba3aa4b6789b18a08a22..1e5556dd1b864109985d5871616ae6b9164bcead
2023-06-29 07:34:47 UTC to 2023-06-27 23:43:06 UTC

- add constgebra to list of math crates (rust-embedded/book#358)
- Switch to GHMQ (rust-embedded/book#357)

## rust-lang/nomicon

1 commits in c369e4b489332f8721fbae630354fa83385d457d..302b995bcb24b70fd883980fd174738c3a10b705
2023-07-05 16:08:32 UTC to 2023-07-05 16:08:32 UTC

- Minor improvements (rust-lang/nomicon#414)

## rust-lang/reference

5 commits in 5ca365eac678cb0d41a20b3204546d6ed70c7171..1ea0178266b3f3f613b0fabdaf16a83961c99cdb
2023-07-08 22:11:07 UTC to 2023-06-26 16:51:55 UTC

- Remove doc of unstable feature of never type (rust-lang/reference#1376)
- Typo: 'assingee' to 'assignee' in expressions.md (rust-lang/reference#1377)
- str type: make sentence more readable (rust-lang/reference#1374)
- Remove obsolete note about soundness hole in type-layout.md (rust-lang/reference#1367)
- Typo: 'a' to 'an' in destructors.md (rust-lang/reference#1371)

## rust-lang/rust-by-example

1 commits in 57636d6926762861f34e030d52ca25a71e95e5bf..8a87926a985ce32ca1fad1be4008ee161a0b91eb
2023-07-07 22:44:06 UTC to 2023-07-07 22:44:06 UTC

- Hint for RGB color calculation (rust-lang/rust-by-example#1726)

## rust-lang/rustc-dev-guide

18 commits in 17fe3e948498c50e208047a750f17d6a8d89669b..b5a12d95e32ae53791cc6ab44417774667ed2ac6
2023-07-09 14:50:50 UTC to 2023-06-28 04:55:24 UTC

- fix: update link to function coverage (rust-lang/rustc-dev-guide#1727)
- Fix a bug in getting-started.md (rust-lang/rustc-dev-guide#1726)
- improve explanation of placing tests in separate file (rust-lang/rustc-dev-guide#1721)
- various fixes/improvements to Contributing chapter (rust-lang/rustc-dev-guide#1723)
- ty::ConstKind has moved (rust-lang/rustc-dev-guide#1724)
- document `./x test --rustc-args` option (rust-lang/rustc-dev-guide#1719)
- tests/run-make files have moved (rust-lang/rustc-dev-guide#1716)
- replace dead link (rust-lang/rustc-dev-guide#1717)
- fix link (rust-lang/rustc-dev-guide#1718)
- update link (rust-lang/rustc-dev-guide#1709)
- typo (rust-lang/rustc-dev-guide#1706)
- OwningRef exists no more (rust-lang/rustc-dev-guide#1715)
- Try to avoid confusion (rust-lang/rustc-dev-guide#1713)
- Issue1707 doc simply use x (rust-lang/rustc-dev-guide#1710)
- include rustc-dev-guide's own issues in suggested search (rust-lang/rustc-dev-guide#1708)
- Improve feature gate and x.py docs (rust-lang/rustc-dev-guide#1701)
- Fix some links (rust-lang/rustc-dev-guide#1705)
- Define more lint terms. (rust-lang/rustc-dev-guide#1681)
2023-07-11 00:58:17 +02:00
Matthias Krüger
c2d4af6a63
Rollup merge of #113543 - cuviper:triagebot-llvm, r=jyn514
Remove `rustc_llvm` from llvm-stamp nags

LLVM is not *built* by `compiler/rustc_llvm` at all, only bindings on
top of it, so there's no need to bump `download-ci-llvm-stamp` for that.
2023-07-11 00:58:17 +02:00
Matthias Krüger
d2a3afebdd
Rollup merge of #113528 - workingjubilee:use-at-minsigstksz-in-rustc-signal-handler, r=WaffleLapkin
Dynamically size sigaltstk in rustc

rustc installs a signal stack that assumes that MINSIGSTKSZ is a constant, unchanging value. Newer hardware undermines that assumption greatly, with register files larger than glibc's traditional static MINSIGSTKZ. Properly handle this so that it is correct on all supported Linux versions with all CPUs.
2023-07-11 00:58:16 +02:00
Matthias Krüger
92a101866d
Rollup merge of #113523 - workingjubilee:reuse-const-inbounds-gep2, r=cuviper
Reuse LLVMConstInBoundsGEP2

We have had LLVM 14 as our minimum for a bit now.
2023-07-11 00:58:15 +02:00
Matthias Krüger
87f978d83c
Rollup merge of #113386 - joshtriplett:style-guide-combinable-expressions, r=compiler-errors
style-guide: Expand example of combinable expressions to include arrays

Arrays are allowed as combinable expressions, but none of the examples
show that.
2023-07-11 00:58:15 +02:00
bors
1d4f5affbd Auto merge of #113544 - Kobzol:ci-macos-13, r=jyn514
CI: use `macos-13` runner for Apple jobs

Trying if performance of Apple CI improves with macOS 13 and SIP disabled. Speed-up:
```
x86_64-apple-1: ~2h 20m > ~1h 20m
x86_64-apple-2: ~1h 45m > ~1h 15m
```

r? `@pietroalbini`
2023-07-10 22:35:11 +00:00
Josh Stone
a219505f7c Only use max_line_length = 100 for *.rs
This setting was added to match rustfmt, but it's been taking effect on
all file editing, which I notice most on git `COMMIT_EDITMSG`. I want to
keep my default 72-width commit messages, please. :)
2023-07-10 15:18:36 -07:00
Chris Wailes
dfcd3226ba Correct the Android stat struct definitions
See https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/sys/stat.h
for reference.
2023-07-10 15:13:25 -07:00
Josh Stone
dd5fa7d9b3 Don't use serde-derive in the rls shim
The already-small RLS shim can get a little smaller, and faster to
build, if we drop the serde-derive dependency and decode the one
"method" field it needs manually from `serde_json::Value`.
2023-07-10 14:53:57 -07:00
jyn
8c91c8fe84 Don't print "Skipping" twice
Bootstrap executes itself twice: once with DryRun::SelfCheck and DryRun::Disabled.
Change it not to print the "Skipping" message if SelfCheck is enabled.

See https://github.com/rust-lang/rust/actions/runs/5503931599/jobs/10029625567?pr=113514#step:24:772.
2023-07-10 15:19:54 -05:00
Michael Goulet
a74db1abb3 Fix another strange suggestion span 2023-07-10 20:09:28 +00:00
Michael Goulet
3a3f4a2144 Don't use method span on clone suggestion 2023-07-10 20:09:28 +00:00
Michael Goulet
fe870424a7 Do not set up wrong span for adjustments 2023-07-10 20:09:26 +00:00
rustbot
b706cf80b0 Update books 2023-07-10 12:23:19 -07:00
Jubilee Young
094cb1a9fb Dynamically size sigaltstk in rustc
rustc installs a signal stack that assumes that
MINSIGSTKSZ is a constant, unchanging value.
Newer hardware undermines that assumption greatly,
with register files larger than MINSIGSTKZ.
Properly handle this so that it is correct on
all supported Linux versions with all CPUs.
2023-07-10 12:05:16 -07:00
bors
8ca44ef9ca Auto merge of #112988 - spastorino:new-rpitit-24, r=compiler-errors
Replace RPITIT current impl with new strategy that lowers as a GAT

This PR replaces the current implementation of RPITITs with the new implementation that we had under -Zlower-impl-trait-in-trait-to-assoc-ty flag that lowers the RPIT as a GAT on the trait and on the impls that implement that trait.

Opening this PR as a draft because this goes after #112682, ~#112981~ and ~#112983~.
As soon as those are merged, I can rebase and we should run perf, crater and test a lot.

r? `@compiler-errors`
2023-07-10 19:01:30 +00:00
Celina G. Val
b9f378b19b Implement a few more rvalue translation to smir
- Introduce an Opaque type for adding information that is still
   internal to the compiler.
2023-07-10 11:47:48 -07:00
Jakub Beránek
8e0a87bdf4
CI: use macos-13 runner for Apple jobs 2023-07-10 20:22:15 +02:00
Celina G. Val
697563289d Implement Stable for AssertMessage 2023-07-10 10:06:18 -07:00
Celina G. Val
44d0fce150 Fix standalone build
Add extern declarations and optional dependencies to fix build done
directly via `cargo build`.
2023-07-10 10:06:18 -07:00
Urgau
c0fbeeab16 Drop uplifted clippy::fn_null_check 2023-07-10 18:12:41 +02:00
Urgau
f6d2bf63d3 Uplift clippy::fn_null_check to rustc 2023-07-10 18:12:41 +02:00
Josh Stone
68a381f38e Remove rustc_llvm from llvm-stamp nags
LLVM is not *built* by `compiler/rustc_llvm` at all, only bindings on
top of it, so there's no need to bump `download-ci-llvm-stamp` for that.
2023-07-10 09:02:47 -07:00
Camille GILLOT
a5031d569e Call super for debuginfo. 2023-07-10 16:01:19 +00:00
Camille GILLOT
b4c342edea Simplify visit_place. 2023-07-10 16:01:19 +00:00
Camille GILLOT
6d7304167c Bless incremental test. 2023-07-10 16:01:18 +00:00
Camille GILLOT
4de2d8fb66 Perform reference propagation earlier. 2023-07-10 16:01:18 +00:00
Camille GILLOT
b74a144a5f Enable by default. 2023-07-10 16:01:18 +00:00
Camille GILLOT
341e0f78d1 Fortify codegen test. 2023-07-10 16:01:18 +00:00
bors
05b82e551e Auto merge of #94748 - tbu-:pr_file_arc, r=Amanieu
Add `Read`, `Write` and `Seek` impls for `Arc<File>` where appropriate

If `&T` implements these traits, `Arc<T>` has no reason not to do so
either. This is useful for operating system handles like `File` or
`TcpStream` which don't need a mutable reference to implement these
traits.

CC #53835.
CC #94744.
2023-07-10 13:26:42 +00:00
lcnr
4965caf9be avoid building proof trees in select 2023-07-10 15:17:01 +02:00
bors
55e8df2b0e Auto merge of #113532 - matthiaskrgr:rollup-mty7u37, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #113331 (Add filter with following segment while lookup typo for path)
 - #113524 (Remove the library/term exception in tidy's pal checker code)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-10 10:30:24 +00:00
Matthias Krüger
34aebbdabd
Rollup merge of #113524 - bjorn3:remove_tidy_pal_exception, r=the8472
Remove the library/term exception in tidy's pal checker code

This crate doesn't exist anymore.
2023-07-10 12:01:33 +02:00
Matthias Krüger
70c637808f
Rollup merge of #113331 - chenyukang:yukang-fix-112590-false-positive, r=estebank
Add filter with following segment while lookup typo for path

From the discussion: https://github.com/rust-lang/rust/pull/112917#discussion_r1239150173

Seems we can not get the assoc items for `Struct`, `Enum` in the resolving phase.
A obvious filter is avoid suggesting the same name with the following segment path.

Use `following_seg` can extend the function `smart_resolve_partial_mod_path_errors` for more scenarios, such as `std::sync_error::atomic::AtomicBool` in test case.

r? `@estebank`
2023-07-10 12:01:32 +02:00
bors
3ea096a28d Auto merge of #2974 - RalfJung:rustup, r=RalfJung
Rustup
2023-07-10 08:29:33 +00:00
bjorn3
470c244c8a Remove the library/term exception in tidy's pal checker code
This crate doesn't exist anymore.
2023-07-10 08:25:50 +00:00
Ralf Jung
a3fdf75d12 Merge from rustc 2023-07-10 10:16:05 +02:00
Ralf Jung
d4034a2035 Preparing for merge from rustc 2023-07-10 10:15:54 +02:00