Commit Graph

166839 Commits

Author SHA1 Message Date
Nicholas Nethercote
b1e6dee596 Merge TokenCursor::{next,next_desugared}.
And likewise for the inlined variants.

I did this for simplicity, but interesting it was a performance win as
well.
2022-04-19 17:02:48 +10:00
Nicholas Nethercote
89ec75b0e9 Inline and remove Parser::next_tok().
It has a single call site.
2022-04-19 17:02:48 +10:00
Nicholas Nethercote
aefbbeec34 Inline and remove TokenTree::{open_tt,close_tt}.
They both have a single call site.
2022-04-19 17:02:48 +10:00
Nicholas Nethercote
ad566b78f2 Tweak Cursor::next_with_spacing.
This makes it more like `CursorRef::next_with_spacing`. There is no
performance effect, just a consistency improvement.
2022-04-19 17:02:48 +10:00
Chris Morgan
0255398ff7 Improve AddrParseError description
The existing description was incorrect for socket addresses, and
misleading: users would see “invalid IP address syntax” and suppose they
were supposed to provide an IP address rather than a socket address.

I contemplated making it two variants (IP, socket), but realised we can
do still better for the IPv4 and IPv6 types, so here it is as six.

I contemplated more precise error descriptions (e.g. “invalid IPv6
socket address syntax: expected a decimal scope ID after %”), but that’s
a more invasive change, and probably not worthwhile anyway.
2022-04-19 13:02:20 +10:00
bors
e2661bac6d Auto merge of #95379 - icewind1991:suggest-associated-type-more, r=jackh726
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-19 01:59:35 +00:00
Joshua Nelson
b4ca06558a Remove assertion that all paths in ShouldRun exist
This breaks on submodules (see #96188). Disable the assertion for now until I can think of a proper
fix.

This doesn't revert any of the changes in `Step`s themselves, only what
`ShouldRun::paths` does.
2022-04-18 20:21:19 -05:00
bors
d5ae66c12c Auto merge of #92287 - JulianKnodt:slice_remainder, r=yaahc
Add slice::remainder

This adds a remainder function to the Slice iterator, so that a caller can access unused
elements if iteration stops.

Addresses #91733
2022-04-18 23:34:24 +00:00
Guillaume Gomez
8d0e10cfbe Correctly handle single : 2022-04-18 23:11:42 +02:00
bors
311e2683e1 Auto merge of #96171 - nikic:llvm-update-2, r=cuviper
Update LLVM submodule

Merge upstream release/14.x branch.

Fixes #94762.
2022-04-18 20:53:42 +00:00
Guillaume Gomez
5c6c1e110f Add test to ensure that keywords in path are working 2022-04-18 21:43:19 +02:00
Guillaume Gomez
299e8ee25e Add an extra check over filter type 2022-04-18 21:43:19 +02:00
Guillaume Gomez
d7d538a8c4 Fix some corner cases 2022-04-18 20:59:09 +02:00
Guillaume Gomez
da363b2fc9 Add more tests for quote errors 2022-04-18 20:59:09 +02:00
Guillaume Gomez
6f35475ba5 Parse idents the same way in both quote string elements and "normal" elements 2022-04-18 20:59:09 +02:00
Guillaume Gomez
a6051c76db Remove unnecessary elem.name.length === 0 since the rustdoc search eBNF does not allow elements without a name 2022-04-18 20:59:09 +02:00
Guillaume Gomez
ab9cf32131 Add tests for paths 2022-04-18 20:59:09 +02:00
Guillaume Gomez
51b4005003 Update the eBNF to allow generics bracket to not be closed if it's EOF 2022-04-18 20:59:09 +02:00
Guillaume Gomez
e03a950747 Handle separators in their own functions and fix missing handling of tabs 2022-04-18 20:59:09 +02:00
Guillaume Gomez
da829d8d9d Improve the BNF description a bit and fix some issues 2022-04-18 20:59:09 +02:00
Guillaume Gomez
1f5c4c2b30 Forbid rustdoc search query to end with -> 2022-04-18 20:59:09 +02:00
Guillaume Gomez
8e29ed43d9 Add isIdentCharacter function to ensure that unexpected characters are handled correctly 2022-04-18 20:59:09 +02:00
Guillaume Gomez
f9251eef68 Replace unneeded use of regex with a simple if 2022-04-18 20:59:09 +02:00
Guillaume Gomez
699ae365df Apply suggestions:
* 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-18 20:59:09 +02:00
Guillaume Gomez
c7de1a16f8 Improve documentation and add some explanations in the code 2022-04-18 20:59:09 +02:00
Guillaume Gomez
49297337b4 Simplify parser syntax 2022-04-18 20:59:08 +02:00
Guillaume Gomez
99d552092c Make query parser more strict and improve display of errors 2022-04-18 20:59:08 +02:00
Guillaume Gomez
264064df36 * Greatly improve the rustdoc search parser source code
* Move all functions outside parseQuery
2022-04-18 20:59:08 +02:00
Guillaume Gomez
99c5394ecc Add query syntax for the parser 2022-04-18 20:59:08 +02:00
Guillaume Gomez
51de26cfd9 * If type filter is in quotes, throw an error.
* If there are generics, don't allow to have quotes.
2022-04-18 20:59:08 +02:00
Guillaume Gomez
bbcf1762dd Improve naming of "val" field 2022-04-18 20:59:08 +02:00
Guillaume Gomez
f5833e759e Add parser tests 2022-04-18 20:59:08 +02:00
Guillaume Gomez
7cefee027a Add possibility to check parsed query 2022-04-18 20:59:08 +02:00
Guillaume Gomez
0f51652ad3 Update tests 2022-04-18 20:59:08 +02:00
Guillaume Gomez
3aeef67037 Update search engine and parser to error when quotes are used on queries with more than one element. 2022-04-18 20:59:08 +02:00
Guillaume Gomez
be41750a10 Greatly improve rustdoc search 2022-04-18 20:59:08 +02:00
bors
8305398d7a Auto merge of #96178 - Dylan-DPC:rollup-6z8pcob, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #96032 (Update books)
 - #96136 (Reword clarification on lifetime for ptr->ref safety docs)
 - #96143 (Fix snapshot --bless not working anymore in htmldocck)
 - #96148 (Use revisions instead of nll compare mode for `/self/` ui tests)
 - #96156 (Replace u8to64_le macro with u64::from_le_bytes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-04-18 18:29:46 +00:00
Ralf Jung
55f0977a6b remove an unnecessary use of loc_place.ptr.into_pointer_or_addr 2022-04-18 12:47:38 -04:00
Ralf Jung
c83241a7f9 avoid an unnecessary call to Pointer::into_parts, and caution against into_pointer_or_addr 2022-04-18 12:30:17 -04:00
Ralf Jung
3236092503 add method to get absolute address of a pointer (useful only for Miri) 2022-04-18 12:30:17 -04:00
Dylan DPC
55e399771e
Rollup merge of #96156 - est31:use_from_le_bytes, r=Dylan-DPC
Replace u8to64_le macro with u64::from_le_bytes

The macro was a reimplementation of the function.
2022-04-18 18:22:07 +02:00
Dylan DPC
97d016eefd
Rollup merge of #96148 - marmeladema:nll-revisions-self, r=jackh726
Use revisions instead of nll compare mode for `/self/` ui tests

r? ``@jackh726``
2022-04-18 18:22:06 +02:00
Dylan DPC
9c1c8b2dff
Rollup merge of #96143 - Urgau:rustdoc-fix-snapshot-bless, r=GuillaumeGomez
Fix snapshot --bless not working anymore in htmldocck

I broke it in https://github.com/rust-lang/rust/pull/95933

r? ```@GuillaumeGomez```
2022-04-18 18:22:05 +02:00
Dylan DPC
a6ad1394f3
Rollup merge of #96136 - thomcc:lifetime-wording, r=RalfJung
Reword clarification on lifetime for ptr->ref safety docs

I believe the current wording of the safety comment is somewhat misleading, and that this is more accurate. Suggested by `@CAD97` in this thread on the topic https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/Lifetime.20of.20reference.20pointer.20docs.20issue

Just to check that this is correct, CC `@RalfJung.`

I suppose it's open for interpretation as to whether or not this is more clear. I think it is.
2022-04-18 18:22:04 +02:00
Dylan DPC
718b1843ee
Rollup merge of #96032 - ehuss:update-books, r=ehuss
Update books

## nomicon

1 commits in 11f1165e8a2f5840467e748c8108dc53c948ee9a..c7d8467ca9158da58ef295ae65dbf00a308752d9
2022-03-19 16:02:00 -0400 to 2022-04-06 14:26:54 +0900
- Change "writers" to "readers" for Deref. (rust-lang/nomicon#346)

## reference

7 commits in c97d14fa6fed0baa9255432b8a93cb70614f80e3..b5f6c2362baf932db9440fbfcb509b309237ee85
2022-03-19 18:18:10 -0700 to 2022-04-10 19:19:51 -0700
- Fix typo: `?` should be inside `&lt;sup&gt;` tags (rust-lang/reference#1190)
- Update aarch64 to use neon as fp (rust-lang/reference#1184)
- Boolean literal expressions (rust-lang/reference#1189)
- Document that unary negation of a signed integer literal cannot cause an overflow error (rust-lang/reference#1188)
- Document compatibility between declarative and procedural macro tokens (rust-lang/reference#1169)
- Document native library modifier syntax and the `whole-archive` modifier specifically (rust-lang/reference#1170)
- Numeric literal expressions and literal suffixes (rust-lang/reference#1177)

## book

8 commits in ea90bbaf53ba64ef4e2da9ac2352b298aec6bec8..765318b844569a642ceef7bf1adab9639cbf6af3
2022-03-28 21:59:34 -0400 to 2022-04-12 21:14:47 -0400
- Propagate nostarch edits to src
- Propagate updated test example code to nostarch snapshot
- Edits to nostarch edits
- edits from nostarch
- Fix error message for the example code
- update ch13-02 to reflect changes in rust-lang/book#2797
- Update to 1.59
- Edits to chapter 2 after tech review

## rust-by-example

4 commits in ec954f35eedf592cd173b21c05a7f80a65b61d8a..c2a98d9fc5d29c481d42052fbeccfde15ed03116
2022-03-22 11:09:06 -0300 to 2022-04-08 06:44:18 -0300
- Code highlight a variable (rust-lang/rust-by-example#1530)
- Add a comment to note that warnings may not be shown in a browser in the Variable Bindings section (rust-lang/rust-by-example#1529)
- Make all new types have UpperCamelCase names in code example in the Aliasing section (rust-lang/rust-by-example#1528)
- Replace `C` with C/C++ (rust-lang/rust-by-example#1527)

## rustc-dev-guide

6 commits in 155126b1d2e2cb01ddb1d7ba9489b90d7cd173ad..eeb5a83c15b6ae60df3e4f19207376b22c6fbc4c
2022-03-22 14:34:21 +0100 to 2022-04-11 23:29:48 +0900
- method-lookup.md improvements (rust-lang/rustc-dev-guide#1296)
- Consolidate crates.io convention section (rust-lang/rustc-dev-guide#1326)
- Update examples with 1.61.0-nightly (latest version) (rust-lang/rustc-dev-guide#1330)
- r-a: Use `python3 x.py` instead of `./x.py` (rust-lang/rustc-dev-guide#1335)
- Update miri.md: correct a minor typo (rust-lang/rustc-dev-guide#1334)
- Add example how lints can be feature gated
2022-04-18 18:22:04 +02:00
bors
0516711ab0 Auto merge of #95906 - jyn514:enforce-valid-paths, r=Mark-Simulacrum
Require all paths passed to `ShouldRun::paths` to exist on disk

This has two benefits:
1. There is a clearer mental model of how bootstrap works. Steps correspond to paths on disk unless it's strictly impossible for them to do so (e.g. dist components).
2. Bootstrap has better checks for internal consistency. This caught several issues:
  - `src/sanitizers` doesn't exist; I changed it to just be a `sanitizers` alias.
  - `src/tools/lld` doesn't exist; I removed it, since `lld` alone already works.
  - `src/llvm` doesn't exist; removed it since `llvm` and `src/llvm-project` both work.
  - `src/lldb_batchmode.py` doesn't exist, it was moved to `src/etc`.
  - `install` was still using `src/librustc` instead of `compiler/rustc`.
  - None of the tools in `dist` / `install` allowed using `src/tools/X` to build them. This might be intentional - I can change them to aliases if you like.

Builds on https://github.com/rust-lang/rust/pull/95901 and should not be merged before.
2022-04-18 16:06:44 +00:00
Ralf Jung
c9e568f72e avoid pairing up AllocId and PointerTag, which is redundant 2022-04-18 10:14:06 -04:00
bors
6fd7e9010d Auto merge of #96042 - m-ou-se:one-reentrant-mutex, r=Amanieu
Use a single ReentrantMutex implementation on all platforms.

This replaces all platform specific ReentrantMutex implementations by the one I added in #95727 for Linux, since that one does not depend on any platform specific details.

r? `@Amanieu`
2022-04-18 12:15:39 +00:00
Mara Bos
94f00e396a Remove forgotten reexport of ReentrantMutex in sys::unsupported. 2022-04-18 13:10:36 +02:00
bors
491f619f56 Auto merge of #96080 - nikic:ranlib, r=Mark-Simulacrum
Respect ranlib specified for target during LLVM build

The ranlib specified for the target was never actually transferred
into the builder configuration. In the dist-x86_64-linux build we
ended up using ranlib instead of llvm-ranlib.

Found this investigating a build failure in #94214.
2022-04-18 09:58:22 +00:00