about summary refs log tree commit diff
path: root/compiler/rustc_span/src
AgeCommit message (Collapse)AuthorLines
2023-01-16Avoid an unnecessary allocationOli Scherer-11/+18
2023-01-14Heuristically undo path prefix mappings.Tim Neumann-6/+100
Because the compiler produces better diagnostics if it can find the source of (potentially remapped) dependencies.
2023-01-14Use associated items of `char` instead of freestanding items in `core::char`Lukas Markeffsky-2/+1
2023-01-12gate const closuresDeadbeef-0/+1
2023-01-12Improve proc macro attribute diagnosticsmejrs-0/+1
2023-01-11Turn format arguments types into lang items.Mara Bos-0/+6
2023-01-09[RFC 2397] Initial implementationCaio-0/+1
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-15/+11
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2023-01-03Suggest more impl Trait on `-> _`Michael Goulet-0/+1
2023-01-02Auto merge of #84762 - cjgillot:resolve-span-opt, r=petrochenkovbors-22/+68
Encode spans relative to the enclosing item -- enable on nightly Follow-up to #84373 with the flag `-Zincremental-relative-spans` set by default. This PR seeks to remove one of the main shortcomings of incremental: the handling of spans. Changing the contents of a function may require redoing part of the compilation process for another function in another file because of span information is changed. Within one file: all the spans in HIR change, so typechecking had to be re-done. Between files: spans of associated types/consts/functions change, so type-based resolution needs to be re-done (hygiene information is stored in the span). The flag `-Zincremental-relative-spans` encodes local spans relative to the span of an item, stored inside the `source_span` query. Trap: stashed diagnostics are referenced by the "raw" span, so stealing them requires to remove the span's parent. In order to avoid too much traffic in the span interner, span encoding uses the `ctxt_or_tag` field to encode: - the parent when the `SyntaxContext` is 0; - the `SyntaxContext` when the parent is `None`. Even with this, the PR creates a lot of traffic to the Span interner, when a Span has both a LocalDefId parent and a non-root SyntaxContext. They appear in lowering, when we add a parent to all spans, including those which come from macros, and during inlining when we mark inlined spans. The last commit changes how queries of `LocalDefId` manage their cache. I can put this in a separate PR if required. Possible future directions: - validate that all spans are marked in HIR validation; - mark macro-expanded spans relative to the def-site and not the use-site.
2022-12-30Rollup merge of #106248 - dtolnay:revertupcastlint, r=jackh726Michael Goulet-1/+0
Revert "Implement allow-by-default `multiple_supertrait_upcastable` lint" This is a clean revert of #105484. I confirmed that reverting that PR fixes the regression reported in #106247. ~~I can't say I understand what this code is doing, but maybe it can be re-landed with a different implementation.~~ **Edit:** https://github.com/rust-lang/rust/issues/106247#issuecomment-1367174384 has an explanation of why #105484 ends up surfacing spurious `where_clause_object_safety` errors. The implementation of `where_clause_object_safety` assumes we only check whether a trait is object safe when somebody actually uses that trait with `dyn`. However the implementation of `multiple_supertrait_upcastable` added in the problematic PR involves checking *every* trait for whether it is object-safe. FYI `@nbdd0121` `@compiler-errors`
2022-12-29Auto merge of #106195 - ↵bors-17/+12
Nilstrieb:no-more-being-clueless-whether-it-really-is-a-literal, r=compiler-errors Improve heuristics whether `format_args` string is a source literal Previously, it only checked whether there was _a_ literal at the span of the first argument, not whether the literal actually matched up. This caused issues when a proc macro was generating a different literal with the same span. This requires an annoying special case for literals ending in `\n` because otherwise `println` wouldn't give detailed diagnostics anymore which would be bad. Fixes #106191
2022-12-29Revert "Implement allow-by-default multiple_supertrait_upcastable lint"David Tolnay-1/+0
This reverts commit 5e44a65517bfcccbe6624a70b54b9f192baa94f3.
2022-12-29Auto merge of #106139 - cjgillot:mir-inline-location, r=eholkbors-0/+1
Give the correct track-caller location with MIR inlining. Fixes https://github.com/rust-lang/rust/issues/105538
2022-12-28Rollup merge of #106172 - estebank:suggest-impl-trait, r=compiler-errorsMatthias Krüger-0/+1
Suggest `impl Iterator` when possible for `_` return type Address #106096.
2022-12-28Rollup merge of #105484 - nbdd0121:upcast, r=compiler-errorsfee1-dead-0/+1
Implement allow-by-default `multiple_supertrait_upcastable` lint The lint detects when an object-safe trait has multiple supertraits. Enabled in libcore and liballoc as they are low-level enough that many embedded programs will use them. r? `@nikomatsakis`
2022-12-27Improve debug logs of `find_width_of_character_at_span`Nilstrieb-17/+12
2022-12-27Rollup merge of #106064 - lukas-code:outlives-macro, r=cjgillotMichael Goulet-0/+3
Partially fix `explicit_outlives_requirements` lint in macros Show the suggestion if and only if the bounds are from the same source context. fixes https://github.com/rust-lang/rust/issues/106044 fixes https://github.com/rust-lang/rust/issues/106063
2022-12-26Suggest `impl Iterator` when possible for `_` return typeEsteban Küber-0/+1
Address #106096.
2022-12-25Explain disabled span hashing.Camille GILLOT-0/+4
2022-12-25Give the correct track-caller location with MIR inlining.Camille GILLOT-0/+1
2022-12-25Encode span parent in the inlined representation.Camille GILLOT-22/+64
2022-12-25document that `Span::to` can go backwardsLukas Markeffsky-0/+3
2022-12-22abort immediately on bad mem::zeroed/uninitRalf Jung-1/+2
2022-12-21Auto merge of #105613 - Nilstrieb:rename-assert_uninit_valid, r=RalfJungbors-1/+1
Rename `assert_uninit_valid` intrinsic It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that. This is actually not fully correct though, as it does still panic for all uninit with `-Zstrict-init-checks`. I'm not sure what the best way is to deal with that not causing confusion. I guess we could just remove the flag? I don't think having it makes a lot of sense anymore with the direction that we have chose to go. It could be relevant again if #100423 lands so removing it may be a bit over eager. r? `@RalfJung`
2022-12-20Auto merge of #105880 - Nilstrieb:make-newtypes-less-not-rust, r=oli-obkbors-17/+13
Improve syntax of `newtype_index` This makes it more like proper Rust and also makes the implementation a lot simpler. Mostly just turns weird flags in the body into proper attributes. It should probably also be converted to an attribute macro instead of function-like, but that can be done in a future PR.
2022-12-19Revert "Replace usage of `ResumeTy` in async lowering with `Context`"Andrew Pollack-1/+2
2022-12-18A few small cleanups for `newtype_index`Nilstrieb-8/+5
Remove the `..` from the body, only a few invocations used it and it's inconsistent with rust syntax. Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18Make `#[debug_format]` an attribute in `newtype_index`Nilstrieb-3/+3
This removes the `custom` format functionality as its only user was trivially migrated to using a normal format. If a new use case for a custom formatting impl pops up, you can add it back.
2022-12-18Make `#[no_ord_impl]` an attribute in `newtype_index`Nilstrieb-1/+1
2022-12-18Make `#[custom_encodable]` an attribute for `newtype_index`Nilstrieb-5/+4
Makes the syntax a little more rusty.
2022-12-15Shorten trimmed display of closuresEsteban Küber-4/+18
When `with_forced_trimmed_paths` is used, only print filename and start of the closure's span, to reduce their verbosity.
2022-12-15more clippy::complexity fixesMatthias Krüger-4/+4
2022-12-13Suggest `collect`ing into `Vec<_>`Esteban Küber-0/+1
2022-12-13Rename `assert_uninit_valid` intrinsicNilstrieb-1/+1
It's not about "uninit" anymore but about "filling with 0x01 bytes" so the name should at least try to reflect that.
2022-12-12minor code cleanupsMatthias Krüger-1/+1
2022-12-11Rollup merge of #105521 - tshepang:keep-heading-separate, r=nagisaMatthias Krüger-1/+2
separate heading from body
2022-12-11Add `round_ties_even` to `f32` and `f64`Jules Bertholet-0/+2
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-4/+1
2022-12-10Rollup merge of #105514 - estebank:is_visible, r=oli-obkMatthias Krüger-0/+9
Introduce `Span::is_visible` r? `@oli-obk`
2022-12-10Rollup merge of #105109 - rcvalle:rust-kcfi, r=bjorn3Matthias Krüger-0/+1
Add LLVM KCFI support to the Rust compiler This PR adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Thank you again, `@bjorn3,` `@eddyb,` `@nagisa,` and `@ojeda,` for all the help!
2022-12-10separate heading from bodyTshepang Mbambo-1/+2
2022-12-09Introduce `Span::is_visible`Esteban Küber-0/+9
2022-12-09Implement allow-by-default multiple_supertrait_upcastable lintGary Guo-0/+1
2022-12-08Add LLVM KCFI support to the Rust compilerRamon de C Valle-0/+1
This commit adds LLVM Kernel Control Flow Integrity (KCFI) support to the Rust compiler. It initially provides forward-edge control flow protection for operating systems kernels for Rust-compiled code only by aggregating function pointers in groups identified by their return and parameter types. (See llvm/llvm-project@cff5bef.) Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by identifying C char and integer type uses at the time types are encoded (see Type metadata in the design document in the tracking issue #89653). LLVM KCFI can be enabled with -Zsanitizer=kcfi. Co-authored-by: bjorn3 <17426603+bjorn3@users.noreply.github.com>
2022-12-08Rollup merge of #105423 - oli-obk:symbols, r=jackh726Matthias Krüger-3/+5
Use `Symbol` for the crate name instead of `String`/`str` It always got converted to a symbol anyway
2022-12-07Use `Symbol` for the crate name instead of `String`/`str`Oli Scherer-3/+5
2022-12-06Rollup merge of #105362 - WaffleLapkin:🙅, r=oli-obkMatthias Krüger-1/+1
Cleanup macro-expanded code in `rustc_type_ir` We could of course just leave this as-is, but every time I go-to-def to this file it's painful to see all this `(&A(ref __self_1_0),)` stuff.
2022-12-06Cleanup macro-expanded code in `rustc_type_ir`Maybe Waffle-1/+1
2022-12-06Replace usage of `ResumeTy` in async lowering with `Context`Arpad Borsos-2/+1
Replaces using `ResumeTy` / `get_context` in favor of using `&'static mut Context<'_>`. Usage of the `'static` lifetime here is technically "cheating", and replaces the raw pointer in `ResumeTy` and the `get_context` fn that pulls the correct lifetimes out of thin air.