about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2021-01-12Add tests for uninhabited typesNadrieril-212/+351
2021-01-12Deduplicate some tests using revisionsNadrieril-227/+74
2021-01-12Auto merge of #80517 - wabain:issue-77880-infer-error-try-conversion-msg, ↵bors-3/+68
r=davidtwco Enhance type inference errors involving the `?` operator This patch adds a special-cased note on type inference errors when the error span points to a `?` return. It also makes the primary label for such errors "cannot infer type of `?` error" in cases where before we would have only said "cannot infer type". One beneficiary of this change is async blocks, where we can't explicitly annotate the return type and so may not generate any other help (#77880); this lets us at least print the error type we're converting from and anything we know about the type we can't fully infer. More generally, it signposts that an implicit conversion is happening that may have impeded type inference the user was expecting. We already do something similar for [mismatched type errors](https://github.com/rust-lang/rust/blob/2987785df3d46d5ff144a5c67fbb8f5cca798d78/src/test/ui/try-block/try-block-bad-type.stderr#L7). The check for a relevant `?` operator is built into the existing HIR traversal which looks for places that could be annotated to resolve the error. That means we could identify `?` uses anywhere in the function that output the type we can't infer, but this patch just sticks to adding the note if the primary span given for the error has the operator; if there are other expressions where the type occurs and one of them is selected for the error instead, it's more likely that the `?` operator's implicit conversion isn't the sole cause of the inference failure and that adding an additional diagnostic would just be noise. I added a ui test for one such case. The data about the `?` conversion is passed around in a `UseDiagnostic` enum that in theory could be used to add more of this kind of note in the future. It was also just easier to pass around than something with a more specific name. There are some follow-up refactoring commits for the code that generates the error label, which was already pretty involved and made a bit more complicated by this change.
2021-01-12Rollup merge of #80930 - euclio:trait-method-mutability-help, r=estebankYuki Okushi-15/+12
fix typo in trait method mutability mismatch help
2021-01-12Rollup merge of #80880 - c410-f3r:tests-tests-tests, r=petrochenkovYuki Okushi-10/+0
Move some tests to more reasonable directories The idea is to move `issues`/`ui` tests in small batches r? `@petrochenkov`
2021-01-12Rollup merge of #79757 - jryans:long-line-tab-handling-early-expand, r=estebankYuki Okushi-0/+25
Replace tabs earlier in diagnostics This replaces tabs earlier in the diagnostics emitting process, which allows various margin calculations to ignore the existence of tabs. It does add a string copy for the source lines that are emitted. Fixes https://github.com/rust-lang/rust/issues/78438 r? `@estebank`
2021-01-12Auto merge of #76580 - rokob:iss76011, r=estebankbors-12/+3
Suggest async {} for async || {} Fixes #76011 This adds support for adding help diagnostics to the feature gating checks and then uses it for the async_closure gate to add the extra bit of help information as described in the issue.
2021-01-11fix typo in trait method mutability mismatch helpAndy Russell-15/+12
2021-01-12Rollup merge of #80885 - camelid:intra-doc-str-ref, r=jyn514Yuki Okushi-0/+9
rustdoc: Resolve `&str` as `str` People almost always are referring to `&str`, not `str`, so this will save a manual link resolve in many cases. Note that we already accept `&` (resolves to `reference`) in intra-doc links, so this shouldn't cause breakage. r? `@jyn514`
2021-01-12Rollup merge of #80324 - Aaron1011:loop-move-fn-self, r=oli-obkYuki Okushi-20/+40
Explain method-call move errors in loops PR #73708 added a more detailed explanation of move errors that occur due to a call to a method that takes `self`. This PR extends that logic to work when a move error occurs due to a method call in the previous iteration of a loop.
2021-01-11Move some tests to more reasonable directoriesCaio-10/+0
2021-01-11Rollup merge of #80892 - camelid:intra-doc-remove-star, r=jyn514Yuki Okushi-2/+0
rustdoc: Remove `*` intra-doc alias for `pointer` It's not valid Rust code and it can easily be confused with a wildcard glob pattern or something else. People can always use `pointer` instead, so it's just removing an alias. It hasn't hit stable yet (I think it's still on nightly), so it's okay to remove it. (We can always add it back later if we change our mind too.) r? `@jyn514` cc https://github.com/rust-lang/rust/pull/80885#discussion_r554622737
2021-01-11Rollup merge of #80881 - jyn514:intra-doc-self, r=GuillaumeGomezYuki Okushi-0/+6
Fix intra-doc links to `Self` and `crate` Closes https://github.com/rust-lang/rust/issues/77732.
2021-01-11Rollup merge of #80809 - camelid:rust-call-abi-msg, r=lcnrYuki Okushi-12/+12
Use standard formatting for "rust-call" ABI message Nearly all error messages start with a lowercase letter and don't use articles - instead they refer to the plural case.
2021-01-10Tweak `?` inference error messagesWilliam Bain-8/+8
2021-01-10Note inference failures using `?` conversionWilliam Bain-3/+68
2021-01-10rustdoc: Remove `*` intra-doc alias for `pointer`Camelid-2/+0
It's not valid Rust code and it can easily be confused with a wildcard glob pattern or something else. People can always use `pointer` instead, so it's just removing an alias. It hasn't hit stable yet (I think it's still on nightly), so it's okay to remove it. (We can always add it back later if we change our mind too.)
2021-01-10rustdoc: Resolve `&str` as `str`Camelid-0/+9
People almost always are referring to `&str`, not `str`, so this will save a manual link resolve in many cases. Note that we already accept `&` (resolves to `reference`) in intra-doc links, so this shouldn't cause breakage.
2021-01-10Auto merge of #79414 - ↵bors-1/+1
sasurau4:feature/add-suggestion-for-pattern-in-fns-without-body, r=matthewjasper Add suggestion for PATTERNS_IN_FNS_WITHOUT_BODY ## Overview Fix #78927
2021-01-10Use standard formatting for "rust-call" ABI messageCamelid-12/+12
Nearly all error messages start with a lowercase letter and don't use articles - instead they refer to the plural case.
2021-01-10Auto merge of #80789 - Aaron1011:fix/stmt-empty, r=petrochenkovbors-0/+40
Synthesize a `TokenStream` for `StmtKind::Empty` Fixes #80760
2021-01-10Fix intra-doc links to `Self` and `crate`Joshua Nelson-0/+6
2021-01-10Auto merge of #80867 - JohnTitor:rollup-tvqw555, r=JohnTitorbors-47/+112
Rollup of 9 pull requests Successful merges: - #79502 (Implement From<char> for u64 and u128.) - #79968 (Improve core::ptr::drop_in_place debuginfo) - #80774 (Fix safety comment) - #80801 (Use correct span for structured suggestion) - #80803 (Remove useless `fill_in` function) - #80820 (Support `download-ci-llvm` on NixOS) - #80825 (Remove under-used ImplPolarity enum) - #80850 (Allow #[rustc_builtin_macro = "name"]) - #80857 (Add comment to `Vec::truncate` explaining `>` vs `>=`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-01-10Rollup merge of #80801 - estebank:correct-binding-sugg-span, r=petrochenkovYuki Okushi-47/+112
Use correct span for structured suggestion On structured suggestion for `let` -> `const` and `const` -> `let`, use a proper `Span` and update tests to check the correct application. Follow up to #80012.
2021-01-10Auto merge of #77862 - danielhenrymantilla:rustdoc/fix-macros_2_0-paths, ↵bors-0/+95
r=jyn514,petrochenkov Rustdoc: Fix macros 2.0 and built-in derives being shown at the wrong path Fixes #74355 - ~~waiting on author + draft PR since my code ought to be cleaned up _w.r.t._ the way I avoid the `.unwrap()`s:~~ - ~~dummy items may avoid the first `?`,~~ - ~~but within the module traversal some tests did fail (hence the second `?`), meaning the crate did not possess the exact path of the containing module (`extern` / `impl` blocks maybe? I'll look into that).~~ r? `@jyn514`
2021-01-09Auto merge of #80441 - petrochenkov:kwtok, r=Aaron1011bors-2/+2
ast: Remove some indirection layers from values in key-value attributes Trying to address some perf regressions from https://github.com/rust-lang/rust/pull/78837#issuecomment-745380762.
2021-01-09Synthesize a `TokenStream` for `StmtKind::Empty`Aaron Hill-0/+40
Fixes #80760
2021-01-09ast: Remove some indirection layers from values in key-value attributesVadim Petrochenkov-2/+2
2021-01-09resolve/expand: Improve attribute expansion on macro definitions and callsVadim Petrochenkov-12/+35
2021-01-08Change wording of noteAaron Hill-19/+19
2021-01-08Explain method-call move errors in loopsAaron Hill-2/+22
PR #73708 added a more detailed explanation of move errors that occur due to a call to a method that takes `self`. This PR extends that logic to work when a move error occurs due to a method call in the previous iteration of a loop.
2021-01-08Auto merge of #76896 - spastorino:codegen-inline-fns2, r=davidtwco,wesleywiserbors-4/+21
Do not make local copies of inline fns in debug mode r? `@wesleywiser` cc `@rust-lang/wg-incr-comp` If this is correct it supersedes https://github.com/rust-lang/rust/pull/76889 Related to #54089
2021-01-08Auto merge of #80653 - jryans:doc-deref-recursive, r=jyn514,GuillaumeGomezbors-2/+89
Recursively document methods via `Deref` traits This changes `rustdoc` to recursively follow `Deref` targets so that methods from all levels are added to the rendered output. This implementation displays the methods from all levels in the expanded state with separate sections for each level. ![image](https://user-images.githubusercontent.com/279572/103482863-46723b00-4ddb-11eb-972b-c463351a425c.png) Fixes https://github.com/rust-lang/rust/issues/26207 Fixes https://github.com/rust-lang/rust/issues/53038 Fixes https://github.com/rust-lang/rust/issues/71640 r? `@jyn514`
2021-01-08Add a note for `*` and `{}` usage on `use`Yuki Okushi-0/+8
2021-01-08Preserve non-local recursive `Deref` implsJ. Ryan Stinnett-0/+26
This adjusts the `rustdoc` trait impl collection path to preserve `Deref` impls from other crates. This adds a first pass to map all of the `Deref` type to target edges and then recursively preserves all targets.
2021-01-08Use target in `Deref` method section IDsJ. Ryan Stinnett-6/+10
There can now be multiple `Deref` method sections, so this adds the target type to the section ID to ensure they are unique.
2021-01-08Recursively document methods via `Deref` traitsJ. Ryan Stinnett-0/+57
2021-01-08Rollup merge of #80799 - jyn514:pretty-print, r=CraftSpiderYuki Okushi-0/+8
Get rid of custom pretty-printing in rustdoc and use rustc_hir_pretty directly instead. Closes https://github.com/rust-lang/rust/issues/79497. r? `@CraftSpider`
2021-01-08Rollup merge of #80761 - andjo403:generic_coverage, r=spastorinoYuki Okushi-1/+1
handle generic trait methods in coverage-report tests also make the generic function pattern more specific and remove the extra $ that fails the matching. r? `@wesleywiser` as this was failing the test of #76896
2021-01-08Rollup merge of #80372 - jyn514:fix-panics, r=ManishearthYuki Okushi-0/+20
Don't panic when an external crate can't be resolved This isn't actually a bug, it can occur when rustdoc tries to resolve a crate that isn't used in the main code. Fixes #72381. r? `@kinnison` if you have time, otherwise `@Manishearth`
2021-01-08Rollup merge of #79675 - CraftSpider:79669, r=estebankYuki Okushi-1/+43
Make sure rust-call errors occur correctly for traits Fixes #79669 Adds trait method resolution to the error, and adds UI tests to ensure it doesn't happen again. Opening as draft because I'm getting weird link errors from unrelated code on my machine, and want to see what CI thinks.
2021-01-07Use correct span for structured suggestionEsteban Küber-47/+112
On structured suggestion for `let` -> `const` and `const` -> `let`, use a proper `Span` and update tests to check the correct application. Follow up to #80012.
2021-01-07Get rid of custom pretty-printing in rustdocJoshua Nelson-0/+8
and use rustc_hir_pretty directly instead
2021-01-07handle generic trait methods in coverage testsAndreas Jonson-1/+1
make the generic function pattern more specific
2021-01-08Rollup merge of #80784 - petrochenkov:nontspan, r=Aaron1011Yuki Okushi-137/+137
rustc_parse: Better spans for synthesized token streams I think using the nonterminal span for synthesizing its tokens is a better approximation than using `DUMMY_SP` or the attribute span like #79472 did in `expand.rs`. r? `@Aaron1011`
2021-01-08Rollup merge of #80660 - max-heller:issue-80559-fix, r=jyn514Yuki Okushi-0/+22
Properly handle primitive disambiguators in rustdoc Fixes #80559 r? ``@jyn514`` Is there a way to test that the generated intra-doc link is what I expect?
2021-01-08Rollup merge of #80521 - richkadel:llvm-coverage-counters-2.4.0, r=wesleywiserYuki Okushi-101/+193
MIR Inline is incompatible with coverage Fixes: #80060 Fixed by disabling inlining if `-Zinstrument-coverage` is set. The PR also adds additional use cases to the coverage test for doctests. r? `@wesleywiser` cc: `@tmandry`
2021-01-08Rollup merge of #80012 - sasurau4:feature/point-constant-identifier-E0435, ↵Yuki Okushi-9/+43
r=petrochenkov Add pointing const identifier when emitting E0435 Fix #79919
2021-01-07rustc_parse: Better spans for synthesized token streamsVadim Petrochenkov-137/+137
2021-01-07bless testsDaiki Ihara-9/+43