about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2022-04-21Rollup merge of #96236 - Aaron1011:constraint-debug, r=jackh726Dylan DPC-58/+30
Add an explicit `Span` field to `OutlivesConstraint` Previously, we would retrieve the span from the `Body` using the `locations` field. However, we may end up changing the `locations` field when moving a constraint from a promoted to a different body. We now store the original `Span` in a dedication field, so that changes to the `locations` do not affect the quality of our diagnostics.
2022-04-21Rollup merge of #90630 - GuillaumeGomez:improve-rustdoc-search, r=notriddleDylan DPC-11/+1140
Create real parser for search queries You can test it [here](https://rustdoc.crud.net/imperio/improve-rustdoc-search/std/index.html). This PR adds a real parser for the query engine in rustdoc. The parser is quite simple but it allows to makes query handling much easier. I added a new testsuite to ensure it works as expected and ran fuzzing checks on it for a few hours without problems. So about the parser: as you can see in the screenshot, it handles recursive generics parsing. It also allows to set which item should use exact matching by adding double-quotes around it (look for `exact_search` in the screenshot). Now about the query engine itself: I simplified it a lot thanks to the parsed query. It behaves mostly the same when there is only one argument, but is much more powerful when there are more than one. When making this change, we also removed the support for multi-query. PS: A big part of the PR is tests and test-related code. :) r? `@camelid`
2022-04-20Rollup merge of #93313 - tmiasko:uninhabited, r=tmandryDylan DPC-93/+154
Check if call return type is visibly uninhabited when building MIR The main motivation behind the change is to expose information about diverging calls to the generator transform and match the precision of drop range tracking which already understands that call expressions with visibly uninhabited types diverges. This change should also accept strictly more programs than before. That is programs that were previously rejected due to errors raised by control-flow sensitive checks in a code that is no longer considered reachable. Fixes #93161.
2022-04-20Auto merge of #96135 - petrochenkov:doclink6, r=GuillaumeGomezbors-17/+27
rustdoc: Optimize and refactor doc link resolution One more subset of https://github.com/rust-lang/rust/pull/94857 that should bring perf improvements rather than regressions + a couple more optimizations on top of it. It's better to read individual commits and their descriptions to understand the changes. The `may_have_doc_links` optimization is not *very* useful here, but it's much more important for https://github.com/rust-lang/rust/pull/94857. Closes https://github.com/rust-lang/rust/issues/96079
2022-04-19Add an explicit `Span` field to `OutlivesConstraint`Aaron Hill-58/+30
Previously, we would retrieve the span from the `Body` using the `locations` field. However, we may end up changing the `locations` field when moving a constraint from a promoted to a different body. We now store the original `Span` in a dedication field, so that changes to the `locations` do not affect the quality of our diagnostics.
2022-04-19Rollup merge of #95813 - Urgau:rustdoc-where-clause-space, r=GuillaumeGomezDylan DPC-0/+17
Remove extra space before a where clause Remove extra space before where clause in the generated documentation. The fix is to move the space before the break-line so that it doesn't appear visually but is still here. Removing it completely would create things like this `impl<D> Delta<D>where D: MyTrait` (missing a space before the where) which I don't think we want. Added two regression test, first one test that the `<br>` is after the space and the second check that the `<br>` is before the spaces. Before: ![image](https://user-images.githubusercontent.com/3616612/162475212-d4bb6727-ed66-4a55-a4a2-4f55189bf8bd.png) After: ![image](https://user-images.githubusercontent.com/3616612/162475467-508fd082-60a7-4a8c-b693-8b188e8843e6.png) r? ``@GuillaumeGomez``
2022-04-19Rollup merge of #95740 - Amanieu:kreg0, r=nagisaDylan DPC-14/+14
asm: Add a kreg0 register class on x86 which includes k0 Previously we only exposed a kreg register class which excludes the k0 register since it can't be used in many instructions. However k0 is a valid register and we need to have a way of marking it as clobbered for clobber_abi. Fixes #94977
2022-04-19Add regression test for #96079Guillaume Gomez-0/+26
2022-04-19rustc_metadata: Store a flag telling whether an item may have doc links in ↵Vadim Petrochenkov-17/+1
its attributes This should be cheap on rustc side, but it's significant optimization for rustdoc that won't need to decode and process attributes unnecessarily
2022-04-19asm: Add a kreg0 register class on x86 which includes k0Amanieu d'Antras-14/+14
Previously we only exposed a kreg register class which excludes the k0 register since it can't be used in many instructions. However k0 is a valid register and we need to have a way of marking it as clobbered for clobber_abi. Fixes #94977
2022-04-19Rollup merge of #96122 - ↵Dylan DPC-0/+50
TaKO8Ki:fix-invalid-error-for-suggestion-to-add-slice-in-pattern-matching, r=nagisa Fix an invalid error for a suggestion to add a slice in pattern-matching closes #96103
2022-04-19Rollup merge of #96086 - jsgf:remove-extern-location, r=davidtwcoDylan DPC-186/+0
Remove `--extern-location` and all associated code `--extern-location` was an experiment to investigate the best way to generate useful diagnostics for unused dependency warnings by enabling a build system to identify the corresponding build config. While I did successfully use this, I've since been convinced the alternative `--json unused-externs` mechanism is the way to go, and there's no point in having two mechanisms with basically the same functionality. This effectively reverts https://github.com/rust-lang/rust/pull/72603
2022-04-19Rollup merge of #94493 - ↵Dylan DPC-3/+15
oribenshir:feature/ISSUE-78543_async_fn_in_foreign_crate_diag_2, r=davidtwco Improved diagnostic on failure to meet send bound on future in a foreign crate Provide a better diagnostic on failure to meet send bound on futures in a foreign crate. fixes #78543
2022-04-19Auto merge of #95379 - icewind1991:suggest-associated-type-more, r=jackh726bors-10/+33
show suggestion to replace generic bounds with associated types in more cases Moves the hint to replace generic parameters with associated type bounds from the "not all associated type bounds are specified"(`E0191`) to "to many generic type parameters provided"(`E0107`). Since `E0191` is only emitted in places where all associated types must be specified (when creating `dyn` types), the suggesting is currently not shown for other generic type uses (such as in generic type bounds). With this change the suggesting is always emitted when the number of excess generic parameters matches the number of unbound associated types. Main motivation for the change was a lack of useful suggesting when doing ```rust fn foo<I: Iterator<usize>>(i: I) {} ```
2022-04-18Correctly handle single `:`Guillaume Gomez-0/+10
2022-04-18Add test to ensure that keywords in path are workingGuillaume Gomez-1/+16
2022-04-18Add an extra check over filter typeGuillaume Gomez-0/+60
2022-04-18Fix some corner casesGuillaume Gomez-1/+26
2022-04-18Add more tests for quote errorsGuillaume Gomez-3/+61
2022-04-18Add tests for pathsGuillaume Gomez-0/+20
2022-04-18Handle separators in their own functions and fix missing handling of tabsGuillaume Gomez-0/+216
2022-04-18Improve the BNF description a bit and fix some issuesGuillaume Gomez-22/+157
2022-04-18Forbid rustdoc search query to end with ->Guillaume Gomez-0/+10
2022-04-18Add isIdentCharacter function to ensure that unexpected characters are ↵Guillaume Gomez-4/+14
handled correctly
2022-04-18Apply suggestions:Guillaume Gomez-30/+47
* Forbid generics without a path (so "<p>" is forbidden). * Change `handleSingleArg` so that it takes `results_others`, `results_in_args` and `results_returned` as arguments instead of using the "global" variables. * Change `createQueryElement` so that it returns the newly created element instead of taking `elems` as argument. * Improve documentation
2022-04-18Improve documentation and add some explanations in the codeGuillaume Gomez-2/+3
2022-04-18Simplify parser syntaxGuillaume Gomez-163/+10
2022-04-18Make query parser more strict and improve display of errorsGuillaume Gomez-86/+175
2022-04-18* Greatly improve the rustdoc search parser source codeGuillaume Gomez-106/+56
* Move all functions outside parseQuery
2022-04-18* If type filter is in quotes, throw an error.Guillaume Gomez-55/+34
* If there are generics, don't allow to have quotes.
2022-04-18Improve naming of "val" fieldGuillaume Gomez-25/+25
2022-04-18Add parser testsGuillaume Gomez-6/+643
2022-04-18Update testsGuillaume Gomez-31/+81
2022-04-18Rollup merge of #96148 - marmeladema:nll-revisions-self, r=jackh726Dylan DPC-192/+360
Use revisions instead of nll compare mode for `/self/` ui tests r? ``@jackh726``
2022-04-18implement `Deref` for `Bar`Takayuki Maeda-2/+30
2022-04-18Auto merge of #95695 - the8472:vec-codegen-tests, r=Mark-Simulacrumbors-4/+63
Add codegen tests for additional cases where noop iterators get optimized away Optimizations have improved over time and now LLVM manages to optimize more in-place-collect noop-iterators to O(1) functions. This updates the codegen test to match. Many but not all cases reported in #79308 work now.
2022-04-17Add regression test for rustdoc duplicated blanket implsGuillaume Gomez-0/+14
2022-04-17Use revisions instead of nll compare mode for `/self/` ui testsmarmeladema-192/+360
2022-04-17Auto merge of #95779 - cjgillot:ast-lifetimes-undeclared, r=petrochenkovbors-172/+673
Report undeclared lifetimes during late resolution. First step in https://github.com/rust-lang/rust/pull/91557 We reuse the rib design of the current resolution framework. Specific `LifetimeRib` and `LifetimeRibKind` types are introduced. The most important variant is `LifetimeRibKind::Generics`, which happens each time we encounter something which may introduce generic lifetime parameters. It can be an item or a `for<...>` binder. The `LifetimeBinderKind` specifies how this rib behaves with respect to in-band lifetimes. r? `@petrochenkov`
2022-04-17Bless nll test.Camille GILLOT-0/+106
2022-04-17Remove extra space before a where clause in the documentationLoïc BRANSTETT-0/+17
2022-04-17Lint elided lifetimes in path on the AST.Camille GILLOT-14/+40
2022-04-17Bless tests.Camille GILLOT-158/+527
2022-04-17Auto merge of #96010 - eduardosm:Unique-on-top-of-NonNull, r=m-ou-se,tmiaskobors-19/+9
Implement `core::ptr::Unique` on top of `NonNull` Removes the use `rustc_layout_scalar_valid_range_start` and some `unsafe` blocks.
2022-04-17Auto merge of #96002 - nnethercote:speed-up-Vec-clear-2, r=m-ou-sebors-11/+0
Speed up Vec::clear(). Currently it just calls `truncate(0)`. `truncate()` is (a) not marked as `#[inline]`, and (b) more general than needed for `clear()`. This commit changes `clear()` to do the work itself. This modest change was first proposed in rust-lang#74172, where the reviewer rejected it because there was insufficient evidence that `Vec::clear()`'s performance mattered enough to justify the change. Recent changes within rustc have made `Vec::clear()` hot within `macro_parser.rs`, so the change is now clearly worthwhile. Although it doesn't show wins on CI perf runs, this seems to be because they use PGO. But not all platforms currently use PGO. Also, local builds don't use PGO, and `truncate` sometimes shows up in an over-represented fashion in local profiles. So local profiling will be made easier by this change. Note that this will also benefit `String::clear()`, because it just calls `Vec::clear()`. Finally, the commit removes the `vec-clear.rs` codegen test. It was added in #52908. From before then until now, `Vec::clear()` just called `Vec::truncate()` with a zero length. The body of Vec::truncate() has changed a lot since then. Now that `Vec::clear()` is doing actual work itself, and not just calling `Vec::truncate()`, it's not surprising that its generated code includes a load and an icmp. I think it's reasonable to remove this test. r? `@m-ou-se`
2022-04-17show suggestion to replace generic bounds with associated types in more casesRobin Appelman-10/+33
2022-04-17Rollup merge of #96112 - niluxv:strict-provenance-lint-improvements, r=nagisaDylan DPC-4/+39
Strict provenance lint diagnostics improvements Use `multipart_suggestion` instead of `span_suggestion` and getting a snippet for the expression. Also don't suggest unnecessary parenthesis in `lossy_provenance_casts`. cc ``@estebank`` ``@rustbot`` label A-diagnostics
2022-04-17Rollup merge of #95346 - Aaron1011:stablize-const-extern-fn, r=pnkfelixDylan DPC-52/+19
Stablize `const_extern_fn` for "Rust" and "C" All other ABIs are left unstable for now. cc #64926
2022-04-16Rollup merge of #95006 - tmiasko:thread-local-static, r=wesleywiserDylan DPC-0/+68
Reject `#[thread_local]` attribute on non-static items
2022-04-16Rollup merge of #94985 - dtolnay:constattr, r=pnkfelixDylan DPC-0/+9
Parse inner attributes on inline const block According to https://github.com/rust-lang/rust/pull/84414#issuecomment-826150936, inner attributes are intended to be supported *"in all containers for statements (or some subset of statements)"*. This PR adds inner attribute parsing and pretty-printing for inline const blocks (https://github.com/rust-lang/rust/issues/76001), which contain statements just like an unsafe block or a loop body. ```rust let _ = const { #![allow(...)] let x = (); x }; ```