Commit Graph

222324 Commits

Author SHA1 Message Date
Yuki Okushi 9dbd25c705
Rollup merge of #110448 - ripytide:master, r=cuviper
cmp doc examples improvements

Most changes are for stylistic consistency, with some changes to provide more clarity.
2023-04-20 17:03:24 +09:00
Yuki Okushi 41a2fb251c
Rollup merge of #110424 - jsoref:spelling-misc, r=Mark-Simulacrum
Spelling misc

These two files seem to be fairly distinct from everything else.

That said, if this project doesn't like changing changelogs, I'm happy to drop the changes to `RELEASES.md`
2023-04-20 17:03:24 +09:00
Yuki Okushi df3aca2af6
Rollup merge of #102341 - jmillikin:nonzero-impl-neg, r=dtolnay
Implement `Neg` for signed non-zero integers.

Negating a non-zero integer currently requires unpacking to a primitive and re-wrapping. Since negation of non-zero signed integers always produces a non-zero result, it is safe to implement `Neg` for `NonZeroI{N}`.

The new `impl` is marked as stable because trait impls for two stable types can't be marked unstable.

See discussion on https://github.com/rust-lang/libs-team/issues/105 for additional context.
2023-04-20 17:03:23 +09:00
John Millikin 4e2797dd76 Implement `Neg` for signed non-zero integers.
Negating a non-zero integer currently requires unpacking to a
primitive and re-wrapping. Since negation of non-zero signed
integers always produces a non-zero result, it is safe to
implement `Neg` for `NonZeroI{N}`.

The new `impl` is marked as stable because trait implementations
for two stable types can't be marked unstable.
2023-04-20 14:27:29 +09:00
bors 7fde08365c Auto merge of #110399 - cjgillot:infer-variance, r=aliemjay
Account for opaque variance in outlives

Fixes https://github.com/rust-lang/rust/issues/108591
Fixes https://github.com/rust-lang/rust/issues/108592
cc `@aliemjay`
2023-04-20 04:08:03 +00:00
bors dc730521ef Auto merge of #110535 - nikic:llvm-16.0.2, r=cuviper
Update to LLVM 16.0.2

Fixes #110256.
2023-04-20 01:49:16 +00:00
bors b9fd498fa7 Auto merge of #110061 - WaffleLapkin:duality_of_myself_and_this, r=cjgillot
Add suggestion to use closure argument instead of a capture on borrowck error

Fixes #109271
r? `@compiler-errors`

This should probably be refined a bit, but opening a PR so that I don't forget anything.
2023-04-19 23:39:03 +00:00
bors 39c6804b92 Auto merge of #106704 - ecnelises:big_archive, r=bjorn3
Support AIX-style archive type

Reading facility of AIX big archive has been supported by `object` since 0.30.0.

Writing facility of AIX big archive has already been supported by `ar_archive_writer`, but we need to bump the version to support the new archive type enum.
2023-04-19 21:21:17 +00:00
Maybe Waffle cac143f0e3 Extend and use `hir::Node::body_id` 2023-04-19 19:13:45 +00:00
Maybe Waffle 102c0af5a7 Add suggestion to use a closure arg instead of a capture on bck error 2023-04-19 19:13:35 +00:00
bors 9c51cf7e7f Auto merge of #110546 - matthiaskrgr:rollup-346kik6, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #110123 ('./configure' now checks if 'config.toml' exists before writing to that destination)
 - #110429 (Spelling src bootstrap)
 - #110430 (Spelling src ci)
 - #110515 (Don't special-case download-rustc in `maybe_install_llvm`)
 - #110521 (Fix `x test lint-docs linkchecker` when download-rustc is enabled)
 - #110525 (Fix `tests/run-make-translation` when download-rustc is enabled)
 - #110531 (small type system cleanup)
 - #110533 (Missing blanket impl trait not public)
 - #110540 (Fix wrong comment in rustc_hir/src/hir.rs)
 - #110541 (Fix various configure bugs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-19 19:11:05 +00:00
Maybe Waffle cfe5c3ca6c Add `#[track_caller]` to `struct_span_err_with_code` (drive-by cleanup)
We use caller information to track where a diagnostic was created,
so all "helper" diagnostic functions should use `#[track_caller]`
2023-04-19 19:10:37 +00:00
Maybe Waffle ceabcd83e6 Remove useless check (drive-by cleanup)
While it might *seem* that this does something, it actually doesn't.
`mut_borrow_of_mutable_ref` returns a `bool` that is ignored by the
let-else. This was basically
```rust
if !self.body.local_decls.get(local).is_some() {
    return
}
```
Which is pretty useless
2023-04-19 19:10:25 +00:00
Maybe Waffle 4eac6fe21e Add test for `a.f(|this| a.g())` 2023-04-19 19:06:09 +00:00
bors df0d9b492d Auto merge of #110496 - WaffleLapkin:🏳️‍⚧️sound, r=compiler-errors
Don't transmute `&List<GenericArg>` <-> `&List<Ty>`

In #93505 we allowed safely transmuting between `&List<GenericArg<'_>>` and `&List<Ty<'_>>`. This was possible because `GenericArg` is a tagged pointer and the tag for types is `0b00`, such that a `GenericArg` with a type inside has the same layout as `Ty`.

While this was meant as an optimization, it doesn't look like it was actually any perf or max-rss win (see https://github.com/rust-lang/rust/pull/94799#issuecomment-1064340003, https://github.com/rust-lang/rust/pull/94841, https://github.com/rust-lang/rust/pull/110496#issuecomment-1513799140).

Additionally the way it was done is quite fragile — `unsafe` code was not properly documented or contained in a module, types were not marked as `repr(C)` (making the transmutes possibly unsound). All of this makes the code maintenance harder and blocks other possible optimizations (as an example I've found out about these `transmutes` when my change caused them to sigsegv compiler).

Thus, I think we can safely (pun intended) remove those transmutes, making maintenance easier, optimizations possible, code less cursed, etc.

r? `@compiler-errors`
2023-04-19 17:01:06 +00:00
Matthias Krüger 0820e31a00
Rollup merge of #110541 - jyn514:fix-configure, r=ozkanonur
Fix various configure bugs

Fixes https://github.com/rust-lang/rust/issues/107050. Fixes https://github.com/rust-lang/rust/issues/108928. Closes https://github.com/rust-lang/rust/pull/108641.

I recommend reading this commit-by-commit to see the commit descriptions, but the code changes are small.

This also changes the README to suggest `configure` instead of `printf`, as well as a few other cleanups described in the commit message.
2023-04-19 17:54:44 +02:00
Matthias Krüger b59658c990
Rollup merge of #110540 - safinaskar:patch-1, r=WaffleLapkin
Fix wrong comment in rustc_hir/src/hir.rs
2023-04-19 17:54:43 +02:00
Matthias Krüger 770f6cd254
Rollup merge of #110533 - GuillaumeGomez:missing-blanket-impl-trait-not-public, r=notriddle
Missing blanket impl trait not public

Fixes #94183.

The problem was that we should have checked if the trait was reachable instead of only "directly public".

r? `@notriddle`
2023-04-19 17:54:43 +02:00
Matthias Krüger 75de33cd1d
Rollup merge of #110531 - lcnr:type-system-stuff, r=aliemjay
small type system cleanup
2023-04-19 17:54:42 +02:00
Matthias Krüger 9a13f4f018
Rollup merge of #110525 - jyn514:translation-download-rustc, r=albertlarsan68
Fix `tests/run-make-translation` when download-rustc is enabled

When building locally, we never generate a `share` directory in the local sysroot. However, when we download the `rustc` component from ci, it includes a `share/man` directory in the sysroot. The `run-make/translation` test assumed that it didn't exist, and would create a link from `fakeroot` to the real share directory, and write symbolic links into it. Change it not to create the link, so that rustc doesn't try to load multiple copies of the same `.ftl` file.

Fixes https://github.com/rust-lang/rust/issues/110357.
2023-04-19 17:54:42 +02:00
Matthias Krüger 1de29ac2bd
Rollup merge of #110521 - jyn514:test-lint-docs, r=albertlarsan68
Fix `x test lint-docs linkchecker` when download-rustc is enabled

Bootstrap was setting LD_LIBRARY_PATH for bootstrap tools in `tool_cmd`, and rustc inherited that environment. That broke when download-rustc was enabled; see the new comment for details.

Fixes https://github.com/rust-lang/rust/issues/110354
2023-04-19 17:54:41 +02:00
Matthias Krüger 6fdc1211dd
Rollup merge of #110515 - jyn514:download-rustc-llvm, r=albertlarsan68
Don't special-case download-rustc in `maybe_install_llvm`

This is no longer necessary now that the llvm in `rust-dev` matches the one in `rustc`.

cc https://github.com/rust-lang/rust/pull/110490#issuecomment-1513026675, https://github.com/rust-lang/rust/pull/110263
2023-04-19 17:54:40 +02:00
Matthias Krüger dc0de094ee
Rollup merge of #110430 - jsoref:spelling-src-ci, r=albertlarsan68
Spelling src ci

The various src/* items seem slightly disparate, so I'm doing src/* individually.

split from https://github.com/rust-lang/rust/pull/110392
2023-04-19 17:54:40 +02:00
Matthias Krüger af92c6a0a3
Rollup merge of #110429 - jsoref:spelling-src-bootstrap, r=albertlarsan68
Spelling src bootstrap

The various src/* items seem slightly disparate, so I'm doing src/* individually.

split from #110392
2023-04-19 17:54:39 +02:00
Matthias Krüger 73bfa18613
Rollup merge of #110123 - madsravn:master, r=jyn514
'./configure' now checks if 'config.toml' exists before writing to that destination

Fixes #110109

Instead of overwriting the current `config.toml` file, exit the `./configure` script with a message stating why.
2023-04-19 17:54:39 +02:00
jyn 8a9668d8e8 Update readme to suggest `./configure` instead of printf
This also makes some other minor cleanups:
- Suggest `python x.py` on windows instead of `./x.py`, which usually
  doesn't work
- Move the "Configure and Make" section to a subsection of "Building on
  Unix"
- Mention `config.toml` earlier
- Suggest `x.py setup user` on Windows, since `configure` won't work
2023-04-19 09:50:21 -05:00
jyn b7607a9113 configure: Set `profile = user` by default 2023-04-19 09:50:21 -05:00
Askar Safin 0b6b72e198
Fix wrong comment in rustc_hir/src/hir.rs 2023-04-19 16:38:04 +03:00
jyn 6d07dbc266 configure: Fix bug in `configure_top_level_key`
Before, it only worked for numbers, not strings.
2023-04-19 08:25:49 -05:00
bors 3a5c8e91f0 Auto merge of #110393 - fee1-dead-contrib:rm-const-traits, r=oli-obk
Rm const traits in libcore

See [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/.60const.20Trait.60.20removal.20or.20rework)

* [x] Bless ui tests
* [ ] Re constify some unstable functions with workarounds if they are needed
2023-04-19 13:03:40 +00:00
Mads Ravn 010d7975d6 Changing position of early exit and using standard error method with correct exit code 2023-04-19 14:58:53 +02:00
Deadbeef 14d1e87db9 temporarily ignore run-make coverage tests 2023-04-19 11:49:47 +00:00
Nikita Popov 935b95630a Update to LLVM 16.0.2 2023-04-19 12:33:37 +02:00
Guillaume Gomez 96f4f4e02e Add regression test for #94183 2023-04-19 11:32:50 +02:00
Guillaume Gomez 9876a11f93 Fix missing blanket impl if the trait is not directly public 2023-04-19 11:32:36 +02:00
lcnr 16d061ea77 small type system cleanup 2023-04-19 10:30:30 +02:00
bors d7f9e81650 Auto merge of #110407 - Nilstrieb:fluent-macro, r=davidtwco
Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`

Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-19 08:26:47 +00:00
jyn 23cf3ce03b Fix `tests/run-make-translation` when download-rustc is enabled
When building locally, we never generate a `share` directory in the
local sysroot. However, when we download the `rustc` component from ci,
it includes a `share/man` directory in the sysroot. The
`run-make/translation` test assumed that it didn't exist, and would
create a link from `fakeroot` to the real share directory, and write
symbolic links into it. Change it not to create the link, so that rustc
doesn't try to load multiple copies of the same `.ftl` file.
2023-04-19 00:39:20 -05:00
bors c781584079 Auto merge of #110522 - matthiaskrgr:rollup-9m7rw3u, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #110432 (Report more detailed reason why `Index` impl is not satisfied)
 - #110451 (Minor changes to `IndexVec::ensure_contains_elem` & related methods)
 - #110476 (Delay a good path bug on drop for `TypeErrCtxt` (instead of a regular delayed bug))
 - #110498 (Switch to `EarlyBinder` for `collect_return_position_impl_trait_in_trait_tys`)
 - #110507 (boostrap: print output during building tools)
 - #110510 (Fix ICE for transmutability in candidate assembly)
 - #110513 (make `non_upper_case_globals` lint not report trait impls)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-19 05:08:54 +00:00
Qiu Chaofan 7c8c9cf470 Bump version of object and related crates 2023-04-19 12:42:20 +08:00
Matthias Krüger 78490ada7c
Rollup merge of #110513 - Ezrashaw:fix-trait-const-name-lint, r=compiler-errors
make `non_upper_case_globals` lint not report trait impls

We should not lint on trait `impl`s for `non_upper_case_globals`; the user doesn't have control over the name. This brings `non_upper_case_globals` into consistency with other `nonstandard_style` lints.
2023-04-19 06:35:36 +02:00
Matthias Krüger fdd2f4bde8
Rollup merge of #110510 - bryangarza:issue-110467-safe-transmute, r=compiler-errors
Fix ICE for transmutability in candidate assembly

Don't skip transmutability check just because there may be generics in the ParamEnv.

Fixes #110467
2023-04-19 06:35:36 +02:00
Matthias Krüger e85b0267a4
Rollup merge of #110507 - weihanglo:print-try-run-output, r=jyn514
boostrap: print output during building tools

Fixes #110506
2023-04-19 06:35:35 +02:00
Matthias Krüger 9f0b16b2bb
Rollup merge of #110498 - kylematsuda:earlybinder-rpitit-tys, r=compiler-errors
Switch to `EarlyBinder` for `collect_return_position_impl_trait_in_trait_tys`

Part of the work to finish https://github.com/rust-lang/rust/issues/105779.

This PR adds `EarlyBinder` to the return type of the `collect_return_position_impl_trait_in_trait_tys` query and removes `bound_return_position_impl_trait_in_trait_tys`.

r? `@lcnr`
2023-04-19 06:35:35 +02:00
Matthias Krüger f20da94ccf
Rollup merge of #110476 - compiler-errors:ty-err-ctxt-good-path, r=lcnr
Delay a good path bug on drop for `TypeErrCtxt` (instead of a regular delayed bug)

r? `@lcnr`
Perhaps we should just delete the `Drop` impl altogether though?

Fixes rust-lang/rust-clippy#10645

`@matthiaskrgr:` I don't know how to make a clippy test for this. Any idea? Clippy's UI tests run with `-D warnings` and I have no idea how to switch it off to make a test that triggers this ICE in the clippy test suite 🤣
2023-04-19 06:35:35 +02:00
Matthias Krüger a184557d1d
Rollup merge of #110451 - WaffleLapkin:ensure_return_elem, r=scottmcm
Minor changes to `IndexVec::ensure_contains_elem` & related methods

r? `@scottmcm`
2023-04-19 06:35:34 +02:00
Matthias Krüger 3320b2a59a
Rollup merge of #110432 - compiler-errors:unsatisfied-index-impl, r=cjgillot
Report more detailed reason why `Index` impl is not satisfied

Fixes #110373
2023-04-19 06:35:34 +02:00
jyn abf9cbcb69 Fix `x test lint-docs` when download-rustc is enabled
Bootstrap was setting LD_LIBRARY_PATH for bootstrap tools in `tool_cmd`,
and rustc inherited that environment. That broke when download-rustc was
enabled; see the new comment for details.
2023-04-18 23:08:48 -05:00
Qiu Chaofan 7037ff99af Recognize AIX style archive kind 2023-04-19 11:10:47 +08:00
bors 9e7f72c57d Auto merge of #110477 - miguelraz:canoodling2-electric-boogaloo, r=compiler-errors
Don't allocate on SimplifyCfg/Locals/Const on every MIR pass

Hey! 👋🏾 This is a first PR attempt to see if I could speed up some rustc internals.

Thought process:

```rust
pub struct SimplifyCfg {
    label: String,
}
```
in [compiler/src/rustc_mir_transform/simplify.rs](7908a1d654/compiler/rustc_mir_transform/src/simplify.rs (L39)) fires multiple times per MIR analysis. This means that a likely string allocation is happening in each of these runs, which may add up, as they are not being  lazily allocated or cached in between the different passes.

...yes, I know that adding a global static array is probably not the future-proof solution, but I wanted to lob this now as a proof of concept to see if it's worth shaving off a few cycles and then making more robust.
2023-04-19 02:57:19 +00:00