Commit Graph

211991 Commits

Author SHA1 Message Date
Yutaro Ohno
e4812583c7 parser: refactoring on recovery from invalid variable declarations
Previously, the `recover_local_after_let` function was called from the
body of the `recover_stmt_local` function. Unifying these two functions
make it more simple and more readable.
2022-12-03 23:41:42 +09:00
yukang
fb004e9a95 fix #101749, use . instead of :: when accessing a method of an object 2022-12-03 22:41:12 +08:00
yukang
795b2afd20 fix #105069, Add AmbiguityError for inconsistent resolution for an import 2022-12-03 22:28:35 +08:00
Yutaro Ohno
690addc6ec parser: fix ICE with invalid variable declaration in macro call
Fix ICE on parsing an invalid variable declaration as a statement like:

```
macro_rules! m { ($s:stmt) => {} }
m! { var x }
```
2022-12-03 23:24:49 +09:00
bjorn3
a99838a115 Make sure all input archives are unmapped before persisting the output archive 2022-12-03 12:53:47 +00:00
bors
840f227b00 Auto merge of #2712 - RalfJung:rustup, r=RalfJung
Rustup
2022-12-03 12:32:28 +00:00
Ralf Jung
29814f2e2a clippy 2022-12-03 13:31:57 +01:00
bors
4bb15759d7 Auto merge of #105183 - GuillaumeGomez:merge-and-dedup-predicates, r=notriddle
Merge generics and where predicates and prevent duplicates in where predicates

Part of #104886 (I didn't include bounds from parent trait yet as I think the PR is already big enough).

Also we'll need to run a perf check.

cc `@fmease` since you worked a bit on this.
r? `@notriddle`
2022-12-03 11:28:33 +00:00
Camille GILLOT
e973240d18 Do not call fn_sig on non-functions. 2022-12-03 09:34:06 +00:00
Camille GILLOT
59cc6cd4ac Remove useless filter in unused extern crate check. 2022-12-03 09:23:03 +00:00
bors
703d95e183 Auto merge of #105133 - oli-obk:promoted_def_ids, r=cjgillot
Ensure query backtraces work for `DefId`s created after ast lowering

r? `@cjgillot`
2022-12-03 08:17:46 +00:00
bors
24f2704e96 Auto merge of #105196 - JohnTitor:rollup-8rxqnq6, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #104903 (Use ocx.normalize in report_projection_error)
 - #105032 (improve doc of into_boxed_slice and impl From<Vec<T>> for Box<[T]>)
 - #105100 (Add missing intra-doc link)
 - #105181 (Don't add a note for implementing a trait if its inner type is erroneous)
 - #105182 (Rustdoc-Json: Don't inline foreign traits)
 - #105188 (Don't elide type information when printing E0308 with `-Zverbose`)
 - #105189 (rustdoc: clean up redundant CSS on `.rustdoc-toggle.hideme`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-03 05:24:35 +00:00
Yuki Okushi
d8f6cc3b63
Rollup merge of #105189 - notriddle:notriddle/rustdoc-toggle-hideme, r=GuillaumeGomez
rustdoc: clean up redundant CSS on `.rustdoc-toggle.hideme`
2022-12-03 12:51:30 +09:00
Yuki Okushi
7d4af8852c
Rollup merge of #105188 - compiler-errors:verbose-ty-err, r=TaKO8Ki
Don't elide type information when printing E0308 with `-Zverbose`

When we pass `-Zverbose`, we kinda expect for all `_` to be replaced with more descriptive information, for example --

```
   = note: expected fn pointer `fn(_, u32)`
                 found fn item `fn(_, i32) {foo}`
```

Where `_` is the "identical" part of the fn signatures, now gets rendered as:

```
   = note: expected fn pointer `fn(i32, u32)`
                 found fn item `fn(i32, i32) {foo}`
```
2022-12-03 12:51:30 +09:00
Yuki Okushi
9afa850d39
Rollup merge of #105182 - aDotInTheVoid:rdj-no-foreign-traits, r=Enselic,GuillaumeGomez
Rustdoc-Json: Don't inline foreign traits

It wasn't done correctly, and [we want to move towards only having local items in the index, and making foreign items easier to resolved](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Rustdoc.20JSON.3A.20Include.20All.20Foreign.20Items.3F)

Fixes #105025. This means #105015 is included to test this

Fixes #105022

r? `@GuillaumeGomez`
2022-12-03 12:51:29 +09:00
Yuki Okushi
8f368666b5
Rollup merge of #105181 - bhbs:skip-note, r=estebank
Don't add a note for implementing a trait if its inner type is erroneous

Fix #105138
2022-12-03 12:51:29 +09:00
Yuki Okushi
019795b162
Rollup merge of #105100 - jhpratt:fix-docs, r=JohnTitor
Add missing intra-doc link

Trivial change. This makes the plain text into inline code and makes it a link.

`@rustbot` label +A-docs
2022-12-03 12:51:28 +09:00
Yuki Okushi
9f3ccd4bf6
Rollup merge of #105032 - HintringerFabian:improve_docs, r=JohnTitor
improve doc of into_boxed_slice and impl From<Vec<T>> for Box<[T]>

Improves description of `into_boxed_slice`, and adds example to `impl From<Vec<T>> for Box<[T]>`.
Fixes #98908
2022-12-03 12:51:27 +09:00
Yuki Okushi
52e886279a
Rollup merge of #104903 - spastorino:consolidate-normalize-in-report_projection_error, r=lcnr
Use ocx.normalize in report_projection_error

r? `@lcnr`

cc `@compiler-errors`
2022-12-03 12:51:27 +09:00
bors
dd7a12593a Auto merge of #105073 - weihanglo:update-cargo, r=weihanglo
Update cargo

9 commits in e027c4b5d25af2119b1956fac42863b9b3242744..f6e737b1e3386adb89333bf06a01f68a91ac5306
2022-11-25 19:44:46 +0000 to 2022-12-02 20:21:24 +0000
- Refactor generate_targets into separate module (https://github.com/rust-lang/cargo/pull/11445)
- Improve file found in multiple build targets warning (https://github.com/rust-lang/cargo/pull/11299)
- Error when precise without -p flag (https://github.com/rust-lang/cargo/pull/11349)
- Improve strategy for selecting targets to be scraped for examples (https://github.com/rust-lang/cargo/pull/11430)
- Aware of compression ratio for unpack size limit (https://github.com/rust-lang/cargo/pull/11337)
- Add test for rustdoc-map generation when using sparse registries (https://github.com/rust-lang/cargo/pull/11403)
- Add error message when `cargo fix` on an empty repo (https://github.com/rust-lang/cargo/pull/11400)
- Store the sparse+ prefix in the SourceId for sparse registries (https://github.com/rust-lang/cargo/pull/11387)
- Update documentation for -Zrustdoc-scrape-examples in the Cargo Book (https://github.com/rust-lang/cargo/pull/11425)
2022-12-03 02:12:48 +00:00
Weihang Lo
9bd6062833
Update cargo
9 commits in e027c4b5d25af2119b1956fac42863b9b3242744..f6e737b1e3386adb89333bf06a01f68a91ac5306
2022-11-25 19:44:46 +0000 to 2022-12-02 20:21:24 +0000
- Refactor generate_targets into separate module (rust-lang/cargo#11445)
- Improve file found in multiple build targets warning (rust-lang/cargo#11299)
- Error when precise without -p flag (rust-lang/cargo#11349)
- Improve strategy for selecting targets to be scraped for examples (rust-lang/cargo#11430)
- Aware of compression ratio for unpack size limit (rust-lang/cargo#11337)
- Add test for rustdoc-map generation when using sparse registries (rust-lang/cargo#11403)
- Add error message when `cargo fix` on an empty repo (rust-lang/cargo#11400)
- Store the sparse+ prefix in the SourceId for sparse registries (rust-lang/cargo#11387)
- Update documentation for -Zrustdoc-scrape-examples in the Cargo Book (rust-lang/cargo#11425)
2022-12-03 01:11:11 +00:00
BlackHoleFox
56592d310f Fix passing MACOSX_DEPLOYMENT_TARGET to the linker 2022-12-02 18:12:16 -06:00
bhbs
715d4a8949 Don't add a note for implementing a trait if its inner type is erroneous 2022-12-03 09:06:47 +09:00
Tomasz Miąsko
b740cdcf43 Mark naked functions as never inline in codegen_fn_attrs
Use code generation attributes to ensure that naked functions are never
inline, replacing separate checks in MIR inliner and LLVM code
generation.
2022-12-03 01:04:42 +01:00
Tomasz Miąsko
c955add18c Disable coverage instrumentation for naked functions 2022-12-03 01:03:28 +01:00
bors
e526d123aa Auto merge of #105187 - matthiaskrgr:rollup-nxyxpko, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #105026 (v8a as default aarch64 target)
 - #105033 (sparc-struct-abi: work around new tail-call optimization)
 - #105144 (Document normalization methods `At::{normalize,query_normalize}`)
 - #105155 (rustdoc: clean up help and settings button CSS)
 - #105162 (Properly synthesize `FnSig` value during cycle)
 - #105163 (Check lifetime param count in `collect_trait_impl_trait_tys`)
 - #105185 (Move `normalize_fn_sig` to `TypeErrCtxt`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-02 23:00:48 +00:00
Michael Howell
c635cb774b rustdoc: clean up redundant CSS on .rustdoc-toggle.hideme 2022-12-02 14:39:06 -07:00
Michael Goulet
5c642d7d1c Don't elide information when printing E0308 with Zverbose 2022-12-02 21:01:59 +00:00
Santiago Pastorino
89047430f1
Define values and err as non mutable 2022-12-02 17:31:45 -03:00
Santiago Pastorino
4dacf4f469
Use ocx.normalize in report_projection_error 2022-12-02 17:31:40 -03:00
Matthias Krüger
8e0d83a70c
Rollup merge of #105185 - compiler-errors:normalize_fn_sig-in-err-ctxt, r=lcnr
Move `normalize_fn_sig` to `TypeErrCtxt`

r? `@lcnr`
2022-12-02 21:22:50 +01:00
Matthias Krüger
09e2d0f289
Rollup merge of #105163 - compiler-errors:afit-lt-arity, r=jackh726
Check lifetime param count in `collect_trait_impl_trait_tys`

We checked the type and const generics count, but not the lifetimes, which were handled in a different function.

Fixes #105154
2022-12-02 21:22:50 +01:00
Matthias Krüger
babdf86952
Rollup merge of #105162 - compiler-errors:fn-sig-arity, r=cjgillot
Properly synthesize `FnSig` value during cycle

Get the arity correct when creating a `FnSig` type during `tcx.fn_sig` cycle recovery

Fixes #105152
2022-12-02 21:22:49 +01:00
Matthias Krüger
de0d18a85e
Rollup merge of #105155 - notriddle:notriddle/flexbox-help-settings-buttons, r=GuillaumeGomez
rustdoc: clean up help and settings button CSS

The old version of this code specified a bunch of different numbers that had to line up just right to get the size it wanted. This version uses flexbox centering, specifies the font size, and lets the browser figure out the rest of the layout automatically.

Preview: http://notriddle.com/notriddle-rustdoc-demos/flexbox-help-settings-buttons/test_dingus/
2022-12-02 21:22:49 +01:00
Matthias Krüger
b5b2d03c0c
Rollup merge of #105144 - compiler-errors:normalization-doc, r=lcnr
Document normalization methods `At::{normalize,query_normalize}`

r? ``@lcnr``
2022-12-02 21:22:48 +01:00
Matthias Krüger
0724a01b8c
Rollup merge of #105033 - durin42:llvm-16-dont-tail-call-me-bro, r=tmandry
sparc-struct-abi: work around new tail-call optimization

Upstream LLVM change https://reviews.llvm.org/D138741 introduced some new tail-call smarts for SPARC which broke some of the checks in this test. Rather than adjust the test expectations, we add an extra no-args function that can get tail-called or not without hurting the needs of the test.

r? ``@nikic``
2022-12-02 21:22:47 +01:00
Matthias Krüger
dab14348e9
Rollup merge of #105026 - oToToT:aarch64-v8a, r=davidtwco
v8a as default aarch64 target

After https://github.com/llvm/llvm-project/commit/8689f5e landed, LLVM takes the intersection of v8a and v8r as default. This commit brings back v8a support by explicitly specifying v8a in the feature list.

This should solve #97724.

p.s. a bit more context can also be found in https://github.com/llvm/llvm-project/issues/57904#issuecomment-1329555590.
2022-12-02 21:22:47 +01:00
bors
32e613bbaa Auto merge of #104999 - saethlin:immediate-abort-inlining, r=thomcc
Adjust inlining attributes around panic_immediate_abort

The goal of `panic_immediate_abort` is to permit the panic runtime and formatting code paths to be optimized away. But while poking through some disassembly of a small program compiled with that option, I found that was not the case. Enabling LTO did address that specific issue, but enabling LTO is a steep price to pay for this feature doing its job.

This PR fixes that, by tweaking two things:
* All the slice indexing functions that we `const_eval_select` on get `#[inline]`. `objdump -dC` told me that originally some `_ct` functions could end up in an executable. I won't pretend to understand what's going on there.
* Normalize attributes across all `panic!` wrappers: use `inline(never) + cold` normally, and `inline` when `panic_immediate_abort` is enabled.

But also, with LTO and `panic_immediate_abort` enabled, this patch knocks ~709 kB out of the `.text` segment of `librustc_driver.so`. That is slightly surprising to me, my best theory is that this shifts some inlining earlier in compilation, enabling some subsequent optimizations. The size improvement of `librustc_driver.so` with `panic_immediate_abort` due to this patch is greater with LTO than without LTO, which I suppose backs up this theory.

I do not know how to test this. I would quite like to, because I think what this is solving was an accidental regression. This only works with `-Zbuild-std` which is a cargo flag, and thus can't be used in a rustc codegen test.

r? `@thomcc`

---

I do not seriously think anyone is going to use a compiler built with `panic_immediate_abort`, but I wanted a big complicated Rust program to try this out on, and the compiler is such.
2022-12-02 20:07:23 +00:00
Michael Goulet
ffca711760 Move normalize_fn_sig to TypeErrCtxt 2022-12-02 19:29:14 +00:00
Guillaume Gomez
269704a4a0 Update existing rustdoc tests 2022-12-02 19:40:40 +01:00
Guillaume Gomez
93d7aa146d Add rustdoc test for bounds de-duplication and merge 2022-12-02 19:40:40 +01:00
Guillaume Gomez
af45040acd Merge generics and where predicates and prevent duplicates in where predicates 2022-12-02 19:40:40 +01:00
Ralf Jung
b64d8670e4 Merge from rustc 2022-12-02 18:16:08 +01:00
Ralf Jung
80ab672b86 Preparing for merge from rustc 2022-12-02 18:14:53 +01:00
Nixon Enraght-Moony
79d897b22a Add test for #105022 2022-12-02 17:05:37 +00:00
Nixon Enraght-Moony
52be350445 Add test for #105025 2022-12-02 17:03:35 +00:00
Nixon Enraght-Moony
881bd865ad Rustdoc-Json: Don't include foreign traits 2022-12-02 16:58:10 +00:00
Nixon Enraght-Moony
c1b8eff4d3 jsondoclint: Check links field 2022-12-02 16:55:47 +00:00
Oli Scherer
c7e94b0efd Use zero based indexing for pass_count 2022-12-02 15:55:24 +00:00
Oli Scherer
80dcc52934 Remove an impl and replace its only use with a method call 2022-12-02 15:43:36 +00:00