Commit Graph

222399 Commits

Author SHA1 Message Date
Yuki Okushi
a496ae6ac3
Rollup merge of #110554 - WaffleLapkin:rustc_data_structures_unsafe_op_in_unsafe_fn, r=Nilstrieb
`deny(unsafe_op_in_unsafe_fn)` in `rustc_data_structures`

r? `@Nilstrieb`

I couldn't bring myself to document the safety in big `unsafe` functions but ehh
2023-04-20 17:03:26 +09:00
Yuki Okushi
615669dbb2
Rollup merge of #110548 - kpreid:span, r=WaffleLapkin
Make `impl Debug for Span` not panic on not having session globals.

I hit the panic that this patch avoids while messing with the early lints in `rustc_session::config::build_session_options()`. The rest of that project is not finished, but this seemed like a self-contained improvement.

(Should changes like this add tests? I don't see similar unit tests.)
2023-04-20 17:03:25 +09:00
Yuki Okushi
f71e78e0df
Rollup merge of #110516 - loongarch-rs:update-bootstrap-linux-raw-sys, r=Mark-Simulacrum
bootstrap: Update linux-raw-sys to 0.3.2

Adds support for LoongArch.
2023-04-20 17:03:25 +09:00
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
Scott McMurray
baf98e7515 Add transmute optimization tests and some extra comments 2023-04-19 23:17:35 -07:00
bors
23a76a8ab5 Auto merge of #110527 - nnethercote:lazy-graph, r=lqd
In `LexicalResolver`, don't construct graph unless necessary.

A small but easy perf win.

r? `@jackh726`
2023-04-20 06:14:55 +00:00
Slanterns
180fe7cc0c
Style fix for loongarch-linux.md 2023-04-20 13:58:57 +08: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
Ezra Shaw
8cad917e68
reimpl make non_upper_case_globals lint not report trait impls 2023-04-20 16:28:49 +12: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
Wang Qilin
4bd363a286 fix out of date comment about rpath in bootstrap 2023-04-20 10:46:17 +08: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
Michael Goulet
f362f6e9e6 Format missing GATs correctly 2023-04-19 23:37:41 +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
Maybe Waffle
f79df7d2a4 deny(unsafe_op_in_unsafe_fn) in rustc_data_structures 2023-04-19 18:00:48 +00:00
Maybe Waffle
25b9263b34 Move GenericArgKind::as_{type,const,region} to GenericArg 2023-04-19 17:59:30 +00:00
Michael Goulet
73038d3a64 Make missing impl item suggestions more obvious that they're missing 2023-04-19 17:57:37 +00:00
Michael Goulet
204c516293 Substitute missing item suggestion correctly 2023-04-19 17:47:39 +00:00
Kevin Reid
883606f2c0 fmt fix 2023-04-19 10:06:30 -07: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
Kevin Reid
f17c805701 Make impl Debug for Span not panic on not having session globals. 2023-04-19 08:55:21 -07: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
Maybe Waffle
3f15521396 Add GenericArgKind::as_{type,const,region} 2023-04-19 14:54:31 +00: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