Commit Graph

159307 Commits

Author SHA1 Message Date
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
Wesley Wiser
6fe13f62c1 Add test case that evals to EvaluatedToOkModuloRegions 2021-12-03 20:25:21 -05:00
Wesley Wiser
98e9b3283e Add test with #[rustc_evaluate_where_clauses]
As suggested via reviewer feedback.
2021-12-03 19:30:19 -05:00
Wesley Wiser
14c619340e Add test for evaluate_obligation: Ok(EvaluatedToOkModuloRegions) ICE
Adds the minimial repro test case from #85360. The fix for #85360 was
supposed to be #85868 however the repro was resolved in the 2021-07-05
nightly while #85360 didn't land until 2021-09-03. The reason for that
is d34a3a401b **also** resolves that
issue.

To test if #85868 actually fixes #85360, I reverted
d34a3a401b and found that #85868 does
indeed resolve #85360.

With that question resolved, add a test case to our incremental test
suite for the original Ok(EvaluatedToOkModuloRegions) ICE.

Thanks to @lqd for helping track this down!
2021-12-03 19:30:19 -05:00
Yechan Bae
844996b42e Consider NonNull as a pointer type 2021-12-03 19:11:40 -05: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
Esteban Kuber
93564c317b Tweak "call this function" suggestion to have smaller span 2021-12-03 23:05:49 +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
Eric Huss
a882fdd334 Update mdbook 2021-12-03 12:25:07 -08:00
bors
3cd151def9 Auto merge of #8040 - xFrednet:6610-known-problems-section-for-pre-expansion, r=camsteffen
Updated known problems section for pre-expansion lints about level attributes

Our last three pre-macro expansion lints aren't affected by lint level attributes. This adds a comment to the know problems section of them. I've also updated some CSS to add some spacing after lists on Clippy's lint list:

Before:

![image](https://user-images.githubusercontent.com/17087237/143783579-064326d4-4e58-4d7d-bbe4-fad8b115fcd4.png)

After:

![image](https://user-images.githubusercontent.com/17087237/143783650-9803fa03-c332-4e0e-886f-523d4217c6e6.png)

---

changelog: [`print_stdout`], [`print_stderr`], [`dbg_macro`]: Document how the lint level can be changed and reference rust-lang/rust-clippy#6610

cc: rust-lang/rust-clippy#6610
2021-12-03 19:31:33 +00: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
xFrednet
17b747857f
Add margin after lists on Clippy's lint list 2021-12-03 20:24:23 +01:00
Cameron Steffen
de9de4fef1 Upgrade map_flatten to complexity 2021-12-03 13:21:48 -06:00
Esteban Kuber
b0c3968615 review comment 2021-12-03 18:45:15 +00:00
Esteban Kuber
962b2197a5 Annotate derived spans and move span suggestion code
* Annotate `derive`d spans from the user's code with the appropciate context
* Add `Span::can_be_used_for_suggestion` to query if the underlying span
  at the users' code
2021-12-03 18:41:40 +00:00
Esteban Kuber
8bee2b88c0 Remove some unnecessarily verbose code 2021-12-03 18:41:39 +00:00
Esteban Kuber
fa3eebb26e Modify bounds_span to ignore bounds coming from a derive macro 2021-12-03 18:41:39 +00:00
Esteban Kuber
e70105f971 Keep spans for generics in #[derive(_)] desugaring
Keep the spans for generics coming from a `derive`d Item, so that errors
and suggestions have better detail.

Fix #84003.
2021-12-03 18:41:39 +00:00
Tom Farmer
3827b6451c Update invalid crate attributes, add help message
tidy run

update invalid crate attributes, improve error

update test outputs

de-capitalise error

update tests

Update invalid crate attributes, add help message

Update - generate span without using BytePos

Add correct dependancies

Update - generate suggestion without BytePos

Tidy run

update tests

Generate Suggestion without BytePos

Add all builtin attributes

add err builtin inner attr at top of crate

fix tests

add err builtin inner attr at top of crate

tidy fix

add err builtin inner attr at top of crate
2021-12-03 18:38:32 +00:00
xFrednet
11ad5a26a9
Add note about crate lint level attributes to pre-expansion lints 2021-12-03 19:29:57 +01:00
xFrednet
1c45d1edfd
Enable rustbot shortcuts for rust-clippy 2021-12-03 19:10:14 +01:00