Commit Graph

100514 Commits

Author SHA1 Message Date
Tyler Mandry
2a9bd75994
Rollup merge of #64690 - petrochenkov:mixed, r=dtolnay
proc_macro API: Expose `macro_rules` hygiene

Proc macros do not have direct access to our oldest and most stable hygiene kind - `macro_rules` hygiene.

To emulate it macro authors have to go through two steps - first generate a temporary `macro_rules` item (using a derive, at least until https://github.com/rust-lang/rust/pull/64035 is merged), then generate a macro call to that item. Popular crates like [proc_macro_hack](https://crates.io/crates/proc-macro-hack) use this trick to generate hygienic identifiers from proc macros.

I'd say that these workarounds with nested macro definitions have more chances to hit some corner cases in our hygiene system, in which we don't have full confidence.
So, let's provide a direct access to `macro_rules` hygiene instead.

This PR does that by adding a new method `Span::mixed_site` (bikeshedding is welcome) in addition to existing `Span::call_site` (stable) and `Span::def_site` (unstable).
Identifiers with this span resolve at def-site in for local variables, labels and `$crate`, and resolve at call-site for everything else, i.e. exactly like identifiers produced by `macro_rules`.

This API addition opens the way to stabilizing proc macros in expression positions (https://github.com/rust-lang/rust/issues/54727), for which use of call-site hygiene or workarounds with temporary items would be quite unfortunate.
(`macro_rules` expanded in expression position, on the other hand, are stable since 1.0 and widely used.)

r? @dtolnay @alexcrichton
2019-10-03 16:25:39 -07:00
Tyler Mandry
da0afc1638
Rollup merge of #64675 - Centril:deprecate-plugin, r=oli-obk
Deprecate `#![plugin]` & `#[plugin_registrar]`

This PR deprecates `#![plugin]` and `#[plugin_registrar]`.

~A removal deadline is set: 1.44.0. This will be in 9 months from now and should give everyone who is still relying on the feature ample time to rid themselves of this dependency.~

cc https://github.com/rust-lang/rust/issues/29597

r? @Mark-Simulacrum
2019-10-03 16:25:37 -07:00
Tyler Mandry
f7ee31e3d7
Rollup merge of #61879 - stjepang:stabilize-todo, r=withoutboats
Stabilize todo macro

The `todo!` macro is just another name for `unimplemented!`.

Tracking issue: https://github.com/rust-lang/rust/issues/59277

This PR needs a FCP to merge.

r? @withoutboats
2019-10-03 16:25:35 -07:00
Dylan MacKenzie
1cda591314 Bless test 2019-10-03 15:51:11 -07:00
Vadim Petrochenkov
68aadcb2ae metadata: Remove unused Option from fn dlsym_proc_macros 2019-10-04 01:12:29 +03:00
Vadim Petrochenkov
0f96ba92b6 metadata: Remove CrateMetadata::name
It duplicates `CrateRoot::name`
2019-10-04 01:12:29 +03:00
Vadim Petrochenkov
f13adc5f9d metadata: Remove CrateMetadata::host_lib
It was only used for retreiving edition, which was a bug.
In case of dual proc macros the edition should be taken from the target crate version, like any other metadata.
2019-10-04 01:12:29 +03:00
Vadim Petrochenkov
92386a7ff3 metadata: Simplify interface of resolve_crate 2019-10-04 01:12:29 +03:00
Vadim Petrochenkov
33c9ada800 metadata: Remove locator::Context::ident
It's a crate name after renaming, so it's entirely irrelevant to crate loading
2019-10-04 01:12:29 +03:00
Vadim Petrochenkov
acd102aebf metadata: Do not pass crate name after renaming to register_crate
It's entirely irrelevant to crate loading
2019-10-04 01:12:28 +03:00
Vadim Petrochenkov
b507971119 metadata: Remove CrateMetadata::imported_name
It's entirely irrelevant to crate loading
2019-10-04 01:12:28 +03:00
Dylan MacKenzie
4d9b4b4769 Remove borrowck_graphviz_postflow from test 2019-10-03 14:24:52 -07:00
Esteban Küber
02f57f83a9 review comments 2019-10-03 13:22:18 -07:00
Esteban Küber
f1499a8646 review comments 2019-10-03 11:55:19 -07:00
Esteban Küber
dfdc369b40 review comments 2019-10-03 11:55:19 -07:00
Esteban Küber
d27683a39f Prove bad turbofish parser recovery in test 2019-10-03 11:55:19 -07:00
Esteban Küber
d7dceaa0c5 Account for missing turbofish in paths too 2019-10-03 11:55:18 -07:00
Esteban Küber
6c9f298a8b review comments 2019-10-03 11:55:18 -07:00
Esteban Küber
ed60cf2475 When encountering chained operators use heuristics to recover from bad turbofish 2019-10-03 11:55:18 -07:00
Felix S. Klock II
e443e1bdf9 Regression tests.
Update: incorporate review feedback.
2019-10-03 20:21:55 +02:00
Niko Matsakis
1fcbd902a1
Update triagebot.toml
Co-Authored-By: Pietro Albini <pietro@pietroalbini.org>
2019-10-03 12:37:31 -04:00
Niko Matsakis
1222cc98ad
permit asyncawait-ondeck to be added by anyone
Still debating if this is the right approach
2019-10-03 12:31:06 -04:00
bors
032a53a06c Auto merge of #64938 - estebank:ice-ice-baby, r=matthewjasper
Avoid ICE on ReFree region on where clause

Fix #64855.
2019-10-03 16:14:32 +00:00
Santiago Pastorino
b9ed64268d
Make visit_projection iterative 2019-10-03 11:19:26 -03:00
Ben Boeckel
126bf3b1dd typo: fix typo in E0392
See #64931.
2019-10-03 09:22:29 -04:00
bors
cfb6d84720 Auto merge of #64999 - nikomatsakis:issue-60424-async-return-inference, r=cramertj
extract expected return type for async fn generators

Fixes #60424

cc @Centril, I know you've been eager to see this fixed.

r? @cramertj
2019-10-03 12:19:21 +00:00
Guillaume Gomez
1d49f9a10a update ui tests 2019-10-03 14:11:39 +02:00
Guillaume Gomez
e86af1bbeb Add long error explanation for E0556 2019-10-03 14:11:31 +02:00
Felix S. Klock II
a18d424c48 Allocate a new diagnostic for defaulted type parameters cannot use Self
(Without this commit, you still get an error (a very similar one, at
that), but it complains about use of forward declaration, which is
confusing since people do not necessarily think of `Self` as being
declared at all.)

Update: incorporate review feedback.
2019-10-03 13:54:27 +02:00
Felix S. Klock II
3a4921cde1 The crux of the bug fix.
Update: review feedback
Update: placate tidy
2019-10-03 13:54:07 +02:00
csmoe
9b91bef78b generate ClosureSubsts from SubstsRef 2019-10-03 19:24:59 +08:00
Niko Matsakis
4396a1ccd4 add regression test for #60218 2019-10-03 05:59:18 -04:00
Felix S Klock II
71e5f78934
Update issue-64655-extern-rust-must-allow-unwind.rs
placate tidy
2019-10-03 11:10:13 +02:00
Felix S Klock II
5e7e8cd41f
Update attributes.rs
Some comment refinements inspired by review feedback.
2019-10-03 11:08:28 +02:00
Felix S Klock II
e7e6dec06a
Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Co-Authored-By: Ralf Jung <post@ralfj.de>
2019-10-03 10:46:01 +02:00
Vadim Petrochenkov
d1310dc6c9 proc_macro: Add Span::mixed_site exposing macro_rules hygiene 2019-10-03 11:28:06 +03:00
Niko Matsakis
a807032f9e ./x.py test --bless --compare-mode=nll 2019-10-03 04:20:51 -04:00
Martin Habovštiak
00d9db14f7
Added doc about behavior of extend on HashMap
It was unclear what the implementation does when it encounters existing keys. This change makes it clear by documenting the trait impl.
2019-10-03 10:09:04 +02:00
Mazdak Farrokhzad
d1f95ef3c5 --bless ui-fulldeps tests 2019-10-03 09:33:28 +02:00
Shotaro Yamada
375469149c Reorder methods of Cell
To make `new` method appear first in documentation.
2019-10-03 15:24:00 +09:00
bors
0221e26562 Auto merge of #65045 - Centril:rollup-djvi539, r=Centril
Rollup of 2 pull requests

Successful merges:

 - #64941 (Inline `{min,max}_value` even in debug builds)
 - #65002 (Update llvm-project submodule)

Failed merges:

r? @ghost
2019-10-03 06:05:08 +00:00
Mazdak Farrokhzad
64ac499db5
Rollup merge of #65002 - alexcrichton:update-lvlm, r=nikic
Update llvm-project submodule

Bring in rust-lang/llvm-project#24 which brings in some wasm
improvements related to the bulk-memory proposal
2019-10-03 08:04:34 +02:00
Mazdak Farrokhzad
b131230c3b
Rollup merge of #64941 - lzutao:inline-max_min_value, r=nnethercote
Inline `{min,max}_value` even in debug builds

I think it is worth to inline `{min,max}_value` even in debug builds.
See this godbolt link: https://godbolt.org/z/-COkVS
2019-10-03 08:04:33 +02:00
Mazdak Farrokhzad
1b8ec975fc plugin_registrary: use normal deprecation instead of hard coded warning. 2019-10-03 07:03:01 +02:00
Mazdak Farrokhzad
287ceed469 Deprecate #![plugin] and #[plugin_registrar]. 2019-10-03 06:46:52 +02:00
Santiago Pastorino
a8d70d1b4a
Add visit_projection_elem method to visitors 2019-10-03 00:54:45 -03:00
Andreas Molzer
334bafebc9 Document current deny by default lints 2019-10-03 04:46:24 +02:00
bors
c6293e3598 Auto merge of #65038 - Centril:rollup-m83dpfh, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #63678 (Improve HRTB error span when -Zno-leak-check is used)
 - #64931 (Reword E0392 slightly)
 - #64959 (syntax: improve parameter without type suggestions)
 - #64975 (Implement Clone::clone_from for LinkedList)
 - #64993 (BacktraceStatus: add Eq impl)
 - #64998 (Filter out RLS output directories on tidy runs)
 - #65010 (Compare `primary` with maximum of `children`s' line num instead of dropping it)

Failed merges:

r? @ghost
2019-10-03 02:08:53 +00:00
Mazdak Farrokhzad
d5a0765f44
Rollup merge of #65010 - AnthonyMikh:fix_65001, r=estebank
Compare `primary` with maximum of `children`s' line num instead of dropping it

Fix #65001.
2019-10-03 04:08:19 +02:00
Mazdak Farrokhzad
4ea2be751c
Rollup merge of #64998 - spastorino:filter-rls-on-tidy, r=petrochenkov
Filter out RLS output directories on tidy runs

Closes #64957

r? @petrochenkov
2019-10-03 04:08:18 +02:00