]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMerge #7945
bors[bot] [Tue, 9 Mar 2021 17:25:23 +0000 (17:25 +0000)]
Merge #7945

7945: Future proof completion scores r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoFuture proof completion scores
Aleksey Kladov [Tue, 9 Mar 2021 17:24:09 +0000 (20:24 +0300)]
Future proof completion scores

3 years agoMerge #7942
bors[bot] [Tue, 9 Mar 2021 16:23:51 +0000 (16:23 +0000)]
Merge #7942

7942: Show whether a binding is mutable or not on hover r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoShow whether a binding is mutable or not on hover
Lukas Wirth [Tue, 9 Mar 2021 15:33:41 +0000 (16:33 +0100)]
Show whether a binding is mutable or not on hover

3 years agoMerge #7944
bors[bot] [Tue, 9 Mar 2021 16:05:23 +0000 (16:05 +0000)]
Merge #7944

7944: Selecting `&mut foo` completion now actually inserts `&mut` r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoSelecting `&mut foo` completion now actually inserts `&mut`
Aleksey Kladov [Tue, 9 Mar 2021 16:04:27 +0000 (19:04 +0300)]
Selecting `&mut foo` completion now actually inserts `&mut`

3 years agoDon't show const items initializer expressions on hover
Lukas Wirth [Tue, 9 Mar 2021 15:33:23 +0000 (16:33 +0100)]
Don't show const items initializer expressions on hover

3 years agoCleanup auto-ref in completion
Aleksey Kladov [Tue, 9 Mar 2021 15:06:08 +0000 (18:06 +0300)]
Cleanup auto-ref in completion

3 years agoMerge #7941
bors[bot] [Tue, 9 Mar 2021 14:54:24 +0000 (14:54 +0000)]
Merge #7941

7941: Fix unused definitions not being document highlit r=Veykril a=Veykril

Fixes #7939

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #7940
bors[bot] [Tue, 9 Mar 2021 14:46:10 +0000 (14:46 +0000)]
Merge #7940

7940: Cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoFix unused definitions not being document highlit
Lukas Wirth [Tue, 9 Mar 2021 14:45:31 +0000 (15:45 +0100)]
Fix unused definitions not being document highlit

3 years agoCleanup
Aleksey Kladov [Tue, 9 Mar 2021 14:44:27 +0000 (17:44 +0300)]
Cleanup

3 years agoCleanup
Aleksey Kladov [Tue, 9 Mar 2021 14:42:05 +0000 (17:42 +0300)]
Cleanup

3 years agoFix bad names
Aleksey Kladov [Tue, 9 Mar 2021 14:39:22 +0000 (17:39 +0300)]
Fix bad names

`res` should only be used for the result variable

3 years agoMerge #7873 #7933
bors[bot] [Tue, 9 Mar 2021 11:58:48 +0000 (11:58 +0000)]
Merge #7873 #7933

7873: Consider unresolved qualifiers during flyimport r=matklad a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/7679

Takes unresolved qualifiers into account, providing better completions (or none, if the path is resolved or do not match).

Does not handle cases when both path qualifier and some trait has to be imported: there are many extra issues with those (such as overlapping imports, for instance) that will require large diffs to address.

Also does not do a fuzzy search on qualifier, that requires some adjustments in `import_map` for better queries and changes to the default replace range which also seems relatively big to include here.

![qualifier_completion](https://user-images.githubusercontent.com/2690773/110040808-0af8dc00-7d4c-11eb-83db-65af94e843bb.gif)

7933: Improve compilation speed r=matklad a=matklad

bors r+
🤖

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoImprove compilation speed
Aleksey Kladov [Tue, 9 Mar 2021 11:54:50 +0000 (14:54 +0300)]
Improve compilation speed

3 years agoMerge #7932
bors[bot] [Tue, 9 Mar 2021 11:48:08 +0000 (11:48 +0000)]
Merge #7932

7932: Make code less surprising r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMake code less surprising
Aleksey Kladov [Tue, 9 Mar 2021 11:43:05 +0000 (14:43 +0300)]
Make code less surprising

Theres no reason to have literal `\n\n` in the source code

3 years agoMerge #7931
bors[bot] [Tue, 9 Mar 2021 11:36:40 +0000 (11:36 +0000)]
Merge #7931

7931: Use `Type::new_with_resolver_inner` more r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoUse `Type::new_with_resolver_inner` more
Jonas Schievink [Tue, 9 Mar 2021 11:31:16 +0000 (12:31 +0100)]
Use `Type::new_with_resolver_inner` more

3 years agoMerge #7927
bors[bot] [Tue, 9 Mar 2021 11:22:37 +0000 (11:22 +0000)]
Merge #7927

7927: Add more documentation for rustc_private r=matklad a=jyn514

Co-authored-by: Joshua Nelson <jyn514@gmail.com>
3 years agoMerge #7928
bors[bot] [Tue, 9 Mar 2021 11:13:17 +0000 (11:13 +0000)]
Merge #7928

7928: Add completion to turn x.err into Err(x) r=matklad a=duongdominhchau

PR for issue #7925

Co-authored-by: Duong Do Minh Chau <duongdominhchau@gmail.com>
3 years agoFix format
Duong Do Minh Chau [Tue, 9 Mar 2021 09:38:07 +0000 (16:38 +0700)]
Fix format

3 years agoMerge #7930
bors[bot] [Tue, 9 Mar 2021 09:03:07 +0000 (09:03 +0000)]
Merge #7930

7930: Clarify that all caps are experimental r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoClarify that all caps are experimental
Aleksey Kladov [Tue, 9 Mar 2021 09:02:20 +0000 (12:02 +0300)]
Clarify that all caps are experimental

3 years agoAdd trailing commas
Duong Do Minh Chau [Tue, 9 Mar 2021 09:00:06 +0000 (16:00 +0700)]
Add trailing commas

3 years agoUpdate the test to match the change
Duong Do Minh Chau [Tue, 9 Mar 2021 08:48:53 +0000 (15:48 +0700)]
Update the test to match the change

3 years agoAdd completion to turn x.err into Err(x)
Duong Do Minh Chau [Tue, 9 Mar 2021 08:36:41 +0000 (15:36 +0700)]
Add completion to turn x.err into Err(x)

3 years agoMerge #7898
bors[bot] [Mon, 8 Mar 2021 22:51:04 +0000 (22:51 +0000)]
Merge #7898

7898: generate_function assist: infer return type r=JoshMcguigan a=JoshMcguigan

This PR makes two changes to the generate function assist:

1. Attempt to infer an appropriate return type for the generated function
2. If a return type is inferred, and that return type is not unit, don't render the snippet

```rust
fn main() {
    let x: u32 = foo$0();
    //              ^^^ trigger the assist to generate this function
}

// BEFORE
fn foo() ${0:-> ()} {
    todo!()
}

// AFTER (only change 1)
fn foo() ${0:-> u32} {
    todo!()
}

// AFTER (change  1 and 2, note the lack of snippet around the return type)
fn foo() -> u32 {
    todo!()
}
```

These changes are made as two commits, in case we want to omit change 2. I personally feel like it is a nice change, but I could understand there being some opposition.

#### Pros of change 2
If we are able to infer a return type, and especially if that return type is not the unit type, the return type is almost as likely to be correct as the argument names/types. I think this becomes even more true as people learn how this feature works.

#### Cons of change 2

We could never be as confident about the return type as we are about the function argument types, so it is more likely a user will want to change that. Plus it is a confusing UX to sometimes have the cursor highlight the return type after triggering this assist and sometimes not have that happen.

#### Why omit unit type?

The assumption is that if we infer the return type as unit, it is likely just because of the current structure of the code rather than that actually being the desired return type. However, this is obviously just a heuristic and will sometimes be wrong. But being wrong here just means falling back to the exact behavior that existed before this PR.

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
3 years agogenerate_function assist don't render snippet if ret type inferred
Josh Mcguigan [Sat, 6 Mar 2021 22:29:45 +0000 (14:29 -0800)]
generate_function assist don't render snippet if ret type inferred

3 years agoBetter strip turbofishes
Kirill Bulatov [Mon, 8 Mar 2021 12:59:54 +0000 (14:59 +0200)]
Better strip turbofishes

3 years agoAdd rustdocs and use better names
Kirill Bulatov [Mon, 8 Mar 2021 12:09:20 +0000 (14:09 +0200)]
Add rustdocs and use better names

3 years agoLess lifetines: derive SemanticsScope in place
Kirill Bulatov [Sun, 7 Mar 2021 22:25:45 +0000 (00:25 +0200)]
Less lifetines: derive SemanticsScope in place

3 years agoRebase leftovers
Kirill Bulatov [Sun, 7 Mar 2021 09:58:43 +0000 (11:58 +0200)]
Rebase leftovers

3 years agoCleanup
Kirill Bulatov [Thu, 4 Mar 2021 22:29:39 +0000 (00:29 +0200)]
Cleanup

3 years agoRestrict fuzzy qualifiers for now
Kirill Bulatov [Thu, 4 Mar 2021 22:11:07 +0000 (00:11 +0200)]
Restrict fuzzy qualifiers for now

3 years agoTest for fuzzy unresolved path maatch
Kirill Bulatov [Wed, 3 Mar 2021 22:10:20 +0000 (00:10 +0200)]
Test for fuzzy unresolved path maatch

3 years agoEnforce the located imports' order
Kirill Bulatov [Wed, 3 Mar 2021 21:59:56 +0000 (23:59 +0200)]
Enforce the located imports' order

3 years agoFix the completion labels and tests
Kirill Bulatov [Wed, 3 Mar 2021 21:55:21 +0000 (23:55 +0200)]
Fix the completion labels and tests

3 years agoWork towards better import labels
Kirill Bulatov [Tue, 2 Mar 2021 23:26:53 +0000 (01:26 +0200)]
Work towards better import labels

3 years agoProfile import_assets better
Kirill Bulatov [Mon, 1 Mar 2021 12:27:07 +0000 (14:27 +0200)]
Profile import_assets better

3 years agoUpdate the docs
Kirill Bulatov [Mon, 1 Mar 2021 12:14:24 +0000 (14:14 +0200)]
Update the docs

3 years agoSimplify
Kirill Bulatov [Mon, 1 Mar 2021 11:55:47 +0000 (13:55 +0200)]
Simplify

3 years agoRefactor the import location
Kirill Bulatov [Sun, 28 Feb 2021 22:05:22 +0000 (00:05 +0200)]
Refactor the import location

3 years agoDo not propose already imported imports
Kirill Bulatov [Sun, 28 Feb 2021 08:32:15 +0000 (10:32 +0200)]
Do not propose already imported imports

3 years agoProperly handle turbofishes in qualifiers
Kirill Bulatov [Sun, 28 Feb 2021 07:57:54 +0000 (09:57 +0200)]
Properly handle turbofishes in qualifiers

3 years agoFix some tests
Kirill Bulatov [Wed, 24 Feb 2021 23:53:59 +0000 (01:53 +0200)]
Fix some tests

3 years agoReturn more data about located imports
Kirill Bulatov [Wed, 24 Feb 2021 23:06:31 +0000 (01:06 +0200)]
Return more data about located imports

3 years agoDraft the qualifier import resolution
Kirill Bulatov [Tue, 23 Feb 2021 23:20:00 +0000 (01:20 +0200)]
Draft the qualifier import resolution

3 years agoFilter out path items by the qualifier
Kirill Bulatov [Sun, 21 Feb 2021 22:51:13 +0000 (00:51 +0200)]
Filter out path items by the qualifier

3 years agoSimplify
Kirill Bulatov [Sun, 21 Feb 2021 21:52:29 +0000 (23:52 +0200)]
Simplify

3 years agoFind the code to change
Kirill Bulatov [Sat, 20 Feb 2021 22:14:27 +0000 (00:14 +0200)]
Find the code to change

3 years agoTest and initial refactoring
Kirill Bulatov [Sat, 20 Feb 2021 21:32:21 +0000 (23:32 +0200)]
Test and initial refactoring

3 years agoAdd more documentation for rustc_private
Joshua Nelson [Mon, 8 Mar 2021 21:56:42 +0000 (16:56 -0500)]
Add more documentation for rustc_private

3 years agoMerge #7924
bors[bot] [Mon, 8 Mar 2021 21:19:31 +0000 (21:19 +0000)]
Merge #7924

7924: Use upstream cov-mark r=matklad a=lnicola

Closes #7922

But doesn't remove any dependency, unfortunately.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoUse upstream cov-mark
Laurențiu Nicola [Mon, 8 Mar 2021 20:19:44 +0000 (22:19 +0200)]
Use upstream cov-mark

3 years agoMerge #7923
bors[bot] [Mon, 8 Mar 2021 19:16:05 +0000 (19:16 +0000)]
Merge #7923

7923: Remove useless code_model indirection r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoHygiene is an internal implementation detail of the compiler
Aleksey Kladov [Mon, 8 Mar 2021 19:14:52 +0000 (22:14 +0300)]
Hygiene is an internal implementation detail of the compiler

3 years agoRemove useless code_model indirection
Aleksey Kladov [Mon, 8 Mar 2021 19:08:30 +0000 (22:08 +0300)]
Remove useless code_model indirection

3 years agoMerge #7918
bors[bot] [Mon, 8 Mar 2021 18:52:08 +0000 (18:52 +0000)]
Merge #7918

7918: Generalize file ensuring infrastructure r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMinor
Aleksey Kladov [Mon, 8 Mar 2021 18:49:25 +0000 (21:49 +0300)]
Minor

3 years agoCleanup the error message
Aleksey Kladov [Mon, 8 Mar 2021 18:41:45 +0000 (21:41 +0300)]
Cleanup the error message

3 years agoRemove now dead code
Aleksey Kladov [Mon, 8 Mar 2021 18:39:09 +0000 (21:39 +0300)]
Remove now dead code

3 years agoUnused params
Aleksey Kladov [Mon, 8 Mar 2021 18:25:44 +0000 (21:25 +0300)]
Unused params

3 years agoMake `code generation` just work
Aleksey Kladov [Mon, 8 Mar 2021 18:13:15 +0000 (21:13 +0300)]
Make `code generation` just work

Contributors don't need to learn about `cargo xtask codegen` if `cargo
test` just does the right thing.

3 years agoUse the same name in xtask and test utils
Aleksey Kladov [Mon, 8 Mar 2021 17:22:33 +0000 (20:22 +0300)]
Use the same name in xtask and test utils

3 years agoGeneralize file ensuring infrastructure
Aleksey Kladov [Mon, 8 Mar 2021 14:20:36 +0000 (17:20 +0300)]
Generalize file ensuring infrastructure

3 years agoMake working with codegen less annoying
Aleksey Kladov [Mon, 8 Mar 2021 13:35:27 +0000 (16:35 +0300)]
Make working with codegen less annoying

We probably should look into removing `xtask codegen` altogether. The
test workflow works perfectly for package.json config.

There are two things preventing that:

* Lint completions are generated on demand.
* Docs are not committed to the repository.

3 years agoMerge #7921
bors[bot] [Mon, 8 Mar 2021 17:37:43 +0000 (17:37 +0000)]
Merge #7921

7921: Don't punish every crate with serde-json r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoDon't punish every crate with serde-json
Aleksey Kladov [Mon, 8 Mar 2021 17:27:08 +0000 (20:27 +0300)]
Don't punish every crate with serde-json

3 years agoMerge #7891
bors[bot] [Mon, 8 Mar 2021 16:51:20 +0000 (16:51 +0000)]
Merge #7891

7891: Improve handling of rustc_private r=matklad a=DJMcNab

This PR changes how `rust-analyzer` handles `rustc_private`. In particular, packages now must opt-in to using `rustc_private` in `Cargo.toml`, by adding:
```toml
[package.metadata.rust-analyzer]
rustc_private=true
```

This means that depending on crates which also use `rustc_private` will be significantly improved, since their dependencies on the `rustc_private` crates will be resolved properly.

A similar approach could be used in #6714 to allow annotating that your package uses the `test` crate, although I have not yet handled that in this PR.

Additionally, we now only index the crates which are transitive dependencies of `rustc_driver` in the `rustcSource` directory. This should not cause any change in behaviour when using `rustcSource: "discover"`, as the source used then will only be a partial clone. However, if `rustcSource` pointing at a local checkout of rustc, this should significantly improve the memory usage and lower indexing time. This is because we avoids indexing all crates in `src/tools/`, which includes `rust-analyzer` itself.

Furthermore, we also prefer named dependencies over dependencies from `rustcSource`. This ensures that feature resolution for crates which are depended on by both `rustc` and your crate uses the correct set for analysing your crate.

See also [introductory zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Fixed.20crate.20graphs.20and.20optional.20builtin.20crates/near/229086673)

I have tested this in [priroda](https://github.com/oli-obk/priroda/), and it provides a significant improvement to the development experience (once I give `miri` the required data in `Cargo.toml`)

Todo:
- [ ] Documentation

This is ready to review, and I will add documentation if this would be accepted (or if I get time to do so anyway)

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
3 years agoDocument rustc_private in metadata
Daniel McNab [Mon, 8 Mar 2021 16:47:40 +0000 (16:47 +0000)]
Document rustc_private in metadata

3 years agoNever run cargo check on the rustc source
Daniel McNab [Mon, 8 Mar 2021 16:42:18 +0000 (16:42 +0000)]
Never run cargo check on the rustc source

3 years agoOnly show directory name
Daniel McNab [Mon, 8 Mar 2021 16:41:40 +0000 (16:41 +0000)]
Only show directory name

3 years agoRevert "Support disabling rustc build scripts"
Daniel McNab [Mon, 8 Mar 2021 16:37:52 +0000 (16:37 +0000)]
Revert "Support disabling rustc build scripts"

This reverts commit ddce6bb282764692d53b719bff4c37e3512d4556.

3 years agoMerge #7920
bors[bot] [Mon, 8 Mar 2021 15:40:48 +0000 (15:40 +0000)]
Merge #7920

7920: Cargo update r=kjeremy a=kjeremy

Chalk changes just a version # bump. There are no actual commits.

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoCargo update
kjeremy [Mon, 8 Mar 2021 15:39:11 +0000 (10:39 -0500)]
Cargo update

Chalk changes just a version # bump. There are no actual commits.

3 years agoMerge #7914
bors[bot] [Mon, 8 Mar 2021 11:58:39 +0000 (11:58 +0000)]
Merge #7914

7914: Make code completion "just work" in more cases r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMake code completion "just work" in more cases
Aleksey Kladov [Mon, 8 Mar 2021 11:52:16 +0000 (14:52 +0300)]
Make code completion "just work" in more cases

3 years agoMerge #7912
bors[bot] [Mon, 8 Mar 2021 11:15:17 +0000 (11:15 +0000)]
Merge #7912

7912: Dedupe import map results r=matklad a=SomeoneToIgnore

While debugging https://github.com/rust-analyzer/rust-analyzer/issues/7902, I've found that there are some duplicates are produced during the external dependencies lookup.

I've spotted at least some of the `indexed_value.value` duplicated when typed `Arc` and requested the completions for that, so I've also deduped the `IndexedValue`'s to avoid unnecessary computations.

This helps to show `Arc` in the completion suggestions in a zero dependency project and in `hir` module, but we loose it again in the `ide` module.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
3 years agoDo not process indexed values more than once
Kirill Bulatov [Mon, 8 Mar 2021 10:06:15 +0000 (12:06 +0200)]
Do not process indexed values more than once

3 years agoDeduplicate search_dependencies results
Kirill Bulatov [Mon, 8 Mar 2021 09:48:51 +0000 (11:48 +0200)]
Deduplicate search_dependencies results

3 years agoMerge #7901
bors[bot] [Mon, 8 Mar 2021 09:41:21 +0000 (09:41 +0000)]
Merge #7901

7901: Make extension respect http proxy settings r=matklad a=kamyuentse

This patch makes vscode extension respect proxy settings when fetching release metadata and rust-analyzer binary.

Co-authored-by: Kam Y. Tse <kevin.xjy@gmail.com>
3 years agoSupport disabling rustc build scripts
Daniel McNab [Mon, 8 Mar 2021 09:05:19 +0000 (09:05 +0000)]
Support disabling rustc build scripts

3 years agoFix the comment
Daniel McNab [Sun, 7 Mar 2021 13:13:54 +0000 (13:13 +0000)]
Fix the comment

It's worse than I thought...

3 years agoExtract the large nested block into a function
Daniel McNab [Sun, 7 Mar 2021 12:59:15 +0000 (12:59 +0000)]
Extract the large nested block into a function

Also add some more detailed comments
Extract into function deleted the previous comments

3 years agoRequire opt in to rustc_private
Daniel McNab [Sun, 7 Mar 2021 12:24:20 +0000 (12:24 +0000)]
Require opt in to rustc_private

This gives the advantage that

A future extension would be to check for `feature(rustc_private)` instead

3 years agoDon't double analyse the same crate
Daniel McNab [Sun, 7 Mar 2021 11:17:14 +0000 (11:17 +0000)]
Don't double analyse the same crate

3 years agoMake extension respect http proxy settings
Kam Y. Tse [Sun, 7 Mar 2021 09:55:43 +0000 (17:55 +0800)]
Make extension respect http proxy settings

3 years agoUpdate crate graph to only use subcrates of rustc_driver
Daniel McNab [Sun, 7 Mar 2021 10:18:01 +0000 (10:18 +0000)]
Update crate graph to only use subcrates of rustc_driver

3 years agoMerge #7889
bors[bot] [Sun, 7 Mar 2021 08:24:02 +0000 (08:24 +0000)]
Merge #7889

7889: Make group imports configurable r=lnicola a=asv1

Co-authored-by: asv <asv7c2@gmail.com>
3 years agoMake group imports configurable
asv [Sat, 6 Mar 2021 11:02:26 +0000 (13:02 +0200)]
Make group imports configurable

3 years agoMerge #7895
bors[bot] [Sun, 7 Mar 2021 08:13:27 +0000 (08:13 +0000)]
Merge #7895

7895: :arrow_up: xflags r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years ago:arrow_up: xflags
Aleksey Kladov [Sat, 6 Mar 2021 20:02:06 +0000 (23:02 +0300)]
:arrow_up: xflags

3 years agoMerge #7892
bors[bot] [Sun, 7 Mar 2021 00:32:56 +0000 (00:32 +0000)]
Merge #7892

7892: Fix TokenStream::from_str for input consisting of a single group with delimiter r=edwin0cheng a=kevinmehall

TokenStream holds a `tt::Subtree` but assumes its `delimiter` is always `None`. In particular, the iterator implementation iterates over the inner `token_trees` and ignores the `delimiter`.

However, `TokenStream::from_str` violated this assumption when the input consists of a single group by producing a Subtree with an outer delimiter, which was ignored as seen by a procedural macro.

`tt::Subtree` is just `pub delimiter: Option<Delimiter>, pub token_trees: Vec<TokenTree>`, so a Subtree that is statically guaranteed not to have a delimiter is just `Vec<TokenTree>`.

Fixes #7810
Fixes #7875

Co-authored-by: Kevin Mehall <km@kevinmehall.net>
3 years agoMerge #7899
bors[bot] [Sat, 6 Mar 2021 23:21:49 +0000 (23:21 +0000)]
Merge #7899

7899: Rename a few `crate_def_map`s to `def_map` r=jonas-schievink a=jonas-schievink

These could all be block `DefMap`s instead of crate-level `DefMap`s

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoRename a few `crate_def_map`s to `def_map`
Jonas Schievink [Sat, 6 Mar 2021 23:20:13 +0000 (00:20 +0100)]
Rename a few `crate_def_map`s to `def_map`

These could all be block `DefMap`s instead of crate-level `DefMap`s

3 years agogenerate_function assist infer return type
Josh Mcguigan [Sat, 6 Mar 2021 22:03:55 +0000 (14:03 -0800)]
generate_function assist infer return type

3 years agoMerge #7896
bors[bot] [Sat, 6 Mar 2021 20:22:36 +0000 (20:22 +0000)]
Merge #7896

7896: Only replace quotes in replace_string_with_char assist r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoOnly replace quotes in replace_string_with_char assist
Lukas Wirth [Sat, 6 Mar 2021 20:21:18 +0000 (21:21 +0100)]
Only replace quotes in replace_string_with_char assist