Commit Graph

159574 Commits

Author SHA1 Message Date
Mara Bos
eb3fc45c87 Update docs. 2021-12-04 19:40:33 +01:00
Mara Bos
1acb44f03c Use IntoIterator for array impl everywhere. 2021-12-04 19:40:33 +01:00
Mara Bos
b34cf1a9e1 Swap body of array::IntoIter::new and IntoIterator::new. 2021-12-04 19:15:47 +01:00
Mara Bos
911ee9403e Deprecate array::IntoIter::new. 2021-12-04 19:15:44 +01:00
Michael Howell
74437e477e Do not add ; to expected tokens list when it's wrong
There's a few spots where semicolons are checked for to do error recovery,
and should not be suggested (or checked for other stuff).

Fixes #87647
2021-12-04 11:05:30 -07:00
bors
907f6d9294 Auto merge of #8074 - Qwaz:send_nonnull, r=xFrednet
Consider NonNull as a pointer type

PR 1/2 for issue #8045. Add `NonNull` as a pointer class to suppress false positives like `UnsafeCell<NonNull<()>>`. However, this change is not sufficient to handle the cases shared in gtk-rs and Rug in the issue.

changelog: none

r? `@xFrednet`
2021-12-04 17:19:07 +00:00
Mara Bos
16711fe076
Update stabilization version of try_from_mut_slice_to_array 2021-12-04 17:17:12 +01:00
piegames
ced2676488 LLVM support .insn directive 2021-12-04 16:56:21 +01:00
Hirochika Matsumoto
9b77a1e571 Don't suggest types whose inner type is erroneous
Currently, we check if the returned type equals to `tcx.ty_error()` not to emit
erroneous types, but this has a pitfall; for example,
`Option<[type error]> != tcx.ty_error()` holds.
2021-12-04 23:51:56 +09:00
Lucas Kent
8bfc76dd62 Fix Vec::extend_from_slice docs 2021-12-05 01:22:49 +11:00
bors
9eabec9f07 Auto merge of #8054 - camsteffen:map-flatten-style, r=giraffate
Upgrade map_flatten to complexity

changelog: upgrade [`map_flatten`] to complexity

Resolves #7999
2021-12-04 13:30:09 +00:00
bors
efec545293 Auto merge of #91517 - matthiaskrgr:rollup-3fmp4go, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #87054 (Add a `try_reduce` method to the Iterator trait)
 - #89701 (Updated error message for accidental uses of derive attribute as a crate attribute)
 - #90519 (Keep spans for generics in `#[derive(_)]` desugaring)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-04 13:23:50 +00:00
woppopo
8f68bdc380 Make Borrow and BorrowMut impls const 2021-12-04 21:57:39 +09:00
Matthias Krüger
0311cfa88c
Rollup merge of #90519 - estebank:issue-84003, r=petrochenkov
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-04 10:42:20 +01:00
Matthias Krüger
9f8e822364
Rollup merge of #89701 - tom7980:issue-89566-fix, r=petrochenkov
Updated error message for accidental uses of derive attribute as a crate attribute

This partially fixes the original issue #89566 by adding derive to the list of invalid crate attributes and then providing an updated error message however I'm not sure how to prevent the resolution error message from emitting without causing the compiler to just abort when it finds an invalid crate attribute (which I'd prefer not to do so we can find and emit other errors).

`@petrochenkov` I have been told you may have some insight on why it's emitting the resolution error though honestly I'm not sure if we need to worry about fixing it as long as we can provide the invalid crate attribute error also (which happens first anyway)
2021-12-04 10:42:19 +01:00
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
Scott McMurray
eb846dbaca Override Iterator::advance(_back)_by for array::IntoIter
Because I happened to notice that `nth` is currently getting codegen'd as a loop even for `Copy` types: <https://rust.godbolt.org/z/fPqv7Gvs7>
2021-12-03 21:36:51 -08:00
Noah Lev
51ca2cc6af Remove single-use GenericParamDef::get_type function
Rationale:

* The name was confusing.

* It was only used in one place.

* That place didn't actually need all the functionality of `get_type`;
  rather, removing `get_type` makes that code clearer.
2021-12-03 21:05:31 -08:00
kit
aef59e4fb8 Add a try_reduce method to the Iterator trait 2021-12-04 15:17:14 +11:00
Noah Lev
a97f175350 rustdoc: Remove single-use Lifetime::get_ref() function 2021-12-03 20:08:11 -08: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
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