Commit graph

153128 commits

Author SHA1 Message Date
Chase Wilson
ab2c5902ca
Added tracking issue to unstable attribute 2021-08-09 10:24:03 -05:00
Chase Wilson
9d8081e8b6
Enabled unzip_option feature for core tests & unzip docs 2021-08-09 10:24:02 -05:00
Chase Wilson
eea3520a8f
Added some basic tests for Option::unzip() and Option::zip() (I noticed that zip had no tests) 2021-08-09 10:24:00 -05:00
Chase Wilson
bc4ce79764
Added the Option::unzip() method 2021-08-09 10:23:46 -05:00
Jan-Erik Rediger
cb19d836dc Proper table row formatting in platform support
Also moves the target into alphabetical order
2021-08-09 16:09:47 +02:00
bors
87ce09d0df Auto merge of #7544 - r00ster91:patch-1, r=flip1995
Clean up examples in new lint suggestion template

I'm pretty sure they meant to write `bounds checking` when they wrote `bounce checking` but I could be wrong. After that I thought I could improve it further and ended up with this.

changelog: none
2021-08-09 14:04:36 +00:00
pierwill
3e123e4150 Remove duplicate trait bounds in rustc_data_structures::graph 2021-08-09 08:52:04 -05:00
bors
14d2aa1582 Auto merge of #7542 - LeSeulArtichaut:cleanups, r=flip1995
Cleanup usage of `span_to_snippet` and `LintContext::sess`

- avoid using `SourceMap::span_to_snippet` directly and use `clippy_utils::source::snippet_opt` instead
- don't use `LintContext::sess()` on `EarlyContext`s which have a `sess` field directly available, saving the import of `LintContext`

changelog: none
2021-08-09 13:48:47 +00:00
bors
0084195dee Auto merge of #7506 - HKalbasi:add-xor-swap, r=camsteffen
Add xor case to `manual swap` lint

Continue of #7153
closes #6598

changelog: Add "xor swap" case to [`manual_swap`]
2021-08-09 13:34:42 +00:00
bors
ae90dcf020 Auto merge of #85357 - Andy-Python-Programmer:aarch64_uefi_target, r=petrochenkov
Add `aarch64-unknown-uefi` target

This pull request adds the `aarch64-unknown-uefi` target.
2021-08-09 13:16:51 +00:00
Hans Kratz
1d4972e0e9 Avoid unnecessary allocation. 2021-08-09 12:59:23 +00:00
Hans Kratz
c1d0f0a65c TEST: Use SmallVec<[u32; 4]> for field projection. 2021-08-09 12:25:33 +00:00
Hans Kratz
c627c0d88b Fix nits. 2021-08-09 12:08:18 +00:00
Laurențiu Nicola
d323063aa4 ⬆️ rust-analyzer 2021-08-09 13:48:36 +03:00
lcnr
24aa45c95e add windows count test 2021-08-09 11:08:39 +02:00
bors
eaf6f46359 Auto merge of #87820 - elichai:patch-2, r=kennytm
Replace read_to_string with read_line in Stdin example

The current example results in infinitely reading from stdin, which can confuse newcomers trying to read from stdin.
(`@razmag` encountered this while learning the language from the docs)
2021-08-09 08:19:19 +00:00
Esteban Küber
f93cbedade Do not ICE on HIR based WF check when involving lifetimes
Fix #87549.
2021-08-09 07:01:35 +00:00
unknown
44b81fb8fc
Add the aarch64-unknown-uefi target
* This commit adds the aarch64-unknown-uefi target and also adds it into
the supported targets list under the tier-3 target table.
* Uses the small code model by default

Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2021-08-09 16:49:04 +10:00
bors
7b52ad00cb Auto merge of #87619 - 12101111:fix-native_link_modifiers_bundle, r=petrochenkov
Fix feature gate checking of static-nobundle and native_link_modifiers

Feature native_link_modifiers_bundle don't need feature static-nobundle
to work.

Also check the feature gates when using native_link_modifiers from command line options. Current nighly compiler don't check those feature gate.

```
> touch lib.rs
> rustc +nightly lib.rs -L /usr/lib -l static:+bundle=dl --crate-type=rlib
> rustc +nightly lib.rs -L /usr/lib -l dylib:+as-needed=dl --crate-type=dylib -Ctarget-feature=-crt-static
> rustc +nightly lib.rs -L /usr/lib -l static:-bundle=dl --crate-type=rlib
error[E0658]: kind="static-nobundle" is unstable
  |
  = note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information
  = help: add `#![feature(static_nobundle)]` to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.

```

First found this in https://github.com/rust-lang/rust/pull/85600#discussion_r676612655
2021-08-09 03:59:30 +00:00
bors
d3928b183d Auto merge of #87465 - audunhalland:refactor_typeck_primary_body_of, r=eddyb
Simplify typeck/primary_body_of, fix comment to match return signature

Hi, new contributor here! I'm carefully reading through the various modules just to learn. I noticed this function, `primary_body_of`, which has gone through a couple of refactors over time, adding new `Option`s to its returned tuple. Observations:

1. the `fn`'s documentation was not all up to date with the the current return signature.
2. `FnHeader` and `FnDecl` are always both `Some` or `None`. So I figured it might just return a reference to the full `hir::FnSig`, for simplicity and more precise typing. It's a pure refactor.

I'm learning better by working with code than just reading it, so here goes! If you want to avoid pure refactor PRs that don't really fix anything, I can revert the code change to only update the comment instead.
2021-08-09 01:08:52 +00:00
Klim Tsoutsman
a4af0401dd
Clarify terms in rustdoc book
Change code blocks to Rust
2021-08-09 08:50:46 +10:00
bors
74a11c63f8 Auto merge of #87235 - poliorcetics:issue-87217-fn-quali-order, r=nagisa
Improve diagnostics for wrongly ordered keywords in function declaration

Fix #87217

`@rustbot` label A-diagnostics T-compiler
2021-08-08 22:28:01 +00:00
hamidreza kalbasi
6d36d1a835 merge XOR_SWAP with MANUAL_SWAP 2021-08-09 02:15:10 +04:30
bors
ad981d58e1 Auto merge of #86879 - YohDeadfall:stabilize-vec-shrink-to, r=dtolnay
Stabilize Vec<T>::shrink_to

This PR stabilizes `shrink_to` feature and closes the corresponding issue. The second point was addressed already, and no `panic!` should occur.

Closes #56431.
2021-08-08 19:37:02 +00:00
David Tolnay
8ec5060cdd
Bump shrink_to stabilization to Rust 1.56 2021-08-08 11:36:53 -07:00
bors
442e627bee Auto merge of #87697 - GuillaumeGomez:add-e0784, r=nagisa
Assign E0784 error code for union expression errors
2021-08-08 16:40:14 +00:00
Chris Denton
419902e413
Fix Windows Command::env("PATH") 2021-08-08 16:03:39 +01:00
12101111
d935a14f4c
Fix feature gate checking of static-nobundle and native_link_modifiers 2021-08-08 21:46:40 +08:00
bors
4e886d6876 Auto merge of #87827 - eddyb:wrapperless-mem-replace, r=m-ou-se
Avoid using the `copy_nonoverlapping` wrapper through `mem::replace`.

This is a much simpler way to achieve the pre-#86003 behavior of `mem::replace` not needing dynamically-sized `memcpy`s (at least before inlining), than re-doing #81238 (which needs #86699 or something similar).

I didn't notice it until recently, but `ptr::write` already explicitly avoided using the wrapper, while `ptr::read` just called the wrapper (and was the reason for us observing any behavior change from #86003 in Rust-GPU).

<hr/>

The codegen test I've added fails without the change to `core::ptr::read` like this (ignore the `v0` mangling, I was using a worktree with it turned on by default, for this):
```llvm
       13: ; core::intrinsics::copy_nonoverlapping::<u8>
       14: ; Function Attrs: inlinehint nonlazybind uwtable
       15: define internal void `@_RINvNtCscK5tvALCJol_4core10intrinsics19copy_nonoverlappinghECsaS4X3EinRE8_25mem_replace_direct_memcpy(i8*` %src, i8* %dst, i64 %count) unnamed_addr #0 {
       16: start:
       17:  %0 = mul i64 %count, 1
       18:  call void `@llvm.memcpy.p0i8.p0i8.i64(i8*` align 1 %dst, i8* align 1 %src, i64 %0, i1 false)
not:17      !~~~~~~~~~~~~~~~~~~~~~                                                                     error: no match expected
       19:  ret void
       20: }
```
With the `core::ptr::read` change, `core::intrinsics::copy_nonoverlapping` doesn't get instantiated and the test passes.

<hr/>

r? `@m-ou-se` cc `@nagisa` (codegen test) `@oli-obk` / `@RalfJung` (miri diagnostic changes)
2021-08-08 13:11:09 +00:00
Klim Tsoutsman
9a784894ee
Fix heading colours in Ayu theme
Closes #87828 
The issue seems to stem from #87210 where code headings were changed from a heading containing code to a heading with the `code-header` class. `rustdoc.css` was updated, but `ayu.css` was missed.
2021-08-08 22:35:51 +10:00
Eduard-Mihai Burtescu
a1d014bdbc Avoid using the copy_nonoverlapping wrapper through mem::replace. 2021-08-08 13:59:36 +03:00
bors
e8c25f2663 Auto merge of #87836 - tsoutsman:master, r=petrochenkov
Change proc_macro::Diagnostics docs

With Rust 1.54 attributes can invoke function-like macros. This allows functions generated by macros to have non-generic documentation. This pull request changes the documentation of `proc_macro::Diagnostics` to be more specific and include a link to the level.
## Example
Before:
```markdown
Adds a new child diagnostic message to `self` with the level
identified by this method’s name with the given `message`.
```
After:
```markdown
Adds a new child diagnostic message to self with the [`Level::Error`]
level, and the given `message`.
```
2021-08-08 10:23:17 +00:00
bors
c4c2986c49 Auto merge of #87815 - BoxyUwU:cec-generics-of-ice, r=eddyb
encode `generics_of` for fields and ty params

Fixes #87674
Fixes #87603

ICE was caused by calling `generics_of` on a `DefId` without any `generics_of` results. This was happening when we call `generics_of` on parent `DefId`s of an unevaluated const when we evaluate it.

r? `@lcnr`
2021-08-08 07:15:48 +00:00
bors
2d10c2a330 Auto merge of #87798 - durin42:llvm-14, r=nikic
PassWrapper: handle move of OptimizationLevel class out of PassBuilder

This is the first build break of the LLVM 14 cycle, and was caused by
https://reviews.llvm.org/D107025. Mercifully an easy fix.
2021-08-08 04:33:22 +00:00
Klim Tsoutsman
26bf0ef0b5
Merge branch 'rust-lang:master' into master 2021-08-08 13:17:23 +10:00
bors
835dce569d Auto merge of #86744 - ijackson:sink-default, r=dtolnay
impl Default, Copy, Clone for std::io::Sink and Empty

The omission of `Sink: Default` is causing me a slight inconvenience in a test harness.  There seems little reason for this and `Empty` not to be `Clone` and `Copy` too.

I have made all three of these insta-stable, because:

AIUI `Copy` can only be derived, and I was not able to find any examples of how to unstably derive it.  I think it is probably not possible.

I hunted through the git history for precedent and found

> 79b8ad84c8
> Implement `Copy` for `IoSlice`
> https://github.com/rust-lang/rust/pull/69403

which was also insta-stable.
2021-08-08 01:52:32 +00:00
bors
798446fe06 Auto merge of #87772 - npmccallum:naked_abi, r=Amanieu
Move naked function ABI check to its own lint

This check was previously categorized under the lint named
`UNSUPPORTED_NAKED_FUNCTIONS`. That lint is future incompatible and will
be turned into an error in a future release. However, as defined in the
Constrained Naked Functions RFC, this check should only be a warning.
This is because it is possible for a naked function to be implemented in
such a way that it does not break even the undefined ABI. For example, a
`jmp` to a `const`.

Therefore, this patch defines a new lint named
`UNDEFINED_NAKED_FUNCTION_ABI` which contains just this single check.
Unlike `UNSUPPORTED_NAKED_FUNCTIONS`, `UNDEFINED_NAKED_FUNCTION_ABI`
will not be converted to an error in the future.

rust-lang/rfcs#2774
rust-lang/rfcs#2972
2021-08-07 23:24:15 +00:00
bors
574d375680 Auto merge of #87743 - cuviper:opaque-calls, r=nikic
Prepare call/invoke for opaque pointers

Rather than relying on `getPointerElementType()` from LLVM function
pointers, we now pass the function type explicitly when building `call`
or `invoke` instructions.
2021-08-07 20:43:25 +00:00
Ellen
5f61271e38 fmt 2021-08-07 20:55:37 +01:00
bors
399ab4601b Auto merge of #87851 - JohnTitor:rollup-odvmr47, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #87744 (Add x.py option to --force-rerun compiletest tests)
 - #87789 (Make vec-shrink-panic test compatible with v0 mangling)
 - #87833 (Fix typo -- "The" -> "They")
 - #87834 (Fix small typo)
 - #87838 (Document that fs::read_dir skips . and ..)
 - #87842 (Fix intra doc link in hidden doc of Iterator::__iterator_get_unchecked)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-08-07 18:21:04 +00:00
Ellen
d777cb84e2 less opt in const param of 2021-08-07 18:44:36 +01:00
Albin Hedman
c8bf5ed628
Add test for int to float 2021-08-07 19:03:34 +02:00
Albin Hedman
09928a9a20
Add tests 2021-08-07 19:03:33 +02:00
Albin Hedman
eefd790d3b
impl const From<num> for num 2021-08-07 19:03:08 +02:00
Yuki Okushi
c159806cf0
Rollup merge of #87842 - steffahn:hidden_broken_intra_doc, r=dtolnay
Fix intra doc link in hidden doc of Iterator::__iterator_get_unchecked

Recently, I edited the import list of the `core::iter::traits::iterator` module (in #85874). This results in a broken intra doc link in a hidden documentation with the effect that `RUSTDOCFLAGS='--document-private-items --document-hidden-items' x doc library/std` fails. (This can be worked around by adding `-Arustdoc::broken-intra-doc-links`; still, it’s a broken link so let’s fix it.)

``@rustbot`` label C-cleanup, T-libs
2021-08-08 01:13:45 +09:00
Yuki Okushi
349290047f
Rollup merge of #87838 - jetomit:add-readdir-note, r=dtolnay
Document that fs::read_dir skips . and ..

Hi,

I think this is worth noting in the docs since it differs from POSIX `readdir`. I didn’t put it under platform-specific notes because it seems to be consistent across platforms, and changing this behavior in the future could cause pretty nasty bugs.

Thanks!
2021-08-08 01:13:44 +09:00
Yuki Okushi
08f56b7bdb
Rollup merge of #87834 - camelid:span-typo, r=CraftSpider
Fix small typo

The closing backtick was outside the closing bracket,
which is why the intra-doc link wasn't working.
2021-08-08 01:13:43 +09:00
Yuki Okushi
6ddbf9ec3c
Rollup merge of #87833 - m-rsha:patch-1, r=Aaron1011
Fix typo -- "The" -> "They"

I was reading through source code to try to learn more about the language and how to make the most of it when I ran into a small typo, so I figured I'd offer up a fix! I'm pretty new now, but hopefully I can offer up more substantial changes later. :D
2021-08-08 01:13:43 +09:00
Yuki Okushi
dc78ee0c80
Rollup merge of #87789 - tmiasko:panik, r=Mark-Simulacrum
Make vec-shrink-panic test compatible with v0 mangling

The v0 mangling includes an instantiating crate in a mangled name,
which crates a false positive match for a word `panic`.
Rename crate name / test case to avoid the issue.
2021-08-08 01:13:42 +09:00
Yuki Okushi
e862383dbb
Rollup merge of #87744 - Smittyvb:xpy-test-force-rerun, r=Mark-Simulacrum
Add x.py option to --force-rerun compiletest tests

This can be used like `./x.py test src/test/ui/abi/ --force-rerun`, and is useful when verifying that newly blessed tests don't change between test runs (such as due to being dependent on the current time or memory layout or RNG), without needing to change the test file or find the right file in `build` to remove.
2021-08-08 01:13:41 +09:00