Commit Graph

59 Commits

Author SHA1 Message Date
kennytm
4711982314
Removed as many "```ignore" as possible.
Replaced by adding extra imports, adding hidden code (`# ...`), modifying
examples to be runnable (sorry Homura), specifying non-Rust code, and
converting to should_panic, no_run, or compile_fail.

Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-23 15:31:53 +08:00
Alex Crichton
be7ebdd512 Bump version and stage0 compiler 2017-06-19 22:25:05 -07:00
Wonwoo Choi
3cb7825986 Update older URLs pointing to the first edition of the Book
`compiler-plugins.html` is moved into the Unstable Book.
Explanation is slightly modified to match the change.
2017-06-15 00:04:00 +09:00
est31
d14d194f61 Support #[allow] etc logic on a per macro level
This commit extends the current unused macro linter
to support directives like #[allow(unused_macros)]
or #[deny(unused_macros)] directly next to the macro
definition, or in one of the modules the macro is
inside. Before, we only supported such directives
at a per crate level, due to the crate's NodeId
being passed to session.add_lint.

We also had to implement handling of the macro's
NodeId in the lint visitor.
2017-05-13 16:02:29 +02:00
Alex Crichton
ab54f4b226 rustc: Remove #![unstable] annotation
These are now no longer necessary with `-Z force-unstable-if-unmarked`
2017-05-11 16:03:05 -07:00
Niko Matsakis
8388772f42 kill a bunch of one off tasks 2017-04-18 08:20:12 -04:00
Niko Matsakis
f227187cb8 remove LinkMeta from SharedCrateContext
A number of things were using `crate_hash` that really ought to be using
`crate_disambiguator` (e.g., to create the plugin symbol names). They
have been updated.

It is important to remove `LinkMeta` from `SharedCrateContext` since it
contains a hash of the entire crate, and hence it will change
whenever **anything** changes (which would then require
rebuilding **everything**).
2017-04-13 18:37:47 -04:00
Jeffrey Seyfried
ec7c0aece1 Merge ExpnId and SyntaxContext. 2017-03-29 00:41:10 +00:00
Oliver Schneider
eb447f4ef4
Fix various useless derefs and slicings 2017-03-27 08:58:00 +02:00
Simonas Kazlauskas
4ca9c97ace Remove ability for plugins to register a MIR pass
In recent months there have been a few different people investigating how to make a plugin that
registers a MIR-pass – one that isn’t intended to be eventually merged into rustc proper.

The interface to register MIR passes was added primarily for miri (& later was
found to make prototyping of rustc-proper MIR passes a tiny bit faster). Since miri does not use
this interface anymore it seems like a good time to remove this "feature".

For prototyping purposes a similar interface can be added by developers themselves in their custom
rustc build.
2017-03-10 08:09:29 -08:00
Jeffrey Seyfried
191abc4264 Remove unused extern crates. 2017-01-22 01:31:02 +00:00
Jeffrey Seyfried
356fa2c5db Warn on unused #[macro_use] imports. 2017-01-22 01:31:00 +00:00
bors
7ac9d337dc Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrc
Remove not(stage0) from deny(warnings)

Historically this was done to accommodate bugs in lints, but there hasn't been a
bug in a lint since this feature was added which the warnings affected. Let's
completely purge warnings from all our stages by denying warnings in all stages.
This will also assist in tracking down `stage0` code to be removed whenever
we're updating the bootstrap compiler.
2017-01-08 08:22:06 +00:00
Alex Crichton
9b0b5b45db Remove not(stage0) from deny(warnings)
Historically this was done to accommodate bugs in lints, but there hasn't been a
bug in a lint since this feature was added which the warnings affected. Let's
completely purge warnings from all our stages by denying warnings in all stages.
This will also assist in tracking down `stage0` code to be removed whenever
we're updating the bootstrap compiler.
2016-12-29 21:07:20 -08:00
Alex Crichton
03bc2cf35a Fallout from updating bootstrap Cargo 2016-12-29 08:47:26 -08:00
Eduard-Mihai Burtescu
864928297d rustc: separate TraitItem from their parent Item, just like ImplItem. 2016-12-28 11:21:45 +02: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
36c8f6b0d3 Cleanup InternedString. 2016-11-21 09:00:56 +00:00
Jeffrey Seyfried
d2f8fb0a0a Move syntax::util::interner -> syntax::symbol, cleanup. 2016-11-20 23:40:20 +00:00
Jeffrey Seyfried
a2626410d7 Refactor MetaItemKind to use Names instead of InternedStrings. 2016-11-20 11:46:06 +00:00
Niko Matsakis
3fd67eba87 fallout from separating impl-items from impls
Basically adding `visit_impl_item` in various places and so forth.
2016-11-16 13:57:43 -05:00
Niko Matsakis
36fbf8c53c refactor Visitor into ItemLikeVisitor and intravisit::Visitor
There are now three patterns (shallow, deep, and nested visit).  These
are described in detail on the docs in `itemlikevisit::ItemLikeVisitor`.
2016-11-16 13:51:36 -05:00
iirelu
e593c3b893 Changed most vec! invocations to use square braces
Most of the Rust community agrees that the vec! macro is clearer when
called using square brackets [] instead of regular brackets (). Most of
these ocurrences are from before macros allowed using different types of
brackets.

There is one left unchanged in a pretty-print test, as the pretty
printer still wants it to have regular brackets.
2016-10-31 22:51:40 +00:00
Jeffrey Seyfried
cbd24757eb Move CrateConfig from Crate to ParseSess. 2016-10-29 07:52:58 +00:00
Jeffrey Seyfried
2b43fac2b9 Remove CrateReader, use CrateLoader instead. 2016-10-22 20:01:38 +00:00
Jeffrey Seyfried
77958d56bc Forbid user-defined macros named "macro_rules". 2016-09-26 00:22:40 +00:00
Nick Cameron
3863834d9c reviewer comments and rebasing 2016-09-23 07:19:31 +12:00
Nick Cameron
6a2d2c9495 Adds a ProcMacro form of syntax extension
This commit adds syntax extension forms matching the types for procedural macros 2.0 (RFC #1566), these still require the usual syntax extension boiler plate, but this is a first step towards proper implementation and should be useful for macros 1.1 stuff too.

Supports both attribute-like and function-like macros.
2016-09-22 08:47:57 +12:00
Jeffrey Seyfried
2abdc8805c Remove MacroRulesTT. 2016-09-15 21:16:51 +00:00
bors
86995dc8c5 Auto merge of #36240 - leeopop:master, r=jseyfried
Allow CompilerControllers to access rustc_plugin::registry::Registry

fixes #36064

I chose to put ructc_plugin::registry::Registry structure
into CompilerState structure, instead of Session structure.
This will preserve dependencies among librustc, libructc_driver, and libructc_plugin.

@jseyfried @sanxiyn
2016-09-04 18:36:42 -07:00
Keunhong Lee
ca5dfd0c97 Allow CompilerControllers to access rustc_plugin::registry::Registry structure. 2016-09-04 03:22:56 +00:00
Alex Crichton
ecc6c39e87 rustc: Implement custom derive (macros 1.1)
This commit is an implementation of [RFC 1681] which adds support to the
compiler for first-class user-define custom `#[derive]` modes with a far more
stable API than plugins have today.

[RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md

The main features added by this commit are:

* A new `rustc-macro` crate-type. This crate type represents one which will
  provide custom `derive` implementations and perhaps eventually flower into the
  implementation of macros 2.0 as well.

* A new `rustc_macro` crate in the standard distribution. This crate will
  provide the runtime interface between macro crates and the compiler. The API
  here is particularly conservative right now but has quite a bit of room to
  expand into any manner of APIs required by macro authors.

* The ability to load new derive modes through the `#[macro_use]` annotations on
  other crates.

All support added here is gated behind the `rustc_macro` feature gate, both for
the library support (the `rustc_macro` crate) as well as the language features.

There are a few minor differences from the implementation outlined in the RFC,
such as the `rustc_macro` crate being available as a dylib and all symbols are
`dlsym`'d directly instead of having a shim compiled. These should only affect
the implementation, however, not the public interface.

This commit also ended up touching a lot of code related to `#[derive]`, making
a few notable changes:

* Recognized derive attributes are no longer desugared to `derive_Foo`. Wasn't
  sure how to keep this behavior and *not* expose it to custom derive.

* Derive attributes no longer have access to unstable features by default, they
  have to opt in on a granular level.

* The `derive(Copy,Clone)` optimization is now done through another "obscure
  attribute" which is just intended to ferry along in the compiler that such an
  optimization is possible. The `derive(PartialEq,Eq)` optimization was also
  updated to do something similar.

---

One part of this PR which needs to be improved before stabilizing are the errors
and exact interfaces here. The error messages are relatively poor quality and
there are surprising spects of this such as `#[derive(PartialEq, Eq, MyTrait)]`
not working by default. The custom attributes added by the compiler end up
becoming unstable again when going through a custom impl.

Hopefully though this is enough to start allowing experimentation on crates.io!

syntax-[breaking-change]
2016-09-02 12:52:56 -07:00
Chiu-Hsiang Hsu
3f7432a399 Change 'rustc::plugin' to 'rustc_plugin' in doc comment 2016-08-31 22:45:37 +08:00
Jeffrey Seyfried
bfb01bbb26 Refactor away AttrMetaMethods. 2016-08-25 20:41:40 +00:00
Jeffrey Seyfried
4eb08bb2ab Refactor away AttrNestedMetaItemMethods. 2016-08-25 20:41:32 +00:00
Sergio Benitez
8250a26b5b Implement RFC#1559: allow all literals in attributes. 2016-08-25 13:25:22 -07:00
Michael Woerister
65eb024542 Remove the 'cfg' field from session::config::Options.
The 'cfg' in the Options struct is only the commandline-specified
subset of the crate configuration and it's almost always wrong to
read that instead of the CrateConfig in HIR crate node.
2016-08-11 09:56:00 -04:00
Jeffrey Seyfried
542ba8c5f7 Fix Cargo.tomls 2016-06-27 18:30:46 +00:00
Jonathan Turner
6ae3502134 Move errors from libsyntax to its own crate 2016-06-23 08:07:35 -04:00
Ariel Ben-Yehuda
70c25c848c remove the librustc_trans -> librustc_mir dependency 2016-06-08 23:58:53 +03:00
Eduard Burtescu
7462da5c38 rustc: use a simpler scheme for plugin registrar symbol names. 2016-05-25 01:20:55 +03:00
Oliver Schneider
46de0fadb5
fix Registry::args for plugins loaded with --extra-plugins 2016-05-10 13:36:39 +02:00
Leo Testard
03ab057f97 Remove the MacroVisitor pass.
This pass was supposed to check use of gated features before
`#[cfg]`-stripping but this was not the case since it in fact happens
after. Checks that are actually important and must be done before macro
expansion are now made where the features are actually used. Close #32648.
Also ensure that attributes on macro-generated macro invocations are
checked as well. Close #32782 and #32655.
2016-04-22 01:40:33 +02:00
Eduard Burtescu
8b0937293b rustc: move rustc_front to rustc::hir. 2016-04-06 09:01:55 +03:00
Michael Woerister
2eebb7b605 Make the compiler emit an error if the crate graph contains two crates with the same crate-name and crate-salt but different SVHs. 2016-03-25 14:07:18 -04:00
bors
c21644ad16 Auto merge of #31916 - nagisa:mir-passmgr-2, r=arielb1
Add Pass manager for MIR

A new PR, since rebasing the original one (https://github.com/rust-lang/rust/pull/31448) properly was a pain. Since then there has been several changes most notable of which:

1. Removed the pretty-printing with `#[rustc_mir(graphviz/pretty)]`, mostly because we now have `--unpretty=mir`, IMHO that’s the direction we should expand this functionality into;
2. Reverted the infercx change done for typeck, because typeck can make an infercx for itself by being a `MirMapPass`

r? @nikomatsakis
2016-03-13 05:33:28 -07:00
Alex Crichton
b53764c73b std: Clean out deprecated APIs
Removes all unstable and deprecated APIs prior to the 1.8 release. All APIs that
are deprecated in the 1.8 release are sticking around for the rest of this
cycle.

Some notable changes are:

* The `dynamic_lib` module was moved into `rustc_back` as the compiler still
  relies on a few bits and pieces.
* The `DebugTuple` formatter now special-cases an empty struct name with only
  one field to append a trailing comma.
2016-03-12 12:31:13 -08:00
Simonas Kazlauskas
811b874716 Add Pass manager for MIR 2016-03-04 15:20:10 +02:00
Alex Crichton
95761417c3 rustbuild: Sync some Cargo.toml/lib.rs dependencies
The standard library doesn't depend on rustc_bitflags, so move it to explicit
dependencies on all other crates. Additionally, the arena/fmt_macros deps could
be dropped from libsyntax.
2016-02-21 09:49:13 -08:00
Jonas Schievink
d12adae719 Autoderef in librustc_plugin 2016-02-12 19:28:42 +01:00