Commit graph

152235 commits

Author SHA1 Message Date
Frank Steffahn 9ff421da99 Remove redundant bounds on get_unchecked for vec_deque iterators, and run fmt 2021-07-28 14:33:36 +02:00
Frank Steffahn f9c982c8fd Add back TrustedRandomAccess-specialization for Vec, but only without coercions 2021-07-28 14:33:36 +02:00
Frank Steffahn bbc6b2691e Change __iterator_get_unchecked to work with TrustedRandomAccessNoCoerce 2021-07-28 14:33:35 +02:00
Frank Steffahn 69dd992f95 Add TrustedRandomAccessNoCoerce supertrait without requirements or guarantees about subtype coercions
Update all the TrustedRandomAccess impls to also implement the new supertrait
2021-07-28 14:33:35 +02:00
Frank Steffahn 1c7f27f792 Improve documentation of TrustedRandomAccess
Include new details regarding coercions to a subtype.
These conditions also explain why the previously removed implementations
for {array, vec, vec_deque}::IntoIter<T> were unsound, because they introduced
an extra `T: Clone` for the TrustedRandomAccess impl, even though their parameter T
is covariant.
2021-07-28 14:33:35 +02:00
Frank Steffahn a0d8a324eb Remove unsound TrustedRandomAccess implementations
Removes the implementations that depend on the user-definable trait `Copy`.
2021-07-28 14:33:28 +02:00
flip1995 9bc5803195
Fix last occurence of **What it does:** 2021-07-28 14:32:02 +02:00
xFrednet 12c61612f7
Update lint documentation to use markdown headlines 2021-07-28 14:31:59 +02:00
flip1995 fe25282aaa
Remove old python lint doc generation scripts 2021-07-28 14:18:40 +02:00
flip1995 6c5d199d57
Update deploy CI
This updates all the deploy scripts and the deploy workflow.

The deploy workflow now runs the metadata collector to collect the lint
documentation. It also changes the files that are checked out in the
deploy workflow from master and adds an explanation why we have to do
this.
2021-07-28 14:16:31 +02:00
Yuki Okushi 7985e4c7c3
Rollup merge of #87524 - FabianWolff:issue-87495, r=Aaron1011
Fix ICE in `diagnostic_hir_wf_check`

Fixes #87495. The [documentation for `ObligationCauseCode::WellFormed`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/traits/enum.ObligationCauseCode.html#variant.WellFormed) says that

> it is always correct [...] to specify `WellFormed(None)`

instead of `WellFormed(Some(...))`, which seems to have caused the issue here, as `diagnostic_hir_wf_check` does not expect to be called with an associated constant and will ICE:

fd853c00e2/compiler/rustc_typeck/src/hir_wf_check.rs (L131-L134)

Therefore, I have changed `check_associated_item()` to pass a `WellFormed(None)` for associated constants.

r? ``@Aaron1011``
2021-07-28 18:28:23 +09:00
Yuki Okushi 4ae529688a
Rollup merge of #87523 - frogtd:patch-2, r=dtolnay
Stop creating a reference then immediately dereferencing it.

Stop creating a reference then immediately dereferencing it.
2021-07-28 18:28:22 +09:00
Yuki Okushi 168238246f
Rollup merge of #87513 - hudson-ayers:bootstrap-py-fix, r=jyn514
bootstrap.py: change `git log` option to indicate desired behavior

When determining which LLVM artifacts to download, bootstrap.py calls: `git log --author=bors --format=%H -n1 -m --first-parent --
src/llvm-project src/bootstrap/download-ci-llvm-stamp src/version`. However, the `-m` option has no effect, per the `git log` help:

> -m
> This option makes diff output for merge commits to be shown in the
> default format. -m will produce the output only if -p is given as
> well. The default format could be changed using log.diffMerges
> configuration parameter, which default value is separate.

Accordingly, this commit removes use of the -m option in favor of ~~`--diff-merges=off`~~ `--no-patch`, since no diff information is needed, and in fact the presence of a diff breaks the command. Tested using git 2.32, this does not change the output of the command.

The motivation for this change is that some patched versions of git change the behavior of the `-m` flag to imply `-p`, rather than to do nothing unless `-p` is passed. These patched versions of git lead to this script not working. Google's corp-provided git is one such example.
2021-07-28 18:28:21 +09:00
Yuki Okushi 8bc7ec1316
Rollup merge of #87507 - jethrogb:jb/sgx-unmoveable-mutex, r=dtolnay
SGX mutex is *not* moveable

Reverts the erroneous change in #85029.
2021-07-28 18:28:20 +09:00
Yuki Okushi 23479f716a
Rollup merge of #87501 - spastorino:remove-min-tait, r=oli-obk
Remove min_type_alias_impl_trait in favor of type_alias_impl_trait

r? ``@oli-obk``
2021-07-28 18:28:19 +09:00
Yuki Okushi 35dddd3dea
Rollup merge of #87500 - Smittyvb:min-max-docs, r=kennytm
Document math behind MIN/MAX consts on integers

Currently the documentation for `[integer]::{MIN, MAX}` doesn't explain where the constants come from. This documents how the values of those constants are related to powers of 2.
2021-07-28 18:28:18 +09:00
Yuki Okushi 954137ea0e
Rollup merge of #87453 - ibraheemdev:i-68697, r=wesleywiser
Suggest removing unnecessary &mut as help message

Closes #68697
2021-07-28 18:28:17 +09:00
Yuki Okushi 287a252c0b
Rollup merge of #87443 - jyn514:submodules-take-n, r=jyn514
Don't treat git repos as non-existent when `ignore_git` is set

The new submodule handling depends on `is_git()` to be accurate to
decide whether it should handle submodules at all or not. Unfortunately,
`is_git()` treated "this directory does not have a git repository" and
"this repository should not be used for SHA/version/commit date info"
the same. This changes it to distinguish the two.

To clarify: ignore_get is set by default whenever channel == "dev", which it is by default whenever you're compiling locally. So basically everyone would hit this, not just people who had explicitly configured ignore_git.

Here's an example of an error this fixes:

```
$ x build
Updating only changed submodules
Submodules updated in 0.01 seconds
    Finished dev [unoptimized + debuginfo] target(s) in 0.17s
warning: x.py has made several changes recently you may want to look at
help: consider looking at the changes in `src/bootstrap/CHANGELOG.md`
note: to silence this warning, add `changelog-seen = 2` at the top of `config.toml`
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.16s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building LLVM for x86_64-unknown-linux-gnu
detected home dir change, cleaning out entire build directory
running: "cmake" "/home/joshua/rustc3/src/llvm-project/llvm" "-G" "Ninja" "-DLLVM_ENABLE_ASSERTIONS=OFF" "-DLLVM_TARGETS_TO_BUILD=AArch64;ARM;BPF;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR" "-DLLVM_INCLUDE_EXAMPLES=OFF" "-DLLVM_INCLUDE_DOCS=OFF" "-DLLVM_INCLUDE_BENCHMARKS=OFF" "-DLLVM_ENABLE_TERMINFO=OFF" "-DLLVM_ENABLE_LIBEDIT=OFF" "-DLLVM_ENABLE_BINDINGS=OFF" "-DLLVM_ENABLE_Z3_SOLVER=OFF" "-DLLVM_PARALLEL_COMPILE_JOBS=48" "-DLLVM_TARGET_ARCH=x86_64" "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu" "-DLLVM_ENABLE_ZLIB=ON" "-DLLVM_ENABLE_LIBXML2=OFF" "-DLLVM_VERSION_SUFFIX=-rust-dev" "-DCMAKE_INSTALL_MESSAGE=LAZY" "-DCMAKE_C_COMPILER=gcc" "-DCMAKE_CXX_COMPILER=g++" "-DCMAKE_ASM_COMPILER=gcc" "-DCMAKE_C_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_INSTALL_PREFIX=/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/llvm" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_BUILD_TYPE=Release"
CMake Error: The source directory "/home/joshua/rustc3/src/llvm-project/llvm" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
thread 'main' panicked at '
command did not execute successfully, got: exit status: 1

build script failed, must exit now', /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.44/src/lib.rs:885:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
	finished in 0.783 seconds
Build completed unsuccessfully in 0:00:01
```

I *believe* this regression was only introduced in https://github.com/rust-lang/rust/pull/87380, not https://github.com/rust-lang/rust/pull/82653. ``@petrochenkov`` can you check that this fixes the issue you encountered in https://github.com/rust-lang/rust/pull/82653#issuecomment-886113679 ?

r? ``@Mark-Simulacrum``
2021-07-28 18:28:15 +09:00
Yuki Okushi 98f7a009fa
Rollup merge of #87330 - inquisitivecrystal:extend-reserve, r=JohnTitor
Use hashbrown's `extend_reserve()` in `HashMap`

When we added `extend_reserve()` to our implementation of `Extend` for `HashMap`, hashbrown didn't have a version we could use. Now that hashbrown has added it, we should use its version instead of implementing it ourself.
2021-07-28 18:28:14 +09:00
Yuki Okushi 911e22b57d
Rollup merge of #87315 - ricobbe:raw-dylib-unstable-book, r=wesleywiser
Add docs for raw-dylib to unstable book
2021-07-28 18:28:13 +09:00
bors eba3228b2a Auto merge of #86251 - Smittyvb:thir-tree-again, r=oli-obk
Support -Z unpretty=thir-tree again

Currently `-Z unpretty=thir-tree` is broken after some THIR refactorings. This re-implements it, making it easier to debug THIR-related issues.

We have to do analyzes before getting the THIR, since trying to create THIR from invalid HIR can ICE. But doing those analyzes requires the THIR to be built and stolen. We work around this by creating a separate query to construct the THIR tree string representation.

Closes https://github.com/rust-lang/project-thir-unsafeck/issues/8, fixes #85552.
2021-07-28 09:01:11 +00:00
Ralf Jung 2acc83ed4f update Miri 2021-07-28 10:39:38 +02:00
bors aea2e446f0 Auto merge of #86735 - jhpratt:rfc-3107, r=petrochenkov
Implement RFC 3107: `#[derive(Default)]` on enums with a `#[default]` attribute

This PR implements RFC 3107, which permits `#[derive(Default)]` on enums where a unit variant has a `#[default]` attribute. See comments for current status.
2021-07-28 05:59:30 +00:00
bors 8b50cc9a2c Auto merge of #85769 - jhpratt:stabilize-const-transmute-union, r=RalfJung
Stabilize `const_fn_transmute`, `const_fn_union`

This PR stabilizes the `const_fn_transmute` and `const_fn_union` features. It _does not_ stabilize any methods (obviously aside from `transmute`) that are blocked on only these features.

Closes #53605. Closes #51909.
2021-07-28 00:53:17 +00:00
Fabian Wolff dbd0fd2c2a Fix ICE in diagnostic_hir_wf_check 2021-07-28 01:41:52 +02:00
Santiago Pastorino f16ae7ee26
Remove min_tait and full_tait stderr dangling files 2021-07-27 19:50:14 -03:00
Santiago Pastorino d395fe8653
Bless nll tests 2021-07-27 19:48:54 -03:00
LeSeulArtichaut 40b57be547 Don't run MIR unsafeck at all when using -Zthir-unsafeck 2021-07-27 23:26:55 +02:00
Smitty 0e017496eb remove unneeded stringify 2021-07-27 16:37:18 -04:00
Jacob Pratt 5331fea875 Update tests 2021-07-27 16:26:50 -04:00
Jacob Pratt 37af399573
Update tests 2021-07-27 16:26:50 -04:00
frogtd 47414aa1bd
Update range.rs
Stop creating a reference then immediately dereferencing it.
2021-07-27 16:14:48 -04:00
Jacob Pratt 7bf791d162
Stabilize const_fn_union 2021-07-27 16:03:33 -04:00
Jacob Pratt 36f02f3523
Stabilize const_fn_transmute 2021-07-27 16:03:09 -04:00
bors 2faabf5793 Auto merge of #80367 - camelid:check_match-combine-loop, r=Nadrieril
Combine two loops in `check_match`

Suggested by Nadrieril in
https://github.com/rust-lang/rust/pull/79051#discussion_r548778186.

Opening to get a perf run. Hopefully this code doesn't require everything in the
first loop to be done before running the second! (It shouldn't though.)

cc `@Nadrieril`
2021-07-27 19:56:18 +00:00
Jacob Pratt 72465b0a32
Prohibit #[default] in invalid places 2021-07-27 15:47:49 -04:00
Jacob Pratt 5ae2371ceb
Indicate E0665 is no longer emitted 2021-07-27 15:47:49 -04:00
Jacob Pratt eef2856eaf
Add machine-applicable suggestions
This avoids the need for tools like rust-analyzer to implement these
suggestions themselves.
2021-07-27 15:47:49 -04:00
Jacob Pratt c70147fd66
Permit deriving default on enums with #[default] 2021-07-27 15:47:47 -04:00
Chris Midgley bc70252f50 Mark code as ignored due to requiring external plugin 2021-07-27 19:44:50 +01:00
Chris Midgley 7f563f7f4e Add long explanation for E0498 2021-07-27 18:06:34 +01:00
bors ea988afcda Auto merge of #83484 - JulianKnodt:infer, r=oli-obk,lcnr
Add hir::GenericArg::Infer

In order to extend inference to consts, make an Infer type on hir::GenericArg.
2021-07-27 16:24:45 +00:00
bors fd853c00e2 Auto merge of #83484 - JulianKnodt:infer, r=oli-obk,lcnr
Add hir::GenericArg::Infer

In order to extend inference to consts, make an Infer type on hir::GenericArg.
2021-07-27 16:24:45 +00:00
ibraheemdev df5e5168d8 remove allow(unconditional_recursion) 2021-07-27 12:12:59 -04:00
Santiago Pastorino 9629d798ca
Remove min_type_alias_impl_trait feature 2021-07-27 12:33:14 -03:00
Santiago Pastorino 66dbeb5f23
existential_type was removed in favor of type_alias_impl_trait 2021-07-27 12:33:13 -03:00
Santiago Pastorino 38bdd0e019
Make all tests use type_alias_impl_trait feature instead of min 2021-07-27 12:33:02 -03:00
Santiago Pastorino 5bff8429a0
Use type_alias_impl_trait instead of min in compiler and lib 2021-07-27 12:27:08 -03:00
Hudson Ayers 1259742865 bootstrap.py: remove unused git log option
When determining which LLVM artifacts to download, bootstrap.py
calls: `git log --author=bors --format=%H -n1 -m --first-parent --
src/llvm-project src/bootstrap/download-ci-llvm-stamp src/version`.
However, the `-m` option has no effect, per the `git log` help:

> -m
> This option makes diff output for merge commits to be shown in the
> default format. -m will produce the output only if -p is given as
> well. The default format could be changed using log.diffMerges
> configuration parameter, which default value is separate.

Accordingly, this commit removes use of the -m option in favor of
`--no-patch`, to make clear that this command should never output
diff information, as the SHA-1 hash is the only desired output.
Tested using git 2.32, this does not change the
output of the command.

The motivation for this change is that some patched versions of git
change the behavior of the `-m` flag to imply `-p`, rather than to do
nothing unless `-p` is passed. These patched versions of git lead to
this script not working. Google's corp-provided git is one such example.
2021-07-27 14:53:02 +00:00
bors ac0fd99194 Auto merge of #7492 - nfejzic:improve_help, r=Manishearth
Explain flags missing in cargo check in --help

This commit closes #7389. As stated in the issue, `cargo clippy --help`
provides explanation for some flags and states that the rest are same
as in `cargo check --help`, even though some clippy specific flags
exist.

This commit extends the `cargo clippy --help` with two additional flags,
  - `cargo clippy --fix`
  - `cargo clippy --no-deps`

If there are more flags which are not present in `cargo check --help`
please bring these to my attention, I will include these aswell.
For now, I noticed only the two flags mentioned above.

changelog: `cargo clippy --help` now explains additional flags missing in `cargo check --help`.
2021-07-27 14:39:08 +00:00