about summary refs log tree commit diff
path: root/compiler/rustc_span
AgeCommit message (Collapse)AuthorLines
2022-01-10Auto merge of #92278 - Aaron1011:fix-fingerprint-caching, r=michaelwoeristerbors-0/+35
Ensure that `Fingerprint` caching respects hashing configuration Fixes #92266 In some `HashStable` impls, we use a cache to avoid re-computing the same `Fingerprint` from the same structure (e.g. an `AdtDef`). However, the `StableHashingContext` used can be configured to perform hashing in different ways (e.g. skipping `Span`s). This configuration information is not included in the cache key, which will cause an incorrect `Fingerprint` to be used if we hash the same structure with different `StableHashingContext` settings. To fix this, the configuration settings of `StableHashingContext` are split out into a separate `HashingControls` struct. This struct is used as part of the cache key, ensuring that our caches always produce the correct result for the given settings. With this in place, we now turn off `Span` hashing during the entire process of computing the hash included in legacy symbols. This current has no effect, but will matter when a future PR starts hashing more `Span`s that we currently skip.
2022-01-09feat: pass_by_value lint attributeMahdi Dibaiee-0/+1
Useful for thin wrapper attributes that are best passed as value instead of reference.
2022-01-09Implement `#[rustc_must_implement_one_of]` attributeMaybe Waffle-0/+1
2022-01-07Fix typo in `StableCrateId` docspierwill-2/+2
2022-01-06Add diagnostic items for macrosAlex Macleod-0/+31
2022-01-05Adjust assert_default_hashing_controlsAaron Hill-6/+15
2022-01-05Ensure that `Fingerprint` caching respects hashing configurationAaron Hill-0/+26
Fixes #92266 In some `HashStable` impls, we use a cache to avoid re-computing the same `Fingerprint` from the same structure (e.g. an `AdtDef`). However, the `StableHashingContext` used can be configured to perform hashing in different ways (e.g. skipping `Span`s). This configuration information is not included in the cache key, which will cause an incorrect `Fingerprint` to be used if we hash the same structure with different `StableHashingContext` settings. To fix this, the configuration settings of `StableHashingContext` are split out into a separate `HashingControls` struct. This struct is used as part of the cache key, ensuring that our caches always produce the correct result for the given settings. With this in place, we now turn off `Span` hashing during the entire process of computing the hash included in legacy symbols. This current has no effect, but will matter when a future PR starts hashing more `Span`s that we currently skip.
2022-01-05Rollup merge of #92442 - pierwill:localdefid-doc-ord, r=Aaron1011Matthias Krüger-5/+11
Add negative `impl` for `Ord`, `PartialOrd` on `LocalDefId` Suggested in https://github.com/rust-lang/rust/pull/92233#discussion_r776123222. This also fixes some formatting in the doc comment. r? `@cjgillot`
2022-01-04Make `DefId` `repr(C)`, optimize big-endian field orderAndre Bogus-1/+8
2022-01-04Add simd_as intrinsicCaleb Zulawski-0/+1
2022-01-03Auto merge of #92179 - Aaron1011:incr-loaded-from-disk, r=michaelwoeristerbors-0/+1
Add `#[rustc_clean(loaded_from_disk)]` to assert loading of query result Currently, you can use `#[rustc_clean]` to assert to that a particular query (technically, a `DepNode`) is green or red. However, a green `DepNode` does not mean that the query result was actually deserialized from disk - we might have never re-run a query that needed the result. Some incremental tests are written as regression tests for ICEs that occured during query result decoding. Using `#[rustc_clean(loaded_from_disk="typeck")]`, you can now assert that the result of a particular query (e.g. `typeck`) was actually loaded from disk, in addition to being green.
2021-12-30Add negative `impl` for `Ord`, `PartialOrd` on `LocalDefId`pierwill-5/+11
Add comment about why `LocalDefId` should not be `Ord` Also fix some formatting in the doc comment.
2021-12-22Remove `PartialOrd` and `Ord` from `LocalDefId`pierwill-2/+32
Implement `Ord`, `PartialOrd` for SpanData
2021-12-21Add `#[rustc_clean(loaded_from_disk)]` to assert loading of query resultAaron Hill-0/+1
Currently, you can use `#[rustc_clean]` to assert to that a particular query (technically, a `DepNode`) is green or red. However, a green `DepNode` does not mean that the query result was actually deserialized from disk - we might have never re-run a query that needed the result. Some incremental tests are written as regression tests for ICEs that occured during query result decoding. Using `#[rustc_clean(loaded_from_disk="typeck")]`, you can now assert that the result of a particular query (e.g. `typeck`) was actually loaded from disk, in addition to being green.
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-85/+25
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-16Auto merge of #89836 - pierwill:fix-85142-crate-hash, r=wesleywiserbors-6/+21
Include rustc version in `rustc_span::StableCrateId` `rustc_span::def_id::StableCrateId` is a hash of various data about a crate during compilation. This PR includes the version of `rustc` in the input when computing this hash. From a cursory reading of [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html), this appears to be acceptable within that design. In order to pass the `mir-opt` and `ui` test suites, this adds new [normalization for hashes and symbol names in `compiletest`](https://github.com/rust-lang/rust/pull/89836/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b). These are enabled by default, but we might prefer it to be configurable. In the UI tests, I had to truncate a significant amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See https://github.com/rust-lang/rust/issues/90116.) Closes #85142.
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-6/+6
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-79/+19
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-14Auto merge of #91660 - llogiq:make-a-hash-of-def-ids, r=nnethercotebors-5/+31
manually implement `Hash` for `DefId` This might speed up hashing for hashers that can work on individual u64s. Just as an experiment, suggested in a reddit thread on `FxHasher`. cc `@nnethercote` Note that this should not be merged as is without cfg-ing the code path for 64 bits.
2021-12-13Add run-make-fulldeps testpierwill-5/+14
Implement RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER Also makes minor docs edits.
2021-12-13Include rustc version in `rustc_span::StableCrateId`pierwill-5/+11
Normalize symbol hashes in compiletest. Remove DefId sorting
2021-12-10Rollup merge of #91625 - est31:remove_indexes, r=oli-obkMatthias Krüger-2/+2
Remove redundant [..]s
2021-12-10manually implement `Hash` for `DefId`Andre Bogus-5/+31
This also reorders the fields to reduce the assembly operations for hashing and changes two UI tests that depended on the former ordering because of hashmap iteration order.
2021-12-09Auto merge of #91692 - matthiaskrgr:rollup-u7dvh0n, r=matthiaskrgrbors-1/+1
Rollup of 6 pull requests Successful merges: - #87599 (Implement concat_bytes!) - #89999 (Update std::env::temp_dir to use GetTempPath2 on Windows when available.) - #90796 (Remove the reg_thumb register class for asm! on ARM) - #91042 (Use Vec extend instead of repeated pushes on several places) - #91634 (Do not attempt to suggest help for overly malformed struct/function call) - #91685 (Install llvm tools to sysroot when assembling local toolchain) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-09Rollup merge of #90796 - Amanieu:remove_reg_thumb, r=joshtriplettMatthias Krüger-1/+0
Remove the reg_thumb register class for asm! on ARM Also restricts r8-r14 from being used on Thumb1 targets as per #90736. cc ``@Lokathor`` r? ``@joshtriplett``
2021-12-09Rollup merge of #87599 - Smittyvb:concat_bytes, r=Mark-SimulacrumMatthias Krüger-0/+1
Implement concat_bytes! This implements the unstable `concat_bytes!` macro, which has tracking issue #87555. It can be used like: ```rust #![feature(concat_bytes)] fn main() { assert_eq!(concat_bytes!(), &[]); assert_eq!(concat_bytes!(b'A', b"BC", [68, b'E', 70]), b"ABCDEF"); } ``` If strings or characters are used where byte strings or byte characters are required, it suggests adding a `b` prefix. If a number is used outside of an array it suggests arrayifying it. If a boolean is used it suggests replacing it with the numeric value of that number. Doubly nested arrays of bytes are disallowed.
2021-12-09Rollup merge of #91476 - m-ou-se:ferris-identifier, r=estebankMatthias Krüger-0/+1
Improve 'cannot contain emoji' error. Before: ``` error: identifiers cannot contain emoji: `🦀` --> src/main.rs:2:9 | 2 | let 🦀 = 1; | ^^ ``` After: ``` error: Ferris cannot be used as an identifier --> src/main.rs:2:9 | 2 | let 🦀 = 1; | ^^ help: try using their name instead: `ferris` ``` r? `@estebank`
2021-12-09Remove redundant [..]sest31-2/+2
2021-12-07Remove the reg_thumb register class for asm! on ARMAmanieu d'Antras-1/+0
Also restricts r8-r14 from being used on Thumb1 targets as per #90736.
2021-12-07Auto merge of #91224 - couchand:2021-11/avr-asm, r=Amanieubors-0/+4
Support AVR for inline asm! A first pass at support for the AVR platform in inline `asm!`. Passes the initial compiler tests, have not yet done more complete verification. In particular, the register classes could use a lot more fleshing out, this draft PR so far only includes the most basic. cc `@Amanieu` `@dylanmckay`
2021-12-07Rollup merge of #87614 - notriddle:notriddle-count2len, r=Mark-SimulacrumMatthias Krüger-0/+1
Recommend fix `count()` -> `len()` on slices Fixes #87302
2021-12-06Recommend fix `count()` -> `len()` on slicesMichael Howell-0/+1
Fixes #87302
2021-12-06Implement concat_bytes!Smitty-0/+1
The tracking issue for this is #87555.
2021-12-06Implement inline asm! for AVR platformAndrew Dona-Couch-0/+4
2021-12-05Rollup merge of #91355 - alexcrichton:stabilize-thread-local-const, r=m-ou-seMatthias Krüger-1/+0
std: Stabilize the `thread_local_const_init` feature This commit is intended to follow the stabilization disposition of the FCP that has now finished in #84223. This stabilizes the ability to flag thread local initializers as `const` expressions which enables the macro to generate more efficient code for accessing it, notably removing runtime checks for initialization. More information can also be found in #84223 as well as the tests where the feature usage was removed in this PR. Closes #84223
2021-12-04Rollup merge of #90519 - estebank:issue-84003, r=petrochenkovMatthias Krüger-0/+10
Keep spans for generics in `#[derive(_)]` desugaring Keep the spans for generics coming from a `derive`d Item, so that errors and suggestions have better detail. Fix #84003.
2021-12-03add `unwind_asm` feature gate for `may_unwind` optioncynecx-0/+1
2021-12-03Add initial AST and MIR support for unwinding from inline assemblyAmanieu d'Antras-0/+1
2021-12-03Auto merge of #90737 - eholk:intofuture, r=tmandrybors-0/+2
Reintroduce `into_future` in `.await` desugaring This is a reintroduction of the remaining parts from https://github.com/rust-lang/rust/pull/65244 that have not been relanded yet. This isn't quite ready to merge yet. The last attempt was reverting due to performance regressions, so we need to make sure this does not introduce those issues again. Issues #67644, #67982 /cc `@yoshuawuyts`
2021-12-03Annotate `derive`d spans and move span suggestion codeEsteban Kuber-0/+10
* Annotate `derive`d spans from the user's code with the appropciate context * Add `Span::can_be_used_for_suggestion` to query if the underlying span at the users' code
2021-12-03Improve 'cannot contain emoji' error.Mara Bos-0/+1
2021-12-03Improve the comments in `Symbol::interner`.Nicholas Nethercote-6/+13
2021-11-29std: Stabilize the `thread_local_const_init` featureAlex Crichton-1/+0
This commit is intended to follow the stabilization disposition of the FCP that has now finished in #84223. This stabilizes the ability to flag thread local initializers as `const` expressions which enables the macro to generate more efficient code for accessing it, notably removing runtime checks for initialization. More information can also be found in #84223 as well as the tests where the feature usage was removed in this PR. Closes #84223
2021-11-28Add parent crate assert to register_expn_idCameron Steffen-0/+1
2021-11-28Add fast path to is_descendant_ofCameron Steffen-2/+19
2021-11-25Rollup merge of #91096 - compiler-errors:elaborate_opaque_trait, r=estebankMatthias Krüger-0/+1
Print associated types on opaque `impl Trait` types This PR generalizes #91021, printing associated types for all opaque `impl Trait` types instead of just special-casing for future. before: ``` error[E0271]: type mismatch resolving `<impl Iterator as Iterator>::Item == u32` ``` after: ``` error[E0271]: type mismatch resolving `<impl Iterator<Item = usize> as Iterator>::Item == u32` ``` --- Questions: 1. I'm kinda lost in binders hell with this one. Is all of the `rebind`ing necessary? 2. Is there a map collection type that will give me a stable iteration order? Doesn't seem like TraitRef is Ord, so I can't just sort later.. 3. I removed the logic that suppresses printing generator projection types. It creates outputs like this [gist](https://gist.github.com/compiler-errors/d6f12fb30079feb1ad1d5f1ab39a3a8d). Should I put that back? 4. I also added spaces between traits, `impl A+B` -> `impl A + B`. I quite like this change, but is there a good reason to keep it like that? r? ````@estebank````
2021-11-24Rollup merge of #90420 - GuillaumeGomez:rustdoc-internals-feature, r=camelidGuillaume Gomez-0/+1
Create rustdoc_internals feature gate As suggested by ``@camelid`` [here](https://github.com/rust-lang/rust/pull/90398#issuecomment-955093851), since `doc_keyword` and `doc_primitive` aren't meant to be stabilized, we could put them behind a same feature flag. This is pretty much what it would look like (needs to update the tests too). The tracking issue is https://github.com/rust-lang/rust/issues/90418. What do you think ``@rust-lang/rustdoc`` ?
2021-11-24Create rustdoc_internals feature gateGuillaume Gomez-0/+1
2021-11-23Add generator lang-itemMichael Goulet-0/+1
2021-11-23Rollup merge of #91140 - nbdd0121:const_typeck, r=oli-obkMatthias Krüger-0/+1
Split inline const to two feature gates and mark expression position inline const complete This PR splits inline const in pattern position into its own `#![feature(inline_const_pat)]` feature gate, and make the usage in expression position complete. I think I have resolved most outstanding issues related to `inline_const` with #89561 and other PRs. The only thing left that I am aware of is #90150 and the lack of lifetime checks when inline const is used in pattern position (FIXME in #89561). Implementation-wise when used in pattern position it has to be lowered during MIR building while in expression position it's evaluated only when monomorphizing (just like normal consts), so it makes some sense to separate it into two feature gates so one can progress without being blocked by another. ``@rustbot`` label: T-compiler F-inline_const