Commit Graph

206703 Commits

Author SHA1 Message Date
Matthias Krüger
808f197ed4
Rollup merge of #102490 - compiler-errors:closure-body-impl-lifetime, r=cjgillot
Generate synthetic region from `impl` even in closure body within an associated fn

Fixes #102209
2022-09-30 23:38:26 +02:00
Matthias Krüger
05b9f0e360
Rollup merge of #102483 - spastorino:create-defs-on-lowering, r=cjgillot
create def ids for impl traits during ast lowering

r? `@cjgillot`
2022-09-30 23:38:25 +02:00
Matthias Krüger
9ec772e223
Rollup merge of #102373 - Nilstrieb:cannot-get-layout-of-branch-error, r=cjgillot
Flush delayed bugs before codegen

Sometimes it can happen that invalid code like a TyKind::Error makes its way through the compiler without triggering any errors (this is always a bug in rustc but bugs do happen sometimes :)). These ICEs will manifest in the backend like as cg_llvm not being able to get the layout of `[type error]`, which makes it hard to debug. By flushing before codegen, we display all the delayed bugs, making it easier to trace it to the root of the problem.

I tried this on #102366 and it showed tons of of delayed bugs and no error in cg_llvm, so it seems to be working.
2022-09-30 23:38:25 +02:00
Matthias Krüger
c07ebeb74b
Rollup merge of #102361 - fee1-dead-contrib:fix-102156, r=eholk
Fix ICE in const_trait check code

This fixes #102156.
2022-09-30 23:38:24 +02:00
Michael Howell
598a02c6ad rustdoc: remove orphaned link on array bracket
This is 682889fb06, but for arrays instead.

For non-generics, this retains links to the array page, but instead of
trying to link it all, it only links the length part, which distinguishes
arrays from slices.

For generics, the entire thing becomes a link, just like slices.
2022-09-30 14:38:05 -07:00
Nicholas Nethercote
5ab68a82d5 Group together more size assertions.
Also add a few more assertions for some relevant token-related types.

And fix an erroneous comment in `rustc_errors`.
2022-10-01 07:30:23 +10:00
bors
8ce3204af9 Auto merge of #102517 - nikic:update-llvm-8, r=cuviper
Update LLVM submodule

This merges in the current upstream release/15.x branch.

Fixes #102402.
2022-09-30 20:41:26 +00:00
nils
e8f1bfe193
Fix typo 2022-09-30 21:02:53 +02:00
Michael Howell
8308c4bd35 rustdoc: update test cases for <section> tags in traits 2022-09-30 11:58:58 -07:00
Santiago Pastorino
b2bef02bcd
create def ids for impl traits during ast lowering 2022-09-30 15:12:01 -03:00
Camille Gillot
4b1cf846bd
Update compiler/rustc_interface/src/queries.rs 2022-09-30 19:50:48 +02:00
bors
877877a19a Auto merge of #102520 - matthiaskrgr:rollup-7nreat0, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #102276 (Added more const_closure functionality)
 - #102382 (Manually order `DefId` on 64-bit big-endian)
 - #102421 (remove the unused :: between trait and type to give user correct diag…)
 - #102495 (Reinstate `hir-stats.rs` test for stage 1.)
 - #102505 (rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`)
 - #102506 (Specify `DynKind::Dyn`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-30 17:47:57 +00:00
Michael Howell
1dcbe72031 rustdoc: add gui test for no-docblock margins 2022-09-30 10:47:18 -07:00
Michael Howell
f145f283f7 rustdoc: add missing margin to no-docblock trait items
Fixes another regression caused by 8846c0853d,
this time fixing the appearance of methods that have no docblock (we didn't
notice this one because libstd docs *always* have docblocks).

See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/trait.AttributesExt.html
2022-09-30 10:45:19 -07:00
Matthias Krüger
a8777580ee
Rollup merge of #102506 - TaKO8Ki:specify-dyn-kind, r=lcnr
Specify `DynKind::Dyn`

ref: https://github.com/rust-lang/rust/pull/101212#discussion_r958861297
2022-09-30 19:06:07 +02:00
Matthias Krüger
5dd4584d2e
Rollup merge of #102505 - notriddle:sub-variant-h4, r=GuillaumeGomez
rustdoc: remove no-op CSS `h3.variant, .sub-variant h4 { border-bottom: none }`

This rule, added in 69df43b041 to override the default `h4` style, has been obsoleted when a65c98fefb changed it so that only the top docblock put `border-bottom` on `h4.`
2022-09-30 19:06:06 +02:00
Matthias Krüger
9f0865bead
Rollup merge of #102495 - nnethercote:reinstate-hir-stats, r=lqd
Reinstate `hir-stats.rs` test for stage 1.

It was disabled in #94075 for stage 1 because that PR changed type layouts such that the results for this test were different for stage 1 and stage 2. But now that #94075 is in beta, the results for this test are now the same for stage 1 and stage 2.

r? ```@lqd```
2022-09-30 19:06:06 +02:00
Matthias Krüger
f7f253ea47
Rollup merge of #102421 - lyming2007:issue-101866, r=lcnr
remove the unused :: between trait and type to give user correct diag…

…nostic information

	modified:   compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
	new file:   src/test/ui/type/issue-101866.rs
	new file:   src/test/ui/type/issue-101866.stderr
2022-09-30 19:06:05 +02:00
Matthias Krüger
e2bc6b8172
Rollup merge of #102382 - cuviper:defid-order, r=fee1-dead
Manually order `DefId` on 64-bit big-endian

`DefId` uses different field orders on 64-bit big-endian vs. others, in
order to optimize its `Hash` implementation. However, that also made it
derive different lexical ordering for `PartialOrd` and `Ord`. That
caused spurious differences wherever `DefId`s are sorted, like the
candidate sources list in `report_method_error`.

Now we manually implement `PartialOrd` and `Ord` on 64-bit big-endian to
match the same lexical ordering as other targets, fixing at least one
test, `src/test/ui/methods/method-ambig-two-traits-cross-crate.rs`.
2022-09-30 19:06:05 +02:00
Matthias Krüger
3452d9d593
Rollup merge of #102276 - ink-feather-org:const_closure_ext, r=fee1-dead
Added more const_closure functionality

Enables ConstFnMutClosure to use a tuple of mutable references instead of just a mutable reference to a tuple.

Removes the new function, since it would barely be usable with this new code.

r? `@fee1-dead`
2022-09-30 19:06:04 +02:00
Michael Howell
8728e17855 rustdoc: add missing margin to no-docblock methods
Fixes another regression caused by 8846c0853d,
this time fixing the appearance of methods that have no docblock (we didn't
notice this one because libstd docs *always* have docblocks).

See how it looks without the fix at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/enum.Type.html#implementations
2022-09-30 09:57:24 -07:00
Alex Macleod
71db0dd918 Fix format_args capture for macro expanded format strings 2022-09-30 17:40:14 +01:00
onestacked
10739d475e Add back ConstFnMutClosure::new, fix formatting 2022-09-30 17:41:01 +02:00
onestacked
9a641a533c Fixed Documentation for wrap_mut_2_imp 2022-09-30 17:16:59 +02:00
onestacked
b73241aa5b Added more const_closure functionality. 2022-09-30 17:16:59 +02:00
Nikita Popov
efbaa11561 Update LLVM submodule
Fixes #102402.
2022-09-30 16:39:32 +02:00
bors
75d3027fb5 Auto merge of #102484 - beetrees:duration-debug-bug-fix, r=scottmcm
Fix integer overflow in `format!("{:.0?}", Duration::MAX)`

Currently `format!("{:.0?}", Duration::MAX)` causes an integer overflow in the `Duration` `Debug` impl ([playground link](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=67675c6895bdb2e37ee727f0ed7622b2)). This is because the carry from the rounding of the fractional_part into the integer_part will cause the integer_part to overflow as it is already `u64::MAX`. This PR uses a larger integer type to avoid that issue, and adds a test for the correct behaviour.
2022-09-30 14:16:57 +00:00
nils
477846f491
Add comment explaining why we flush delayed bugs before codegen 2022-09-30 14:11:18 +02:00
Guillaume Gomez
461c31642d Add GUI test for sidebar links color 2022-09-30 13:29:40 +02:00
Guillaume Gomez
98f05a0282 * Migrate sidebar links color to new CSS theme handling
* Remove specific color handling for ".current" items in the sidebar.
2022-09-30 13:29:39 +02:00
bors
f914b82a75 Auto merge of #102509 - matthiaskrgr:rollup-gtenet8, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #101075 (Migrate rustc_codegen_gcc to SessionDiagnostics )
 - #102350 (Improve errors for incomplete functions in struct definitions)
 - #102481 (rustdoc: remove unneeded CSS `.rust-example-rendered { position }`)
 - #102491 (rustdoc: remove no-op source sidebar `opacity`)
 - #102499 (Adjust the s390x data layout for LLVM 16)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-30 10:39:09 +00:00
Matthias Krüger
588a25a6f8
Rollup merge of #102499 - cuviper:llvm-16-s390x, r=nikic
Adjust the s390x data layout for LLVM 16

LLVM [D131158] changed the SystemZ data layout to always set 64-bit
vector alignment, which used to be conditional on the "vector" feature.

[D131158]: https://reviews.llvm.org/D131158

r? `@nikic`
2022-09-30 10:22:39 +02:00
Matthias Krüger
e36c3c12cc
Rollup merge of #102491 - notriddle:notriddle/sidebar-opacity, r=GuillaumeGomez
rustdoc: remove no-op source sidebar `opacity`

These rules were added in dc2c972334 to work with CSS transitions. They're otherwise redundant, since the `visibility` property already hides everything.

dc2c972334/src/librustdoc/html/static/css/rustdoc.css (L350-L354)

The transition was remove with 237d62588d, but the now-redundant `opacity` property was not.
2022-09-30 10:22:38 +02:00
Matthias Krüger
c4a1876900
Rollup merge of #102481 - notriddle:notriddle/rust-example-rendered, r=GuillaumeGomez
rustdoc: remove unneeded CSS `.rust-example-rendered { position }`

The Run button isn't inside the `<pre>` any more. It's instead nested below the example wrapper.

The class name can't be removed from the DOM, because `main.js` uses it.
2022-09-30 10:22:38 +02:00
Matthias Krüger
6906e64c30
Rollup merge of #102350 - TaKO8Ki:incomplete-fn-in-struct-definition, r=fee1-dead
Improve errors for incomplete functions in struct definitions

Given the following code:

```rust
fn main() {}

struct Foo {
    fn
}
```

[playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=29139f870511f6918324be5ddc26c345)

The current output is:

```
   Compiling playground v0.0.1 (/playground)
error: functions are not allowed in struct definitions
 --> src/main.rs:4:5
  |
4 |     fn
  |     ^^
  |
  = help: unlike in C++, Java, and C#, functions are declared in `impl` blocks
  = help: see https://doc.rust-lang.org/book/ch05-03-method-syntax.html for more information

error: could not compile `playground` due to previous error
```

In this case, rustc should suggest escaping `fn` to use it as an identifier.
2022-09-30 10:22:37 +02:00
Matthias Krüger
25017f8bce
Rollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=davidtwco
Migrate rustc_codegen_gcc to SessionDiagnostics

As part of #100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate.

``@rustbot`` label +A-translation
2022-09-30 10:22:36 +02:00
bors
4a0ee3cdc6 Auto merge of #102387 - nnethercote:inline-Token-PartialEq, r=lqd
Inline a few functions.

r? `@ghost`
2022-09-30 07:57:12 +00:00
Michael Howell
19b297c6e1 rustdoc: remove no-op CSS h3.variant, .sub-variant h4 { border-bottom: none }
This rule, added in 69df43b041 to override the
default `h4` style, has been obsoleted when
a65c98fefb changed it so that only the top
docblock put `border-bottom` on `h4.`
2022-09-30 00:00:54 -07:00
Takayuki Maeda
1ca33851df specify DynKind::Dyn 2022-09-30 15:52:20 +09:00
bors
b3aa4997d4 Auto merge of #102164 - compiler-errors:rpitit-foreign, r=TaKO8Ki
Serialize return-position `impl Trait` in trait hidden values in foreign libraries

Fixes #101630
2022-09-30 04:24:14 +00:00
Josh Stone
ed9e6f2ad8 Enable inline stack probes on X86 with LLVM 16 2022-09-29 19:49:23 -07:00
Michael Goulet
85a726e754 Remove expr_parentheses_needed from ParseSess 2022-09-30 01:39:20 +00:00
bors
d45feb3ad2 Auto merge of #102304 - lcnr:coherence-cleanup, r=compiler-errors
remove outdated coherence hack

we have a more precise detection for downstream conflicts in candidate assembly: the `is_knowable` check in `candidate_from_obligation_no_cache`.

r? types cc `@nikomatsakis`
2022-09-30 01:32:15 +00:00
Josh Stone
2e7a964485 Adjust the s390x data layout for LLVM 16
LLVM [D131158] changed the SystemZ data layout to always set 64-bit
vector alignment, which used to be conditional on the "vector" feature.

[D131158]: https://reviews.llvm.org/D131158
2022-09-29 18:18:26 -07:00
fee1-dead
d7fe44d988 Use let chains instead of let else 2022-09-30 00:31:53 +00:00
Nicholas Nethercote
f65eb51b00 Reinstate hir-stats.rs test for stage 1.
It was disabled in #94075 for stage 1 because that PR changed type
layouts such that the results for this test were different for stage 1
and stage 2. But now that #94075 is in beta, the results for this test
are now the same for stage 1 and stage 2.
2022-09-30 10:18:36 +10:00
bors
1bb8d276c9 Auto merge of #101887 - nnethercote:shrink-Res, r=spastorino
Shrink `hir::def::Res`

r? `@spastorino`
2022-09-29 22:45:24 +00:00
Michael Goulet
3722ad4c26 Don't lower assoc bindings just to deny them 2022-09-29 22:44:43 +00:00
Michael Howell
db376ee7ab rustdoc: update test case now that the UI animation is removed 2022-09-29 15:40:24 -07:00
Michael Howell
6d02a4dc33 rustdoc: remove no-op source sidebar opacity
These rules were added in dc2c972334 to work
with CSS transitions. They're otherwise redundant, since the `visibility`
property already hides everything.

dc2c972334/src/librustdoc/html/static/css/rustdoc.css (L350-L354)

The transition was remove with 237d62588d, but
the now-redundant `opacity` property was not.
2022-09-29 15:33:02 -07:00