Commit Graph

79 Commits

Author SHA1 Message Date
Josh Driver
4ecdc68153 Move MacroKind into Def::Macro 2017-02-23 20:12:33 +10:30
Josh Driver
2d91e7aab8 Refactor macro resolution errors + add derive macro suggestions 2017-02-16 22:03:15 +10:30
Jeffrey Seyfried
2cc61eebb7 Allow using inert attributes from proc_macro_derives with #![feature(proc_macro)]. 2017-02-12 07:20:04 +00:00
Jeffrey Seyfried
4b413bc393 Move legacy custom derives collection into resolver.find_attr_invoc(). 2017-02-12 03:22:52 +00:00
Josh Driver
fbdd038866 Move derive macro expansion into the MacroExpander
This removes the expand_derives function, and sprinkles
the functionality throughout the Invocation Collector,
Expander and Resolver.
2017-02-05 09:31:02 +10:30
Jeffrey Seyfried
356fa2c5db Warn on unused #[macro_use] imports. 2017-01-22 01:31:00 +00:00
Austin Bonander
375cbd20cf Implement #[proc_macro_attribute]
* Add support for `#[proc_macro]`

* Reactivate `proc_macro` feature and gate `#[proc_macro_attribute]` under it

* Have `#![feature(proc_macro)]` imply `#![feature(use_extern_macros)]`,
error on legacy import of proc macros via `#[macro_use]`
2017-01-16 22:41:22 -08:00
Vadim Petrochenkov
2092682191 resolve: Do not use "resolve"/"resolution" in error messages 2017-01-12 10:08:27 +03:00
Josh Driver
e9b5839918 Style fixes 2016-12-31 17:55:59 +10:30
Josh Driver
22f788c644 Stop macro calls in structs for proc_macro_derive from panicing 2016-12-31 17:19:23 +10:30
Jeffrey Seyfried
41f1e189ee Use DefIds instead of NodeIds for pub(restricted) visibilities. 2016-12-24 00:23:03 +00:00
bors
467a7f049b Auto merge of #38533 - jseyfried:legacy_custom_derive_deprecation, r=nrc
Allow legacy custom derive authors to disable warnings in downstream crates

This PR allows legacy custom derive authors to use a pre-deprecated method `registry.register_custom_derive()` instead of `registry.register_syntax_extension()` to avoid downstream deprecation warnings.

r? @nrc
2016-12-23 18:43:12 +00:00
Jeffrey Seyfried
c12fc66a9d Allow legacy custom derive authors to disable warnings in downstream crates. 2016-12-23 05:49:34 +00:00
Jeffrey Seyfried
f10f50b426 Refactor how global paths are represented (for both ast and hir). 2016-12-22 06:14:35 +00:00
Alex Crichton
0cf7d5dcae Merge branch 'rfc_1560_warning_cycle' of https://github.com/jseyfried/rust into rollup
Conflicts:
	src/librustc_resolve/lib.rs
	src/librustc_resolve/resolve_imports.rs
2016-12-20 13:00:16 -08:00
Jeffrey Seyfried
8d9ba291f5 Minor bugfix for macro invocation path resolution. 2016-12-19 20:57:02 +00:00
Jeffrey Seyfried
8e61ff25d8 Optimize ast::PathSegment. 2016-12-19 20:57:00 +00:00
Jeffrey Seyfried
421c5d11c1 Remove scope placeholders, remove method add_macro of ext::base::Resolver. 2016-12-18 23:26:30 +00:00
Jeffrey Seyfried
e80d1a8faf Remove MacroDef's fields imported_from and allow_internal_unstable,
remove `export` argument of `resolver.add_macro()`.
2016-12-18 23:26:29 +00:00
Jeffrey Seyfried
59de7f8f04 Add ident.unhygienize() and use Ident more instead of Name in resolve. 2016-12-18 23:26:22 +00:00
Jeffrey Seyfried
cfabce2230 Demote most backwards incompatible ambiguity errors from RFC 1560 to warnings. 2016-12-15 06:02:49 +00:00
Jeffrey Seyfried
ed9a09d40c Support paths in macro invocations. 2016-11-30 22:54:40 +00:00
Jeffrey Seyfried
29791ada1d Minor cleanup. 2016-11-30 21:19:46 +00:00
Jeffrey Seyfried
e9e178a581 Refactor away ResolveResult. 2016-11-29 00:18:39 +00:00
Jeffrey Seyfried
cbe478766c macros: improve performance of legacy name resolution. 2016-11-23 01:51:37 +00:00
bors
ebec55406b Auto merge of #37824 - jseyfried:symbols, r=eddyb
Clean up `ast::Attribute`, `ast::CrateConfig`, and string interning

This PR
 - removes `ast::Attribute_` (changing `Attribute` from `Spanned<Attribute_>` to a struct),
 - moves a `MetaItem`'s name from the `MetaItemKind` variants to a field of `MetaItem`,
 - avoids needlessly wrapping `ast::MetaItem` with `P`,
 - moves string interning into `syntax::symbol` (`ast::Name` is a reexport of `symbol::Symbol` for now),
 - replaces `InternedString` with `Symbol` in the AST, HIR, and various other places, and
 - refactors `ast::CrateConfig` from a `Vec` to a `HashSet`.

r? @eddyb
2016-11-21 08:08:47 -06:00
Jeffrey Seyfried
bf41c85c24 Cleanup. 2016-11-21 09:21:48 +00:00
Jeffrey Seyfried
36c8f6b0d3 Cleanup InternedString. 2016-11-21 09:00:56 +00:00
Jeffrey Seyfried
a2626410d7 Refactor MetaItemKind to use Names instead of InternedStrings. 2016-11-20 11:46:06 +00:00
Jeffrey Seyfried
6cb33a089f Cleanup formatting. 2016-11-17 08:16:32 +00:00
Jeffrey Seyfried
9c88650080 Add feature use_extern_macros. 2016-11-17 08:08:06 +00:00
Jeffrey Seyfried
1bbf7a43d3 Add field expansion: Mark to NameBinding. 2016-11-17 08:07:46 +00:00
Jeffrey Seyfried
83aac43f52 Refactor Resolver::builtin_macros to use NameBindings instead of DefIds. 2016-11-17 08:07:45 +00:00
Jeffrey Seyfried
641274f907 Resolve imports during expansion. 2016-11-17 08:07:44 +00:00
Jeffrey Seyfried
907120637e Add field module.unresolved_invocations. 2016-11-17 08:07:41 +00:00
bors
3dced6f71e Auto merge of #37645 - jseyfried:fix_crate_var_in_custom_derives, r=nrc
Fix regression involving custom derives on items with `$crate`

The regression was introduced in #37213.

I believe we cannot make the improvements from #37213 work with the current custom derive setup (c.f. https://github.com/rust-lang/rust/issues/37637#issuecomment-258959145) -- we'll have to wait for `TokenStream`'s API to improve.

Fixes #37637.
r? @nrc
2016-11-10 11:25:17 -08:00
Jeffrey Seyfried
11195676a0 Elimite $crate before invokng custom derives. 2016-11-10 10:23:35 +00:00
Jeffrey Seyfried
872943c317 Improve macro reexports. 2016-11-10 10:04:24 +00:00
bors
09fc1af9d8 Auto merge of #37506 - jseyfried:improve_shadowing_checks, r=nrc
macros: improve shadowing checks

This PR improves macro-expanded shadowing checks to work with out-of-(pre)order expansion.

Out-of-order expansion became possible in #37084, so this technically a [breaking-change] for nightly.
The regression test from this PR is an example of code that would break.

r? @nrc
2016-11-06 19:12:28 -08:00
Jeffrey Seyfried
076c5d445b Fix shadowing checking. 2016-11-02 07:42:37 +00:00
Seo Sanghyeon
07c8a25f42 Remove unused type aliases 2016-10-31 23:14:27 +09:00
Jeffrey Seyfried
6c4b551403 Cleanup Resolver::disallowed_shadowing. 2016-10-31 06:56:06 +00:00
Jeffrey Seyfried
53de24bbd1 Refactor away fields MacroDef::{use_locally, export}. 2016-10-24 00:43:19 +00:00
Jeffrey Seyfried
8b0c292a72 Improve $crate. 2016-10-19 10:03:06 +00:00
Jeffrey Seyfried
33e3da831c Use the macro namespace for custom derives. 2016-10-15 22:55:19 +00:00
Jeffrey Seyfried
d902963b6d Refactor syntax::ext::base::Resolver::resolve_invoc. 2016-10-15 20:50:02 +00:00
Jeffrey Seyfried
a4c0daab6d Remove LegacyBindingKind::MacroUse. 2016-10-11 05:14:10 +00:00
Jeffrey Seyfried
111caef9a3 Clean up the scopes of expanded #[macro_use] imports. 2016-10-11 05:14:08 +00:00
Jeffrey Seyfried
31e0e12e69 Add support for undetermined macro invocations. 2016-10-11 03:41:48 +00:00
Jeffrey Seyfried
6808b0a2b7 Check for shadowing errors after all invocations have been expanded. 2016-10-11 03:28:54 +00:00