about summary refs log tree commit diff
path: root/src/librustc_span
AgeCommit message (Collapse)AuthorLines
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.
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-19/+23
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-19/+23
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 #73881 - pierwill:pierwill-citations, r=jonas-schievinkManish Goregaokar-5/+4
Standardize bibliographic citations in rustc API docs See #73877.
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-02Standardize bibliographic citations in rustc API docspierwill-5/+4
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-1/+6
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 #73853 - pierwill:pierwill-multispan-doc, r=jonas-schievinkManish Goregaokar-1/+3
Add newline to rustc MultiSpan docs Also adds back-ticks when referring to the contents of this collection.
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-29Serialize all foreign `SourceFile`s into proc-macro crate metadataAaron Hill-3/+43
Normally, we encode a `Span` that references a foreign `SourceFile` by encoding information about the foreign crate. When we decode this `Span`, we lookup the foreign crate in order to decode the `SourceFile`. However, this approach does not work for proc-macro crates. When we load a proc-macro crate, we do not deserialzie any of its dependencies (since a proc-macro crate can only export proc-macros). This means that we cannot serialize a reference to an upstream crate, since the associated metadata will not be available when we try to deserialize it. This commit modifies foreign span handling so that we treat all foreign `SourceFile`s as local `SourceFile`s when serializing a proc-macro. All `SourceFile`s will be stored into the metadata of a proc-macro crate, allowing us to cotinue to deserialize a proc-macro crate without needing to load any of its dependencies. Since the number of foreign `SourceFile`s that we load during a compilation session may be very large, we only serialize a `SourceFile` if we have also serialized a `Span` which requires it.
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-28Add newline to rustc MultiSpan docspierwill-1/+3
Also adds back-ticks when referring to the contents of this collection.
2020-06-28Remove `const_if_match` feature gate from librariesDylan MacKenzie-1/+1
2020-06-26Make `likely` and `unlikely` constGary Guo-0/+2
They are gated by internal feature gate const_likely