about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-09-19[bootstrap] Improve the error message when `ninja` is not found to link to ↵Daira Hopwood-2/+6
installation instructions. Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-09-19Auto merge of #89028 - Aaron1011:coercion-cause, r=nagisabors-14/+14
Propagate coercion cause into `try_coerce` Currently, `coerce_inner` discards its `ObligationCause` when calling `try_coerce`. This interfers with other diagnostc improvements I'm working on, since we will lose the original span by the time the actual coercion occurs. Additionally, we now use the span of the trailing expression (rather than the span of the entire function) when performing a coercion in `check_return_expr`. This currently has no visible effect on any of the unit tests, but will unblock future diagnostic improvements.
2021-09-19Auto merge of #88968 - tmiasko:start-block-no-predecessors, r=davidtwcobors-65/+75
Start block is not allowed to have basic block predecessors * The MIR validator is extended to detect potential violations. * The start block has no predecessors after building MIR, so no changes are required there. * The SimplifyCfg could previously violate this requirement when collapsing goto chains, so transformation is disabled for the start block, which also substantially simplifies the implementation. * The LLVM function entry block also must not have basic block predecessors. Previously, to ensure that code generation had to perform necessary adjustments. This now became unnecessary. The motivation behind the change is to align with analogous requirement in LLVM, and to avoid potential latent bugs like the one reported in #88043.
2021-09-18Update cargoEric Huss-0/+0
2021-09-18Auto merge of #82183 - michaelwoerister:lazier-defpathhash-loading2, ↵bors-0/+1
r=wesleywiser Simplify lazy DefPathHash decoding by using an on-disk hash table. This PR simplifies the logic around mapping `DefPathHash` values encountered during incremental compilation to valid `DefId`s in the current session. It is able to do so by using an on-disk hash table encoding that allows for looking up values directly, i.e. without deserializing the entire table. The main simplification comes from not having to keep track of `DefPathHashes` being used during the compilation session.
2021-09-18Auto merge of #88650 - sapessi:issue-77175-fix, r=estebankbors-0/+19
Skip single use lifetime lint for generated opaque types Fix: #77175 The opaque type generated by the desugaring process of an async function uses the lifetimes defined by the originating function. The DefId for the lifetimes in the opaque type are different from the ones in the originating async function - as they should be, as far as I understand, and could therefore be considered a single use lifetimes, this causes the single_use_lifetimes lint to fail compilation if explicitly denied. This fix skips the lint for lifetimes used only once in generated opaque types for an async function that are declared in the parent async function definition. More info in the comments on the original issue: 1 and 2
2021-09-18./x.py test --blessTomasz Miąsko-65/+75
2021-09-17Auto merge of #88956 - ehuss:update-cargo, r=ehussbors-0/+0
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-17Update cargoEric Huss-0/+0
2021-09-17Rollup merge of #88964 - GuillaumeGomez:version-help, r=Nemo157Guillaume Gomez-13/+39
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-17Rollup merge of #88954 - nbdd0121:panic3, r=oli-obkGuillaume Gomez-37/+83
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-17Rollup merge of #88899 - FabianWolff:issue-88844, r=matthewjasperGuillaume Gomez-0/+26
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-17Rollup merge of #88666 - GuillaumeGomez:compiler-docs, r=Mark-SimulacrumGuillaume Gomez-10/+53
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-17Rollup merge of #87566 - JohnTitor:find-eqeq-on-assoc-type-bounds, r=estebankGuillaume Gomez-0/+42
Recover invalid assoc type bounds using `==` Fix #87493 r? `@estebank`
2021-09-17Rollup merge of #87460 - FabianWolff:issue-87456, r=Aaron1011Guillaume Gomez-211/+495
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-17Rollup merge of #86422 - JohnTitor:clearer-parens-err-for-loop, r=estebankGuillaume Gomez-7/+10
Emit clearer diagnostics for parens around `for` loop heads Fixes #63113 r? `@estebank`
2021-09-17Add rustdoc version into the help popupGuillaume Gomez-13/+39
2021-09-17Correctly handle "--open" option when building compiler docsGuillaume Gomez-0/+9
2021-09-17Allow to pass "compiler" arguments to doc subcommandGuillaume Gomez-10/+44
2021-09-17Apply review commentsYuki Okushi-4/+6
2021-09-17Rollup merge of #89033 - cuviper:sysroot-lib-path, r=Mark-SimulacrumYuki Okushi-0/+13
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-17Rollup merge of #88911 - FabianWolff:issue-88653, r=petrochenkovYuki Okushi-0/+31
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-17Rollup merge of #88883 - c410-f3r:tests, r=petrochenkovYuki Okushi-37/+2
Move some tests to more reasonable directories - 7 cc #73494 r? ``@petrochenkov``
2021-09-17Rollup merge of #88735 - hnj2:patch-1, r=GuillaumeGomezYuki Okushi-0/+10
Don't lint about missing code examples in derived traits When the `missing_doc_code_examples` lint is performed it also requires that derived Trait implementations have a code example for each member etc., which causes undesirable behavior. # Examples With `missing_doc_code_examples` enable we are not able to use the `Clone` derive macro due to the generated code not being documented: ```rust #[deny(rustdoc::missing_doc_code_examples)] /// docs /// ``` /// let s = SomeStruct; /// ``` #[derive(Clone)] pub struct SomeStruct; ``` yields: ``` Documenting testt v0.1.0 (<redacted>) error: missing code example in this documentation --> src/lib.rs:7:10 | 7 | #[derive(Clone)] | ^^^^^ | note: the lint level is defined here --> src/lib.rs:1:8 | 1 | #[deny(rustdoc::missing_doc_code_examples)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing code example in this documentation --> src/lib.rs:7:10 | 7 | #[derive(Clone)] | ^^^^^ error: could not document `testt` Caused by: process didn't exit successfully: `rustdoc ... ``` closes #81775
2021-09-17Rollup merge of #87529 - FabianWolff:issue-87496, r=nikomatsakisYuki Okushi-0/+28
Fix ICE in `improper_ctypes_definitions` lint with all-ZST transparent types Fixes #87496. There is also another function in the same file that looks fishy, but I haven't been able to produce an ICE there, and in any case, it's not related to #87496: https://github.com/rust-lang/rust/blob/fd853c00e255559255885aadff9e93a1760c8728/compiler/rustc_lint/src/types.rs#L720-L734 r? ```@JohnTitor```
2021-09-17Recover invalid assoc type bounds using `==`Yuki Okushi-0/+40
2021-09-17Use `multipart_suggestion`Yuki Okushi-3/+7
2021-09-17Emit clearer diagnostics for parens around `for` loop headsYuki Okushi-5/+4
2021-09-17Make diagnostics clearer for `?` operatorsYuki Okushi-2/+25
2021-09-16Set the library path in sysroot-crates-are-unstableJosh Stone-0/+13
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-17Don't lint about missing code examples in derived traitsHans-0/+10
Fixes #81775
2021-09-16Auto merge of #88719 - estebank:point-at-arg-for-obligation, r=nagisabors-335/+690
Point at argument instead of call for their obligations When an obligation is introduced by a specific `fn` argument, point at the argument instead of the `fn` call if the obligation fails to be fulfilled. Move the information about pointing at the call argument expression in an unmet obligation span from the `FulfillmentError` to a new `ObligationCauseCode`. When giving an error about an obligation introduced by a function call that an argument doesn't fulfill, and that argument is a block, add a span_label pointing at the innermost tail expression. Current output: ``` error[E0425]: cannot find value `x` in this scope --> f10.rs:4:14 | 4 | Some(x * 2) | ^ not found in this scope error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>` --> f10.rs:2:31 | 2 | let p = Some(45).and_then({ | ______________________--------_^ | | | | | required by a bound introduced by this call 3 | | |x| println!("doubling {}", x); 4 | | Some(x * 2) | | ----------- 5 | | }); | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` ``` Previous output: ``` error[E0425]: cannot find value `x` in this scope --> f10.rs:4:14 | 4 | Some(x * 2) | ^ not found in this scope error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>` --> f10.rs:2:22 | 2 | let p = Some(45).and_then({ | ^^^^^^^^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` ``` Partially address #27300. Will require rebasing on top of #88546.
2021-09-16Propagate coercion cause into `try_coerce`Aaron Hill-14/+14
Currently, `coerce_inner` discards its `ObligationCause` when calling `try_coerce`. This interfers with other diagnostc improvements I'm working on, since we will lose the original span by the time the actual coercion occurs. Additionally, we now use the span of the trailing expression (rather than the span of the entire function) when performing a coercion in `check_return_expr`. This currently has no visible effect on any of the unit tests, but will unblock future diagnostic improvements.
2021-09-16Auto merge of #89019 - Manishearth:rollup-5qp8a5s, r=Manishearthbors-67/+86
Rollup of 10 pull requests Successful merges: - #88292 (Enable --generate-link-to-definition for rustc's docs) - #88729 (Recover from `Foo(a: 1, b: 2)`) - #88875 (cleanup(rustc_trait_selection): remove vestigial code from rustc_on_unimplemented) - #88892 (Move object safety suggestions to the end of the error) - #88928 (Document the closure arguments for `reduce`.) - #88976 (Clean up and add doc comments for CStr) - #88983 (Allow calling `get_body_with_borrowck_facts` without `-Z polonius`) - #88985 (Update clobber_abi list to include k[1-7] regs) - #88986 (Update the backtrace crate) - #89009 (Fix typo in `break` docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-09-16Rollup merge of #88985 - Commeownist:patch-1, r=AmanieuManish Goregaokar-3/+3
Update clobber_abi list to include k[1-7] regs
2021-09-16Rollup merge of #88892 - estebank:trait-objects, r=petrochenkovManish Goregaokar-40/+40
Move object safety suggestions to the end of the error
2021-09-16Rollup merge of #88729 - estebank:struct-literal-using-parens, r=oli-obkManish Goregaokar-24/+42
Recover from `Foo(a: 1, b: 2)` Detect likely `struct` literal using parentheses as delimiters and emit targeted suggestion instead of type ascription parse error. Fix #61326.
2021-09-16Rollup merge of #88292 - SkiFire13:enable-rustdoc-links, r=jyn514Manish Goregaokar-0/+1
Enable --generate-link-to-definition for rustc's docs cc `@jyn514`
2021-09-16Auto merge of #88979 - tmiasko:no-remove-zsts-in-generators, r=oli-obkbors-0/+16
Disable RemoveZsts in generators to avoid query cycles Querying layout of a generator requires its optimized MIR. Thus computing layout during MIR optimization of a generator might create a query cycle. Disable RemoveZsts in generators to avoid the issue (similar approach is used in ConstProp transform already). Fixes #88972.
2021-09-16fix rebaseEsteban Kuber-0/+18
2021-09-16Auto merge of #88219 - jyn514:parallel-io, r=GuillaumeGomezbors-45/+53
rustdoc: reduce number of copies when using parallel IO This is Windows-only for now; I was getting really bad slowdowns from this on linux for some reason. Helps with https://github.com/rust-lang/rust/issues/82741. Follow-up to https://github.com/rust-lang/rust/pull/60971.
2021-09-16Point at argument when evaluating `Path`'s boundsEsteban Kuber-46/+10
When evaluating an `ExprKind::Call`, we first have to `check_expr` on it's callee. When this one is a `ExprKind::Path`, we had to evaluate the bounds introduced for its arguments, but by the time we evaluated them we no longer had access to the argument spans. Now we special case this so that we can point at the right place on unsatisfied bounds. This also allows the E0277 deduplication to kick in correctly, so we now emit fewer errors.
2021-09-16Fix rebaseEsteban Kuber-3/+12
2021-09-16Remove unnecessary labelEsteban Kuber-28/+7
2021-09-16fix rebaseEsteban Kuber-1/+3
2021-09-16Point at call span that introduced obligation for the argEsteban Kuber-249/+657
2021-09-16Refactor `FulfillmentError` to track less dataEsteban Kuber-3/+3
Move the information about pointing at the call argument expression in an unmet obligation span from the `FulfillmentError` to a new `ObligationCauseCode`.
2021-09-16Point at argument instead of call for their obligationsEsteban Kuber-47/+22
When an obligation is introduced by a specific `fn` argument, point at the argument instead of the `fn` call if the obligation fails to be fulfilled.
2021-09-16Enable rustdoc's --generate-link-to-definition for rustc docsGiacomo Stevanato-0/+1
2021-09-16Auto merge of #86809 - DevinR528:reachable-pat, r=Nadrierilbors-5/+340
Add non_exhaustive_omitted_patterns lint related to rfc-2008-non_exhaustive Fixes: #84332 This PR adds `non_exhaustive_omitted_patterns`, an allow by default lint that is triggered when a `non_exhaustive` type is missing explicit patterns. The warning or deny attribute can be put above the wildcard `_` pattern on enums or on the expression for enums or structs. The lint is capable of warning about multiple types within the same pattern. This lint will not be triggered for `if let ..` patterns. ```rust // crate A #[non_exhaustive] pub struct Foo { a: u8, b: usize, } #[non_exhaustive] pub enum Bar { A(Foo), B, } // crate B #[deny(non_exhaustive_omitted_patterns)] // here match Bar::B { Bar::B => {} #[deny(non_exhaustive_omitted_patterns)] // or here _ => {} } #[warn(non_exhaustive_omitted_patterns)] // only here let Foo { a, .. } = Foo::default(); #[deny(non_exhaustive_omitted_patterns)] match Bar::B { // triggers for Bar::B, and Foo.b Bar::A(Foo { a, .. }) => {} // if the attribute was here only Bar::B would cause a warning _ => {} } ```