about summary refs log tree commit diff
path: root/src/librustc_span
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-7293/+0
2020-08-27Abort when catch_unwind catches a foreign exceptionAmanieu d'Antras-0/+1
2020-08-23Auto merge of #73084 - Aaron1011:feature/new-recursive-expand, r=petrochenkovbors-0/+2
Re-land PR #72388: Recursively expand `TokenKind::Interpolated` in `probably_equal_for_proc_macro` PR #72388 allowed us to preserve the original `TokenStream` in more cases during proc-macro expansion, but had to be reverted due to a large number of regressions (See #72545 and #72622). These regressions fell into two categories 1. Missing handling for `Group`s with `Delimiter::None`, which are inserted during `macro_rules!` expansion (but are lost during stringification and re-parsing). A large number of these regressions were due to `syn` and `proc-macro-hack`, but several crates needed changes to their own proc-macro code. 2. Legitimate hygiene issues that were previously being masked by stringification. Some of these were relatively benign (e.g. [a compiliation error](https://github.com/paritytech/parity-scale-codec/pull/210) caused by misusing `quote_spanned!`). However, two crates had intentionally written unhygenic `macro_rules!` macros, which were able to access identifiers that were not passed as arguments (see https://github.com/rust-lang/rust/issues/72622#issuecomment-636402573). All but one of the Crater regressions have now been fixed upstream (see https://hackmd.io/ItrXWRaSSquVwoJATPx3PQ?both). The remaining crate (which has a PR pending at https://github.com/sammhicks/face-generator/pull/1) is not on `crates.io`, and is a Yew application that seems unlikely to have any reverse dependencies. As @petrochenkov mentioned in https://github.com/rust-lang/rust/issues/72545#issuecomment-638632434, not re-landing PR #72388 allows more crates to write unhygenic `macro_rules!` macros, which will eventually stop compiling. Since there is only one Crater regression remaining, since additional crates could write unhygenic `macro_rules!` macros in the time it takes that PR to be merged.
2020-08-22Add backwards-compat hack for certain '$name' tokensAaron Hill-0/+2
See issue #74616
2020-08-22Auto merge of #74566 - lzutao:guard, r=petrochenkovbors-0/+1
Gate if-let guard feature Enhanced on #74315. That PR is in crater queue so I don't want to push to it. Close #74232 cc #51114
2020-08-18Moved coverage counter injection from BasicBlock to Statement.Rich Kadel-4/+0
2020-08-16hir: introduce lang items for AST loweringDavid Wood-0/+2
This commit adds new lang items which will be used in AST lowering once `QPath::LangItem` is introduced. Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
2020-08-15replaced log with tracingGurpreet Singh-3/+3
2020-08-14Rework `rustc_serialize`Matthew Jasper-100/+119
- Move the type parameter from `encode` and `decode` methods to the trait. - Remove `UseSpecialized(En|De)codable` traits. - Remove blanket impls for references. - Add `RefDecodable` trait to allow deserializing to arena-allocated references safely. - Remove ability to (de)serialize HIR. - Create proc-macros `(Ty)?(En|De)codable` to help implement these new traits.
2020-08-10Rollup merge of #75320 - estebank:js-for-i-of-x, r=davidtwcoYuki Okushi-0/+1
Detect likely `for foo of bar` JS syntax Fix #75311.
2020-08-09Auto merge of #75278 - cuviper:indexmap, r=Mark-Simulacrumbors-12/+9
Upgrade indexmap and use it more First this upgrades `indexmap` to 1.5.1, which is now based on `hashbrown::raw::RawTable`. This means it shares a lot of the same performance characteristics for insert, lookup, etc., while keeping items in insertion order. Then across various rustc crates, this replaces a lot of `Vec`+`HashMap` pairs with a single `IndexMap` or `IndexSet`. Closes #60608. r? @eddyb
2020-08-09rustc_span: note the perf loss seen from IndexSet in symbol::InternerJosh Stone-0/+4
2020-08-09rustc_span: use IndexSet in SpanInternerJosh Stone-12/+5
2020-08-09Auto merge of #75137 - Aaron1011:fix/hygiene-skip-expndata, r=petrochenkovbors-4/+21
Don't serialize ExpnData for foreign crates When we encode an ExpnId into the crate metadata, we write out the CrateNum of the crate that 'owns' the corresponding `ExpnData`, which is later used to decode the `ExpnData` from its owning crate. However, we current serialize the `ExpnData` for all `ExpnIds` that we serialize, even if the `ExpnData` was already serialized into a foreign crate. This commit skips encoding this kind of `ExpnData`, which should hopefully speed up metadata encoding and reduce the total metadata size.
2020-08-09Auto merge of #75134 - Aaron1011:feature/expn-data-parent-hash, r=petrochenkovbors-33/+39
Hash parent ExpnData cc https://github.com/rust-lang/rust/pull/72121#discussion_r460528326
2020-08-09Add comment about the lack of `ExpnData` serialization for proc-macro cratesAaron Hill-0/+3
2020-08-08Detect likely `for foo of bar` JS syntaxEsteban Küber-0/+1
Fix #75311.
2020-08-08Gate to if-let guard featureLzu Tao-0/+1
2020-08-08Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkovbors-0/+9
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Auto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitorbors-2/+2
Rollup of 7 pull requests Successful merges: - #75224 (Don't call a function in function-arguments-naked.rs) - #75237 (Display elided lifetime for non-reference type in doc) - #75250 (make MaybeUninit::as_(mut_)ptr const) - #75253 (clean up const-hacks in int endianess conversion functions) - #75259 (Add missing backtick) - #75267 (Small cleanup) - #75270 (fix a couple of clippy findings) Failed merges: r? @ghost
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-0/+9
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-08fix clippy::needless_return: remove unneeded return statementsMatthias Krüger-2/+2
2020-08-05add min_const_generics feature gateBastian Kauschke-0/+1
2020-08-04Don't serialize ExpnData for foreign cratesAaron Hill-4/+18
When we encode an ExpnId into the crate metadata, we write out the CrateNum of the crate that 'owns' the corresponding `ExpnData`, which is later used to decode the `ExpnData` from its owning crate. However, we current serialize the `ExpnData` for all `ExpnIds` that we serialize, even if the `ExpnData` was already serialized into a foreign crate. This commit skips encoding this kind of `ExpnData`, which should hopefully speed up metadata encoding and reduce the total metadata size.
2020-08-04Hash parent ExpnDataAaron Hill-33/+39
2020-08-02fix typosliuzhenyu-2/+2
2020-07-31Move from `log` to `tracing`Oliver Scherer-1/+1
2020-07-28Auto merge of #74471 - da-x:string-type-diagnostic-item, r=petrochenkovbors-0/+1
librustc_typeck: use diag item instead of string compare
2020-07-26Share serialization optimization between incr and metadataAaron Hill-35/+110
2020-07-26Properly reset `orig_id` when loading from incremental cacheAaron Hill-1/+11
2020-07-26Ignore `orig_id` for stable hashingAaron Hill-0/+7
This does not affect semantic equality, and was causing an enormous number of Span hash invalidations.
2020-07-26Hygiene serialization implementationAaron Hill-38/+329
2020-07-23replace miri_start_panic intrinsic by 'extern fn'Ralf Jung-1/+0
2020-07-20mir: use attribute over `-Z polymorphize-errors`David Wood-0/+1
This commit replaces the `-Z polymorphize-errors` debugging flag with a `#[rustc_polymorphize_error]` attribute for use on functions. Signed-off-by: David Wood <david@davidtw.co>
2020-07-18librustc_typeck: use diag item instead of string compareDan Aloni-0/+1
2020-07-17Auto merge of #74395 - Mark-Simulacrum:stage0-next, r=pietroalbinibors-1/+0
Bump version to 1.47 This also bumps to a more recent rustfmt version, just to keep us relatively up to date (though almost nothing has changed in rustfmt we use beyond bumps to the parser infra). No formatting changes as a result of this. r? @pietroalbini
2020-07-16Rollup merge of #74357 - nnethercote:symbol-related-improvements, r=oli-obkManish Goregaokar-0/+57
Some `Symbol` related improvements These commits make things nicer and avoid some `Symbol::as_str()` calls. r? @oli-obk
2020-07-16apply bootstrap cfgsMark Rousskov-1/+0
2020-07-17Remove some `Symbol:as_str()` calls.Nicholas Nethercote-0/+2
2020-07-17Remove `ExtCtxt::ident_of`.Nicholas Nethercote-0/+55
It's equivalent to `Ident::from_str_and_span`. The commit also introduces some more static symbols so that `Ident::new` can be used in various places instead of `Ident::from_str_and_span`. The commit also changes `Path::path` from a `&str` to a `Symbol`, which then allows the lifetime annotation to be removed from `Ty`. Also, the use of `Symbol` in `Bounds` removes the need for its lifetime annotation.
2020-07-16Revert "Remove spotlight usage"Manish Goregaokar-0/+2
This reverts commit 13c6d5819aae3c0de6a90e7f17ea967bf4487cbb.
2020-07-16Rename `sym::item_context` as `sym::ItemContext`.Nicholas Nethercote-1/+1
Because it represents the symbol `ItemContext`, and `sym` identifiers are supposed to match the actual symbol whenever possible.
2020-07-16Enforce the static symbol order.Nicholas Nethercote-107/+116
By making the proc macro abort if any symbols are out of order. The commit also changes the proc macro collect multiple errors (of order or duplicated symbols) and prints them at the end, which is useful if you have multiple errors.
2020-07-15Rollup merge of #74344 - estebank:stringly-wobbly, r=eddybManish Goregaokar-0/+1
Remove string comparison and use diagnostic item instead r? @eddyb
2020-07-15Rollup merge of #74276 - lcnr:discriminant-kind-what, r=nagisaManish Goregaokar-0/+1
improve DiscriminantKind handling Adds a lang item `discriminant_type` for the associated type `DiscriminantKind::Discriminant`. Changes the discriminant of generators from `i32` to `u32`, which should not be observable to fix an oversight where MIR was using `u32` and codegen and typeck used `i32`.
2020-07-15improve DiscriminantKind handlingBastian Kauschke-0/+1
This now reuses `fn discriminant_ty` in project, removing some code duplication. Doing so made me realize that we previously had a disagreement about the discriminant type of generators, with MIR using `u32` and codegen and trait selection using `i32`. We now always use `u32`.
2020-07-15Change `SymbolName::name` to a `&str`.Nicholas Nethercote-2/+0
This eliminates a bunch of `Symbol::intern()` and `Symbol::as_str()` calls, which is good, because they require locking the interner. Note that the unsafety in `from_cycle_error()` is identical to the unsafety on other adjacent impls.
2020-07-14Remove string comparison and use diagnostic item insteadEsteban Küber-0/+1
2020-07-15Remove lots of `Symbol::as_str()` calls.Nicholas Nethercote-1/+1
In various ways, such as changing functions to take a `Symbol` instead of a `&str`.
2020-07-15Add and use more static symbols.Nicholas Nethercote-0/+172
Note that the output of `unpretty-debug.stdout` has changed. In that test the hash values are normalized from a symbol numbers to small numbers like "0#0" and "0#1". The increase in the number of static symbols must have caused the original numbers to contain more digits, resulting in different pretty-printing prior to normalization.