about summary refs log tree commit diff
path: root/compiler/rustc_span/src
AgeCommit message (Collapse)AuthorLines
2024-01-22Rollup merge of #120143 - ↵Matthias Krüger-0/+1
compiler-errors:consolidate-instance-resolve-for-coroutines, r=oli-obk Consolidate logic around resolving built-in coroutine trait impls Deduplicates a lot of code. Requires defining a new lang item for `Coroutine::resume` for consistency, but it seems not harmful at worst, and potentially later useful at best. r? oli-obk
2024-01-19Consolidate logic around resolving built-in coroutine trait implsMichael Goulet-0/+1
2024-01-19Stabilize simple offset_ofGeorge Bateman-0/+1
2024-01-19Add new intrinsic `is_constant` and optimize `pow`Catherine Flores-0/+1
Fix overflow check Make MIRI choose the path randomly and rename the intrinsic Add back test Add miri test and make it operate on `ptr` Define `llvm.is.constant` for primitives Update MIRI comment and fix test in stage2 Add const eval test Clarify that both branches must have the same side effects guaranteed non guarantee use immediate type instead Co-Authored-By: Ralf Jung <post@ralfj.de>
2024-01-19Auto merge of #120112 - matthiaskrgr:rollup-48o3919, r=matthiaskrgrbors-5/+16
Rollup of 9 pull requests Successful merges: - #119582 (bootstrap: handle vendored sources when remapping crate paths) - #119730 (docs: fix typos) - #119828 (Improved collapse_debuginfo attribute, added command-line flag) - #119869 (replace `track_errors` usages with bubbling up `ErrorGuaranteed`) - #120037 (Remove `next_root_ty_var`) - #120094 (tests/ui/asm/inline-syntax: adapt for LLVM 18) - #120096 (Set RUSTC_BOOTSTRAP=1 consistently) - #120101 (change `.unwrap()` to `?` on write where `fmt::Result` is returned) - #120102 (Fix typo in munmap_partial.rs) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-18Rollup merge of #119828 - azhogin:azhogin/collapse_debuginfo_improved_attr, ↵Matthias Krüger-5/+16
r=petrochenkov Improved collapse_debuginfo attribute, added command-line flag Improved attribute collapse_debuginfo with variants: `#[collapse_debuginfo=(no|external|yes)]`. Added command-line flag for default behaviour. Work-in-progress: will add more tests. cc https://github.com/rust-lang/rust/issues/100758
2024-01-17Use UnhashMap for a few more mapsMark Rousskov-4/+4
This avoids hashing data that's already hashed.
2024-01-17Improved collapse_debuginfo attribute, added command-line flag (no|external|yes)Andrew Zhogin-5/+16
2024-01-15compiler: Lower fn call arg spans down to MIRMartin Nordholts-1/+1
To enable improved accuracy of diagnostics in upcoming commits.
2024-01-13Auto merge of #118947 - Bryanskiy:delegStep1, r=petrochenkov,lcnrbors-0/+1
Delegation implementation: step 1 See https://github.com/rust-lang/rust/issues/118212 for more details. r? `@petrochenkov`
2024-01-12Rollup merge of #119819 - chenyukang:yukang-fix-118183-lint, r=davidtwcoGuillaume Gomez-0/+28
Check rust lints when an unknown lint is detected Fixes #118183
2024-01-12Delegation implementation: step 1Bryanskiy-0/+1
2024-01-12check rust lints when an unknown lint is detectedyukang-0/+28
2024-01-09Remove more needless leb128 coding for enum variantsMark Rousskov-11/+12
This removes emit_enum_variant and the emit_usize calls that resulted in. In libcore this eliminates 17% of leb128, taking us from 8964488 to 7383842 leb128's serialized.
2024-01-09Rollup merge of #118903 - azhogin:azhogin/skip_second_stmt_debuginfo.rs, ↵Matthias Krüger-8/+33
r=petrochenkov Improved support of collapse_debuginfo attribute for macros. Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain. Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap). cc https://github.com/rust-lang/rust/issues/100758
2024-01-08Improved support of collapse_debuginfo attribute for macros.Andrew Zhogin-8/+33
2024-01-08macro_rules: Add an expansion-local cache to span markerVadim Petrochenkov-1/+1
2024-01-06Auto merge of #119662 - matthiaskrgr:rollup-ehofh5n, r=matthiaskrgrbors-65/+48
Rollup of 9 pull requests Successful merges: - #118194 (rustdoc: search for tuples and unit by type with `()`) - #118781 (merge core_panic feature into panic_internals) - #119486 (pass allow-{dirty,staged} to clippy) - #119591 (rustc_mir_transform: Make DestinationPropagation stable for queries) - #119595 (Fixed ambiguity in hint.rs) - #119624 (rustc_span: More consistent span combination operations) - #119653 (compiler: update Fuchsia sanitizer support.) - #119655 (Remove ignore-stage1 that was added when changing error count msg) - #119661 (Strip lld-wrapper binaries) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-06Rollup merge of #119624 - petrochenkov:dialoc4, r=compiler-errorsMatthias Krüger-65/+48
rustc_span: More consistent span combination operations Also add more tests for using `tt` in addition to `ident`, and some other minor tweaks, see individual commits. This is a part of https://github.com/rust-lang/rust/pull/119412 that doesn't yet add side tables for metavariable spans.
2024-01-06Auto merge of #119531 - petrochenkov:cmpctxt, r=cjgillotbors-43/+64
rustc_span: Optimize syntax context comparisons Including comparisons with root context. - `eq_ctxt` doesn't require retrieving full `SpanData`, or taking the span interner lock twice. - Checking `SyntaxContext` for "rootness" is cheaper than extracting a full outer `ExpnData` for it and checking *it* for rootness. The internal lint for `eq_ctxt` is also tweaked to detect `a.ctxt() != b.ctxt()` in addition to `a.ctxt() == b.ctxt()`.
2024-01-06Auto merge of #119478 - bjorn3:no_serialize_specialization, r=wesleywiserbors-96/+205
Avoid specialization in the metadata serialization code With the exception of a perf-only specialization for byte slices and byte vectors. This uses the same trick of introducing a new trait and having the Encodable and Decodable derives add a bound to it as used for TyEncoder/TyDecoder. The new code is clearer about which encoder/decoder uses which impl and it reduces the dependency of rustc on specialization, making it easier to remove support for specialization entirely or turn it into a construct that is only allowed for perf optimizations if we decide to do this.
2024-01-06rustc_span: Optimize syntax context comparisonsVadim Petrochenkov-43/+64
Including comparisons with root context
2024-01-05Auto merge of #119192 - michaelwoerister:mcp533-push, r=cjgillotbors-2/+28
Replace a number of FxHashMaps/Sets with stable-iteration-order alternatives This PR replaces almost all of the remaining `FxHashMap`s in query results with either `FxIndexMap` or `UnordMap`. The only case that is missing is the `EffectiveVisibilities` struct which turned out to not be straightforward to transform. Once that is done too, we can remove the `HashStable` implementation from `HashMap`. The first commit adds the `StableCompare` trait which is a companion trait to `StableOrd`. Some types like `Symbol` can be compared in a cross-session stable way, but their `Ord` implementation is not stable. In such cases, a `StableCompare` implementation can be provided to offer a lightweight way for stable sorting. The more heavyweight option is to sort via `ToStableHashKey`, but then sorting needs to have access to a stable hashing context and `ToStableHashKey` can also be expensive as in the case of `Symbol` where it has to allocate a `String`. The rest of the commits are rather mechanical and don't overlap, so they are best reviewed individually. Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533).
2024-01-05rustc_span: More consistent span combination operationsVadim Petrochenkov-49/+47
2024-01-05rustc_span: Remove `fn fresh_expansion`Vadim Petrochenkov-16/+1
In the past it did create a fresh expansion, but now, after surviving a number of refactorings, it does not. Now it's just a thin wrapper around `apply_mark`.
2024-01-04Rollup merge of #119325 - RalfJung:custom-mir, r=compiler-errorsMatthias Krüger-0/+1
custom mir: make it clear what the return block is Custom MIR recently got support for specifying the "unwind action", so now there's two things coming after the actual call part of `Call` terminators. That's not very self-explaining so I propose we change the syntax to imitate keyword arguments: ``` Call(popped = Vec::pop(v), ReturnTo(drop), UnwindContinue()) ``` Also fix some outdated docs and add some docs to `Call` and `Drop`.
2024-01-04Make iteration order of region_scope_tree query stableMichael Woerister-1/+17
2024-01-04Split StableCompare trait out of StableOrd trait.Michael Woerister-1/+11
StableCompare is a companion trait to `StableOrd`. Some types like `Symbol` can be compared in a cross-session stable way, but their `Ord` implementation is not stable. In such cases, a `StableOrd` implementation can be provided to offer a lightweight way for stable sorting. (The more heavyweight option is to sort via `ToStableHashKey`, but then sorting needs to have access to a stable hashing context and `ToStableHashKey` can also be expensive as in the case of `Symbol` where it has to allocate a `String`.)
2024-01-01Add comments sugested by reviewerbjorn3-0/+5
2023-12-31Avoid specialization for AttrId deserializationbjorn3-0/+22
2023-12-31Remove almost all uses of specialization from the metadata encoding codebjorn3-85/+143
2023-12-31Avoid specialization for the Span Encodable and Decodable implsbjorn3-11/+35
2023-12-26custom mir: make it clear what the return block isRalf Jung-0/+1
2023-12-26Rollup merge of #119235 - Urgau:missing-feature-gate-sanitizer-cfi-cfgs, ↵Michael Goulet-0/+1
r=Nilstrieb Add missing feature gate for sanitizer CFI cfgs Found during the review of https://github.com/rust-lang/rust/pull/118494 in https://github.com/rust-lang/rust/pull/118494#discussion_r1416079288. cc `@rcvalle`
2023-12-25select AsyncFn traits during overloaded call opMichael Goulet-0/+6
2023-12-24Auto merge of #119139 - michaelwoerister:cleanup-stable-source-file-id, ↵bors-64/+81
r=cjgillot Unify SourceFile::name_hash and StableSourceFileId This PR adapts the existing `StableSourceFileId` type so that it can be used instead of the `name_hash` field of `SourceFile`. This simplifies a few things that were kind of duplicated before. The PR should also fix issues https://github.com/rust-lang/rust/issues/112700 and https://github.com/rust-lang/rust/issues/115835, but I was not able to reproduce these issues in a regression test. As far as I can tell, the root cause of these issues is that the id of the originating crate is not hashed in the `HashStable` impl of `Span` and thus cache entries that should have been considered invalidated were loaded. After this PR, the `stable_id` field of `SourceFile` includes information about the originating crate, so that ICE should not occur anymore.
2023-12-23Specialize DefPathHash table to skip crate IDsMark Rousskov-2/+0
Instead, we store just the local crate hash as a bare u64. On decoding, we recombine it with the crate's stable crate ID stored separately in metadata. The end result is that we save ~8 bytes/DefIndex in metadata size. One key detail here is that we no longer distinguish in encoded metadata between present and non-present DefPathHashes. It used to be highly likely we could distinguish as we used DefPathHash::default(), an all-zero representation. However in theory even that is fallible as nothing strictly prevents the StableCrateId from being zero.
2023-12-23Add missing CFI sanitizer cfgs feature gateUrgau-0/+1
2023-12-19Unify SourceFile::name_hash and StableSourceFileIdMichael Woerister-64/+81
2023-12-19Desugar for await loopsEric Holk-0/+2
2023-12-19Plumb awaitness of for loopsEric Holk-0/+1
2023-12-15Add better ICE messages for some undescriptive panicsRoss Smyth-2/+4
2023-12-11Auto merge of #117758 - Urgau:lint_pointer_trait_comparisons, r=davidtwcobors-0/+2
Add lint against ambiguous wide pointer comparisons This PR is the resolution of https://github.com/rust-lang/rust/issues/106447 decided in https://github.com/rust-lang/rust/issues/117717 by T-lang. ## `ambiguous_wide_pointer_comparisons` *warn-by-default* The `ambiguous_wide_pointer_comparisons` lint checks comparison of `*const/*mut ?Sized` as the operands. ### Example ```rust let ab = (A, B); let a = &ab.0 as *const dyn T; let b = &ab.1 as *const dyn T; let _ = a == b; ``` ### Explanation The comparison includes metadata which may not be expected. ------- This PR also drops `clippy::vtable_address_comparisons` which is superseded by this one. ~~One thing: is the current naming right? `invalid` seems a bit too much.~~ Fixes https://github.com/rust-lang/rust/issues/117717
2023-12-10Remove edition umbrella features.Eric Huss-13/+0
2023-12-10Auto merge of #116952 - compiler-errors:lifetime_capture_rules_2024, r=TaKO8Kibors-0/+1
Implement 2024-edition lifetime capture rules RFC Implements rust-lang/rfcs#3498.
2023-12-10remove redundant importssurechen-6/+2
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-12-09Add simd_masked_{load,store} platform-intrinsicsJakub Okoński-0/+2
This maps to the LLVM intrinsics: llvm.masked.load and llvm.masked.store
2023-12-08Implement `async gen` blocksMichael Goulet-0/+5
2023-12-06Rollup merge of #118660 - cuviper:alloc_str, r=petrochenkovMatthias Krüger-5/+1
rustc_arena: add `alloc_str` Two places called `from_utf8_unchecked` for strings from `alloc_slice`, and one's SAFETY comment said this was for lack of `alloc_str` -- so let's just add that instead!
2023-12-06Auto merge of #118679 - matthiaskrgr:rollup-zr1l9w6, r=matthiaskrgrbors-0/+2
Rollup of 7 pull requests Successful merges: - #116496 (Provide context when `?` can't be called because of `Result<_, E>`) - #117563 (docs: clarify explicitly freeing heap allocated memory) - #117874 (`riscv32` platform support) - #118516 (Add ADT variant infomation to StableMIR and finish implementing TyKind::internal()) - #118650 (add comment about keeping flags in sync between bootstrap.py and bootstrap.rs) - #118664 (docs: remove #110800 from release notes) - #118669 (library: fix comment about const assert in win api) r? `@ghost` `@rustbot` modify labels: rollup