about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-11-09Add test for str for "expected primitive, found type"Zachary S-3/+28
2024-11-08Auto merge of #132717 - RalfJung:rustc_safe_intrinsic, r=compiler-errorsbors-120/+58
remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic functions instead This brings us one step closer towards removing support for `extern "rust-intrinsic"` blocks, in favor of `#[rustc_intrinsic]` functions. Also move `#[rustc_intrinsic]` under the `intrinsics` feature gate, to match the `extern "rust-intrinsic"` style.
2024-11-08remove support for rustc_safe_intrinsic attribute; use rustc_intrinsic ↵Ralf Jung-120/+58
functions instead
2024-11-08Rollup merge of #132738 - cuviper:channel-heap-init, r=ibraheemdevStuart Cook-0/+29
Initialize channel `Block`s directly on the heap The channel's `Block::new` was causing a stack overflow because it held 32 item slots, instantiated on the stack before moving to `Box::new`. The 32x multiplier made modestly-large item sizes untenable. That block is now initialized directly on the heap. Fixes #102246 try-job: test-various
2024-11-08Rollup merge of #132161 - celinval:smir-fix-indent, r=compiler-errorsStuart Cook-0/+311
[StableMIR] A few fixes to pretty printing Improve identation, and a few other rvalue printing try-job: x86_64-msvc try-job: test-various
2024-11-08Auto merge of #132756 - workingjubilee:rollup-bed2akn, r=workingjubileebors-22/+216
Rollup of 10 pull requests Successful merges: - #130586 (Set "symbol name" in raw-dylib import libraries to the decorated name) - #131913 (Add `{ignore,needs}-{rustc,std}-debug-assertions` directive support) - #132095 (Fix #131977 parens mangled in shared mut static lint suggestion) - #132131 ([StableMIR] API to retrieve definitions from crates) - #132639 (core: move intrinsics.rs into intrinsics folder) - #132696 (Compile `test_num_f128` conditionally on `reliable_f128_math` config) - #132737 (bootstrap: Print better message if lock pid isn't available) - #132739 (Fix `librustdoc/scrape_examples.rs` formatting) - #132740 (Update test for LLVM 20's new vector splat syntax) - #132741 (Update mips64 data layout to match LLVM 20 change) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-07Rollup merge of #132740 - zmodem:simd_syntax_update, r=durin42Jubilee-3/+3
Update test for LLVM 20's new vector splat syntax that was introduced in https://github.com/llvm/llvm-project/pull/112548
2024-11-07Rollup merge of #132639 - RalfJung:intrinsics, r=workingjubilee,AmanieuJubilee-6/+6
core: move intrinsics.rs into intrinsics folder This makes the rustbot notification we have set up for this folder in `triagebot.toml` actually work. Also IMO it makes more sense to have it all in one folder.
2024-11-07Rollup merge of #132131 - celinval:smir-crate-defs, r=compiler-errorsJubilee-0/+149
[StableMIR] API to retrieve definitions from crates Add functions to retrieve function definitions and static items from all crates (local and external). For external crates, we're still missing items from trait implementation and primitives. r? ````@compiler-errors:```` Do you know what is the best way to retrieve the associated items for primitives and trait implementations for external crates? Thanks!
2024-11-07Rollup merge of #132095 - gechelberger:fix-131977, r=wesleywiserJubilee-0/+42
Fix #131977 parens mangled in shared mut static lint suggestion Resolves #131977 for static mut references after discussion with Esteban & Jieyou on [t-compiler/help](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/linting.20with.20parens.20in.20the.20HIR). This doesn't do anything to change the underlying issue if there are other expressions that generate lint suggestions which need to be applied within parentheses.
2024-11-07Rollup merge of #131913 - jieyouxu:only_debug_assertions, r=onur-ozkanJubilee-13/+16
Add `{ignore,needs}-{rustc,std}-debug-assertions` directive support Add `{ignore,needs}-{rustc,std}-debug-assertions` compiletest directives and retire the old `{ignore,only}-debug` directives. The old `{ignore,only}-debug` directives were ambiguous because you could have std built with debug assertions but rustc not built with debug assertions or vice versa. If we want to support the use case of controlling test run based on if rustc was built with debug assertions, then having `{ignore,only}-debug` will be very confusing. cc ````@matthiaskrgr```` Closes #123987. r? bootstrap (or compiler tbh)
2024-11-07This test needs threadsJosh Stone-0/+1
2024-11-08Auto merge of #128849 - estebank:issue-89143, r=jackh726bors-57/+47
Tweak detection of multiple crate versions to be more encompassing Previously, we only emitted the additional context if the type was in the same crate as the trait that appeared multiple times in the dependency tree. Now, we look at all traits looking for two with the same name in different crates with the same crate number, and we are more flexible looking for the types involved. This will work even if the type that implements the wrong trait version is from a different crate entirely. ``` error[E0277]: the trait bound `CustomErrorHandler: ErrorHandler` is not satisfied because the trait comes from a different crate version --> src/main.rs:5:17 | 5 | cnb_runtime(CustomErrorHandler {}); | ^^^^^^^^^^^^^^^^^^^^^ the trait `ErrorHandler` is not implemented for `CustomErrorHandler` | note: there are multiple different versions of crate `c` in the dependency graph --> /home/gh-estebank/testcase-rustc-crate-version-mismatch/c-v0.2/src/lib.rs:1:1 | 1 | pub trait ErrorHandler {} | ^^^^^^^^^^^^^^^^^^^^^^ this is the required trait | ::: src/main.rs:1:5 | 1 | use b::CustomErrorHandler; | - one version of crate `c` is used here, as a dependency of crate `b` 2 | use c::cnb_runtime; | - one version of crate `c` is used here, as a direct dependency of the current crate | ::: /home/gh-estebank/testcase-rustc-crate-version-mismatch/b/src/lib.rs:1:1 | 1 | pub struct CustomErrorHandler {} | ----------------------------- this type doesn't implement the required trait | ::: /home/gh-estebank/testcase-rustc-crate-version-mismatch/c-v0.1/src/lib.rs:1:1 | 1 | pub trait ErrorHandler {} | ---------------------- this is the found trait = note: two types coming from two different versions of the same crate are different types even if they look the same = help: you can use `cargo tree` to explore your dependency tree ``` Fix #89143.
2024-11-07[StableMIR] A few fixes to pretty printingCelina G. Val-0/+311
Improve identation, and a few other rvalue printing
2024-11-07[StableMIR] API to retrieve definitions from cratesCelina G. Val-0/+149
Add functions to retrieve function definitions and static items from all crates (local and external). For external crates, add a query to retrieve the number of defs in a foreign crate.
2024-11-07Auto merge of #132472 - taiki-e:sparc-asm, r=Amanieubors-41/+562
Basic inline assembly support for SPARC and SPARC64 This implements asm_experimental_arch (tracking issue https://github.com/rust-lang/rust/issues/93335) for SPARC and SPARC64. This PR includes: - General-purpose registers `r[0-31]` (`reg` register class, LLVM/GCC constraint `r`) Supported types: i8, i16, i32, i64 (SPARC64-only) Aliases: `g[0-7]` (`r[0-7]`), `o[0-7]` (`r[8-15]`), `l[0-7]` (`r[16-23]`), `i[0-7]` (`r[24-31]`) - `y` register (clobber-only, needed for clobber_abi) - preserves_flags: Integer condition codes (`icc`, `xcc`) and floating-point condition codes (`fcc*`) The following are *not* included: - 64-bit integer support on SPARC-V8+'s global or out registers (`g[0-7]`, `o[0-7]`): GCC's `h` constraint (it seems that there is no corresponding constraint in LLVM?) - Floating-point registers (LLVM/GCC constraint `e`/`f`): I initially tried to implement this, but postponed it for now because there seemed to be several parts in LLVM that behaved differently than in the LangRef's description. - clobber_abi: Support for floating-point registers is needed. Refs: - LLVM - Reserved registers https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp#L52 - Register definitions https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/SparcRegisterInfo.td - Supported constraints https://llvm.org/docs/LangRef.html#supported-constraint-code-list - GCC - Reserved registers https://github.com/gcc-mirror/gcc/blob/63b6967b06b5387821c4e5f2c113da6aaeeae2b7/gcc/config/sparc/sparc.h#L633-L658 - Supported constraints https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html - SPARC ISA/ABI - (64-bit ISA) The SPARC Architecture Manual, Version 9 (32-bit ISA) The SPARC Architecture Manual, Version 8 (64-bit ABI) System V Application Binary Interface SPARC Version 9 Processor Supplement, Rev 1.35 (32-bit ABI) System V Application Binary Interface SPARC Processor Supplement, Third Edition The above docs can be downloaded from https://sparc.org/technical-documents - (32-bit V8+ ABI) The V8+ Technical Specification https://temlib.org/pub/SparcStation/Standards/V8plus.pdf cc `@thejpster` (sparc-unknown-none-elf target maintainer) (AFAIK, other sparc/sprac64 targets don't have target maintainers) r? `@Amanieu` `@rustbot` label +O-SPARC +A-inline-assembly
2024-11-07fix testEsteban Küber-6/+1
2024-11-07Remove less relevant info from diagnosticEsteban Küber-26/+20
``` error[E0277]: the trait bound `dep_2_reexport::Type: Trait` is not satisfied because the trait comes from a different crate version --> multiple-dep-versions.rs:7:18 | 7 | do_something(Type); | ^^^^ the trait `Trait` is not implemented for `dep_2_reexport::Type` | note: there are multiple different versions of crate `dependency` in the dependency graph --> /home/gh-estebank/rust/build/x86_64-unknown-linux-gnu/test/run-make/crate-loading/rmake_out/multiple-dep-versions-1.rs:4:1 | 3 | pub struct Type(pub i32); | --------------- this type implements the required trait 4 | pub trait Trait { | ^^^^^^^^^^^^^^^ this is the required trait | ::: multiple-dep-versions.rs:1:1 | 1 | extern crate dep_2_reexport; | ---------------------------- one version of crate `dependency` is used here, as a dependency of crate `foo` 2 | extern crate dependency; | ------------------------ one version of crate `dependency` is used here, as a direct dependency of the current crate | ::: /home/gh-estebank/rust/build/x86_64-unknown-linux-gnu/test/run-make/crate-loading/rmake_out/multiple-dep-versions-2.rs:3:1 | 3 | pub struct Type; | --------------- this type doesn't implement the required trait 4 | pub trait Trait { | --------------- this is the found trait = note: two types coming from two different versions of the same crate are different types even if they look the same = help: you can use `cargo tree` to explore your dependency tree ``` The approach to accomplish this is a HACK, and we'd want a better way to do this. I believe that moving E0277 to be a structured diagnostic would help in that regard.
2024-11-07Tweak diagnostic outputEsteban Küber-39/+27
``` error[E0277]: the trait bound `dep_2_reexport::Type: Trait` is not satisfied because the trait comes from a different crate version --> multiple-dep-versions.rs:7:18 | 7 | do_something(Type); | ^^^^ the trait `Trait` is not implemented for `dep_2_reexport::Type` | note: there are multiple different versions of crate `dependency` in the dependency graph --> /home/gh-estebank/rust/build/x86_64-unknown-linux-gnu/test/run-make/crate-loading/rmake_out/multiple-dep-versions-1.rs:4:1 | 3 | pub struct Type(pub i32); | --------------- this type implements the required trait 4 | pub trait Trait { | ^^^^^^^^^^^^^^^ this is the required trait | ::: multiple-dep-versions.rs:1:1 | 1 | extern crate dep_2_reexport; | ---------------------------- one version of crate `dependency` is used here, as a dependency of crate `foo` 2 | extern crate dependency; | ------------------------ one version of crate `dependency` is used here, as a direct dependency of the current crate | ::: /home/gh-estebank/rust/build/x86_64-unknown-linux-gnu/test/run-make/crate-loading/rmake_out/multiple-dep-versions-2.rs:3:1 | 3 | pub struct Type; | --------------- this type doesn't implement the required trait 4 | pub trait Trait { | --------------- this is the found trait = note: two types coming from two different versions of the same crate are different types even if they look the same = help: you can use `cargo tree` to explore your dependency tree note: required by a bound in `do_something` --> /home/gh-estebank/rust/build/x86_64-unknown-linux-gnu/test/run-make/crate-loading/rmake_out/multiple-dep-versions-1.rs:12:24 | 12 | pub fn do_something<X: Trait>(_: X) {} | ^^^^^ required by this bound in `do_something` ```
2024-11-07Tweak detection of multiple crate versions to be more ecompassingEsteban Küber-5/+18
Previously, we only emitted the additional context if the type was in the same crate as the trait that appeared multiple times in the dependency tree. Now, we look at all traits looking for two with the same name in different crates with the same crate number, and we are more flexible looking for the types involved. This will work even if the type that implements the wrong trait version is from a different crate entirely. ``` error[E0277]: the trait bound `CustomErrorHandler: ErrorHandler` is not satisfied --> src/main.rs:5:17 | 5 | cnb_runtime(CustomErrorHandler {}); | ----------- ^^^^^^^^^^^^^^^^^^^^^ the trait `ErrorHandler` is not implemented for `CustomErrorHandler` | | | required by a bound introduced by this call | help: you have multiple different versions of crate `c` in your dependency graph --> src/main.rs:1:5 | 1 | use b::CustomErrorHandler; | ^ one version of crate `c` is used here, as a dependency of crate `b` 2 | use c::cnb_runtime; | ^ one version of crate `c` is used here, as a direct dependency of the current crate note: two types coming from two different versions of the same crate are different types even if they look the same --> /home/gh-estebank/testcase-rustc-crate-version-mismatch/c-v0.2/src/lib.rs:1:1 | 1 | pub trait ErrorHandler {} | ^^^^^^^^^^^^^^^^^^^^^^ this is the required trait | ::: /home/gh-estebank/testcase-rustc-crate-version-mismatch/b/src/lib.rs:1:1 | 1 | pub struct CustomErrorHandler {} | ----------------------------- this type doesn't implement the required trait | ::: /home/gh-estebank/testcase-rustc-crate-version-mismatch/c-v0.1/src/lib.rs:1:1 | 1 | pub trait ErrorHandler {} | ---------------------- this is the found trait = help: you can use `cargo tree` to explore your dependency tree note: required by a bound in `cnb_runtime` --> /home/gh-estebank/testcase-rustc-crate-version-mismatch/c-v0.2/src/lib.rs:3:41 | 3 | pub fn cnb_runtime(_error_handler: impl ErrorHandler) {} | ^^^^^^^^^^^^ required by this bound in `cnb_runtime` ``` Fix #89143.
2024-11-07Update test for LLVM 20's new vector splat syntaxHans Wennborg-3/+3
that was introduced in https://github.com/llvm/llvm-project/pull/112548
2024-11-07Initialize channel `Block`s directly on the heapJosh Stone-0/+28
The channel's `Block::new` was causing a stack overflow because it held 32 item slots, instantiated on the stack before moving to `Box::new`. The 32x multiplier made modestly-large item sizes untenable. That block is now initialized directly on the heap. Fixes #102246
2024-11-07core: move intrinsics.rs into intrinsics folderRalf Jung-6/+6
2024-11-07Basic inline assembly support for SPARC and SPARC64Taiki Endo-41/+562
2024-11-07Rollup merge of #132707 - zmodem:tests_vs_diagnostic_width, r=jieyouxuJonas Böttiger-54/+58
Add --diagnostic-width to some tests failing after 1a0c5021838 Otherwise the tests would fail depending on the execution environment.
2024-11-07Auto merge of #132710 - matthiaskrgr:padautz, r=jieyouxubors-0/+94
more crash tests r? `@jieyouxu`
2024-11-06more crash testsMatthias Krüger-0/+94
2024-11-06Add --diagnostic-width to some tests failing after 1a0c5021838Hans Wennborg-54/+58
Otherwise the tests would fail depending on the execution environment.
2024-11-06Auto merge of #132703 - GuillaumeGomez:rollup-tfuef34, r=GuillaumeGomezbors-1/+3
Rollup of 3 pull requests Successful merges: - #132617 (Fix an extra newline in rendered std doc) - #132698 (Remove unneeded fields in `scrape_examples::FindCalls`) - #132700 (add note not to re-report crashes from `crashes` tests) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-07Rollup merge of #132700 - matthiaskrgr:plzno, r=fmeaseGuillaume Gomez-1/+3
add note not to re-report crashes from `crashes` tests for reasons... :sweat_smile: r? `@fmease`
2024-11-06add note not to re-report crashes from `crashes` testsMatthias Krüger-1/+3
2024-11-06Clean middle generics using paren sugar if trait has rustc_paren_sugarMichael Goulet-0/+6
2024-11-06Auto merge of #132404 - makai410:suggest-swap-lhs-rhs, r=fee1-deadbors-0/+28
Suggest swapping LHS and RHS when RHS impls `PartialEq<lhs_ty>` Closes: #130495 r? `@fee1-dead`
2024-11-06Auto merge of #132663 - estebank:e0320-tweak, r=compiler-errorsbors-15/+15
Tweak E0320 overflow error wording Surround type with backticks as we should in every error.
2024-11-06Auto merge of #132664 - matthiaskrgr:rollup-i27nr7i, r=matthiaskrgrbors-8/+5
Rollup of 5 pull requests Successful merges: - #131261 (Stabilize `UnsafeCell::from_mut`) - #131405 (bootstrap/codegen_ssa: ship llvm-strip and use it for -Cstrip) - #132077 (Add a new `wide-arithmetic` feature for WebAssembly) - #132562 (Remove the `wasm32-wasi` target from rustc) - #132660 (Remove unused errs.rs file) Failed merges: - #131721 (Add new unstable feature `const_eq_ignore_ascii_case`) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-05Rollup merge of #132562 - alexcrichton:remove-wasm32-wasi, r=jieyouxuMatthias Krüger-6/+3
Remove the `wasm32-wasi` target from rustc This commit is the final step in the journey of renaming the historical `wasm32-wasi` target in the Rust compiler to `wasm32-wasip1`. Various steps in this journey so far have been: * 2023-04-03: rust-lang/compiler-team#607 - initial proposal for this rename * 2024-11-27: rust-lang/compiler-team#695 - amended schedule/procedure for rename * 2024-01-29: rust-lang/rust#120468 - initial introduction of `wasm32-wasip1` * 2024-06-18: rust-lang/rust#126662 - warn on usage of `wasm32-wasi` * 2024-11-08: this PR - remove the `wasm32-wasi` target The full transition schedule is in [this comment][comment] and is summarized with: * 2024-05-02: Rust 1.78 released with `wasm32-wasip1` target * 2024-09-05: Rust 1.81 released warning on usage of `wasm32-wasi` * 2025-01-09: Rust 1.84 to be released without the `wasm32-wasi` target This means that support on stable for the replacement target of `wasm32-wasip1` has currently been available for 6 months. Users have already seen warnings on stable for 2 months about usage of `wasm32-wasi` and stable users have another 2 months of warnings before the target is removed from stable. This commit is intended to be the final step in this transition so the source tree should no longer mention `wasm32-wasi` except in historical reference to the older name of the `wasm32-wasip1` target. [comment]: https://github.com/rust-lang/rust/pull/120468#issuecomment-1977878747
2024-11-05Rollup merge of #132077 - alexcrichton:wide-arithmetic, r=jieyouxuMatthias Krüger-2/+2
Add a new `wide-arithmetic` feature for WebAssembly This commit adds a new rustc target feature named `wide-arithmetic` for WebAssembly targets. This corresponds to the [wide-arithmetic] proposal for WebAssembly which adds new instructions catered towards accelerating integer arithmetic larger than 64-bits. This proposal to WebAssembly is not standard yet so this new feature is flagged as an unstable target feature. Additionally Rust's LLVM version doesn't support this new feature yet since support will first be added in LLVM 20, so the feature filtering logic for LLVM is updated to handle this. I'll also note that I'm not currently planning to add wasm-specific intrinsics to `std::arch::wasm32` at this time. The currently proposed instructions are all accessible through `i128` or `u128`-based operations which Rust already supports, so intrinsic shouldn't be necessary to get access to these new instructions. [wide-arithmetic]: https://github.com/WebAssembly/wide-arithmetic
2024-11-05Tweak E0320 overflow error wordingEsteban Küber-15/+15
Surrount type with backticks as we should in every error.
2024-11-05Rollup merge of #132571 - RalfJung:const_eval_select_macro, r=oli-obkMatthias Krüger-2/+2
add const_eval_select macro to reduce redundancy I played around a bit with a macro to make const_eval_select invocations look a bit nicer and avoid repeating the argument lists. Here's what I got. What do you think? I didn't apply this everywhere yet because I wanted to gather feedback first. The second commit moves the macros from https://github.com/rust-lang/rust/pull/132542 into a more sensible place. It didn't seem worth its own PR and would conflict with this PR if done separately. Cc ``@oli-obk`` ``@saethlin`` ``@tgross35`` try-job: dist-aarch64-msvc
2024-11-05Rollup merge of #132567 - estebank:bad-suggestion, r=NadrierilMatthias Krüger-5/+30
Properly suggest `E::assoc` when we encounter `E::Variant::assoc` Use the right span when encountering an enum variant followed by an associated item so we don't lose the associated item in the resulting code. Do not suggest the thing twice, once as a removal of the associated item and a second time as a typo suggestion.
2024-11-05Rollup merge of #132498 - uellenberg:typo-and-let-suggestions, r=estebankMatthias Krüger-1/+46
Suggest fixing typos and let bindings at the same time Fixes #132483 Currently, a suggestion for adding a let binding won't be shown if we suggest fixing a typo. This changes that behavior to always show both, if possible. Essentially, this turns the suggestion from ```rust error[E0425]: cannot find value `x2` in this scope --> src/main.rs:4:5 | 4 | x2 = 2; | ^^ help: a local variable with a similar name exists: `x1` For more information about this error, try `rustc --explain E0425`. ``` to ```rust error[E0425]: cannot find value `x2` in this scope --> src/main.rs:4:5 | 4 | x2 = 2; | ^^ | help: a local variable with a similar name exists | 4 | x1 = 2; | ~~ help: you might have meant to introduce a new binding | 4 | let x2 = 2; | +++ For more information about this error, try `rustc --explain E0425`. ``` for the following code: ```rust fn main() { let x1 = 1; x2 = 2; } ``` The original behavior only shows the suggestion for a let binding if a typo suggestion wasn't already displayed. However, this falls apart in the cases like the one above where we have multiple similar variables. I don't think it makes sense to hide this suggestion if there's a similar variable, since that defeats the purpose of this suggestion in that case (it's meant to help those coming from languages like Python).
2024-11-05Rollup merge of #132259 - mrkajetanp:branch-protection-pauth-lr, r=davidtwcoMatthias Krüger-10/+76
rustc_codegen_llvm: Add a new 'pc' option to branch-protection Add a new 'pc' option to -Z branch-protection for aarch64 that enables the use of PC as a diversifier in PAC branch protection code. When the pauth-lr target feature is enabled in combination with -Z branch-protection=pac-ret,pc, the new 9.5-a instructions (pacibsppc, retaasppc, etc) will be generated.
2024-11-05Auto merge of #129884 - RalfJung:forbidden-target-features, r=workingjubileebors-0/+71
mark some target features as 'forbidden' so they cannot be (un)set with -Ctarget-feature The context for this is https://github.com/rust-lang/rust/issues/116344: some target features change the way floats are passed between functions. Changing those target features is unsound as code compiled for the same target may now use different ABIs. So this introduces a new concept of "forbidden" target features (on top of the existing "stable " and "unstable" categories), and makes it a hard error to (un)set such a target feature. For now, the x86 and ARM feature `soft-float` is on that list. We'll have to make some effort to collect more relevant features, and similar features from other targets, but that can happen after the basic infrastructure for this landed. (These features are being collected in https://github.com/rust-lang/rust/issues/131799.) I've made this a warning for now to give people some time to speak up if this would break something. MCP: https://github.com/rust-lang/compiler-team/issues/780
2024-11-05Auto merge of #132580 - compiler-errors:globs, r=Noratriebbors-239/+239
Remove unnecessary pub enum glob-imports from `rustc_middle::ty` We used to have an idiom in the compiler where we'd prefix or suffix all the variants of an enum, for example `BoundRegionKind`, with something like `Br`, and then *glob-import* that enum variant directly. `@noratrieb` brought this up, and I think that it's easier to read when we just use the normal style `EnumName::Variant`. This PR is a bit large, but it's just naming. The only somewhat opinionated change that this PR does is rename `BorrowKind::Imm` to `BorrowKind::Immutable` and same for the other variants. I think these enums are used sparingly enough that the extra length is fine. r? `@noratrieb` or reassign
2024-11-05add const_eval_select macro to reduce redundancyRalf Jung-2/+2
also move internal const_panic helpers to a better location
2024-11-05Auto merge of #132626 - workingjubilee:rollup-hbmtbzk, r=workingjubileebors-209/+299
Rollup of 11 pull requests Successful merges: - #131153 (Improve duplicate derive Copy/Clone diagnostics) - #132025 (fix suggestion for diagnostic error E0027) - #132303 (More tests for non-exhaustive C-like enums in FFI) - #132492 (remove support for extern-block const intrinsics) - #132587 (Revert "Avoid nested replacement ranges" from #129346.) - #132596 ([rustdoc] Fix `--show-coverage` when JSON output format is used) - #132598 (Clippy: Move some attribute lints to be early pass (post expansion)) - #132601 (Update books) - #132606 (Improve example of `impl Pattern for &[char]`) - #132608 (document `type_implements_trait`) - #132609 (docs: fix grammar in doc comment at unix/process.rs) r? `@ghost` `@rustbot` modify labels: rollup
2024-11-04Rollup merge of #132596 - GuillaumeGomez:show-coverage, r=notriddleJubilee-0/+34
[rustdoc] Fix `--show-coverage` when JSON output format is used I realized while looking on the docs.rs page of the `sysinfo` crate that the coverage numbers displayed were wrong: ![image](https://github.com/user-attachments/assets/264b2e25-6271-4ed1-8b35-e8bd4fd475c6) I realized that it was because `--show-coverage --output-format=json` was relying on the same logic as the JSON output for the doc generation whereas it should not. I fixed it by changing the API for querying `is_json` a bit. The underlying issue is that JSON output format is stripping reexports of items from private modules. r? ``@notriddle``
2024-11-04Rollup merge of #132492 - RalfJung:const-intrinsics, r=compiler-errorsJubilee-208/+145
remove support for extern-block const intrinsics This converts all const-callable intrinsics into the "new" form of a regular `fn` with `#[rustc_intrinsic]` attribute. That simplifies some of the logic since those functions can be marked `const fn` like regular functions, so intrinsics no longer need a special case to be considered const-callable at all. I also added a new attribute `#[rustc_const_stable_intrinsic]` to mark an intrinsic as being ready to be exposed on stable. Previously we used the `#[rustc_const_stable_indirect]` attribute for that, but that attribute had a dual role -- when used on a regular function, it is an entirely safe marker to make this function part of recursive const stability, but on an intrinsic it is a trusted marker requiring special care. It's not great for the same attribute to be sometimes fully checked and safe, and sometimes trusted and requiring special care, so I split this into two attributes. This also fixes https://github.com/rust-lang/rust/issues/122652 by accepting intrinsics as const-stable if they have a fallback body that is recursively const-stable. The library changes are best reviewed with whitespace hidden. r? `@compiler-errors`
2024-11-04Rollup merge of #132303 - nyurik:non-exhaustive-err, r=compiler-errorsJubilee-1/+10
More tests for non-exhaustive C-like enums in FFI Add a few more tests for the `improper_ctypes` lint as found with the [varnish-rs](https://github.com/gquintard/varnish-rs) project. This follows up on #116831, fixed in #116863 by ``@workingjubilee`` - I have been seeing these fail with the bindgen-generated non-exhaustive enums inside other structs. Seems the issue does not exist in the primary branch, so this PR just makes sure more cases are covered for the future.
2024-11-04Rollup merge of #132025 - duncpro:E0027, r=compiler-errorsJubilee-0/+76
fix suggestion for diagnostic error E0027 Closes #132008