Commit graph

158874 commits

Author SHA1 Message Date
Matthias Krüger c223a1c109
Rollup merge of #87054 - kit-981:master, r=scottmcm
Add a `try_reduce` method to the Iterator trait

Tracking issue: #87053
2021-12-04 10:42:19 +01:00
bors 887999d163 Auto merge of #88439 - cynecx:unwind_asm, r=Amanieu
Unwinding support for inline assembly

r? `@Amanieu`
2021-12-04 05:59:16 +00:00
kit aef59e4fb8 Add a try_reduce method to the Iterator trait 2021-12-04 15:17:14 +11:00
bors f581572778 Auto merge of #91505 - matthiaskrgr:rollup-orxgsxo, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #90538 (Document how recursion is handled for `ty::Ty`)
 - #90851 (Add unchecked downcast methods)
 - #91209 (Implement ``@snapshot`` check for htmldocck)
 - #91385 (Suggest the `pat_param` specifier before `|` on 2021 edition )
 - #91478 (Remove incorrect newline from float cast suggestion)
 - #91481 (Use let_else in some more places in rustc_lint)
 - #91488 (Fix ICE when `yield`ing in function returning `impl Trait`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-04 02:53:54 +00:00
Matthias Krüger df51bffe6b
Rollup merge of #91488 - compiler-errors:issue-91477, r=estebank
Fix ICE when `yield`ing in function returning `impl Trait`

Change an assert to a `delay_span_bug` and remove an unwrap, that should fix it.

Fixes #91477
2021-12-04 02:26:26 +01:00
Matthias Krüger af546dba31
Rollup merge of #91481 - est31:let_else, r=jackh726
Use let_else in some more places in rustc_lint

Follow-up of #91018 and #89933 . Also cc #90985 which added the first let_else uses to rustc_lint.
2021-12-04 02:26:25 +01:00
Matthias Krüger f9587b60b6
Rollup merge of #91478 - estebank:fix-newline-in-cast-suggestion, r=camelid
Remove incorrect newline from float cast suggestion
2021-12-04 02:26:24 +01:00
Matthias Krüger 2b64476b9c
Rollup merge of #91385 - ecstatic-morse:pat-param-spec-suggest, r=estebank
Suggest the `pat_param` specifier before `|` on 2021 edition

Ran into this today after writing some Rust for the first time in a while.

r? `@estebank`
2021-12-04 02:26:23 +01:00
Matthias Krüger 420ddd0b7e
Rollup merge of #91209 - camelid:snapshot, r=jyn514
Implement `@snapshot` check for htmldocck

This form of check allows performing snapshot tests (à la `src/test/ui`)
on rustdoc HTML output, making it easier to create and update tests.

See [this Zulip thread][1] for more information about the motivation for
this change.

[1]: https://zulip-archive.rust-lang.org/stream/266220-rustdoc/topic/HTML.20snapshot.20tests.html#262651142

r? `@GuillaumeGomez`
2021-12-04 02:26:22 +01:00
Matthias Krüger 0bd4ee79e0
Rollup merge of #90851 - ibraheemdev:downcast-unchecked, r=scottmcm
Add unchecked downcast methods

```rust
impl dyn Any (+ Send + Sync) {
    pub unsafe fn downcast_ref_unchecked<T: Any>(&self) -> &T;
    pub unsafe fn downcast_mut_unchecked<T: Any>(&mut self) -> &mut T;
}

impl<A: Allocator> Box<dyn Any (+ Send + Sync), A> {
    pub unsafe fn downcast_unchecked<T: Any>(&self) -> Box<T, A>;
}
```
2021-12-04 02:26:21 +01:00
Matthias Krüger f99cd4022a
Rollup merge of #90538 - camelid:doc-recur-ty, r=estebank
Document how recursion is handled for `ty::Ty`

Based on this forum discussion:
https://internals.rust-lang.org/t/recursive-type-representation-in-rustc/15235/4

cc `@estebank`
2021-12-04 02:26:20 +01:00
bors 14c1e71d09 Auto merge of #91501 - camelid:rm-tuple-impls-2, r=GuillaumeGomez
rustdoc: Remove Clean impls for tuples

This PR removes all nine Clean impls on tuples, converting them to
functions instead.

The fact that these are impls causes several problems:

  1. They are nameless, so it's unclear what they do.

  2. It's hard to find where they're used apart from removing them and
     seeing what errors occur (this applies to all Clean impls, not just
     the tuple ones).

  3. Rustc doesn't currently warn when impls are unused, so dead code
     can accumulate easily (all Clean impls).

  4. Their bodies often use tuple field indexing syntax (e.g., `self.1`)
     to refer to their "arguments", which makes reading the code more
     difficult.

As I noted, some of these problems apply to all Clean impls, but even
those problems are exacerbated by the tuple impls since they make
general understanding of the code harder.

Converting the impls to functions solves all four of these problems.

r? `@GuillaumeGomez`
2021-12-03 23:46:53 +00:00
cynecx 3dbb621c72 limit may_unwind codegen test to x86_64 2021-12-03 23:53:31 +01:00
cynecx afdafcbcf8 fix feature-gate test for may_unwind 2021-12-03 23:51:49 +01:00
cynecx 233dede5b6 fix inline asm test by not hardcoding symbol names 2021-12-03 23:51:49 +01:00
cynecx 7f870be4b5 fix inline asm test because of missing attribute 2021-12-03 23:51:49 +01:00
cynecx 021a8d80eb rustc_codegen_gcc: proper check for may_unwind 2021-12-03 23:51:49 +01:00
cynecx fb35cee709 add clobber_abi("C") to may_unwind inline-asm tests 2021-12-03 23:51:49 +01:00
cynecx 8e9ccdf28f add tests for asm's options(may_unwind) 2021-12-03 23:51:49 +01:00
cynecx 686ace3b41 add unwind_asm feature gate for may_unwind option 2021-12-03 23:51:49 +01:00
cynecx 059d3b3f34 rustc_codegen_gcc: error on unwinding inline asm 2021-12-03 23:51:49 +01:00
cynecx e33a3f9c27 Update unstable-book with recent asm changes (may_unwind) 2021-12-03 23:51:49 +01:00
cynecx 6cbf44f1d4 cg_cranelift: check may_unwind flag instead of cleanup 2021-12-03 23:51:49 +01:00
cynecx 91021de1f6 LLVM codgen support for unwinding inline assembly 2021-12-03 23:51:49 +01:00
cynecx 491dd1f387 Adjust llvm wrapper for unwinding support for inlineasm 2021-12-03 23:51:49 +01:00
Amanieu d'Antras 940b2eabad Add initial AST and MIR support for unwinding from inline assembly 2021-12-03 23:51:46 +01:00
Noah Lev e36561dbdd Remove a Clean impl for a tuple (9)
This was the last one!
2021-12-03 14:05:42 -08:00
Noah Lev de5ea80437 Remove a Clean impl for a tuple (8) 2021-12-03 14:05:42 -08:00
Noah Lev 38c6b13c3a Remove a Clean impl for a tuple (7) 2021-12-03 14:05:42 -08:00
Noah Lev 4ede1f8a75 Remove a Clean impl for a tuple (6) 2021-12-03 14:05:42 -08:00
Noah Lev c39ef72d74 Remove a Clean impl for a tuple (5) 2021-12-03 14:05:42 -08:00
Noah Lev 9b51072309 Remove a Clean impl for a tuple (4) 2021-12-03 14:05:42 -08:00
Noah Lev f9ed012000 Clean up definition of clean_ty_generics a bit 2021-12-03 14:05:41 -08:00
Noah Lev 927a5e393c Remove a Clean impl for a tuple (3) 2021-12-03 14:05:41 -08:00
Noah Lev 63d434a363 Remove a Clean impl for a tuple (2) 2021-12-03 14:05:41 -08:00
Noah Lev 2fbdc79ae6 Remove a Clean impl for a tuple (1)
This commit removes the first of nine Clean impls on tuples, converting
it to a function instead.

The fact that these are impls causes several problems:

  1. They are nameless, so it's unclear what they do.

  2. It's hard to find where they're used apart from removing them and
     seeing what errors occur (this applies to all Clean impls, not just
     the tuple ones).

  3. Rustc doesn't currently warn when impls are unused, so dead code
     can accumulate easily (all Clean impls).

  4. Their bodies often use tuple field indexing syntax (e.g., `self.1`)
     to refer to their "arguments", which makes reading the code more
     difficult.

As I noted, some of these problems apply to all Clean impls, but even
those problems are exacerbated by the tuple impls since they make
general understanding of the code harder.

Converting the impls to functions solves all four of these problems.
2021-12-03 13:58:45 -08:00
Noah Lev f2ecfc7e2e rustdoc: Rename bounds to bindings where appropriate 2021-12-03 13:18:52 -08:00
Ibraheem Ahmed 4ec5cdc94b fix stability annotations for Box::downcast 2021-12-03 16:06:13 -05:00
Noah Lev 9931782a38 Document how recursion is handled for ty::Ty
Based on this forum discussion:
https://internals.rust-lang.org/t/recursive-type-representation-in-rustc/15235/4
2021-12-03 11:30:28 -08:00
bors 532d2b14c0 Auto merge of #90737 - eholk:intofuture, r=tmandry
Reintroduce `into_future` in `.await` desugaring

This is a reintroduction of the remaining parts from https://github.com/rust-lang/rust/pull/65244 that have not been relanded yet.

This isn't quite ready to merge yet. The last attempt was reverting due to performance regressions, so we need to make sure this does not introduce those issues again.

Issues #67644, #67982

/cc `@yoshuawuyts`
2021-12-03 19:29:21 +00:00
bors ff2439b7b9 Auto merge of #91491 - spastorino:revert-91354, r=oli-obk
Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"

This reverts commit 18bb8c61a9, reversing
changes made to d9baa36190.

Reverts #91354 in order to address #91489. We would need to place this changes in a more granular way and would also be nice to address the small perf regression that was also introduced.

r? `@oli-obk`
cc `@fee1-dead`
2021-12-03 16:26:01 +00:00
bors 2a9e0831d6 Auto merge of #91393 - Julian-Wollersberger:lexer_optimization, r=petrochenkov
Optimize `rustc_lexer`

The `cursor.first()` method in `rustc_lexer` now calls the `chars.next()` method instead of `chars.nth_char(0)`.

This allows LLVM to optimize the code better. The biggest win is that `eat_while()` is now fully inlined and generates better assembly. This improves the lexer's performance by 35% in a micro-benchmark I made (Lexing all 18MB of code in the compiler directory). But lexing is only a small part of the overall compilation time, so I don't know how significant it is.

Big thanks to criterion and `cargo asm`.
2021-12-03 13:20:14 +00:00
Santiago Pastorino 85b723c4e6
Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"
This reverts commit 18bb8c61a9, reversing
changes made to d9baa36190.
2021-12-03 10:11:21 -03:00
bors d47a6cc3f2 Auto merge of #91286 - scottmcm:residual-trait, r=joshtriplett
Make `array::{try_from_fn, try_map}` and `Iterator::try_find` generic over `Try`

Fixes #85115

This only updates unstable functions.

`array::try_map` didn't actually exist before; this adds it under the still-open tracking issue #79711 from the old PR #79713.

Tracking issue for the new trait: #91285

This would also solve the return type question in for the proposed `Iterator::try_reduce` in #87054
2021-12-03 10:15:11 +00:00
bors 3e21768a0a Auto merge of #91486 - matthiaskrgr:rollup-699fo18, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #88906 (Implement write() method for Box<MaybeUninit<T>>)
 - #90269 (Make `Option::expect` unstably const)
 - #90854 (Type can be unsized and uninhabited)
 - #91170 (rustdoc: preload fonts)
 - #91273 (Fix ICE #91268 by checking that the snippet ends with a `)`)
 - #91381 (Android: -ldl must appear after -lgcc when linking)
 - #91453 (Document Windows TLS drop behaviour)
 - #91462 (Use try_normalize_erasing_regions in needs_drop)
 - #91474 (suppress warning about set_errno being unused on DragonFly)
 - #91483 (Sync rustfmt subtree)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-03 07:12:36 +00:00
Michael Goulet 7c108ababc Fix ICE when yielding in fn returning impl Trait 2021-12-02 22:36:05 -08:00
Matthias Krüger a2160609c0
Rollup merge of #91483 - calebcartwright:sync-rustfmt-subtree, r=calebcartwright
Sync rustfmt subtree
2021-12-03 06:24:19 +01:00
Matthias Krüger aa6f2d9a79
Rollup merge of #91474 - rtzoeller:dfly_set_errno, r=cuviper
suppress warning about set_errno being unused on DragonFly

Other targets allow this function to be unused, DragonFly just misses out due to providing a specialization.

This fixes a build error for DragonFly.
2021-12-03 06:24:18 +01:00
Matthias Krüger f056f0d1b4
Rollup merge of #91462 - b-naber:use-try-normalize-erasing-regions, r=jackh726
Use try_normalize_erasing_regions in needs_drop

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

r? ``@jackh726``
2021-12-03 06:24:17 +01:00
Matthias Krüger 25474ed731
Rollup merge of #91453 - ChrisDenton:doc-win-tls-dtors, r=dtolnay
Document Windows TLS drop behaviour

The way Windows TLS destructors are run has some "interesting" properties. They should be documented.

Fixes #74875
2021-12-03 06:24:16 +01:00