summary refs log tree commit diff
path: root/compiler/rustc_span/src
AgeCommit message (Collapse)AuthorLines
2025-07-24Mitigate `#[align]` name resolution ambiguity regression with a renameJieyou Xu-0/+2
From `#[align]` -> `#[rustc_align]`. Attributes starting with `rustc` are always perma-unstable and feature-gated by `feature(rustc_attrs)`. See regression RUST-143834. For the underlying problem where even introducing new feature-gated unstable built-in attributes can break user code such as ```rs macro_rules! align { () => { /* .. */ }; } pub(crate) use align; // `use` here becomes ambiguous ``` refer to RUST-134963. Since the `#[align]` attribute is still feature-gated by `feature(fn_align)`, we can rename it as a mitigation. Note that `#[rustc_align]` will obviously mean that current unstable user code using `feature(fn_aling)` will need additionally `feature(rustc_attrs)`, but this is a short-term mitigation to buy time, and is expected to be changed to a better name with less collision potential. See <https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202025-07-17/near/529290371> where mitigation options were considered. (cherry picked from commit 69b71e44107b4905ec7ad84ccb3edf4f14b3df69)
2025-06-22Rollup merge of #142874 - marxin:cranelift-typo-fix, r=bjorn3Guillaume Gomez-1/+1
cranelift: fix target feature name typo: "fxsr" Fix a typo introduced in 71b698c0b81c2e35c852ebcdf1f5cbe9e9162a50 CC: `@clubby789` `@bjorn3`
2025-06-22cranelift: fix target feature name type: "fxsr"Martin Liska-1/+1
2025-06-22Implement DesugaringKind::FormatLiteralmejrs-0/+16
2025-06-21Rollup merge of #142787 - samueltardieu:diag-items-for-clippy, ↵Matthias Krüger-0/+7
r=Manishearth,Urgau Add diagnostic items for Clippy Clippy still uses some paths to access items from the standard library. Adding the missing diagnostic items allows removing the last remaining paths. Closes rust-lang/rust-clippy#5393
2025-06-20Rollup merge of #142767 - nnethercote:symbol-cleanups, r=petrochenkovJakub Beránek-2/+2
Some symbol and PathRoot cleanups I'm looking into unifying how we join and print paths. Here are some preliminary cleanups. r? ``@petrochenkov``
2025-06-20Add diagnostic items for ClippySamuel Tardieu-0/+7
2025-06-20Avoid some unnecessary symbol interning.Nicholas Nethercote-2/+1
- `Ident::from_str_and_span` -> `Ident::new` when the string is pre-interned. - `Ident::from_str` -> `Ident::with_dummy_span` when the string is pre-interned. - `_d` and `_e` are unused.
2025-06-20Use a symbol for `ExpansionConfig::crate_name`.Nicholas Nethercote-0/+1
This avoids some symbol interning and `to_string` conversions.
2025-06-18Implement lint against direct uses of rustc_type_ir in compiler cratesRomain Perier-0/+1
This commit adds a lint to prevent the use of rustc_type_ir in random compiler crates, except for type system internals traits, which are explicitly allowed. Moreover, this fixes diagnostic_items() to include the CRATE_OWNER_ID, otherwise rustc_diagnostic_item attribute is ignored on the crate root.
2025-06-16trait_sel: `{Meta,Pointee}Sized` on `Sized` typesDavid Wood-0/+3
Introduce the `MetaSized` and `PointeeSized` traits as supertraits of `Sized` and initially implement it on everything that currently implements `Sized` to isolate any changes that simply adding the traits introduces.
2025-06-15Auto merge of #142388 - cjgillot:span-hash, r=davidtwcobors-6/+6
Do not clone Arc when hashing span. Tiny improvement I was when trying to profile span hashing.
2025-06-13Auto merge of #142443 - matthiaskrgr:rollup-l1l6d0v, r=matthiaskrgrbors-0/+1
Rollup of 9 pull requests Successful merges: - rust-lang/rust#128425 (Make `missing_fragment_specifier` an unconditional error) - rust-lang/rust#135927 (retpoline and retpoline-external-thunk flags (target modifiers) to enable retpoline-related target features) - rust-lang/rust#140770 (add `extern "custom"` functions) - rust-lang/rust#142176 (tests: Split dont-shuffle-bswaps along opt-levels and arches) - rust-lang/rust#142248 (Add supported asm types for LoongArch32) - rust-lang/rust#142267 (assert more in release in `rustc_ast_lowering`) - rust-lang/rust#142274 (Update the stdarch submodule) - rust-lang/rust#142276 (Update dependencies in `library/Cargo.lock`) - rust-lang/rust#142308 (Upgrade `object`, `addr2line`, and `unwinding` in the standard library) Failed merges: - rust-lang/rust#140920 (Extract some shared code from codegen backend target feature handling) r? `@ghost` `@rustbot` modify labels: rollup try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-gnu try-job: dist-i586-gnu-i586-i686-musl try-job: test-various
2025-06-13Rollup merge of #142410 - RalfJung:align_of, r=WaffleLapkin,workingjubileeMatthias Krüger-3/+3
intrinsics: rename min_align_of to align_of Now that `pref_align_of` is gone (https://github.com/rust-lang/rust/pull/141803), we can give the intrinsic backing `align_of` its proper name. r? `@workingjubilee` or `@bjorn3`
2025-06-13Rollup merge of #142158 - xizheyin:141617, r=jdonszelmannMatthias Krüger-0/+1
Tracking the old name of renamed unstable library features This PR resolves the first problem of rust-lang/rust#141617 : tracking renamed unstable features. The first commit is to add a ui test, and the second one tracks the changes. I will comment on the code for clarification. r? `@jdonszelmann` There have been a lot of PR's reviewed by you lately, thanks for your time! cc `@jyn514`
2025-06-12add `extern "custom"` functionsFolkert de Vries-0/+1
2025-06-12intrinsics: rename min_align_of to align_ofRalf Jung-3/+3
2025-06-12Tracking the old name of renamed unstable library attributexizheyin-0/+1
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-06-12Introduce `-Zmacro-stats`.Nicholas Nethercote-1/+2
It collects data about macro expansions and prints them in a table after expansion finishes. It's very useful for detecting macro bloat, especially for proc macros. Details: - It measures code snippets by pretty-printing them and then measuring lines and bytes. This required a bunch of additional pretty-printing plumbing, in `rustc_ast_pretty` and `rustc_expand`. - The measurement is done in `MacroExpander::expand_invoc`. - The measurements are stored in `ExtCtxt::macro_stats`.
2025-06-11Do not clone Arc when hashing span.Camille GILLOT-6/+6
2025-06-08Rollup merge of #142194 - bjorn3:less_unstable_features, r=jieyouxuJubilee-1/+0
Remove all unused feature gates from the compiler
2025-06-08Remove all unused feature gates from the compilerbjorn3-1/+0
2025-06-07intrinsics: use const generic to set atomic orderingRalf Jung-0/+16
2025-06-02Rollup merge of #141874 - usamoi:eps, r=tgross35Jakub Beránek-0/+2
add f16_epsilon and f128_epsilon diagnostic items cc https://github.com/rust-lang/rust/issues/116909 r? ``@tgross35``
2025-06-02Auto merge of #119899 - onur-ozkan:redesign-stage0-std, ↵bors-2/+14
r=albertlarsan68,jieyouxu,mark-simulacrum,kobzol,jyn514,Noratrieb,WaffleLapkin,RalfJung,bjorn3 redesign stage 0 std ### Summary **Blog post: https://blog.rust-lang.org/inside-rust/2025/05/29/redesigning-the-initial-bootstrap-sequence/** This PR changes how bootstrap builds the stage 1 compiler by switching to precompiled stage 0 standard library instead of building the in-tree one. The goal was to update bootstrap to use the beta standard library at stage 0 rather than compiling it from source (see the motivation at https://github.com/rust-lang/compiler-team/issues/619). Previously, to build a stage 1 compiler bootstrap followed this path: ``` download stage0 compiler -> build in-tree std -> compile stage1 compiler with in-tree std ``` With this PR, the new path is: ``` download stage0 compiler -> compile stage1 compiler with precompiled stage0 std ``` This also means that `cfg(bootstrap)`/`cfg(not(bootstrap))` is no longer needed for library development. ### Building "library" Since stage0 `std` is no longer in-tree `x build/test/check library --stage 0` is now no-op. The minimum supported stage to build `std` is now 1. For the same reason, default stage values in the library profile is no longer 0. Because building the in-tree library now requires a stage1 compiler, I highly recommend library developers to enable `download-rustc` to speed up compilation time. <hr> **Blog post: https://blog.rust-lang.org/inside-rust/2025/05/29/redesigning-the-initial-bootstrap-sequence/** If you encounter a bug or unexpected results please open a topic in the [#t-infra/bootstrap](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap) Zulip channel or create a [bootstrap issue](https://github.com/rust-lang/rust/issues/new?template=bootstrap.md). (Review thread: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Review.20thread.3A.20stage.200.20redesign.20PR/with/508271433) ~~Blocked on https://github.com/rust-lang/rust/pull/122709~~ try-job: dist-x86_64-linux try-job: `x86_64-msvc*` try-job: `x86_64-apple-*` try-job: `aarch64-apple` try-job: x86_64-gnu try-job: `x86_64-gnu-llvm*`
2025-06-02add f16_epsilon and f128_epsilonusamoi-0/+2
2025-05-30`slice.get(i)` should use a slice projection in MIR, like `slice[i]` doesScott McMurray-0/+1
2025-05-30handle cfg bootstrap on compiler and mirionur-ozkan-2/+14
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-05-30Rollup merge of #141507 - RalfJung:atomic-intrinsics, r=bjorn3Matthias Krüger-0/+1
atomic_load intrinsic: use const generic parameter for ordering We have a gazillion intrinsics for the atomics because we encode the ordering into the intrinsic name rather than making it a parameter. This is particularly bad for those operations that take two orderings. Let's fix that! This PR only converts `load`, to see if there's any feedback that would fundamentally change the strategy we pursue for the const generic intrinsics. The first two commits are preparation and could be a separate PR if you prefer. `@BoxyUwU` -- I hope this is a use of const generics that is unlikely to explode? All we need is a const generic of enum type. We could funnel it through an integer if we had to but an enum is obviously nicer... `@bjorn3` it seems like the cranelift backend entirely ignores the ordering?
2025-05-29Rollup merge of #141690 - Patrick-6:intercept-mutex, r=m-ou-seJacob Pratt-0/+3
Add `rustc_diagnostic_item` to `sys::Mutex` methods For an ongoing project for adding a concurrency model checker to Miri we need to be able to intercept locking/unlocking operations on standard library mutexes. This PR adds diagnostic items to the relevant calls `lock`, `try_lock` and `unlock` for the `sys::Mutex` implementation on the targets we care about. This PR also makes the internals of `pthread::Mutex` less public, to reduce the chance of anyone locking/unlocking a mutex without going through the intercepted methods. r? ``@RalfJung``
2025-05-28atomic_load intrinsic: use const generic parameter for orderingRalf Jung-0/+1
2025-05-28Rollup merge of #140697 - Sa4dUs:split-autodiff, r=ZuseZ4Trevor Gross-1/+4
Split `autodiff` into `autodiff_forward` and `autodiff_reverse` This PR splits `#[autodiff]` macro so `#[autodiff(df, Reverse, args)]` would become `#[autodiff_reverse(df, args)]` and `#[autodiff(df, Forward, args)]` would become `#[autodiff_forwad(df, args)]`.
2025-05-28Add diagnostic items to sys::MutexPatrick-6-0/+3
2025-05-27Rollup merge of #140367 - folkertdev:asm-cfg, r=nnethercoteTrevor Gross-0/+1
add `asm_cfg`: `#[cfg(...)]` within `asm!` tracking issue: https://github.com/rust-lang/rust/issues/140364 blocked on: https://github.com/rust-lang/rust/pull/140490 This feature was discussed in https://github.com/rust-lang/rust/issues/140279. It allows configuring templates and operands in the assembly macros, for example: ```rust asm!( // or global_asm! or naked_asm! "nop", #[cfg(target_feature = "sse2")] "nop", // ... #[cfg(target_feature = "sse2")] a = const 123, // only used on sse2 ); ``` r? `@tgross35` cc `@traviscross` `@Amanieu` Now builds on https://github.com/rust-lang/rust/pull/140490, which should be merged first.
2025-05-27support `#[cfg(...)]` on arguments to the `asm!` macrosFolkert de Vries-0/+1
2025-05-23Rollup merge of #141376 - nnethercote:rename-kw-Empty, r=petrochenkovMatthias Krüger-14/+13
Rename `kw::Empty` as `sym::empty`. Because the empty string is not a keyword. r? `@petrochenkov`
2025-05-22Auto merge of #141396 - matthiaskrgr:rollup-feg050g, r=matthiaskrgrbors-1/+0
Rollup of 7 pull requests Successful merges: - #135562 (Add ignore value suggestion in closure body) - #139635 (Finalize repeat expr inference behaviour with inferred repeat counts) - #139668 (Handle regions equivalent to 'static in non_local_bounds) - #140218 (HIR ty lowering: Clean up & refactor the lowering of type-relative paths) - #140435 (use uX::from instead of _ as uX in non - const contexts) - #141130 (rustc_on_unimplemented cleanups) - #141286 (Querify `coroutine_hidden_types`) Failed merges: - #140247 (Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs) r? `@ghost` `@rustbot` modify labels: rollup
2025-05-22Rollup merge of #141377 - nnethercote:rm-unnecessary-is_empty-checks, ↵Matthias Krüger-1/+1
r=GuillaumeGomez Remove unnecessary `is_empty` checks Part of #137978. r? `@GuillaumeGomez`
2025-05-22Rollup merge of #141130 - mejrs:use_self, r=compiler-errorsMatthias Krüger-1/+0
rustc_on_unimplemented cleanups Addresses some of the fixmes from https://github.com/rust-lang/rust/pull/139091 and https://github.com/rust-lang/rust/pull/140307. - switch from `_Self` to `Self` in library - properly validate that arguments in the `on` filter and the format strings are actually valid See https://github.com/rust-lang/rustc-dev-guide/pull/2357 for the relevant documentation.
2025-05-22Remove `is_empty` check in `Ident::is_numeric`.Nicholas Nethercote-1/+1
`Ident`s can no longer be empty, so the test always succeeds.
2025-05-22Auto merge of #137198 - tgross35:cfg-match-rename, r=Amanieubors-2/+2
Rename `cfg_match!` to `cfg_select!` [`@Nemo157` pointed out](https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605) that `cfg_match!` syntax does not actually align well with match syntax, which is a possible source of confusion. The comment points out that usage is instead more similar to ecosystem `select!` macros. Rename `cfg_match!` to `cfg_select!` to match this. Tracking issue: https://github.com/rust-lang/rust/issues/115585 [1]: https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605
2025-05-22Rename `kw::Empty` as `sym::empty`.Nicholas Nethercote-14/+13
Because the empty string is not a keyword.
2025-05-21Avoid creating an empty identifer in `Symbol::to_ident_string`.Nicholas Nethercote-1/+2
Because that causes an assertion failure in debug builds. Fixes #140884.
2025-05-21Initial naive implementation using `Symbols` to represent autodiff modes ↵Marcelo Domínguez-0/+2
(`Forward`, `Reverse`) Since the mode is no longer part of `meta_item`, we must insert it manually (otherwise macro expansion with `#[rustc_autodiff]` won't work). This can be revised later if a more structured representation becomes necessary (using enums, annotated structs, etc). Some tests are currently failing. I'll address them next.
2025-05-20Rename `cfg_match!` to `cfg_select!`Trevor Gross-2/+2
At [1] it was pointed out that `cfg_match!` syntax does not actually align well with match syntax, which is a possible source of confusion. The comment points out that usage is instead more similar to ecosystem `select!` macros. Rename `cfg_match!` to `cfg_select!` to match this. Tracking issue: https://github.com/rust-lang/rust/issues/115585 [1]: https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605
2025-05-20Split `autodiff` into `autodiff_forward` and `autodiff_reverse`Marcelo Domínguez-1/+2
Pending fix. ``` error: cannot find a built-in macro with name `autodiff_forward` --> library\core\src\macros\mod.rs:1542:5 | 1542 | / pub macro autodiff_forward($item:item) { 1543 | | /* compiler built-in */ 1544 | | } | |_____^ error: cannot find a built-in macro with name `autodiff_reverse` --> library\core\src\macros\mod.rs:1549:5 | 1549 | / pub macro autodiff_reverse($item:item) { 1550 | | /* compiler built-in */ 1551 | | } | |_____^ error: could not compile `core` (lib) due to 2 previous errors ```
2025-05-17do away with `_Self` and `TraitName` and check generic params for ↵mejrs-1/+0
rustc_on_unimplemented
2025-05-14Add `Ipv4Addr` and `Ipv6Addr` diagnostic itemsSamuel Tardieu-0/+2
They will be used in Clippy to detect runtime parsing of known-valid IP addresses.
2025-05-12update cfg(bootstrap)Pietro Albini-1/+0
2025-05-11Rollup merge of #140792 - Urgau:minimum-maximum-intrinsics, ↵León Orell Valerian Liehr-0/+8
r=scottmcm,traviscross,tgross35 Use intrinsics for `{f16,f32,f64,f128}::{minimum,maximum}` operations This PR creates intrinsics for `{f16,f32,f64,f64}::{minimum,maximum}` operations. This wasn't done when those operations were added as the LLVM support was too weak but now that LLVM has libcalls for unsupported platforms we can finally use them. Cranelift and GCC[^1] support are partial, Cranelift doesn't support `f16` and `f128`, while GCC doesn't support `f16`. r? `@tgross35` try-job: aarch64-gnu try-job: dist-various-1 try-job: dist-various-2 [^1]: https://www.gnu.org/software///gnulib/manual/html_node/Functions-in-_003cmath_002eh_003e.html