about summary refs log tree commit diff
path: root/compiler/rustc_span/src
AgeCommit message (Collapse)AuthorLines
2022-05-05generalize "incoherent impls" impl for custom typeslcnr-0/+1
2022-05-04Stabilize `bool::then_some`Josh Triplett-1/+0
2022-05-03Add support for a new attribute `#[debugger_visualizer]` to support ↵ridwanabdillahi-0/+25
embedding debugger visualizers into a generated PDB. Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries. Merge the queries for debugger visualizers into a single query. Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`. Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate. Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature. Respond to PR comments and minor cleanups.
2022-05-02fix most compiler/ doctestsElliot Roberts-7/+10
2022-04-30Add `do yeet` expressions to allow experimentation in nightlyScott McMurray-0/+6
Using an obviously-placeholder syntax. An RFC would still be needed before this could have any chance at stabilization, and it might be removed at any point. But I'd really like to have it in nightly at least to ensure it works well with try_trait_v2, especially as we refactor the traits.
2022-04-29Fix duplicate directory separator in --remap-path-prefix.Michael Woerister-1/+93
2022-04-22extend `EventArgRecorder` into span-aware `SpannedEventArgRecorder`Rémy Rakic-0/+37
The self-profiler's `EventArgRecorder` is general-purpose in its ability to record Strings (and `rustc_span` depends on the crate its defined in, `rustc_data_structure`). Some generic activities could use recording locations where they happen in the user's code: to allow e.g. to track macro expansions and diagnose performance issues there. This adds a `SpannedEventArgRecorder` that can record an argument given as a span, rather than a String, since turning spans into Strings can be tricky if you're not happy with its default Debug output. This way the recorder can have a `record_arg_spanned` method which will do that.
2022-04-20Auto merge of #96082 - michaelwoerister:less_impl_stable_hash_via_hash, ↵bors-2/+1
r=compiler-errors incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it. Fixes https://github.com/rust-lang/rust/issues/96013.
2022-04-19Rollup merge of #95740 - Amanieu:kreg0, r=nagisaDylan DPC-0/+1
asm: Add a kreg0 register class on x86 which includes k0 Previously we only exposed a kreg register class which excludes the k0 register since it can't be used in many instructions. However k0 is a valid register and we need to have a way of marking it as clobbered for clobber_abi. Fixes #94977
2022-04-19asm: Add a kreg0 register class on x86 which includes k0Amanieu d'Antras-0/+1
Previously we only exposed a kreg register class which excludes the k0 register since it can't be used in many instructions. However k0 is a valid register and we need to have a way of marking it as clobbered for clobber_abi. Fixes #94977
2022-04-19Rollup merge of #96142 - cjgillot:no-crate-def-index, r=petrochenkovDylan DPC-2/+13
Stop using CRATE_DEF_INDEX outside of metadata encoding. `CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want. We should not manipulate raw `DefIndex` outside of metadata encoding.
2022-04-19incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it.Michael Woerister-2/+1
2022-04-17Auto merge of #96016 - Aaron1011:hash-name-cleanup, r=cjgillotbors-10/+0
Remove last vestiges of skippng ident span hashing This removes a comment that no longer applies, and properly hashes the full ident for path segments.
2022-04-17Stop using CRATE_DEF_INDEX.Camille GILLOT-2/+13
`CRATE_DEF_ID` and `CrateNum::as_def_id` are almost always what we want.
2022-04-16Rollup merge of #95961 - RalfJung:gather-scatter, r=workingjubileeDylan DPC-0/+1
implement SIMD gather/scatter via vector getelementptr Fixes https://github.com/rust-lang/portable-simd/issues/271 However, I don't *really* know what I am doing here... Cc ``@workingjubilee`` ``@calebzulawski`` I didn't do anything for cranelift -- ``@bjorn3`` not sure if it's okay for that backend to temporarily break. I'm happy to cherry-pick a patch that adds cranelift support. :)
2022-04-15Rollup merge of #94461 - jhpratt:2024-edition, r=pnkfelixDylan DPC-2/+35
Create (unstable) 2024 edition [On Zulip](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Deprecating.20macro.20scoping.20shenanigans/near/272860652), there was a small aside regarding creating the 2024 edition now as opposed to later. There was a reasonable amount of support and no stated opposition. This change creates the 2024 edition in the compiler and creates a prelude for the 2024 edition. There is no current difference between the 2021 and 2024 editions. Cargo and other tools will need to be updated separately, as it's not in the same repository. This change permits the vast majority of work towards the next edition to proceed _now_ instead of waiting until 2024. For sanity purposes, I've merged the "hello" UI tests into a single file with multiple revisions. Otherwise we'd end up with a file per edition, despite them being essentially identical. ````@rustbot```` label +T-lang +S-waiting-on-review Not sure on the relevant team, to be honest.
2022-04-13Auto merge of #95981 - martingms:invert-line-offset-parsing, r=nnethercotebors-11/+14
Optimize `<SourceFile as Decodable>::decode` It showed up as a hot-ish function in a callgrind profile of the `await-call-tree` benchmark crate. Provides some moderate speedups to compilation of some of the smaller benchmarks: #### Primary benchmarks Benchmark | Profile | Scenario | % Change | Significance Factor? -- | -- | -- | -- | -- helloworld | check | full | -1.81% | 9.03x helloworld | check | incr-unchanged | -1.80% | 8.99x helloworld | check | incr-full | -1.59% | 7.97x helloworld | check | incr-patched: println | -1.57% | 7.86x #### Secondary benchmarks <div class="category-title"></div> Benchmark | Profile | Scenario | % Change | Significance Factor? -- | -- | -- | -- | -- unify-linearly | check | incr-unchanged | -1.55% | 7.74x unify-linearly | check | incr-patched: dummy fn | -1.42% | 7.08x await-call-tree | check | incr-unchanged | -1.27% | 6.35x await-call-tree | debug | incr-unchanged | -1.19% | 5.95x await-call-tree | opt | incr-unchanged | -1.19% | 5.94x issue-46449 | check | incr-unchanged | -1.08% | 5.39x issue-46449 | check | incr-patched: u8 3072 | -1.00% | 5.00x structopt-0.3.26 | check | incr-unchanged | -0.94% | 4.72x structopt-0.3.26 | opt | incr-unchanged | -0.92% | 4.60x structopt-0.3.26 | debug | incr-unchanged | -0.92% | 4.59x issue-46449 | check | full | -0.89% | 4.46x structopt-0.3.26 | check | full | -0.83% | 4.17x structopt-0.3.26 | debug | full | -0.78% | 3.88x structopt-0.3.26 | opt | full | -0.76% | 3.81x unify-linearly | check | full | -0.75% | 3.74x projection-caching | check | incr-unchanged | -0.74% | 3.70x issue-46449 | check | incr-patched: u32 3072 | -0.70% | 3.50x issue-46449 | check | incr-patched: empty 3072 | -0.68% | 3.41x structopt-0.3.26 | check | incr-full | -0.68% | 3.40x wf-projection-stress-65510 | check | incr-unchanged | -0.68% | 3.39x issue-46449 | check | incr-patched: static str 6144 | -0.67% | 3.37x wf-projection-stress-65510 | debug | incr-unchanged | -0.67% | 3.33x wf-projection-stress-65510 | opt | incr-unchanged | -0.66% | 3.31x issue-46449 | check | incr-patched: io error 6144 | -0.66% | 3.29x unify-linearly | check | incr-full | -0.65% | 3.26x issue-46449 | check | incr-full | -0.65% | 3.25x structopt-0.3.26 | debug | incr-full | -0.64% | 3.18x structopt-0.3.26 | opt | incr-full | -0.63% | 3.17x issue-46449 | debug | incr-unchanged | -0.61% | 3.06x issue-46449 | opt | incr-unchanged | -0.61% | 3.03x await-call-tree | check | full | -0.60% | 2.99x issue-88862 | check | incr-unchanged | -0.58% | 2.91x deep-vector | debug | full | 0.57% | 2.83x await-call-tree | check | incr-full | -0.52% | 2.59x tt-muncher | opt | full | -0.52% | 2.58x issue-58319 | check | incr-unchanged | -0.50% | 2.52x await-call-tree | debug | full | -0.50% | 2.49x await-call-tree | opt | full | -0.49% | 2.45x deep-vector | debug | incr-patched: println | 0.47% | 2.37x await-call-tree | debug | incr-full | -0.45% | 2.26x await-call-tree | opt | incr-full | -0.44% | 2.18x issue-88862 | check | full | -0.41% | 2.06x mockall-0.11.0 | check | incr-unchanged | -0.38% | 1.90x regression-31157 | check | incr-unchanged | -0.37% | 1.86x wf-projection-stress-65510 | opt | full | -0.36% | 1.80x deunicode-1.3.1 | check | incr-unchanged | -0.35% | 1.76x unify-linearly | debug | incr-patched: dummy fn | -0.35% | 1.74x mockall-0.11.0 | check | full | -0.35% | 1.73x unify-linearly | debug | incr-unchanged | -0.34% | 1.69x deunicode-1.3.1 | check | full | -0.33% | 1.63x token-stream-stress | check | full | -0.32% | 1.62x token-stream-stress | check | incr-full | -0.32% | 1.59x token-stream-stress | check | incr-unchanged | -0.32% | 1.59x regression-31157 | check | incr-patched: println | -0.31% | 1.57x wf-projection-stress-65510 | check | full | -0.31% | 1.54x deeply-nested-multi | check | incr-unchanged | -0.31% | 1.53x mockall-0.11.0 | opt | incr-unchanged | -0.30% | 1.50x r? `@nnethercote`
2022-04-13Remove last vestiges of skippng ident span hashingAaron Hill-10/+0
This removes a comment that no longer applies, and properly hashes the full ident for path segments.
2022-04-13Use .extend(..) instead of push()-ing in loopMartin Gammelsæter-18/+12
A bit less readable but more compact, and maybe faster? We'll see.
2022-04-12Remove NodeIdHashingMode.Camille GILLOT-1/+1
2022-04-12Optimize line offset parsing in <SourceFile as Decodable>::decodeMartin Gammelsæter-11/+20
By inverting parsing loop, avoiding continually re-checking bytes_per_diff.
2022-04-12add simd_arith_offset intrinsicsRalf Jung-0/+1
2022-04-08Split `fuzzy_provenance_casts` into lossy and fuzzy, feature gate and test itniluxv-0/+1
* split `fuzzy_provenance_casts` into a ptr2int and a int2ptr lint * feature gate both lints * update documentation to be more realistic short term * add tests for these lints
2022-04-05span: move `MultiSpan`David Wood-137/+0
`MultiSpan` contains labels, which are more complicated with the introduction of diagnostic translation and will use types from `rustc_errors` - however, `rustc_errors` depends on `rustc_span` so `rustc_span` cannot use types like `DiagnosticMessage` without dependency cycles. Introduce a new `rustc_error_messages` crate that can contain `DiagnosticMessage` and `MultiSpan`. Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-04Mention implementers of unsatisfied traitEsteban Kuber-0/+4
When encountering an unsatisfied trait bound, if there are no other suggestions, mention all the types that *do* implement that trait: ``` error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/impl_wf.rs:22:6 | LL | impl Baz<f32> for f32 { } | ^^^^^^^^ the trait `Foo` is not implemented for `f32` | = help: the following other types implement trait `Foo`: Option<T> i32 str note: required by a bound in `Baz` --> $DIR/impl_wf.rs:18:31 | LL | trait Baz<U: ?Sized> where U: Foo { } | ^^^ required by this bound in `Baz` ``` Mention implementers of traits in `ImplObligation`s. Do not mention other `impl`s for closures, ranges and `?`.
2022-04-03Improve method name suggestionsOliver Downard-2/+82
Attempts to improve method name suggestions when a matching method name is not found. The approach taken is use the Levenshtein distance and account for substrings having a high distance but can sometimes be very close to the intended method (eg. empty vs is_empty).
2022-04-02Create 2024 editionJacob Pratt-2/+35
2022-03-31Rollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errorsDylan DPC-3/+3
Spellchecking compiler comments This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-31Rollup merge of #95011 - michaelwoerister:awaitee_field, r=tmandryDylan DPC-1/+1
async: Give predictable name to binding generated from .await expressions. This name makes it to debuginfo and allows debuggers to identify such bindings and their captured versions in suspended async fns. This will be useful for async stack traces, as discussed in https://internals.rust-lang.org/t/async-debugging-logical-stack-traces-setting-goals-collecting-examples/15547. I don't know if this needs some discussion by ````@rust-lang/compiler,```` e.g. about the name of the binding (`__awaitee`) or about the fact that this PR introduces a (soft) guarantee about a compiler generated name. Although, regarding the later, I think the same reasoning applies here as it does for debuginfo in general. r? ````@tmandry````
2022-03-31Rollup merge of #94869 - jackh726:gats_extended, r=compiler-errorsDylan DPC-0/+1
Add the generic_associated_types_extended feature Right now, this only ignore obligations that reference new placeholders in `poly_project_and_unify_type`. In the future, this might do other things, like allowing object-safe GATs. **This feature is *incomplete* and quite likely unsound. This is mostly just for testing out potential future APIs using a "relaxed" set of rules until we figure out *proper* rules.** Also drive by cleanup of adding a `ProjectAndUnifyResult` enum instead of using a `Result<Result<Option>>`. r? `@nikomatsakis`
2022-03-30Add the generic_associated_types_extended featureJack Huey-0/+1
2022-03-30Spellchecking compiler commentsYuri Astrakhan-3/+3
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30remove now unnecessary lang itemslcnr-10/+0
2022-03-30rework implementation for inherent impls for builtin typeslcnr-0/+2
2022-03-30async: Give predictable, reserved name to binding generated from .await ↵Michael Woerister-1/+1
expressions. This name makes it to debuginfo and allows debuggers to identify such bindings and their captured versions in suspended async fns.
2022-03-27Make fatal DiagnosticBuilder yield neverMichael Goulet-1/+1
2022-03-24add diagnostic items for clippy'sMax Baumann-0/+4
2022-03-21Rename `~const Drop` to `~const Destruct`Deadbeef-1/+1
2022-03-21Add `Destructible` for replacing `~const Drop`Deadbeef-0/+1
2022-03-15Add deprecated_safe feature gate and attribute, cc #94978skippy10110-0/+1
2022-03-14Rollup merge of #90621 - adamgemmell:dev/stabilise-target-feature, r=AmanieuMatthias Krüger-0/+1
Stabilise `aarch64_target_feature` This PR stabilises `aarch64_target_feature` - see https://github.com/rust-lang/rust/issues/90620
2022-03-14Stabilise `aarch64_target_feature`Adam Gemmell-0/+1
2022-03-10Rollup merge of #94368 - c410-f3r:metaaaaaaaaaaaaaaaaaaaaaaaaaaa, r=petrochenkovDylan DPC-0/+1
[1/2] Implement macro meta-variable expressions See https://github.com/rust-lang/rust/pull/93545#issuecomment-1050963295 The logic behind `length`, `index` and `count` was removed but the parsing code is still present, i.e., everything is simply ignored like `ignored`. r? ``@petrochenkov``
2022-03-10Rollup merge of #94274 - djkoloski:unknown_unstable_lints, r=tmandryDylan DPC-0/+1
Treat unstable lints as unknown This change causes unstable lints to be ignored if the `unknown_lints` lint is allowed. To achieve this, it also changes lints to apply as soon as they are processed. Previously, lints in the same set were processed as a batch and then all simultaneously applied. Implementation of https://github.com/rust-lang/compiler-team/issues/469
2022-03-10Rollup merge of #94635 - jhpratt:merge-deprecated-attrs, r=davidtwcoMatthias Krüger-0/+1
Merge `#[deprecated]` and `#[rustc_deprecated]` The first commit makes "reason" an alias for "note" in `#[rustc_deprecated]`, while still prohibiting it in `#[deprecated]`. The second commit changes "suggestion" to not just be a feature of `#[rustc_deprecated]`. This is placed behind the new `deprecated_suggestion` feature. This needs a tracking issue; let me know if this PR will be approved and I can create one. The third commit is what permits `#[deprecated]` to be used when `#![feature(staged_api)]` is enabled. This isn't yet used in stdlib (only tests), as it would require duplicating all deprecation attributes until a bootstrap occurs. I intend to submit a follow-up PR that replaces all uses and removes the remaining `#[rustc_deprecated]` code after the next bootstrap. `@rustbot` label +T-libs-api +C-feature-request +A-attributes +S-waiting-on-review
2022-03-10Auto merge of #94787 - matthiaskrgr:rollup-yyou15f, r=matthiaskrgrbors-0/+1
Rollup of 8 pull requests Successful merges: - #91804 (Make some `Clone` impls `const`) - #92541 (Mention intent of `From` trait in its docs) - #93057 (Add Iterator::collect_into) - #94739 (Suggest `if let`/`let_else` for refutable pat in `let`) - #94754 (Warn users about `||` in let chain expressions) - #94763 (Add documentation about lifetimes to thread::scope.) - #94768 (Ignore `close_read_wakes_up` test on SGX platform) - #94772 (Add miri to the well known conditional compilation names and values) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-09New `deprecated_suggestion` feature, use in testsJacob Pratt-0/+1
2022-03-09Implement macro meta-variable expressionsCaio-0/+1
2022-03-09Add miri to the well known conditional compilation names and valuesLoïc BRANSTETT-0/+1
2022-03-08Treat unstable lints as unknownDavid Koloski-0/+1
This change causes unstable lints to be ignored if the `unknown_lints` lint is allowed. To achieve this, it also changes lints to apply as soon as they are processed. Previously, lints in the same set were processed as a batch and then all simultaneously applied. Implementation of https://github.com/rust-lang/compiler-team/issues/469