Commit Graph

212856 Commits

Author SHA1 Message Date
TheOddGarlic
64f3e4f195 Migrate "requires unsafe" diagnostics 2022-12-17 19:08:24 +01:00
TheOddGarlic
71fe52fed0 Migrate "unsafe_op_in_unsafe_fn" lints 2022-12-17 19:08:24 +01:00
TheOddGarlic
82f05446a5 Migrate "function cannot return without recursing" diagnostic 2022-12-17 19:08:24 +01:00
bors
65c53c3bb6 Auto merge of #105800 - lqd:dylib-thinlto, r=bjorn3
Don't copy symbols from dylibs with `-Zdylib-lto`

When `rustc_driver` started being built with `-Zdylib-lto -Clto=thin`, some libstd symbols were copied by the LTO process into the dylib. That causes duplicate local symbols that are not present otherwise.

Depending on the situation (lib loading order apparently), the duplicated symbols could cause issues: `rustc_driver` overrode the panic hook, but it didn't apply to rustc main's hook (the default from libstd). This is the cause of #105637, in some situations the panic hook installed by `rustc_driver` isn't executed, and only libstd's backtrace is shown (and a double panic). The query stack, as well as the various notes to open a GH about the ICE, don't appear.

It's not clear exactly what is needed to trigger the issue, but I have simulated a reproducer [here](https://github.com/lqd/issue-105637) with cargo involved, the incorrect panic hook is executed on my machine. It is hard to reproduce in a unit test: `cargo run` + `rustup` involves LD_LIBRARY_PATH, which is not the case for `compiletest`. cargo also adds unconditional flags that are then overridden in [`bootstrap` when building rustc with `rust.lto = thin`](9c07efe84f/src/bootstrap/compile.rs (L702-L714)) as done on CI).

All this to say the compilation and execution environment in `bootstrap` leading to the bug building `rustc_driver` is different from our UI tests, and I believe one of the reasons it's hard to make an exact reproducer test. Thankfully there's _still_ a difference in the behavior though: although in the unit test the correct panic hook seems to be executed compared to my repro and the current nightly, only the fix removes the double panic here.

The `7e8277aefa12f1469fb1df01418ff5846a7854a9` `try` build:
- fixes the reproducer repo linked above
- restores the ICE messages from https://github.com/rust-lang/rust/issues/105321 back to the state in its OP compared to the description in https://github.com/rust-lang/rust/issues/105637
- restores the ICE message and the query stack from https://github.com/rust-lang/rust/issues/105777 compared to nightly

While I believe this technically fixes the P-critical issue https://github.com/rust-lang/rust/issues/105637, I would not want to close it yet as we may want to backport to beta/stable (if a point release happens, it would fix the ICEs reported on 1.66.0, which is built with ThinLTO on linux). Once this PR lands, I'll also open another PR to re-enable ThinLTO on x64 darwin's dist builder.
2022-12-17 14:51:10 +00:00
bors
aef17b7ae6 Auto merge of #105421 - jacobbramley:jb/branch-prot-check, r=nagisa
Check AArch64 branch-protection earlier in the pipeline.

As suggested in #93516.

r? `@nagisa`
2022-12-17 12:10:27 +00:00
bors
49c2279ef6 Auto merge of #105820 - matthiaskrgr:rollup-uzm1l8f, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #105770 (Rename ConstS to ConstData)
 - #105785 (Add regression test for #55976)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-17 09:08:07 +00:00
Matthias Krüger
905caed79e
Rollup merge of #105785 - JohnTitor:issue-55976-2, r=compiler-errors
Add regression test for #55976

Closes #55976
r? `@compiler-errors`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-12-17 09:25:53 +01:00
Matthias Krüger
9b6605dcc4
Rollup merge of #105770 - oli-obk:deref_all_the_things, r=compiler-errors
Rename ConstS to ConstData

just a style nit to get it in sync with all the other interned datastructures
2022-12-17 09:25:53 +01:00
bors
fde3000299 Auto merge of #105794 - ChrisDenton:internal-doc, r=jyn514
Add CI test for documentation of hidden items in std

Fixes #87844

r? `@jyn514`
2022-12-17 06:27:30 +00:00
bors
74699b82ca Auto merge of #105811 - ojeda:Dwarnings-no_fp_fmt_parse, r=Mark-Simulacrum
core: ensure `no_fp_fmt_parse` builds are warning-free

Rust recently introduced a new `unused_imports` warning in `no_fp_fmt_parse` builds, which was fixed in
https://github.com/rust-lang/rust/pull/105434.

To avoid accumulating more over time, let's keep the builds warning-free. This ensures projects compiling `core` with this custom config do not see the warnings in the future and that they can keep enabling `-Dwarnings`.

Similarly, https://github.com/rust-lang/rust/pull/98652 did it for `alloc`'s `no_global_oom_handling`.
2022-12-17 03:11:39 +00:00
bors
998e1a91db Auto merge of #105804 - matthiaskrgr:rollup-iaqlbl3, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #105493 (Help rust-analyzer normalize query return types)
 - #105710 (Don't bug if we're trying to cast `dyn*` to another type)
 - #105711 (bail in `collect_trait_impl_trait_tys` if signatures reference errors)
 - #105768 (Detect inherent associated types not having CamelCase)
 - #105780 (rustdoc: Don't add "Read more" link if there is no extra content)
 - #105802 (Make enum-match.rs test robust against variable name changes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-17 00:41:15 +00:00
Matthias Krüger
803ce455a3
Rollup merge of #105802 - chbaker0:enum-match-filecheck, r=tmiasko
Make enum-match.rs test robust against variable name changes

https://reviews.llvm.org/D140192 caused the LLVM variable generated for enum discriminant checks to be named differently (%narrow vs %1).

This adjusts the test CHECK directives to match any name.
2022-12-17 00:45:54 +01:00
Matthias Krüger
11de52a46d
Rollup merge of #105780 - GuillaumeGomez:read-more-links, r=notriddle
rustdoc: Don't add "Read more" link if there is no extra content

Fixes #105677.
2022-12-17 00:45:53 +01:00
Matthias Krüger
81c11892a9
Rollup merge of #105768 - fee1-dead-contrib:iat-style, r=eholk
Detect inherent associated types not having CamelCase

Fixes #105341.
2022-12-17 00:45:52 +01:00
Matthias Krüger
a6c6a8d216
Rollup merge of #105711 - compiler-errors:rpitit-references-errors, r=eholk
bail in `collect_trait_impl_trait_tys` if signatures reference errors

Fixes #105290
2022-12-17 00:45:52 +01:00
Matthias Krüger
86bbc20146
Rollup merge of #105710 - compiler-errors:dyn-star-rigid-cast, r=eholk
Don't bug if we're trying to cast `dyn*` to another type

Fixes #105097
2022-12-17 00:45:51 +01:00
Matthias Krüger
505848a935
Rollup merge of #105493 - WaffleLapkin:unchoke-r-a, r=Nilstrieb
Help rust-analyzer normalize query return types

See [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/rustc.20query.20types.20are.20not.20normalized.20since.20recently/near/312686086), since https://github.com/rust-lang/rust/pull/103808, rust analyzer doesn't normalize return types of queries. This is because r-a doesn't support associated type defaults (yet).

The easiest fix is to not use associated type defaults (duh), which this PR does.

r? `@cjgillot`
2022-12-17 00:45:50 +01:00
Miguel Ojeda
af7f2222d3 core: ensure no_fp_fmt_parse builds are warning-free
Rust recently introduced a new `unused_imports` warning
in `no_fp_fmt_parse` builds, which was fixed in
https://github.com/rust-lang/rust/pull/105434.

To avoid accumulating more over time, let's keep the builds
warning-free. This ensures projects compiling `core` with
this custom config do not see the warnings in the future
and that they can keep enabling `-Dwarnings`.

Similarly, https://github.com/rust-lang/rust/pull/98652 did it
for `alloc`'s `no_global_oom_handling`.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2022-12-17 00:19:59 +01:00
Collin Baker
8751d3b2e9 Make enum-match.rs test robust against variable name changes
https://reviews.llvm.org/D140192 caused the LLVM variable generated
for enum discriminant checks to be named differently (%narrow vs %1).

This adjusts the test CHECK directives to match any name.
2022-12-16 17:32:29 -05:00
bors
bbb9cfbbc5 Auto merge of #102318 - Amanieu:default_alloc_error_handler, r=oli-obk
Stabilize default_alloc_error_handler

Tracking issue: #66741

This turns `feature(default_alloc_error_handler)` on by default, which causes the compiler to automatically generate a default OOM handler which panics if `#[alloc_error_handler]` is not provided.

The FCP completed over 2 years ago but the stabilization was blocked due to an issue with unwinding. This was fixed by #88098 so stabilization can be unblocked.

Closes #66741
2022-12-16 21:08:45 +00:00
Rémy Rakic
be5685bb4d add simulated non-regression test for issue 105637 2022-12-16 20:58:05 +00:00
Rémy Rakic
d2f4a9ca25 don't copy symbols from dylibs with -Zdylib-lto 2022-12-16 20:39:23 +00:00
Chris Denton
8534fd3089
Fix intra-doc link 2022-12-16 20:21:44 +00:00
Chris Denton
3d852f60aa
Test documentation of hidden items in std 2022-12-16 20:21:43 +00:00
bors
9c07efe84f Auto merge of #105018 - zertosh:path_buf_deref_mut, r=dtolnay
Implement DerefMut for PathBuf

Without this, there's no way to get a `&mut Path` from `PathBuf` without
going through `into_boxed_path`. This is relevant now that #105002 adds
`PathBuf::as_mut_os_string` and `Path::as_mut_os_str`.
2022-12-16 18:06:10 +00:00
bors
63b3bac77c Auto merge of #105775 - matthiaskrgr:rollup-2o8qn7e, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #105725 (Allow `impl ~const Trait` opaque types)
 - #105744 (Rewrite `E0158` error-code docs for clarity)
 - #105747 (Fix ICE calling method on auto trait)
 - #105748 (doc: Fix a few small issues)
 - #105756 (rustdoc: simplify CSS for codeblock tooltips)
 - #105757 (rustdoc: remove unused CSS `.sub-settings`)
 - #105764 (rustdoc: name the source page sidebar-toggle `#src-sidebar-toggle`)
 - #105774 (Remove unused stderr files)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-16 15:12:00 +00:00
Maybe Waffle
452c745518 Add a comment warning against using associated type defaults <3 2022-12-16 15:10:48 +00:00
Deadbeef
08a0e71ec9 Detect inherent associated types not having CamelCase
Fixes #105341.
2022-12-16 14:45:04 +00:00
Guillaume Gomez
80059e1b72 Add test for presence of read more links 2022-12-16 14:52:35 +01:00
Guillaume Gomez
14b508fbec Don't add "Read more" link if there is no extra content 2022-12-16 14:52:35 +01:00
Matthias Krüger
8e35aad446
Rollup merge of #105774 - TaKO8Ki:remove-unused-stderr-files, r=tmiasko
Remove unused stderr files
2022-12-16 14:02:21 +01:00
Matthias Krüger
d30057b797
Rollup merge of #105764 - notriddle:notriddle/src-sidebar-toggle, r=GuillaumeGomez
rustdoc: name the source page sidebar-toggle `#src-sidebar-toggle`

The old name doesn't get across where it's really supposed to be used.
2022-12-16 14:02:20 +01:00
Matthias Krüger
3142e6f0b1
Rollup merge of #105757 - notriddle:notriddle/sub-settings, r=GuillaumeGomez
rustdoc: remove unused CSS `.sub-settings`

Obsoleted when 9625ed8be7 changed the DOM.
2022-12-16 14:02:20 +01:00
Matthias Krüger
0820bb2826
Rollup merge of #105756 - notriddle:notriddle/example-wrap-tooltip, r=GuillaumeGomez
rustdoc: simplify CSS for codeblock tooltips

Instead of making its parts `display: none` and then changing it on hover, just make the pseudo-element itself on hover.
2022-12-16 14:02:19 +01:00
Matthias Krüger
1ad070a118
Rollup merge of #105748 - hakoerber:master, r=Dylan-DPC
doc: Fix a few small issues

Hey, while reading through the (awesome) stdlib docs, I found a few minor typos.

* A few typos around generic types (`;` vs `,`)
* Use inline code formatting for code fragments
* One instance of wrong wording
2022-12-16 14:02:19 +01:00
Matthias Krüger
cc04e97cfb
Rollup merge of #105747 - chenyukang:yukang/fix-105732-auto-trait, r=compiler-errors
Fix ICE calling method on auto trait

Fixes #105732
r? `@compiler-errors`
2022-12-16 14:02:18 +01:00
Matthias Krüger
3b9aea967f
Rollup merge of #105744 - Ezrashaw:e0158-clarity, r=GuillaumeGomez
Rewrite `E0158` error-code docs for clarity

Fixes #105585.

The `E0158` error-code docs are unclear. It doesn't explain all three different variants of the error and doesn't explain *why* the error occurs. This PR cleans it up a bit and brings it properly into line with [RFC1567](https://rust-lang.github.io/rfcs/1567-long-error-codes-explanation-normalization.html).

I'm a first time Rust contributor so I've probably not got it quite right. I also haven't run the whole build process because I assume that my minor docs changes shouldn't break everything.
2022-12-16 14:02:18 +01:00
Matthias Krüger
22797ef6b2
Rollup merge of #105725 - fee1-dead-contrib:allow-impl-const-trait, r=oli-obk
Allow `impl ~const Trait` opaque types
2022-12-16 14:02:17 +01:00
bors
03770f0e2b Auto merge of #103880 - b-naber:field-ty-mir, r=lcnr
Use non-ascribed type as field's type in mir

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

r? `@lcnr`
2022-12-16 12:47:49 +00:00
Takayuki Maeda
75ebd691c8 remove unused stderr files 2022-12-16 20:55:06 +09:00
Oli Scherer
b170669917 Make a field only as public as it needs to be 2022-12-16 10:09:23 +00:00
Oli Scherer
02cbc017d7 Rename ConstS to ConstData 2022-12-16 10:02:51 +00:00
bors
01ef4b21dc Auto merge of #105763 - Ezrashaw:rustc-book-relative-links, r=jyn514
Use relative links in the unstable and rustc book

Fixes #98227.

As it stands, potential issues could arise from mismatch of stable/ nightly in the books. This PR fixes this issue by using relative links instead of absolute ones. I have replaced every absolute link under `src/doc/rustc` and `src/doc/unstable-book/` and tested each manually.

The link at `src/doc/rustc/src/targets/index.md:7`:
`[here](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/struct.Target.html).`
I need help with because my local directory structure and https://doc.rust-lang.org/ seem to be different, where is `nightly-rustc`?

`@jyn514`
2022-12-16 09:30:56 +00:00
bors
a803f313fd Auto merge of #105717 - compiler-errors:anonymize, r=jackh726
always use `anonymize_bound_vars`

Unless this is perf-sensitive, it's probably best to always use one anonymize function that does the right thing for all bound vars.

r? types
2022-12-16 06:45:08 +00:00
bors
39b2a41b39 Auto merge of #104334 - compiler-errors:ufcs-sugg-wrong-def-id, r=estebank
Use impl's def id when calculating type to specify in UFCS

Fixes #104327
Fixes #104328

Also addresses https://github.com/rust-lang/rust/pull/102670#discussion_r987381197
2022-12-16 03:57:10 +00:00
Michael Howell
a84483eb59 rustdoc: name the source page sidebar-toggle #src-sidebar-toggle
The old name doesn't get across where it's really supposed to be used.
2022-12-15 16:29:52 -07:00
bors
7a6af2711b Auto merge of #105760 - matthiaskrgr:rollup-r8beo9w, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #105481 (Start improving monomorphization items stats)
 - #105674 (Point at method chains on `E0271` errors)
 - #105679 (Suggest constraining type parameter with `Clone`)
 - #105694 (Don't create dummy if val has escaping bounds var)
 - #105727 (Tweak output for bare `dyn Trait` in arguments)
 - #105739 (Migrate Jump to def links background to CSS variable)
 - #105743 (`SimplifiedType` cleanups)
 - #105758 (Move `TypeckResults` to separate module)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-15 22:53:03 +00:00
Ezra Shaw
9ea3550a26
remove relative links from rustc-book and unstable-book
Co-authored-by: Joshua Nelson <github@jyn.dev>
2022-12-16 11:44:07 +13:00
yukang
605f77b7d0 fix #105732, Fix ICE calling method on auto trait 2022-12-16 05:55:26 +08:00
Matthias Krüger
2e03ff1b35
Rollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errors
Move `TypeckResults` to separate module

`ty::context` is really big and the typeck results aren't directly related to `TyCtxt`, so move them to a separate module. Also contains a small drive-by macro "improvement".
2022-12-15 22:03:01 +01:00