Commit Graph

9783 Commits

Author SHA1 Message Date
Mazdak Farrokhzad 34d91709b6 parse: refactor fun ret ty & param ty 2019-12-12 17:54:49 +01:00
Mazdak Farrokhzad 7672bff378 Unify associated function parsing. 2019-12-12 17:54:48 +01:00
Mazdak Farrokhzad 92a372b020 Unify {Impl,Trait}Item as AssocItem. 2019-12-12 17:54:48 +01:00
Mazdak Farrokhzad 39073767a4 Unify {Trait,Impl}ItemKind::TyAlias structures. 2019-12-12 17:54:48 +01:00
Mazdak Farrokhzad c02fd31302 TraitItemKind::Type -> TraitItemKind::TyAlias. 2019-12-12 17:54:48 +01:00
Mazdak Farrokhzad f6403c6c76 Use Option in ImplItemKind::Method. 2019-12-12 17:54:48 +01:00
Mazdak Farrokhzad 73557faed2 Use Option in ImplItemKind::Const. 2019-12-12 17:54:48 +01:00
Mazdak Farrokhzad c4bbe9cbbe Alias TraitItem & ImplItem.
Allow defaultness on trait items syntactically.
2019-12-12 17:54:48 +01:00
Tyler Mandry 3340a5b48d Rollup merge of #67113 - Centril:enum-vis-pretty-fix, r=davidtwco
Print the visibility in `print_variant`.

r? @davidtwco
cc @dtolnay for `syn` awareness.
2019-12-09 14:33:03 -08:00
Mazdak Farrokhzad c8850c7144 Make ForeignItem an alias of Item. 2019-12-07 06:05:25 +01:00
Mazdak Farrokhzad e9840d94b9 Print the visibility in print_variant. 2019-12-07 05:59:41 +01:00
varkor 9f1269f23c Rename to then_some and then 2019-12-06 12:24:54 +00:00
varkor e3a8ea4e18 Use to_option in various places 2019-12-06 12:23:23 +00:00
Mark Rousskov 42c4ae0d4b Deduplicate CrateConfig 2019-12-03 12:19:17 -05:00
Mark Rousskov 52d4d478a1 Move ParseSess to librustc_session 2019-12-03 12:19:16 -05:00
Mark Rousskov 817d1ae834 Move BufferedEarlyLint to librustc_session 2019-12-03 12:19:16 -05:00
Mark Rousskov f03d8f305a Move early lint declarations to librustc_session 2019-12-03 12:19:14 -05:00
Vadim Petrochenkov 498737c8e9 Address review comments 2019-12-02 22:13:13 +03:00
Vadim Petrochenkov cf71538094 syntax: Optimize conversion AttrItem -> MetaItem by avoiding outer_tokens. 2019-12-02 21:56:34 +03:00
Vadim Petrochenkov 537895535d syntax: Use ast::MacArgs for macro definitions 2019-12-02 21:56:34 +03:00
Vadim Petrochenkov 1a496f3379 syntax: Use ast::MacArgs for attributes 2019-12-02 21:56:34 +03:00
Vadim Petrochenkov 0fac56717a syntax: Remove redundant span from ast::Mac
Also remove a couple of redundant `visit_mac` asserts
2019-12-02 21:56:34 +03:00
Vadim Petrochenkov a81804b4d5 syntax: Introduce a struct MacArgs for macro arguments 2019-12-02 21:56:34 +03:00
Mazdak Farrokhzad b772b5b19d Rollup merge of #66895 - Centril:rustc_feature, r=oli-obk
Feature gating *declarations* => new crate `rustc_feature`

This PR moves the data-oriented parts of feature gating into its own crate, `rustc_feature`.
The parts consist of some data types as well as `accepted`, `active`, `removed`, and `builtin_attrs`.

Feature gate checking itself remains in `syntax::feature_gate::check`. The parts which define how to emit feature gate errors could probably be moved to `rustc_errors` or to the new `rustc_session` crate introduced in #66878. The visitor itself could probably be moved as a pass in `rustc_passes` depending on how the dependency edges work out.

The PR also contains some drive-by cleanup of feature gate checking. As such, the PR probably best read commit-by-commit.

r? @oli-obk
cc @petrochenkov
cc @Mark-Simulacrum
2019-11-30 16:56:58 +01:00
Mazdak Farrokhzad ded177a06a derive(Default) for Features 2019-11-30 07:44:50 +01:00
Mazdak Farrokhzad 79077f13ff move GateIssue to rustc_feature & simplify emit_feature_err 2019-11-30 07:40:28 +01:00
Mazdak Farrokhzad 9626181494 check.rs: inline a constant 2019-11-30 03:30:49 +01:00
Mazdak Farrokhzad b45f21d38e move UnstableFeatures -> rustc_feature 2019-11-30 02:50:47 +01:00
Mazdak Farrokhzad db89679ebc inline two explanation constants 2019-11-30 02:40:45 +01:00
Mazdak Farrokhzad 70234f16df builtin_attrs.rs -> rustc_feature 2019-11-30 02:34:18 +01:00
Mazdak Farrokhzad d04b838a44 move is_builtin_attr to syntax::attr 2019-11-30 02:20:07 +01:00
Mazdak Farrokhzad 4d9fde59ae builtin_attrs: inline some strings 2019-11-30 02:03:32 +01:00
Mazdak Farrokhzad 6cab02cf14 simplify gated cfgs logic 2019-11-30 01:57:53 +01:00
Mazdak Farrokhzad 8ad4d15f38 move AttributeTemplate to builtin_attrs 2019-11-30 00:56:46 +01:00
Mazdak Farrokhzad 048201fa7a move Stability to rustc_feature 2019-11-30 00:39:51 +01:00
Mazdak Farrokhzad 3d080a4a77 introduce crate rustc_feature and move active, accepted, and removed to it 2019-11-30 00:25:40 +01:00
Vadim Petrochenkov 9be526e8eb rustc_metadata: Move has_global_allocator from session to cstore 2019-11-28 20:59:57 +03:00
Tyler Mandry bb6236cd74 Rollup merge of #66754 - estebank:rustdoc-capitalization, r=Dylan-DPC
Various tweaks to diagnostic output
2019-11-26 17:56:19 -06:00
Tyler Mandry f178d35ae7 Rollup merge of #66719 - Mark-Simulacrum:int-normalization, r=Centril
Store pointer width as u32 on Config

This removes the dependency on IntTy, UintTy from Session.

It's not obviously a win, but it seems a bit odd to store the AST IntTy/UintTy in Session, rather we store the pointer width as an integer and add normalization methods to IntTy and UintTy.
2019-11-26 17:56:15 -06:00
Esteban Küber 85fb054fef Tweak removed feature error 2019-11-25 13:30:52 -08:00
bors 582a4eaee6 Auto merge of #66279 - cjgillot:hashstable, r=Zoxc
Use proc-macro to derive HashStable everywhere

Hello,

A second proc-macro is added to derive HashStable for crates librustc depends on.
This proc-macro `HashStable_Generic` (to bikeshed) allows to decouple code and strip much of librustc's boilerplate.

Still, two implementations `Span` and `TokenKind` require to be placed in librustc.
The latter only depends on the `bug` macro. Advise welcome on how to sever that link.
A trait `StableHasingContextLike` has been introduced at each crate root,
in order to handle those implementations which require librustc's very `StableHashingContext`.

This overall effort allowed to remove the `impl_stable_hash_for` macro.

Each commit passes the `x.py check`.
I still have to double check there was no change in the implementation.
2019-11-25 09:28:59 +00:00
bors c9bacb70f0 Auto merge of #66671 - matthewjasper:ast-address-of, r=Centril
Ast address-of

This is the parts of #64588 that don't affect MIR. If an address-of expression makes it to MIR lowering we error and lower to the best currently expressible approximation to limit further errors.

r? @Centril
2019-11-25 01:20:38 +00:00
Mark Rousskov 66dce1114d Store ptr_width as u32 on Config
This removes the dependency on IntTy, UintTy from Session.
2019-11-24 16:32:07 -05:00
Matthew Jasper 064bed0f31 Parse and feature gate raw address of expressions 2019-11-24 18:06:13 +00:00
Matthew Jasper a8efd31f2b Add raw address of expressions to the AST and HIR 2019-11-24 18:06:13 +00:00
Mazdak Farrokhzad 6618af2c5c Rollup merge of #61351 - GuillaumeGomez:stabilize-cfg-rustdoc, r=QuietMisdreavus
Stabilize cfg(doc)

cc #43781.
2019-11-23 23:22:33 +01:00
Camille GILLOT 782cc9f65c Derive HashStable for TokenKind. 2019-11-23 18:52:23 +01:00
Camille GILLOT 4d1674f620 Use proc-macro for TokenTree. 2019-11-23 18:22:24 +01:00
Camille GILLOT ce301075c0 Rename StableHashingContextLike to HashStableContext. 2019-11-23 17:57:00 +01:00
bors 6d523ee501 Auto merge of #66507 - ecstatic-morse:const-if-match, r=oli-obk
Enable `if` and `match` in constants behind a feature flag

This PR is an initial implementation of #49146. It introduces a `const_if_match` feature flag and does the following if it is enabled:
- Allows `Downcast` projections, `SwitchInt` terminators and `FakeRead`s for matched places through the MIR const-checker.
- Allows `if` and `match` expressions through the HIR const-checker.
- Stops converting `&&` to `&` and `||` to `|` in `const` and `static` items.

As a result, the following operations are now allowed in a const context behind the feature flag:
- `if` and `match`
- short circuiting logic operators (`&&` and `||`)
- the `assert` and `debug_assert` macros (if the `const_panic` feature flag is also enabled)

However, the following operations remain forbidden:
- `while`, `loop` and `for` (see #52000)
- the `?` operator (calls `From::from` on its error variant)
- the `assert_eq` and `assert_ne` macros, along with their `debug` variants (calls `fmt::Debug`)

This PR is possible now that we use dataflow for const qualification (see #64470 and #66385).

r? @oli-obk
cc @rust-lang/wg-const-eval @eddyb
2019-11-23 01:13:41 +00:00