Commit Graph

230540 Commits

Author SHA1 Message Date
Michael Goulet
d45eb41c50 Dont report CTFE errors that are due to references-error layouts 2023-07-27 18:51:44 +00:00
Michael Goulet
77fa702b63 Fix aksama template 2023-07-27 18:24:08 +00:00
Michael Goulet
37076c9b4e Don't attempt to compute layout of type referencing error 2023-07-27 18:24:08 +00:00
bors
9339f446a5 Auto merge of #113374 - GuillaumeGomez:private-to-public-path, r=notriddle,fmease
[rustdoc] If re-export is private, get the next item until a public one is found or expose the private item directly

Fixes #81141.

If we have:

```rust
use Private as Something;

pub fn foo() -> Something {}
```

Then `Something` will be replaced by `Private`.

r? `@notriddle`
2023-07-27 15:56:50 +00:00
bors
b73e9a48ae Auto merge of #114130 - GuillaumeGomez:rollup-69ihuaj, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #114032 (typos)
 - #114059 (rustdoc: fix cross-crate `impl Sized` & `impl ?Sized`)
 - #114088 (Bump syn dependency)
 - #114091 (docs: fmt::Debug*: Fix comments for finish method.)
 - #114109 (Docs: Fix URL for `rmatches`)
 - #114117 (Restore region uniquification in the new solver 🎉  )
 - #114123 (Turns out opaque types can have hidden types registered during mir validation)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-27 14:10:02 +00:00
Guillaume Gomez
218e88e5d8
Rollup merge of #114123 - oli-obk:tait_wtf, r=WaffleLapkin
Turns out opaque types can have hidden types registered during mir validation

See the newly added test's documentation for an explanation.

fixes #114121
2023-07-27 16:05:15 +02:00
Guillaume Gomez
0bebfa39cc
Rollup merge of #114117 - compiler-errors:return-to-uniq, r=lcnr
Restore region uniquification in the new solver 🎉

All of the bugs that were "due" to uniquification have been settled via other means (e.g. bidirectional alias-relate, param-env incompleteness, etc).

Firstly, revert the functional changes in #110180. 😸

Secondly, we need to ignore regions when considering if a goal has changed (the "has_changed" boolean returned from `evaluate_goal`) -- otherwise, because we're doing region uniquification, we may perpetually consider a goal to be changed. See the UI test I committed for an explanation.
2023-07-27 16:05:15 +02:00
Guillaume Gomez
eb1f1a4cc0
Rollup merge of #114109 - veera-sivarajan:fix-str-docs, r=GuillaumeGomez
Docs: Fix URL for `rmatches`

This PR fixes a link to `str::rmatches()` by pointing it to the correct URL.
2023-07-27 16:05:14 +02:00
Guillaume Gomez
ee54896ca1
Rollup merge of #114091 - waywardmonkeys:doc-fmt-finish-comments, r=GuillaumeGomez
docs: fmt::Debug*: Fix comments for finish method.

In the code sample for the `finish` method on `DebugList`, `DebugMap`, and `DebugSet`, refer to finishing the list, map, or set, rather than struct as it did.
2023-07-27 16:05:14 +02:00
Guillaume Gomez
f7123db888
Rollup merge of #114088 - oli-obk:syn, r=davidtwco
Bump syn dependency

r? `@davidtwco` because this affects diagnostics derive diagnostics (yes this sentence is grammatically correct)
2023-07-27 16:05:13 +02:00
Guillaume Gomez
1fa0c4db4f
Rollup merge of #114059 - fmease:rustdoc-fix-x-crate-impl-sized, r=GuillaumeGomez
rustdoc: fix cross-crate `impl Sized` & `impl ?Sized`

Previously, cross-crate impl-Trait (APIT, RPIT, etc.) that only consists of a single `Sized` bound (modulo outlives-bounds) and ones that are `?Sized` were incorrectly rendered. To give you a taste (before vs. after):

```diff
- fn sized(x: impl ) -> impl
+ fn sized(x: impl Sized) -> impl Sized

- fn sized_outlives<'a>(x: impl 'a) -> impl 'a
+ fn sized_outlives<'a>(x: impl Sized + 'a) -> impl Sized + 'a

- fn maybe_sized(x: &impl ) -> &impl
+ fn maybe_sized(x: &impl ?Sized) -> &impl ?Sized

- fn debug_maybe_sized(x: &impl Debug) -> &impl ?Sized + Debug
+ fn debug_maybe_sized(x: &(impl Debug + ?Sized)) -> &(impl Debug + ?Sized)
```

Moreover, we now surround impl-Trait that has multiple bounds with parentheses if they're the pointee of a reference or raw pointer type. This affects both local and cross-crate docs. The current output isn't correct (rustc would emit the error *ambiguous `+` in a type* if we fed the rendered code back to it).

---

Best reviewed commit by commit :)

`@rustbot` label A-cross-crate-reexports
2023-07-27 16:05:13 +02:00
Guillaume Gomez
b8414fe02e
Rollup merge of #114032 - tshepang:patch-1, r=GuillaumeGomez
typos
2023-07-27 16:05:12 +02:00
bors
49a16b64b0 Auto merge of #114105 - dicej:llvm-update, r=cuviper
Update LLVM submodule

This adds https://github.com/rust-lang/llvm-project/pull/148.
2023-07-27 12:12:31 +00:00
bors
f239bb6bea Auto merge of #113281 - dayo05:master, r=davidtwco
Implement diagnostic translation for rustc-errors

This is my first PR to rustc yeah~

I'm going to implement diagnostic translation on rustc-errors crate.

This PR is WIP, the reason of opening this as draft, I want to show my code to prevent the issue caused by misunderstanding and also I have few questions.

Some error messages are processed by `pluralize!` macro which determines to use plural word or not. From now, I make two kinds of keys and combine with enum but I'm not sure is this best method to do it.

Is there any prefered method to do this? => This resolved on conversation on PR.

I'll remain to perform force-push until my first implementation looks good to me
2023-07-27 09:20:40 +00:00
Guillaume Gomez
2461d0cf9c Remove transmute calls and caching for use paths 2023-07-27 10:54:10 +02:00
Oli Scherer
99a9a63ca6 Turns out opaque types can have hidden types registered during mir validation 2023-07-27 08:23:06 +00:00
bors
2efa46dc15 Auto merge of #114080 - compiler-errors:negative, r=spastorino
Don't treat negative trait predicates as always knowable

We don't need this. It was added in #90104 but I don't really know why. It's not sound afaict -- negative trait predicates need the same coherence-ambiguity/orphan check rules as positive ones.

r? `@lcnr`

cc `@spastorino,` do you remember why?
2023-07-27 07:29:00 +00:00
bors
3e11b223d7 Auto merge of #114116 - matthiaskrgr:rollup-dtdfk76, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #113872 (Tweak CGU sorting in a couple of places.)
 - #114053 (CI: fix CMake installation for 32/64 bit `dist` Linux)
 - #114075 (inline format!() args from rustc_codegen_llvm to the end (4))
 - #114081 (`desugar_doc_comments` cleanups)
 - #114082 (add stable NullaryOp)
 - #114098 (replace atty crate with std's IsTerminal)
 - #114102 (Dont pass `-Zwrite-long-types-to-disk=no` for `ui-fulldeps --stage=1`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-27 04:37:48 +00:00
Matthias Krüger
8cae3439b0
Rollup merge of #114102 - compiler-errors:fulldeps-stage1-hack, r=pnkfelix
Dont pass `-Zwrite-long-types-to-disk=no` for `ui-fulldeps --stage=1`

Due to this hack:

601a34de8c/src/bootstrap/test.rs (L1473-L1484)

We use the stage 0 compiler to build the stage 1 fulldeps tests. That means that we don't have `-Zwrite-long-types-to-disk=no` which was added in #113893.

Add a temporary hack to fix this (https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Some.20tests.20failing.20with.20--stage.201) until the next beta bump.
2023-07-27 06:04:15 +02:00
Matthias Krüger
dea5b4fff3
Rollup merge of #114098 - klensy:drop-atty, r=fee1-dead
replace atty crate with std's IsTerminal
2023-07-27 06:04:15 +02:00
Matthias Krüger
17e4f80257
Rollup merge of #114082 - ericmarkmartin:smir-nullary-op, r=spastorino
add stable NullaryOp

r? `@spastorino`
2023-07-27 06:04:14 +02:00
Matthias Krüger
a926c73b5b
Rollup merge of #114081 - nnethercote:desugar_doc_comments-cleanups, r=petrochenkov
`desugar_doc_comments` cleanups

r? `@petrochenkov`
2023-07-27 06:04:14 +02:00
Matthias Krüger
fa21a8c6f8
Rollup merge of #114075 - matthiaskrgr:fmt_args_rustc_3, r=wesleywiser
inline format!() args from rustc_codegen_llvm to the end (4)

r? `@WaffleLapkin`
2023-07-27 06:04:13 +02:00
Matthias Krüger
14669cbb9a
Rollup merge of #114053 - Kobzol:ci-linux-fix-cmake, r=nikic
CI: fix CMake installation for 32/64 bit `dist` Linux

Should hopefully fix LLVM 17 build (https://github.com/rust-lang/rust/pull/114048#issuecomment-1649586577).
2023-07-27 06:04:13 +02:00
Matthias Krüger
c3cd05198a
Rollup merge of #113872 - nnethercote:tweak-cgu-sorting, r=pnkfelix
Tweak CGU sorting in a couple of places.

In `base.rs`, tweak how the CGU size interleaving works. Since #113777, it's much more common to have multiple CGUs with identical sizes. With the existing code these same-sized items ended up in the opposite-to-desired order due to the stable sorting. The code now starts with a reverse sort (like is done in `partitioning.rs`) which gives the behaviour we want. This doesn't matter much for perf, but makes profiles in `samply` look more like what we expect.

In `partitioning.rs`, we can use `sort_by_key` instead of `sort_by_cached_key` because `CGU::size_estimate()` is cheap. (There is an identical CGU sort earlier in that function that already uses `sort_by_key`.)

r? `@pnkfelix`
2023-07-27 06:04:12 +02:00
Michael Goulet
1ffc6ca9a5 Consider a goal as NOT changed if its response is identity modulo regions 2023-07-27 04:00:49 +00:00
Michael Goulet
99f60ec411 Revert "don't uniquify regions when canonicalizing"
This reverts commit 171f541470.
2023-07-27 03:16:34 +00:00
bors
d150dbb067 Auto merge of #113708 - rcvalle:rust-cfi-fix-100778, r=compiler-errors
CFI: Fix ICE: encode_const: unexpected type [usize

Fixes #100778 and #113366, and complements #106547 by adding support for encoding const parameters.
2023-07-27 02:48:38 +00:00
bors
e7d6ce3a6f Auto merge of #114034 - Amanieu:riscv-atomicbool, r=thomcc
Optimize `AtomicBool` for target that don't support byte-sized atomics

`AtomicBool` is defined to have the same layout as `bool`, which means that we guarantee that it has a size of 1 byte. However on certain architectures such as RISC-V, LLVM will emulate byte atomics using a masked CAS loop on an aligned word.

We can take advantage of the fact that `bool` only ever has a value of 0 or 1 to replace `swap` operations with `and`/`or` operations that LLVM can lower to word-sized atomic `and`/`or` operations. This takes advantage of the fact that the incoming value to a `swap` or `compare_exchange` for `AtomicBool` is often a compile-time constant.

### Example

```rust
pub fn swap_true(atomic: &AtomicBool) -> bool {
    atomic.swap(true, Ordering::Relaxed)
}
```

### Old

```asm
	andi	a1, a0, -4
	slli	a0, a0, 3
	li	a2, 255
	sllw	a2, a2, a0
	li	a3, 1
	sllw	a3, a3, a0
	slli	a3, a3, 32
	srli	a3, a3, 32
.LBB1_1:
	lr.w	a4, (a1)
	mv	a5, a3
	xor	a5, a5, a4
	and	a5, a5, a2
	xor	a5, a5, a4
	sc.w	a5, a5, (a1)
	bnez	a5, .LBB1_1
	srlw	a0, a4, a0
	andi	a0, a0, 255
	snez	a0, a0
	ret
```

### New

```asm
	andi	a1, a0, -4
	slli	a0, a0, 3
	li	a2, 1
	sllw	a2, a2, a0
	amoor.w	a1, a2, (a1)
	srlw	a0, a1, a0
	andi	a0, a0, 255
	snez	a0, a0
	ret
```
2023-07-27 01:00:12 +00:00
Veera
0169ce968c Fix URL for rmatches 2023-07-26 17:57:56 -05:00
bors
0d95f91329 Auto merge of #113843 - wesleywiser:replace_rustc_apfloat, r=pnkfelix
Replace in-tree `rustc_apfloat` with the new version of the crate

Replace the in-tree version of `rustc_apfloat` with the new version of the crate which has been correctly licensed. The new crate incorporates upstream changes from LLVM since the original port was done including many correctness fixes and has been extensively fuzz tested to validate correctness.

Fixes #100233
Fixes #102403
Fixes #113407
Fixes #113409
Fixes #55993
Fixes #93224
Closes #93225
Closes #109573
2023-07-26 21:21:19 +00:00
Joel Dice
6776265d1b
Update LLVM submodule
This adds https://github.com/rust-lang/llvm-project/pull/148.
2023-07-26 14:55:50 -06:00
bors
fb7e6d078d Auto merge of #114103 - matthiaskrgr:rollup-01m6l2w, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #101994 (rand: freebsd update, using getrandom.)
 - #113930 (Add Param and Bound ty to SMIR)
 - #113942 (Squelch a noisy rustc_expand unittest)
 - #113996 (Define CMAKE_SYSTEM_NAME on a cross build targeting DragonFly.)
 - #114070 (Add `sym::iter_mut` + `sym::as_mut_ptr` for Clippy)
 - #114073 (Remove -Z diagnostic-width)
 - #114090 (compiletest: remove ci-specific remap-path-prefix)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-26 19:21:47 +00:00
Matthias Krüger
a1956e281a
Rollup merge of #114090 - mdibaiee:remove-remap-path-prefix-ci, r=wesleywiser
compiletest: remove ci-specific remap-path-prefix

Now that we have fixed the underlying cause of long type name inconsistencies in #113893, we can remove the remap-path-prefix logic from CI

resolves #113424
2023-07-26 20:49:14 +02:00
Matthias Krüger
43a38e7e55
Rollup merge of #114073 - ehuss:remove-z-diagnostic-width, r=fee1-dead
Remove -Z diagnostic-width

This removes the `-Z diagnostic-width` option since it is ignored and does nothing. `-Z diagnostic-width` was stabilized as `--diagnostic-width` in #95635. It is not entirely clear why the `-Z` flag was kept, but in part its final use was removed in #102216, but the `-Z` flag itself was not removed.
2023-07-26 20:49:14 +02:00
Matthias Krüger
c6bfa7761a
Rollup merge of #114070 - blyxyas:iter_mut_symbol, r=oli-obk
Add `sym::iter_mut` + `sym::as_mut_ptr` for Clippy

We currently have `sym::iter` and `sym::iter_repeat`, this PR adds `sym::iter_mut` as it's useful for https://github.com/rust-lang/rust-clippy/pull/11038 and another Clippy lint, it also adds `sym::as_mut_ptr` as it's useful for https://github.com/rust-lang/rust-clippy/pull/10962.
2023-07-26 20:49:13 +02:00
Matthias Krüger
998fd94405
Rollup merge of #113996 - inferiorhumanorgans:dragonfly-cmake-system-name, r=ozkanonur
Define CMAKE_SYSTEM_NAME on a cross build targeting DragonFly.

Without `CMAKE_SYSTEM_NAME` set to the target  a cross compile will generally fail.  Related to #109170.
2023-07-26 20:49:13 +02:00
Matthias Krüger
d35cf499d8
Rollup merge of #113942 - ehuss:squelch-bad_path_expr_1, r=fee1-dead
Squelch a noisy rustc_expand unittest

The test `rustc_parse::tests::bad_path_expr_1` prints an error message to stderr, circumventing libtest's stderr intercept. This causes noise when running tests, in particular they show up 16 times on the GitHub Actions summary page. The solution here is to not use an error emitter that prints to stderr, and instead check that the correct error is generated.
2023-07-26 20:49:12 +02:00
Matthias Krüger
d910e7d9eb
Rollup merge of #113930 - spastorino:smir-types-6, r=oli-obk
Add Param and Bound ty to SMIR

r? ``@oli-obk``
2023-07-26 20:49:12 +02:00
Matthias Krüger
26d791b351
Rollup merge of #101994 - devnexen:rand_fbsd_update, r=workingjubilee
rand: freebsd update, using getrandom.

supported since the 12th release, while 11.4 is EOL since 2021.
2023-07-26 20:49:11 +02:00
Michael Goulet
1794466c00 Dont pass -Zwrite-long-types-to-disk=no for ui-fulldeps --stage=1 2023-07-26 18:43:40 +00:00
bors
6908c73ab0 Auto merge of #114012 - GuillaumeGomez:fix-113982, r=notriddle
Fix missing attribute merge on glob foreign re-exports

Fixes https://github.com/rust-lang/rust/issues/113982.

The attributes were not merged with the import's in case of glob re-export of foreign items.

r? `@notriddle`
2023-07-26 17:35:51 +00:00
Ralf Jung
9d3e35ceaa Add tests for #102403 and #113407 2023-07-26 13:31:54 -04:00
yukang
98dd81e4e3 Add test case for #109567 2023-07-26 13:31:54 -04:00
bors
601a34de8c Auto merge of #113457 - davidtwco:lint-ctypes-issue-113436, r=oli-obk
lint/ctypes: fix `()` return type checks

Fixes #113436.

`()` is normally FFI-unsafe, but is FFI-safe when used as a return type. It is also desirable that a transparent newtype for `()` is FFI-safe when used as a return type.

In order to support this, when a type was deemed FFI-unsafe, because of a `()` type, and was used in return type - then the type was considered  FFI-safe. However, this was the wrong approach - it didn't check that the `()` was part of a transparent newtype! The consequence of this is that the presence of a `()` type in a more complex return type would make it the entire type be considered safe (as long as the `()` type was the first that the lint found) - which is obviously incorrect.

Instead, this logic is removed, and after [consultation with t-lang](https://github.com/rust-lang/rust/issues/113436#issuecomment-1640756721), I've fixed the bugs and inconsistencies and  made `()` FFI-safe within types.

I also refactor a function, but that's not too exciting.
2023-07-26 15:27:36 +00:00
Eric Huss
9914ae3292 Squelch a noisy rustc_expand unittest 2023-07-26 08:12:08 -07:00
klensy
31630859cc replace atty crate with std's isTerminal 2023-07-26 18:09:50 +03:00
Wesley Wiser
47a4484a78 Remove unused NCSA license 2023-07-26 10:20:15 -04:00
Wesley Wiser
6f5d960389 Fix miri 2023-07-26 10:20:15 -04:00
Wesley Wiser
15e9f56088 Replace in-tree rustc_apfloat with the new version of the crate 2023-07-26 10:20:15 -04:00