Commit graph

155044 commits

Author SHA1 Message Date
Eduard-Mihai Burtescu
a1d7c51d27 ty::layout: move trait FnAbiExt to just before its impl. 2021-09-18 01:42:43 +03:00
bors
a58db2e4dd Auto merge of #88962 - fee1-dead:const-drop, r=oli-obk
inline(always) on check_recursion_limit

r? `@oli-obk`

#88558 caused a regression, this PR adds `#[inline(always)]` to `check_recursion_limit`, a possible suspect of that regression.
2021-09-17 21:37:01 +00:00
DeveloperC286
05b01cd787 refactor: VecDeques IntoIter fields to private 2021-09-17 21:46:32 +01:00
Mark Rousskov
c4c5fc8c4c Add nofallback tests 2021-09-17 15:37:12 -04:00
Mark Rousskov
078e3fd4ba Add another case of fallback to () avoid breakage
This adds src/test/ui/never_type/fallback-closure-ret.rs as a test case which
showcases the failure mode fixed by this commit.
2021-09-17 15:34:47 -04:00
bors
9dd4ce80fb Auto merge of #88956 - ehuss:update-cargo, r=ehuss
Update cargo

13 commits in e515c3277bf0681bfc79a9e763861bfe26bb05db..33ee5f82edb50af87b952c5b28de0f5fb41ebf18
2021-09-08 14:32:15 +0000 to 2021-09-17 13:51:54 +0000
- Update curl-sys (rust-lang/cargo#9917)
- Bump Cargo's curl requirement to 7.79.0 (rust-lang/cargo#9914)
- Revert "When a dependency does not have a version, git or path, fails directly" (rust-lang/cargo#9911)
- Add some contributor docs for debugging testsuite tests. (rust-lang/cargo#9904)
- Fix warnings when documenting with `--document-private-items` (rust-lang/cargo#9903)
- Improve "wrong output" error. (rust-lang/cargo#9905)
- Fix warnings from better precision of `dead_code` lint (rust-lang/cargo#9906)
- Bump to 0.58.0, update changelog (rust-lang/cargo#9900)
- Fix rustc --profile=dev unstable check. (rust-lang/cargo#9898)
- config.md: fix typo (rust-lang/cargo#9896)
- Enable some tests on windows. (rust-lang/cargo#9893)
- Enable strip test on macos. (rust-lang/cargo#9889)
- Fix `cargo fix --edition` on stable. (rust-lang/cargo#9890)
2021-09-17 18:48:26 +00:00
Eric Huss
1626feebf2 Update cargo 2021-09-17 10:55:59 -07:00
Sachin Cherian
ec34aa61d6 modify std::os docs to be more consistent
> add intra doc links
> add a usage example for the os::windows module
2021-09-17 23:23:21 +05:30
Aaron Hill
95bea1594c
Convert debug_assert to assert in CachingSourceMapView
I suspect that there's a bug somewhere in this code, which is
leading to the `predicates_of` ICE being seen in #89035
2021-09-17 12:01:29 -05:00
The8472
57465d9c1b use AtomicU64::fetch_update instead of handrolled RMW-loop 2021-09-17 18:54:24 +02:00
Niko Matsakis
59dc2013e2 optimization: use a single DepthFirstSearch instead of hashsets
Extend the `DepthFirstSearch` iterator so that it can be re-used and
extended with add'l start nodes. Then replace the FxHashSets of nodes
we were using in the fallback analysis with a single iterator. This
way we won't re-walk portions of the graph that are reached more than
once, and we also do less allocation etc.
2021-09-17 12:47:48 -04:00
Niko Matsakis
bc2ece2a8d stop categorizing inference variables as diverging when created
Instead, we now rely on the code that looks for a NeverToAny adjustment.
2021-09-17 12:47:48 -04:00
Niko Matsakis
1c004f2d43 remove reliance on "diverging" type variables
Instead, we now record those type variables that are the target of a
`NeverToAny` adjustment and consider those to be the "diverging" type
variables. This allows us to remove the special case logic that
creates a type variable for `!` in coercion.
2021-09-17 12:47:48 -04:00
Niko Matsakis
ebb8ff9edf remove diverging type variables from fn check
The comment seems incorrect. Testing revealed that the examples in
question still work (as well as some variants) even without the
special casing here.
2021-09-17 12:47:48 -04:00
Niko Matsakis
2ee89144e2 introduce new fallback algorithm
We now fallback type variables using the following rules:

* Construct a coercion graph `A -> B` where `A` and `B` are unresolved
  type variables or the `!` type.
* Let D be those variables that are reachable from `!`.
* Let N be those variables that are reachable from a variable not in
D.
* All variables in (D \ N) fallback to `!`.
* All variables in (D & N) fallback to `()`.
2021-09-17 12:47:48 -04:00
Maybe Waffle
71e2eacc7b Stabilize Iterator::map_while 2021-09-17 19:42:46 +03:00
bors
207d9558d0 Auto merge of #89047 - GuillaumeGomez:rollup-29gmr02, r=GuillaumeGomez
Rollup of 10 pull requests

Successful merges:

 - #86422 (Emit clearer diagnostics for parens around `for` loop heads)
 - #87460 (Point to closure when emitting 'cannot move out' for captured variable)
 - #87566 (Recover invalid assoc type bounds using `==`)
 - #88666 (Improve build command for compiler docs)
 - #88899 (Do not issue E0071 if a type error has already been reported)
 - #88949 (Fix handling of `hir::GenericArg::Infer` in `wrong_number_of_generic_args.rs`)
 - #88953 (Add chown functions to std::os::unix::fs to change the owner and group of files)
 - #88954 (Allow `panic!("{}", computed_str)` in const fn.)
 - #88964 (Add rustdoc version into the help popup)
 - #89012 (Suggest removing `#![feature]` for library features that have been stabilized)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-09-17 15:49:22 +00:00
Guillaume Gomez
101a88f950
Rollup merge of #89012 - vishadGoyal:issue-88802-fix, r=jyn514
Suggest removing `#![feature]` for library features that have been stabilized

Issue: https://github.com/rust-lang/rust/issues/88802
Delayed the check if #![feature] has been used to enable lib features in a non-nightly build to occur after TyCtxt has been constructed.
2021-09-17 17:41:21 +02:00
Guillaume Gomez
833358b964
Rollup merge of #88964 - GuillaumeGomez:version-help, r=Nemo157
Add rustdoc version into the help popup

After a discussion with a rustdoc user about a specific behaviour, we realized we were not talking about the same version. To add on top of it, it was actually not that simple to find out the version since it was hosted documentation.

So to simplify things, I added the version into the help popup:

![Screenshot from 2021-09-16 10-45-52](https://user-images.githubusercontent.com/3050060/133581128-b93b460a-e1cb-4a31-9f2f-97c7a916cfcc.png)

Does the version format looks or would you prefer that I add more information? We can also add the commit hash, commit date, host and release.

cc `@rust-lang/rustdoc`
r? `@jyn514`
2021-09-17 17:41:19 +02:00
Guillaume Gomez
eb62779f2d
Rollup merge of #88954 - nbdd0121:panic3, r=oli-obk
Allow `panic!("{}", computed_str)` in const fn.

Special-case `panic!("{}", arg)` and translate it to `panic_display(&arg)`. `panic_display` will behave like `panic_any` in cosnt eval and behave like `panic!(format_args!("{}", arg))` in runtime.

This should bring Rust 2015 and 2021 to feature parity in terms of `const_panic`; and hopefully would unblock the stabilisation of #51999.

`@rustbot` modify labels: +T-compiler +T-libs +A-const-eval +A-const-fn

r? `@oli-obk`
2021-09-17 17:41:19 +02:00
Guillaume Gomez
723d27934b
Rollup merge of #88953 - joshtriplett:chown, r=dtolnay
Add chown functions to std::os::unix::fs to change the owner and group of files

This is a straightforward wrapper that uses the existing helpers for C
string handling and errno handling.

Having this available is convenient for UNIX utility programs written in
Rust, and avoids having to call unsafe functions like `libc::chown`
directly and handle errors manually, in a program that may otherwise be
entirely safe code.

In addition, these functions provide a more Rustic interface by
accepting appropriate traits and using `None` rather than `-1`.
2021-09-17 17:41:18 +02:00
Guillaume Gomez
6f5c09849e
Rollup merge of #88949 - FabianWolff:issue-87563, r=estebank
Fix handling of `hir::GenericArg::Infer` in `wrong_number_of_generic_args.rs`

Fixes #87563. More precisely, I have fixed the "index out of bounds" error, which is what #87563 is about. The example given there still ICEs due to running into this `todo!()`, but I'd say that this is a separate issue:
c3c0f80d60/compiler/rustc_typeck/src/astconv/mod.rs (L460-L463)
2021-09-17 17:41:17 +02:00
Guillaume Gomez
307f2ddfa4
Rollup merge of #88899 - FabianWolff:issue-88844, r=matthewjasper
Do not issue E0071 if a type error has already been reported

Fixes #88844. A suggested fix is already included in the error message for E0412, so with my changes, E0071 is simply not emitted anymore if the type in question is a "type error". This makes sense, I think, because we cannot confidently state that something is "not a struct" if we couldn't resolve it properly; and it's unnecessary to pollute the output with this additional error message, as it is a direct consequence of the former error.

I have also addressed the issue mentioned in https://github.com/rust-lang/rust/issues/88844#issuecomment-917324856 by changing the fixed example in the documentation to more closely match the erroneous code example.
2021-09-17 17:41:16 +02:00
Guillaume Gomez
765f1533db
Rollup merge of #88666 - GuillaumeGomez:compiler-docs, r=Mark-Simulacrum
Improve build command for compiler docs

It was rather complicated to document rustc crates. With this, you can directly run:

```console
x.py doc compiler
x.py doc compiler/rustc_hir_pretty
```

The second commit adds the handling of the `--open` flag.

r? `@Mark-Simulacrum`
2021-09-17 17:41:15 +02:00
Guillaume Gomez
1b7896716e
Rollup merge of #87566 - JohnTitor:find-eqeq-on-assoc-type-bounds, r=estebank
Recover invalid assoc type bounds using `==`

Fix #87493
r? `@estebank`
2021-09-17 17:41:14 +02:00
Guillaume Gomez
aed7f00097
Rollup merge of #87460 - FabianWolff:issue-87456, r=Aaron1011
Point to closure when emitting 'cannot move out' for captured variable

Attempts to fix #87456. The error message now points to the capturing closure, but I was not able to explain _why_ the closure implements `Fn` or `FnMut` (`TypeckResults::closure_kind_origins` did not contain anything for the closure in question).

cc `@Aaron1011`
2021-09-17 17:41:13 +02:00
Guillaume Gomez
b6d0ccab72
Rollup merge of #86422 - JohnTitor:clearer-parens-err-for-loop, r=estebank
Emit clearer diagnostics for parens around `for` loop heads

Fixes #63113
r? `@estebank`
2021-09-17 17:41:12 +02:00
Guillaume Gomez
cd3f4da244 Add rustdoc version into the help popup 2021-09-17 17:32:57 +02:00
Yilin Chen
d5de680e20 Work around invalid DWARF bugs for fat LTO
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2021-09-17 23:19:38 +08:00
John Paul Adrian Glaubitz
5d22b1afe2 doc/platform-support: Add documentation for m68k-unknown-linux-gnu 2021-09-17 15:07:14 +00:00
John Paul Adrian Glaubitz
c99d365d7e doc/platform-support.md: Add m68k-unknown-linux-gnu as Tier 3 target 2021-09-17 15:07:14 +00:00
John Paul Adrian Glaubitz
2cef5d8091 library/std/env: Add 'm68k' to comment on ARCH constant 2021-09-17 15:07:14 +00:00
John Paul Adrian Glaubitz
fa27d50caa compiler/rustc_llvm: Enable M68k LLVM target 2021-09-17 15:07:14 +00:00
John Paul Adrian Glaubitz
5e56778dc8 libstd: Add m68k for raw type definitions on Linux 2021-09-17 15:07:14 +00:00
John Paul Adrian Glaubitz
13b029d6fc rustdoc: Add human-readable cfg string for m68k 2021-09-17 15:07:13 +00:00
John Paul Adrian Glaubitz
0e4e0ce884 compiletest: Add m68k to ARCH_TABLE 2021-09-17 15:07:13 +00:00
John Paul Adrian Glaubitz
33088b9395 ci: Add Dockerfile for dist-m68k-linux 2021-09-17 15:07:13 +00:00
John Paul Adrian Glaubitz
9d177f8926 build-manifest: Add m68k-unknown-linux-gnu target 2021-09-17 15:07:13 +00:00
John Paul Adrian Glaubitz
580559129b compiler/rustc_target: Add support for m68k-linux-gnu 2021-09-17 15:07:12 +00:00
John Paul Adrian Glaubitz
df7ad3af21 bootstrap: Add LLVM target matching for M68k 2021-09-17 15:07:12 +00:00
John Paul Adrian Glaubitz
0ad0d305ff bootstrap: Add cputype matching for m68k 2021-09-17 15:07:12 +00:00
Michael Woerister
4d151d92de Update odht to 0.2.1 2021-09-17 15:57:57 +02:00
Guillaume Gomez
57ee7a63eb Correctly handle "--open" option when building compiler docs 2021-09-17 13:38:56 +02:00
Guillaume Gomez
bc49c3b651 Allow to pass "compiler" arguments to doc subcommand 2021-09-17 13:37:24 +02:00
bors
e0c38af27c Auto merge of #88945 - Aaron1011:no-projection-completion, r=wesleywiser,jackh726
Remove concept of 'completion' from the projection cache

Fixes #88910

When we initially store a `NormalizedTy` in the projection cache,
we discard all obligations that we can (while ensuring that we
don't cause any issues with incremental compilation).

Marking a projection cache entry as 'completed' discards all
obligations associated with it. This can only cause problems,
since any obligations stored in the cache are there for a reason
(e.g. they evaluate to `EvaluatedToOkModuloRegions`).

This commit removes `complete` and `complete_normalized` entirely.
2021-09-17 09:44:28 +00:00
bors
1c03f0d0ba Auto merge of #89037 - JohnTitor:rollup-rd9btbs, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #86382 (Make diagnostics clearer for `?` operators)
 - #87529 (Fix ICE in `improper_ctypes_definitions` lint with all-ZST transparent types)
 - #88339 (Add TcpListener::into_incoming and IntoIncoming)
 - #88735 (Don't lint about missing code examples in derived traits)
 - #88751 (Couple of changes to FileSearch and SearchPath)
 - #88883 (Move some tests to more reasonable directories - 7)
 - #88887 (Const Deref)
 - #88911 (Improve error message for type mismatch in generator arguments)
 - #89014 (PassWrapper: handle separate Module*SanitizerPass)
 - #89033 (Set the library path in sysroot-crates-are-unstable)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-09-17 06:47:35 +00:00
Yuki Okushi
ee99bb3939
Apply review comments 2021-09-17 14:10:41 +09:00
Yuki Okushi
4d5bcbe957
Rollup merge of #89033 - cuviper:sysroot-lib-path, r=Mark-Simulacrum
Set the library path in sysroot-crates-are-unstable

Most of the `run-make-fulldeps` tests use a make-driven rustc command
that includes `HOST_RPATH_DIR` in the library path, but this particular
test runs from python instead. When the toolchain is built without
`rpath` enabled, we need that library path in the environment so it can
find its own libraries.
2021-09-17 14:09:51 +09:00
Yuki Okushi
3cff47b608
Rollup merge of #89014 - durin42:llvm-14-module-pass-manager, r=nikic
PassWrapper: handle separate Module*SanitizerPass

Change ab41eef9aca3 in LLVM split MemorySanitizerPass into
MemorySanitizerPass for functions and ModuleMemorySanitizerPass for
modules. There's a related change for ThreadSanitizerPass, and in here
since we're using a ModulePassManager I only add the module flavor of
the pass on LLVM 14.

r? `@nikic` cc `@nagisa`
2021-09-17 14:09:50 +09:00
Yuki Okushi
c97ff098f1
Rollup merge of #88911 - FabianWolff:issue-88653, r=petrochenkov
Improve error message for type mismatch in generator arguments

Fixes #88653. The code example given there is invalid because the `Generator` trait (unlike the `Fn` traits) does not take the generator arguments in tupled-up form (because there can only be one argument, from my understanding). Hence, the type error in the example in #88653 is correct, because the given generator takes a `bool` argument, whereas the function's return type talks about a generator with a `(bool,)` argument.

The error message is both confusing and wrong, though: It is wrong because it displays the wrong "expected signature", and it is confusing because both the "expected" and "found" notes point at the same span. With my changes, I get the following, more helpful output:
```
error[E0631]: type mismatch in generator arguments
 --> test.rs:5:22
  |
5 | fn foo(bar: bool) -> impl Generator<(bool,)> {
  |                      ^^^^^^^^^^^^^^^^^^^^^^^ expected signature of `fn((bool,)) -> _`
6 |     |bar| {
  |     ----- found signature of `fn(bool) -> _`
```
2021-09-17 14:09:49 +09:00