Commit Graph

222438 Commits

Author SHA1 Message Date
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
Vadim Petrochenkov
53c71b6ab3 resolve: Remove module_children_untracked 2023-04-19 16:35:08 +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
Michael van Straten
342c5fb6c5 Fixed bad formating 2023-04-19 13:04:01 +02:00
Michael van Straten
3d49cc1198 Translated absolute byte offset to relative 2023-04-19 13:02:30 +02: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
Nicholas Nethercote
8e6c9e0694 In LexicalResolver, don't construct graph unless necessary.
A small but easy perf win.
2023-04-19 16:17:29 +10: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