Commit Graph

563 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
93a8283614 Move builtin attribute logic to new rustc_attr crate.
For now, this is all the crate contains, but more
attribute logic & types will be moved there over time.
2020-02-01 18:54:56 +01:00
Mazdak Farrokhzad
3484e2fab4
Rollup merge of #68140 - ecstatic-morse:const-trait-bound-opt-out, r=oli-obk
Implement `?const` opt-out for trait bounds

For now, such bounds are treated exactly the same as unprefixed ones in all contexts. [RFC 2632](https://github.com/rust-lang/rfcs/pull/2632) does not specify whether such bounds are forbidden outside of `const` contexts, so they are allowed at the moment.

Prior to this PR, the constness of a trait bound/impl was stored in `TraitRef`. Now, the constness of an `impl` is stored in `ast::ItemKind::Impl` and the constness of a bound in `ast::TraitBoundModifer`. Additionally, constness of trait bounds is now stored in an additional field of `ty::Predicate::Trait`, and the combination of the constness of the item along with any `TraitBoundModifier` determines the constness of the bound in accordance with the RFC. Encoding the constness of impls at the `ty` level is left for a later PR.

After a discussion in \#wg-grammar on Discord, it was decided that the grammar should not encode the mutual exclusivity of trait bound modifiers. The grammar for trait bound modifiers remains `[?const] [?]`. To encode this, I add a dummy variant to `ast::TraitBoundModifier` that is used when the syntax `?const ?` appears. This variant causes an error in AST validation and disappears during HIR lowering.

cc #67794

r? @oli-obk
2020-01-21 19:42:20 +01:00
Dylan MacKenzie
adbd01e84a Track constness while lowering bounds 2020-01-20 01:28:10 -08:00
Dylan MacKenzie
ab3081a70e Add constness field to ty::Predicate::Trait 2020-01-20 00:00:08 -08:00
Mazdak Farrokhzad
de6046fa0f remove rustc_error_codes deps except in rustc_driver 2020-01-18 21:53:53 +01:00
Dylan MacKenzie
4743995ed3 Use named fields for hir::ItemKind::Impl 2020-01-17 16:14:29 -08:00
varkor
799efd3615 Fix issue with using self module via indirection 2020-01-10 23:30:13 +00:00
Mazdak Farrokhzad
0997388b87 normalize rustc::hir::intravisit imports 2020-01-08 22:09:42 +01:00
Mazdak Farrokhzad
8351667091 intravisit: abstract over HIR Map 2020-01-08 22:01:07 +01:00
Mazdak Farrokhzad
2c3e5d3de0 - remove syntax::{span_warn!, span_err!, span_fatal!. struct_err!}
- remove syntax::{help!, span_help!, span_note!}
- remove unused syntax::{struct_span_fatal, struct_span_err_or_warn!, span_err_or_warn!}
- lintify check_for_bindings_named_same_as_variants + conflicting_repr_hints
- inline syntax::{struct_span_warn!, diagnostic_used!}
- stringify_error_code! -> error_code! & use it more.
- find_plugin_registrar: de-fatalize an error
- de-fatalize metadata errors
- move type_error_struct! to rustc_typeck
- struct_span_err! -> rustc_errors
2020-01-08 04:25:33 +01:00
Mazdak Farrokhzad
ebfd8673a7 Remove rustc_hir reexports in rustc::hir. 2020-01-05 12:49:22 +01:00
Mazdak Farrokhzad
60d5d36370 move {Par}DeepVisitor to intravisit 2020-01-04 19:03:27 +01:00
Mazdak Farrokhzad
2f64ab6633 {HirId,ItemLocal}{Map,Set} -> rustc::hir & nix rustc::nodemap 2020-01-04 19:01:42 +01:00
Mazdak Farrokhzad
4ff12ce4c1 Normalize syntax::symbol imports. 2020-01-02 13:57:04 +01:00
Vadim Petrochenkov
70f1d57048 Rename syntax_pos to rustc_span in source code 2020-01-01 09:15:18 +03:00
bors
bf2d145c62 Auto merge of #67032 - cjgillot:hirene, r=Zoxc
Allocate HIR on an arena 4/4

This is the fourth and last PR in the series started by #66931, #66936 and #66942.

The last commits should compile on their own.
The difference with the previous PR is given by https://github.com/cjgillot/rust/compare/hirene-ty...hirene

A few more cleanups may be necessary, please tell me.

r? @eddyb like the other
cc @Zoxc
2019-12-31 03:27:36 +00:00
Vadim Petrochenkov
b9a9c5b4fd Make things build again 2019-12-30 19:18:16 +03:00
Camille GILLOT
aa3678d4f4 Remove HirVec from Generics. 2019-12-30 11:29:29 +01:00
Camille GILLOT
36f95ab3fa Fallout in other crates. 2019-12-27 19:20:28 +01:00
Camille GILLOT
8284035372 Fallout in other crates. 2019-12-26 23:38:46 +01:00
varkor
35979a92bf Add span information to ExprKind::Assign 2019-12-23 11:20:13 +00:00
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Camille GILLOT
42c03e4bb4 Use Arena inside hir::Mod. 2019-12-21 23:34:34 +01:00
Camille GILLOT
e2526120f2 Use Arena inside hir::StructField. 2019-12-21 23:33:42 +01:00
Camille GILLOT
4f1c88be46 Use Arena inside hir::EnumDef. 2019-12-21 23:32:42 +01:00
Camille GILLOT
5fec1ca0ff Use Arena inside hir::ImplItem. 2019-12-21 23:31:47 +01:00
Camille GILLOT
0f7d77363b Use Arena inside hir::TraitItem. 2019-12-21 23:30:52 +01:00
Camille GILLOT
acf33f2d6b Use Arena inside hir::ForeignItem. 2019-12-21 23:29:27 +01:00
Camille GILLOT
abbe6259e1 Handle Attributes in arena. 2019-12-21 23:20:09 +01:00
Camille GILLOT
084e6722f9 Use Arena inside hir::Item. 2019-12-21 23:17:29 +01:00
Mikhail Babenko
f07bd06137 allow customising ty::TraitRef's printing behavior
fix clippy

allow customising ty::TraitRef's printing behavior

fix clippy

stylistic fix
2019-11-29 17:30:21 +03:00
Guillaume Gomez
4963116e59 Remove unused error_codes.rs files 2019-11-14 13:05:56 +01:00
Guillaume Gomez
798e389e57 Update to use new librustc_error_codes library 2019-11-14 13:05:42 +01:00
Mazdak Farrokhzad
99603e99cc
Rollup merge of #65252 - petrochenkov:deriveholders2, r=matthewjasper
expand: Simplify expansion of derives

And make it more uniform with other macros.
This is done by merging placeholders for future derives' outputs into the derive container's output fragment early (addressing FIXMEs from https://github.com/rust-lang/rust/pull/63667).

Also, macros with names starting with `_` are no longer reported as unused, in accordance with the usual behavior of `unused` lints.

r? @matthewjasper or @mark-i-m
2019-10-19 07:10:04 +02:00
Vadim Petrochenkov
25cc99fca0 privacy: Avoid one more unwrap causing an ICE in rustdoc
The issue is rustdoc-specific because its root cause if the `everybody_loops` pass makes some def-ids to not have local hir-ids
2019-10-19 00:23:57 +03:00
Eduard-Mihai Burtescu
cd9e4441eb rustc: arena-allocate the slice in ty::GenericsPredicate, not the whole struct. 2019-10-18 03:14:57 +03:00
Guillaume Gomez
7a8415894f Fix/improve some error codes long explanation 2019-10-07 11:15:45 +02:00
varkor
7bc94cc3c2 Rename Item.node to Item.kind 2019-09-26 18:21:48 +01:00
varkor
c3d8791373 Rename Ty.node to Ty.kind 2019-09-26 18:21:10 +01:00
varkor
ce6aabbaa1 Rename ImplItem.node to ImplItem.kind 2019-09-26 18:21:09 +01:00
varkor
8bd0382134 Rename Pat.node to Pat.kind 2019-09-26 18:21:09 +01:00
varkor
95f6d72a60 Rename Expr.node to Expr.kind
For both `ast::Expr` and `hir::Expr`.
2019-09-26 18:21:09 +01:00
varkor
e2e0f9af85 Rename sty to kind 2019-09-25 15:50:04 +01:00
Mark Rousskov
41b39fce98 Remove rustc_diagnostic_macros feature 2019-09-05 12:35:18 -04:00
Mark Rousskov
b437240cee Replace diagnostic plugins with macro_rules 2019-09-05 12:35:15 -04:00
Esteban Küber
4971667f17 review comments 2019-08-21 16:11:01 -07:00
Esteban Küber
8c07d7814d When declaring a declarative macro in an item it's only accessible inside it 2019-08-21 15:41:51 -07:00
Vadim Petrochenkov
a6182711ef Remove Spanned from {ast,hir}::FieldPat 2019-08-15 12:31:50 +03:00
Caio
6a42b0b28d Merge Variant and Variant_ 2019-08-14 14:47:01 -03:00
Vadim Petrochenkov
e18ad70d2b diagnostics: Describe crate root modules in DefKind::Mod as "crate" 2019-08-10 23:17:20 +03:00