about summary refs log tree commit diff
path: root/src/librustc_span/symbol.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-1693/+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-14Rework `rustc_serialize`Matthew Jasper-28/+7
- 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-09rustc_span: note the perf loss seen from IndexSet in symbol::InternerJosh Stone-0/+4
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-05add min_const_generics feature gateBastian Kauschke-0/+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-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-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-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.
2020-07-15Fix the ordering of the static symbols.Nicholas Nethercote-64/+66
2020-07-15Rename `sym::nontrapping_fptoint`.Nicholas Nethercote-4/+8
2020-07-11Correctly sort const_fn_transmuteManish Goregaokar-1/+1
2020-07-11Stabilize `transmute` in constants and statics but not const fnOliver Scherer-0/+1
2020-07-09Rollup merge of #74079 - nnethercote:session-globals, r=nikomatsakisManish Goregaokar-2/+2
Eliminate confusing "globals" terminology. There are some structures that are called "globals", but are they global to a compilation session, and not truly global. I have always found this highly confusing, so this commit renames them as "session globals" and adds a comment explaining things. Also, the commit fixes an unnecessary nesting of `set()` calls `src/librustc_errors/json/tests.rs` r? @Aaron1011
2020-07-09Eliminate confusing "globals" terminology.Nicholas Nethercote-2/+2
There are some structures that are called "globals", but are they global to a compilation session, and not truly global. I have always found this highly confusing, so this commit renames them as "session globals" and adds a comment explaining things. Also, the commit fixes an unnecessary nesting of `set()` calls `src/librustc_errors/json/tests.rs`
2020-07-05Rollup merge of #74000 - lcnr:lazy_normalisation_consts, r=varkorManish Goregaokar-0/+1
add `lazy_normalization_consts` feature gate In #71973 I underestimated the amount of code which is influenced by lazy normalization of consts and decided against having a separate feature flag for this. Looking a bit more into this, the following issues are already working with lazy norm in its current state #47814 #57739 #73980 I therefore think it is worth it to enable lazy norm separately. Note that `#![feature(const_generics)]` still automatically activates this feature, so using `#![feature(const_generics, lazy_normalization_consts)]` is redundant. r? @varkor @nikomatsakis
2020-07-04Match on `Symbol` instead of `&str` for type-checking intrinsics.Oliver Scherer-0/+79
2020-07-04add `lazy_normalization_consts` feature gateBastian Kauschke-0/+1
2020-07-03Rollup merge of #73670 - davidhewitt:format-args-capture, r=varkorManish Goregaokar-0/+1
Add `format_args_capture` feature This is the initial implementation PR for [RFC 2795](https://github.com/rust-lang/rfcs/pull/2795). Note that, as dicussed in the tracking issue (#67984), the feature gate has been called `format_args_capture`. Next up I guess I need to add documentation for this feature. I've not written any docs before for rustc / std so I would appreciate suggestions on where I should add docs.
2020-07-02Rollup merge of #73724 - CryZe:wasm-saturating-casts, r=alexcrichtonManish Goregaokar-0/+1
Use WASM's saturating casts if they are available WebAssembly supports saturating floating point to integer casts behind a target feature. The feature is already available on many browsers. Beginning with 1.45 Rust will start defining the behavior of floating point to integer casts to be saturating as well. For this Rust constructs additional checks on top of the `fptoui` / `fptosi` instructions it emits. Here we introduce the possibility for the codegen backend to construct saturating casts itself and only fall back to constructing the checks ourselves if that is not possible. Resolves part of #73591
2020-07-02Auto merge of #73954 - Manishearth:rollup-8qvh170, r=Manishearthbors-0/+3
Rollup of 10 pull requests Successful merges: - #73414 (Implement `slice_strip` feature) - #73564 (linker: Create GNU_EH_FRAME header by default when producing ELFs) - #73622 (Deny unsafe ops in unsafe fns in libcore) - #73684 (add spans to injected coverage counters, extract with CoverageData query) - #73812 (ast_pretty: Pass some token streams and trees by reference) - #73853 (Add newline to rustc MultiSpan docs) - #73883 (Compile rustdoc less often.) - #73885 (Fix wasm32 being broken due to a NodeJS version bump) - #73903 (Changes required for rustc/cargo to build for iOS targets) - #73938 (Optimise fast path of checked_ops with `unlikely`) Failed merges: r? @ghost
2020-07-02Address review comments and add UI testChristopher Serr-1/+1
2020-07-02Check for feature with pre-interned symbolChristopher Serr-0/+1
2020-07-02Rollup merge of #73684 - richkadel:llvm-coverage-map-gen-2, r=wesleywiserManish Goregaokar-0/+3
add spans to injected coverage counters, extract with CoverageData query This is the next iteration on the Rust Coverage implementation, and follows PR #73488 @tmandry @wesleywiser I came up with an approach for coverage spans, pushing them through the Call terminator as additional args so they can be extracted by the CoverageData query. I'm using an IndexVec to store them in CoverageData such that there can be only one per index (even if parts of the MIR get duplicated during optimization). If this approach works for you, I can quickly expand on this to build a separate IndexVec for counter expressions, using a separate call that will be ignored during code generation, but from which I can extract the counter expression values. Let me know your thoughts. Thanks! r? @tmandry Rust compiler MCP rust-lang/compiler-team#278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation
2020-07-01Rollup merge of #73345 - petrochenkov:nointerp, r=Aaron1011Manish Goregaokar-0/+3
expand: Stop using nonterminals for passing tokens to attribute and derive macros Make one more step towards fully token-based expansion and fix issues described in https://github.com/rust-lang/rust/issues/72545#issuecomment-640276791. Now `struct S;` is passed to `foo!(struct S;)` and `#[foo] struct S;` in the same way - as a token stream `struct S ;`, rather than a single non-terminal token `NtItem` which is then broken into parts later. The cost is making pretty-printing of token streams less pretty. Some of the pretty-printing regressions will be recovered by keeping jointness with each token, which we will need to do anyway. Unfortunately, this is not exactly the same thing as https://github.com/rust-lang/rust/pull/73102. One more observable effect is how `$crate` is printed in the attribute input. Inside `NtItem` was printed as `crate` or `that_crate`, now as a part of a token stream it's printed as `$crate` (there are good reasons for these differences, see https://github.com/rust-lang/rust/pull/62393 and related PRs). This may break old proc macros (custom derives) written before the main portion of the proc macro API (macros 1.2) was stabilized, those macros did `input.to_string()` and reparsed the result, now that result can contain `$crate` which cannot be reparsed. So, I think we should do this regardless, but we need to run crater first. r? @Aaron1011
2020-07-01Rollup merge of #73778 - nbdd0121:const_likely, r=oli-obkManish Goregaokar-0/+2
Make `likely` and `unlikely` const, gated by feature `const_unlikely` This PR also contains a fix to allow `#[allow_internal_unstable]` to work properly with `#[rustc_const_unstable]`. cc @RalfJung @nagisa r? @oli-obk
2020-07-01expand: Stop using nonterminals for passing tokens to attribute and derive ↵Vadim Petrochenkov-0/+3
macros
2020-06-29add spans to injected coverage countersRich Kadel-0/+3
added regions with counter expressions and counters. Added codegen_llvm/coverageinfo mod for upcoming coverage map Move coverage region collection to CodegenCx finalization Moved from `query coverageinfo` (renamed from `query coverage_data`), as discussed in the PR at: https://github.com/rust-lang/rust/pull/73684#issuecomment-649882503 Address merge conflict in MIR instrument_coverage test The MIR test output format changed for int types. moved debug messages out of block.rs This makes the block.rs calls to add coverage mapping data to the CodegenCx much more concise and readable. move coverage intrinsic handling into llvm impl I realized that having half of the coverage intrinsic handling in `rustc_codegen_ssa` and half in `rustc_codegen_llvm` meant that any non-llvm backend would be bound to the same decisions about how the coverage-related MIR terminators should be handled. To fix this, I moved the non-codegen portion of coverage intrinsic handling into its own trait, and implemented it in `rustc_codegen_llvm` alongside `codegen_intrinsic_call`. I also added the (required?) stubs for the new intrinsics to `IntrepretCx::emulate_intrinsic()`, to ensure calls to this function do not fail if called with these new but known intrinsics. address PR Feedback on 28 June 2020 2:48pm PDT
2020-06-26Make `likely` and `unlikely` constGary Guo-0/+2
They are gated by internal feature gate const_likely