Commit graph

236438 commits

Author SHA1 Message Date
Josh Stone 5f86fe96d8 ci: add a runner for vanilla LLVM 17 2023-10-19 10:47:18 -07:00
bors c104861b7b Auto merge of #116940 - matthiaskrgr:rollup-25ezp8a, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #116650 (add some comments and some cleanup around Miri intptrcast)
 - #116896 (Only check in a single place if a pass is enabled.)
 - #116906 (Use v0.0.0 in compiler crates)
 - #116921 (fix(bootstrap) info message show correct path now)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-19 13:25:39 +00:00
Matthias Krüger e8544f80ec
Rollup merge of #116921 - Fenex:fix/bootstrap-setup-info-msg, r=compiler-errors
fix(bootstrap) info message show correct path now

running `./x setup tools` showed me a note with incorrect path
2023-10-19 14:38:28 +02:00
Matthias Krüger c9764263d2
Rollup merge of #116906 - compiler-errors:version-0, r=oli-obk
Use v0.0.0 in compiler crates

I may be totally off base here, but my understanding is that it's conventional to use v0.0.0 to reflect the unversioned nature of the compiler crates. Fix that for some of the compiler crates that were created recently.
2023-10-19 14:38:27 +02:00
Matthias Krüger 096943a534
Rollup merge of #116896 - cjgillot:single-inline, r=oli-obk
Only check in a single place if a pass is enabled.

Fixes https://github.com/rust-lang/rust/issues/116294
2023-10-19 14:38:26 +02:00
Matthias Krüger 1d46614335
Rollup merge of #116650 - RalfJung:miri-intptrcast, r=oli-obk
add some comments and some cleanup around Miri intptrcast

`@saethlin` maybe this helps a bit?
2023-10-19 14:38:26 +02:00
bors 3fbcfd2b6f Auto merge of #116132 - darthunix:connect_poll, r=cuviper
Make TCP connect handle EINTR correctly

According to the [POSIX](https://pubs.opengroup.org/onlinepubs/009695399/functions/connect.html) standard, if connect() is interrupted by a signal that is caught while blocked waiting to establish a connection, connect() shall fail and set errno to EINTR, but the connection request shall not be aborted, and the connection shall be established asynchronously. When the connection has been established asynchronously, select() and poll() shall indicate that the file descriptor for the socket is ready for writing.

The previous implementation differs from the recomendation: in a case of the EINTR we tried to reconnect in a loop and sometimes get EISCONN error (this problem was originally detected on MacOS).

1. More details about the problem in an [article](http://www.madore.org/~david/computers/connect-intr.html).
2. The original [issue](https://git.picodata.io/picodata/picodata/tarantool-module/-/issues/157).
2023-10-19 11:22:28 +00:00
bors a01382dbea Auto merge of #116037 - wesleywiser:stack_protector_test_windows, r=cuviper
Add `-Zstack-protector` test for Windows targets

Add variants of the `stack-protector-heuristics-effect.rs` test for 32-bit and 64-bit MSVC Windows and update the original test to run on GNU Windows targets.

I added two tests instead of trying to modify the original because:
  - MSVC uses a different function name (`__security_check_cookie` to perform the test rather than doing the test inline and calling `__stack_chk_fail`).
  - LLVM's stack protection pass doesn't currently support generating checks for [frames with funclet based EH personality](37fd3c96b9/llvm/lib/CodeGen/StackProtector.cpp (L103C1-L109C4)).
  - 32-bit Windows uses classic EH while 64-bit Windows uses table-based EH which results in slightly different codegen.

[CI run with test passing on {i686,x86_64}-{msvc,mingw}](https://github.com/rust-lang/rust/actions/runs/6275450644/job/17042958375?pr=116037)
2023-10-19 07:50:09 +00:00
bors 36b61e5aa5 Auto merge of #116923 - fmease:rollup-ev7q387, r=fmease
Rollup of 7 pull requests

Successful merges:

 - #116663 (Don't ICE when encountering unresolved regions in `fully_resolve`)
 - #116761 (Fix podman detection in CI scripts)
 - #116795 (Add `#[track_caller]` to `Option::unwrap_or_else`)
 - #116829 (Make `#[repr(Rust)]` incompatible with other (non-modifier) representation hints like `C` and `simd`)
 - #116883 (Change my name in mailmap)
 - #116908 (Tweak wording of type errors involving type params)
 - #116912 (Some renaming nits for `rustc_type_ir`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-19 03:52:32 +00:00
León Orell Valerian Liehr 8aa1d7124a
Rollup merge of #116912 - compiler-errors:rustc_type_ir-bikeshedding, r=jackh726
Some renaming nits for `rustc_type_ir`

tl;dr:
* `ListTy` -> `Tys`
* `PlaceholderType` -> `PlaceholderTy`
* `RegionVid` -> `InferRegion`
* `ListBinderExistentialPredicate` -> `BoundExistentialPredicates`
* `GenericArgsRef` -> `GenericArgs`

r? jackh726
2023-10-19 04:34:48 +02:00
León Orell Valerian Liehr 64ed233fc1
Rollup merge of #116908 - estebank:issue-78206, r=compiler-errors
Tweak wording of type errors involving type params

Fix #78206.
2023-10-19 04:34:47 +02:00
León Orell Valerian Liehr 42c7d216b7
Rollup merge of #116883 - blyxyas:fix-mailmap, r=Nilstrieb
Change my name in mailmap

I changed some things about my distro (my GPG key, along with the git username). This PR sets my committer name as `blyxyas` for those commits so that it is the same as my reviewer name in `thanks`.
2023-10-19 04:34:47 +02:00
León Orell Valerian Liehr 2eb6e5f740
Rollup merge of #116829 - fmease:rust-aint-c, r=compiler-errors
Make `#[repr(Rust)]` incompatible with other (non-modifier) representation hints like `C` and `simd`

Read more about this change here: https://github.com/rust-lang/rust/pull/116829#issuecomment-1768618240.

Fixes [after backport] #116825.
2023-10-19 04:34:46 +02:00
León Orell Valerian Liehr 80c9588549
Rollup merge of #116795 - DaniPopes:track-caller-option, r=cuviper
Add `#[track_caller]` to `Option::unwrap_or_else`

Same as #116317 but for `Option`.

Closes #115302
2023-10-19 04:34:46 +02:00
León Orell Valerian Liehr 29d98777cb
Rollup merge of #116761 - Nilstrieb:podman, r=cuviper
Fix podman detection in CI scripts

When docker-podman compat was set up in a way that causes "docker" to be the argv[0] of podman, the previous detection did not work. This was for example the case in the compat package from nixpkgs.

This checks the output and should work everywhere.

I tested it locally by executing
```sh
if [[ "$id" != 0 && "$(docker version)" =~ Podman ]]; then
    echo yes
else
    echo no
fi
```
which printed `no` before, and `yes` now.

fixes #113129

r? cuviper
2023-10-19 04:34:45 +02:00
León Orell Valerian Liehr 2dd1c8f693
Rollup merge of #116663 - compiler-errors:resolve-regions, r=lcnr
Don't ICE when encountering unresolved regions in `fully_resolve`

We can encounter unresolved regions due to unconstrained impl lifetime arguments because `collect_return_position_impl_trait_in_trait_tys` runs before WF actually checks that the impl is well-formed.

Fixes #116525
2023-10-19 04:34:45 +02:00
bors 020d00867a Auto merge of #114534 - niluxv:strict_prov_unwind, r=cuviper,workingjubilee
Strict provenance unwind

1. Turned many `usize`s in the personality/unwind code that are actually pointers into `*const u8`.
2. Rewrote `read_encoded_pointer` to conform to strict-provenance, along the lines as described by `@eddyb` [in zulip some time ago](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/strict.20provenance.20in.20dwarf.3A.3Aeh/near/276197290).

This should make supporting CHERI in the future easier (but they use a [slightly modified format in the callsite table](https://cheri-compiler-explorer.cl.cam.ac.uk/z/n6GhhW), which requires a CHERI specific modification to `find_eh_action`).
2023-10-19 01:56:45 +00:00
Vitaliy Busko 2d144d2115
fix(bootstrap) info message show correct path now 2023-10-19 08:52:46 +07:00
bors 89432aadcb Auto merge of #116402 - joboet:global_alloc_tls_unsoundness, r=thomcc,workingjubilee
Panic when the global allocator tries to register a TLS destructor

Using a `RefCell` avoids the undefined behaviour encountered in #116390 and reduces the amount of `unsafe` code in the codebase.
2023-10-19 00:03:42 +00:00
Esteban Küber bd8b46800d Tweak wording of type errors involving type params
Fix #78206.
2023-10-18 23:53:18 +00:00
Michael Goulet 189e6a833e Some renaming nits for rustc_type_ir 2023-10-18 23:29:28 +00:00
Michael Goulet 8d20182999 Remove unused variant BinderListTy 2023-10-18 23:09:17 +00:00
Michael Goulet 60c95448c3 Use v0.0.0 in compiler crates 2023-10-18 21:55:15 +00:00
bors 0039d739d4 Auto merge of #116493 - compiler-errors:coinductive-cycle-lint, r=lcnr
Bump `COINDUCTIVE_OVERLAP_IN_COHERENCE` to deny + warn in deps

1.73 is the first place this shows up in stable (recall that there was only 1 regression), so let's bump this to deny on nightly.

r? lcnr
2023-10-18 21:41:50 +00:00
Michael Goulet ea73f10867 Don't ICE when encountering unresolved regions in fully_resolve 2023-10-18 20:39:29 +00:00
Michael Goulet 973d589582 Bump COINDUCTIVE_OVERLAP_IN_COHERENCE 2023-10-18 18:54:11 +00:00
bors cc705b8012 Auto merge of #116046 - Zalathar:fn-cov-info, r=cjgillot
coverage: Move most per-function coverage info into `mir::Body`

Currently, all of the coverage information collected by the `InstrumentCoverage` pass is smuggled through MIR in the form of individual `StatementKind::Coverage` statements, which must then be reassembled by coverage codegen.

That's awkward for a number of reasons:
- While some of the coverage statements do care about their specific position in the MIR control-flow graph, many of them don't, and are just tacked onto the function's first BB as metadata carriers.
- MIR inlining can result in coverage statements being duplicated, so coverage codegen has to jump through hoops to avoid emitting duplicate mappings.
- MIR optimizations that would delete coverage statements need to carefully copy them into the function's first BB so as not to omit them from coverage reports.
- The order in which coverage codegen sees coverage statements is dependent on MIR optimizations/inlining, which can cause unnecessary churn in the emitted coverage mappings.
- We don't have a good way to annotate MIR-level functions with extra coverage info that doesn't belong in a statement.

---

This PR therefore takes most of the per-function coverage info and stores it in a field in `mir::Body` as `Option<Box<FunctionCoverageInfo>>`.

(This adds one pointer to the size of `mir::Body`, even when coverage is not enabled.)

Coverage statements still need to be injected into MIR in some cases, but only when they actually affect codegen (counters) or are needed to detect code that has been optimized away as unreachable (counters/expressions).

---

By the end of this PR, the information stored in `FunctionCoverageInfo` is:

- A hash of the function's source code (needed by LLVM's coverage map format)
- The number of coverage counters added by coverage instrumentation
- A table of coverage expressions, associating each expression ID with its operator (add or subtract) and its two operands
- The list of mappings, associating each covered code region with a counter/expression/zero value

---

~~This is built on top of #115301, so I'll rebase and roll a reviewer once that lands.~~
r? `@ghost`
`@rustbot` label +A-code-coverage
2023-10-18 18:48:34 +00:00
Camille GILLOT c1c5a1d69a Only check in a single place if a pass is enabled. 2023-10-18 16:59:23 +00:00
León Orell Valerian Liehr d0b99e3efe
Make #[repr(Rust)] and #[repr(C)] incompatible with one another 2023-10-18 17:25:23 +02:00
bors e1aa9edde0 Auto merge of #116887 - lcnr:alias-ty-constructor, r=compiler-errors
`TyCtxt::mk_alias_ty` -> `AliasTy::new`
2023-10-18 15:17:48 +00:00
Zalathar 33da0978ac coverage: Explicitly note that counter/expression IDs are function-local 2023-10-18 23:44:36 +11:00
Zalathar 753caf292c coverage: Update docs for StatementKind::Coverage
This new description reflects the changes made in this PR, and should hopefully
be more useful to non-coverage developers who need to care about coverage
statements.
2023-10-18 23:44:36 +11:00
Zalathar 13b2d604ec coverage: Store expression data in function coverage info
Even though expression details are now stored in the info structure, we still
need to inject `ExpressionUsed` statements into MIR, because if one is missing
during codegen then we know that it was optimized out and we can remap all of
its associated code regions to zero.
2023-10-18 23:44:34 +11:00
Zalathar 7d38f4a611 Remove unused TyCtxt from remove_dead_blocks
This context was only needed by code for processing coverage statements, which
has been removed.
2023-10-18 23:42:45 +11:00
Zalathar 6da319f635 coverage: Store all of a function's mappings in function coverage info
Previously, mappings were attached to individual coverage statements in MIR.
That necessitated special handling in MIR optimizations to avoid deleting those
statements, since otherwise codegen would be unable to reassemble the original
list of mappings.

With this change, a function's list of mappings is now attached to its MIR
body, and survives intact even if individual statements are deleted by
optimizations.
2023-10-18 23:42:39 +11:00
lcnr 306a7ea8b4 AliasTy::new instead of tcx method 2023-10-18 13:57:19 +02:00
bors e1de04ad4e Auto merge of #116885 - aliemjay:rollup-plbeppt, r=aliemjay
Rollup of 5 pull requests

Successful merges:

 - #116812 (Disable missing_copy_implementations lint on non_exhaustive types)
 - #116856 (Disable effects in libcore again)
 - #116865 (Suggest constraining assoc types in more cases)
 - #116870 (Don't compare host param by name)
 - #116879 (revert #114586)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-18 11:55:41 +00:00
Zalathar 4099ab1997 coverage: Make expression simplification non-destructive
Instead of modifying the accumulated expressions in-place, we now build a set
of expressions that are known to be zero, and then consult that set on the fly
when converting the expression data for FFI.

This will be necessary when moving mappings and expression data into function
coverage info, which can't be mutated during codegen.
2023-10-18 22:29:31 +11:00
Ali MJ Al-Nasrawy 8489bce7f5
Rollup merge of #116879 - aliemjay:revert-opaque-bubble, r=oli-obk
revert #114586

Reverts #114586.

cc #116877 (not closing until this gets a beta backport)
fixes #116684
fixes https://github.com/rust-lang/rust/pull/114586#issuecomment-1751967321

r? `@oli-obk` or `@lcnr`
2023-10-18 14:24:52 +03:00
Ali MJ Al-Nasrawy 42e5f415fe
Rollup merge of #116870 - compiler-errors:host-param-by-name, r=fee1-dead
Don't compare host param by name

Seems sketchy to be searching for `sym::host` by name, especially when we can get the actual index with not very much work.

r? fee1-dead
2023-10-18 14:24:52 +03:00
Ali MJ Al-Nasrawy d69cdb2ceb
Rollup merge of #116865 - estebank:issue-46969, r=compiler-errors
Suggest constraining assoc types in more cases

Fix #46969.

```
error[E0308]: mismatched types
  --> $DIR/suggest-contraining-assoc-type-because-of-assoc-const.rs:12:21
   |
LL |     const N: C::M = 4u8;
   |                     ^^^ expected associated type, found `u8`
   |
   = note: expected associated type `<C as O>::M`
                         found type `u8`
help: consider constraining the associated type `<C as O>::M` to `u8`
   |
LL | impl<C: O<M = u8>> U<C> for u16 {
   |          ++++++++

```
2023-10-18 14:24:51 +03:00
Ali MJ Al-Nasrawy a536d58607
Rollup merge of #116856 - oli-obk:no_effects, r=compiler-errors
Disable effects in libcore again

r? `@fee1-dead`

This was accidentally allowed by https://github.com/rust-lang/rust/pull/114776 without feature gates
2023-10-18 14:24:51 +03:00
Ali MJ Al-Nasrawy 0653d7eebf
Rollup merge of #116812 - rmehri01:missing_copy_implementations_non_exhaustive, r=petrochenkov
Disable missing_copy_implementations lint on non_exhaustive types

Fixes #116766
2023-10-18 14:24:50 +03:00
blyxyas 54eef1601d
Change my name in mailmap 2023-10-18 12:37:09 +02:00
Zalathar 8efdd4cca6 coverage: Collect a function's coverage mappings into a single list
This is an intermediate step towards being able to store all of a function's
mappings in function coverage info.
2023-10-18 21:24:01 +11:00
Zalathar 79f935b96c coverage: Rename Operand to CovTerm
Later patches in this PR will use `CovTerm` to represent things that are not
expression operands.
2023-10-18 21:23:58 +11:00
Zalathar a18c5f3b75 coverage: Store the number of counters/expressions in function coverage info
Coverage codegen can now allocate arrays based on the number of
counters/expressions originally used by the instrumentor.

The existing query that inspects coverage statements is still used for
determining the number of counters passed to `llvm.instrprof.increment`. If
some high-numbered counters were removed by MIR optimizations, the instrumented
binary can potentially use less memory and disk space at runtime.
2023-10-18 21:22:40 +11:00
Zalathar c479bc7f3b coverage: Attach an optional FunctionCoverageInfo to mir::Body
This allows coverage information to be attached to the function as a whole when
appropriate, instead of being smuggled through coverage statements in the
function's basic blocks.

As an example, this patch moves the `function_source_hash` value out of
individual `CoverageKind::Counter` statements and into the per-function info.

When synthesizing unused functions for coverage purposes, the absence of this
info is taken to indicate that a function was not eligible for coverage and
should not be synthesized.
2023-10-18 21:20:29 +11:00
bors e8b8c78d84 Auto merge of #116815 - Nilstrieb:more-funny-pretty-printers, r=compiler-errors
Remove lots of generics from `ty::print`

All of these generics mostly resolve to the same thing, which means we can remove them, greatly simplifying the types involved in pretty printing and unlocking another simplification (that is not performed in this PR): Using `&mut self` instead of passing `self` through the return type.

cc `@eddyb` you probably know why it's like this, just checking in and making sure I didn't do anything bad

r? oli-obk
2023-10-18 09:57:07 +00:00
bors 6d7160ce97 Auto merge of #116814 - estebank:windows-ice-path, r=petrochenkov
Use `YYYY-MM-DDTHH_MM_SS` as datetime format for ICE dump files

Windows paths do not support `:`, so use a datetime format in ICE dump paths that Windows will accept.

CC #116809, fix #115180.
2023-10-18 07:45:56 +00:00