about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2019-11-30simplify gated cfgs logicMazdak Farrokhzad-38/+24
2019-11-30move AttributeTemplate to builtin_attrsMazdak Farrokhzad-27/+17
2019-11-30move Stability to rustc_featureMazdak Farrokhzad-11/+3
2019-11-30introduce crate rustc_feature and move active, accepted, and removed to itMazdak Farrokhzad-1013/+21
2019-11-28rustc_metadata: Move `has_global_allocator` from session to cstoreVadim Petrochenkov-4/+2
2019-11-26Rollup merge of #66754 - estebank:rustdoc-capitalization, r=Dylan-DPCTyler Mandry-3/+2
Various tweaks to diagnostic output
2019-11-26Rollup merge of #66719 - Mark-Simulacrum:int-normalization, r=CentrilTyler Mandry-0/+24
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-25Tweak removed feature errorEsteban Küber-3/+2
2019-11-25Auto merge of #66279 - cjgillot:hashstable, r=Zoxcbors-10/+48
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-25Auto merge of #66671 - matthewjasper:ast-address-of, r=Centrilbors-23/+45
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-24Store ptr_width as u32 on ConfigMark Rousskov-0/+24
This removes the dependency on IntTy, UintTy from Session.
2019-11-24Parse and feature gate raw address of expressionsMatthew Jasper-1/+5
2019-11-24Add raw address of expressions to the AST and HIRMatthew Jasper-22/+40
2019-11-23Rollup merge of #61351 - GuillaumeGomez:stabilize-cfg-rustdoc, r=QuietMisdreavusMazdak Farrokhzad-1/+0
Stabilize cfg(doc) cc #43781.
2019-11-23Derive HashStable for TokenKind.Camille GILLOT-13/+11
2019-11-23Use proc-macro for TokenTree.Camille GILLOT-21/+2
2019-11-23Rename StableHashingContextLike to HashStableContext.Camille GILLOT-4/+4
2019-11-23Auto merge of #66507 - ecstatic-morse:const-if-match, r=oli-obkbors-0/+3
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-22Fix rebase fallout.Camille GILLOT-0/+1
2019-11-22Derives for ast.Camille GILLOT-4/+4
2019-11-22Invert implementations for TokenKind.Camille GILLOT-3/+46
Also export a bunch of Token-related impls.
2019-11-22Export HashStable for DelimSpan, Lit and Path.Camille GILLOT-3/+13
2019-11-22Rollup merge of #66183 - Centril:empty-vis-trait-decl, r=petrochenkovMazdak Farrokhzad-43/+56
*Syntactically* permit visibilities on trait items & enum variants Fixes #65041 Suppose we have `$vis trait_item` or `$vis enum_variant` and `$vis` is a `:vis` macro fragment. Before this PR, this would fail to parse. This is now instead allowed as per language team consensus in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286. (See added tests for elaboration.) Moreover, we now also permit visibility modifiers on trait items & enum variants *syntactically* but reject them with semantic checks (in `ast_validation`): ```rust #[cfg(FALSE)] trait Foo { pub fn bar(); } // OK #[cfg(FALSE)] enum E { pub U } // OK ```
2019-11-22Add StableHashingContextLike to HashStable_Generic derive.Camille GILLOT-0/+5
2019-11-22Auto merge of #66460 - cjgillot:hashstable_generic, r=Zoxcbors-27/+36
Add a proc-macro to derive HashStable in librustc dependencies 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 some librustc's boilerplate. Not everything is migrated, because `Span` and `TokenKind` require to be placed inside librustc. Types using them stay there too. Split out of #66279 r? @Zoxc
2019-11-22Auto merge of #66565 - Mark-Simulacrum:syntax-cfg-mod, r=petrochenkovbors-19/+5
Move process_configure_mod to rustc_parse This removes the hack in favor of perhaps a less principled, but less painful, approach. This also supports my work to decouple `Session` from librustc, as `ParseSess` currently has `Attribute` as "part" of it but after this PR will no longer do so.
2019-11-21Add feature gate for const `if` and `match`Dylan MacKenzie-0/+3
2019-11-21Stabilize cfg rustdocGuillaume Gomez-1/+0
2019-11-21Gate fallback via `#![feature(never_type_fallback)]`.Mazdak Farrokhzad-0/+3
2019-11-21Stabilize the `never_type`, written `!`.Mazdak Farrokhzad-21/+2
2019-11-20Delete ProcessCfgModMark Rousskov-19/+5
The previous commit removes the use of this, and now we cleanup.
2019-11-20Rollup merge of #66060 - traxys:test_65401, r=michaelwoeristerMazdak Farrokhzad-1/+4
Making ICEs and test them in incremental This adds: - A way to make the compiler ICE - A way to check for ICE in `cfail` tests with `should-ice` - A regression test for issue #65401 I am not sure the attribute added `should-ice` is the best for this job
2019-11-19Auto merge of #66206 - PotHix:master, r=estebankbors-1/+1
Suggest `#[repr(C)]` instead of `#[repr(C, packed, ...)]` The code was previously suggesting `#[repr(C, packed, ...)]` for incorrect uses of `repr` (e.g. `#[repr = "C"]`). This change suggests the usage of `#[repr(C)]` instead. r? @estebank Ref: #61286.
2019-11-17Remove extern crate.Camille GILLOT-2/+3
2019-11-17HashStable in libsyntax.Camille GILLOT-4/+3
2019-11-17HashStable literals in libsyntax.Camille GILLOT-2/+2
2019-11-17Further HashStable_Generic derives.Camille GILLOT-5/+8
2019-11-17Use proc_macro for HashStable derive in libsyntax.Camille GILLOT-16/+22
2019-11-17Rollup merge of #66381 - Centril:66340, r=petrochenkovYuki Okushi-1/+4
find_deprecation: deprecation attr may be ill-formed meta. Fixes #66340. r? @petrochenkov cc @pnkfelix
2019-11-17Address review commentsVadim Petrochenkov-4/+1
2019-11-16ast: Keep string literals in ABIs preciselyVadim Petrochenkov-21/+37
2019-11-16ast: Keep `extern` qualifiers in functions more preciselyVadim Petrochenkov-24/+45
2019-11-15Rollup merge of #66427 - Mark-Simulacrum:errors-json, r=CentrilMazdak Farrokhzad-1892/+1
Move the JSON error emitter to librustc_errors This is done both as a cleanup (it makes little sense for this emitter to be in libsyntax), but also as part of broader work to decouple Session from librustc itself. Along the way, this also moves SourceMap to syntax_pos, which is also nice for the above reasons, as well as allowing dropping the SourceMapper trait from code. This had the unfortunate side-effect of moving `FatalError` to rustc_data_structures (it's needed in syntax_pos, due to SourceMap, but putting it there feels somehow worse).
2019-11-15Move JSON emitter to rustc_errorsMark Rousskov-635/+0
2019-11-15Remove SourceMapper traitMark Rousskov-3/+3
SourceMap is now in the root of all rustc-specific crates, syntax_pos, so there's no need for the trait object to decouple the dependencies between librustc_errors and libsyntax as was needed previously.
2019-11-15Rollup merge of #66197 - Centril:transparent-ast, r=varkorTyler Mandry-58/+35
Push `ast::{ItemKind, ImplItemKind}::OpaqueTy` hack down into lowering We currently have a hack in the form of `ast::{ItemKind, ImplItemKind}::OpaqueTy` which is constructed literally when you write `type Alias = impl Trait;` but not e.g. `type Alias = Vec<impl Trait>;`. Per https://github.com/rust-lang/rfcs/pull/2515, this needs to change to allow `impl Trait` in nested positions. This PR achieves this change for the syntactic aspect but not the semantic one, which will require changes in lowering and def collection. In the interim, `TyKind::opaque_top_hack` is introduced to avoid knock-on changes in lowering, collection, and resolve. These hacks can then be removed and fixed one by one until the desired semantics are supported. r? @varkor
2019-11-15Move SourceMap to syntax_posMark Rousskov-1257/+1
This does not update the use sites or delete the now unnecessary SourceMapper trait, to allow git to interpret the file move as a rename rather than a new file.
2019-11-15find_deprecation: deprecation attr may be ill-formed meta.Mazdak Farrokhzad-1/+4
2019-11-14TAIT: use hack in ->HIR to avoid more changesMazdak Farrokhzad-0/+9
2019-11-14TAIT: feature gate recursive locationsMazdak Farrokhzad-20/+26