about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-07-04offset_from: "the difference must fit in an isize" is a corollaryRalf Jung-5/+19
also, isize::MIN is an impossible distance
2024-07-01Auto merge of #126941 - GuillaumeGomez:migrate-run-make-llvm-ident, r=Kobzolbors-19/+41
Migrate `run-make/llvm-ident` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. r? `@Kobzol` try-job: armhf-gnu
2024-07-01Rollup merge of #127201 - GuillaumeGomez:improve-run-make-support, r=KobzolGuillaume Gomez-5/+5
Improve run-make-support API I think I'll slowly continue this work. Makes things a bit nicer for contributors, so why not. :D r? ``@Kobzol``
2024-07-01Rollup merge of #127129 - compiler-errors:full-expr-span, r=jieyouxuGuillaume Gomez-15/+54
Use full expr span for return suggestion on type error/ambiguity We sometimes use parts of an expression rather than the whole thing for an obligation span. For example, a method obligation will just point to the path segment corresponding to the `method` in `rcvr.method(args)`. So let's not use that assuming it'll point to the *whole* expression span, which we can access from the expr hir id we store in `ObligationCauseCode::WhereClauseInExpr`. Fixes #127109
2024-07-01Rollup merge of #126880 - Rejyr:migrate-rmake-vw, r=KobzolGuillaume Gomez-65/+80
Migrate `volatile-intrinsics`, `weird-output-filenames`, `wasm-override-linker`, `wasm-exceptions-nostd` to `rmake` Also refactors `wasm-abi` and `compressed-debuginfo`. Part of #121876. r? ``@jieyouxu`` try-job: x86_64-gnu-debug try-job: dist-various-2
2024-07-01Rollup merge of #126732 - StackOverflowExcept1on:master, r=m-ou-seGuillaume Gomez-1/+0
Stabilize `PanicInfo::message()` and `PanicMessage` Resolves #66745 This stabilizes the [`PanicInfo::message()`](https://doc.rust-lang.org/nightly/core/panic/struct.PanicInfo.html#method.message) and [`PanicMessage`](https://doc.rust-lang.org/nightly/core/panic/struct.PanicMessage.html). Demonstration of [custom panic handler](https://github.com/StackOverflowExcept1on/panicker): ```rust #![no_std] #![no_main] extern crate libc; #[no_mangle] extern "C" fn main() -> libc::c_int { panic!("I just panic every time"); } #[panic_handler] fn my_panic(panic_info: &core::panic::PanicInfo) -> ! { use arrayvec::ArrayString; use core::fmt::Write; let message = panic_info.message(); let location = panic_info.location().unwrap(); let mut debug_msg = ArrayString::<1024>::new(); let _ = write!(&mut debug_msg, "panicked with '{message}' at '{location}'"); if debug_msg.try_push_str("\0").is_ok() { unsafe { libc::puts(debug_msg.as_ptr() as *const _); } } unsafe { libc::exit(libc::EXIT_FAILURE) } } ``` ``` $ cargo +stage1 run --release panicked with 'I just panic every time' at 'src/main.rs:8:5' ``` - [x] FCP: https://github.com/rust-lang/rust/issues/66745#issuecomment-2198143725 r? libs-api
2024-07-01Migrate `run-make/llvm-ident` to `rmake.rs`Guillaume Gomez-19/+41
2024-07-01Avoid MIR bloat in inliningScott McMurray-843/+286
In 126578 we ended up with more binary size increases than expected. This change attempts to avoid inlining large things into small things, to avoid that kind of increase, in cases when top-down inlining will still be able to do that inlining later.
2024-07-01Improve `target` method API in `run-make-support`Guillaume Gomez-3/+3
2024-07-01Improve `run-make-support` API for `assert*` functionsGuillaume Gomez-2/+2
2024-07-01Auto merge of #127197 - matthiaskrgr:rollup-aqpvn5q, r=matthiaskrgrbors-0/+339
Rollup of 7 pull requests Successful merges: - #126923 (test: dont optimize to invalid bitcasts) - #127090 (Reduce merge conflicts from rustfmt's wrapping) - #127105 (Only update `Eq` operands in GVN if it can update both sides) - #127150 (Fix x86_64 code being produced for bare-metal LoongArch targets' `compiler_builtins`) - #127181 (Introduce a `rustc_` attribute to dump all the `DefId` parents of a `DefId`) - #127182 (Fix error in documentation for IpAddr::to_canonical and Ipv6Addr::to_canonical) - #127191 (Ensure `out_of_scope_macro_calls` lint is registered) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-01Rollup merge of #127191 - beetrees:register-out-of-scope-macro-calls, ↵Matthias Krüger-0/+6
r=compiler-errors Ensure `out_of_scope_macro_calls` lint is registered Fixes part of https://github.com/rust-lang/rust/issues/126984#issuecomment-2198792687.
2024-07-01Rollup merge of #127181 - BoxyUwU:dump_def_parents, r=compiler-errorsMatthias Krüger-0/+162
Introduce a `rustc_` attribute to dump all the `DefId` parents of a `DefId` We've run into a bunch of issues with anon consts having the wrong generics and it would have been incredibly helpful to be able to quickly slap a `rustc_` attribute to check what `tcx.parent(` will return on the relevant DefIds. I wasn't sure of a better way to make this work for anon consts than requiring the attribute to be on the enclosing item and then walking the inside of it to look for any anon consts. This particular method will honestly break at some point when we stop having a `DefId` available for anon consts in hir but that's for another day... r? ``@compiler-errors``
2024-07-01Rollup merge of #127105 - scottmcm:issue-127089, r=cjgillotMatthias Krüger-0/+127
Only update `Eq` operands in GVN if it can update both sides Otherwise the types might not match Fixes #127089 r? mir-opt
2024-07-01Rollup merge of #126923 - ↵Matthias Krüger-0/+44
workingjubilee:regression-tests-for-simd-invalid-bitcast, r=calebzulawski test: dont optimize to invalid bitcasts Regression tests to prevent regressing.
2024-07-01Auto merge of #126996 - oli-obk:do_not_count_errors, r=nnethercotebors-480/+496
Automatically taint InferCtxt when errors are emitted r? `@nnethercote` Basically `InferCtxt::dcx` now returns a `DiagCtxt` that refers back to the `Cell<Option<ErrorGuaranteed>>` of the `InferCtxt` and thus when invoking `Diag::emit`, and the diagnostic is an error, we taint the `InferCtxt` directly. That change on its own has no effect at all, because `InferCtxt` already tracks whether errors have been emitted by recording the global error count when it gets opened, and checking at the end whether the count changed. So I removed that error count check, which had a bit of fallout that I immediately fixed by invoking `InferCtxt::dcx` instead of `TyCtxt::dcx` in a bunch of places. The remaining new errors are because an error was reported in another query, and never bubbled up. I think they are minor enough for this to be ok, and sometimes it actually improves diagnostics, by not silencing useful diagnostics anymore. fixes #126485 (cc `@olafes)` There are more improvements we can do (like tainting in hir ty lowering), but I would rather do that in follow up PRs, because it requires some refactorings.
2024-07-01Auto merge of #127176 - fee1-dead-contrib:fx-requires-next-solver, ↵bors-428/+527
r=compiler-errors Make `feature(effects)` require `-Znext-solver` Per https://github.com/rust-lang/rust/pull/120639#pullrequestreview-2144804638 I made this a hard error because otherwise it should be a lint and that seemed more complicated. Not sure if this is the best place to put the error though. r? project-const-traits
2024-06-30Use full expr span for return suggestion on type error/ambiguityMichael Goulet-15/+54
2024-07-01Auto merge of #127082 - GuillaumeGomez:help-gui-test, r=notriddlebors-0/+70
Add back `help-page.goml` rustdoc GUI test Since https://github.com/rust-lang/rust/pull/127010 was merged, let's see if we can revert https://github.com/rust-lang/rust/pull/126445... r? `@notriddle`
2024-07-01Ensure `out_of_scope_macro_calls` lint is registeredbeetrees-0/+6
2024-06-30add `rustc_dump_def_parents` attributeBoxy-0/+162
2024-06-30Add a GVN test for 127089 that doesn't optimize to a constantScott McMurray-0/+52
2024-06-30Migrate tests to use `-Znext-solver`Deadbeef-428/+503
2024-06-30Make `feature(effects)` require `-Znext-solver`Deadbeef-0/+24
2024-06-30Rollup merge of #127161 - GuillaumeGomez:improve-run-make-args, r=KobzolMatthias Krüger-16/+12
Improve `run-make-support` library `args` API It allows to pass both `Vec` and slices, which makes it much better (for me at least :wink:). r? ``@Kobzol``
2024-06-30Rollup merge of #127160 - pacak:123630-test, r=NadrierilMatthias Krüger-0/+43
Add a regression test for #123630 Fixes #123630 compiler should not suggest nonsensical signatures, original suggestion was ``` error[E0308]: mismatched types --> src/lib.rs:3:31 | 3 | fn select<F, I>(filter: F) -> Select<F, I> { | ------ ^^^^^^^^^^^^ expected `Select<F, I>`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | = note: expected struct `Select<F, I>` found unit type `()` error[E0282]: type annotations needed for `Select<{closure@src/lib.rs:8:22: 8:25}, I>` --> src/lib.rs:8:9 | 8 | let lit = select(|x| match x { | ^^^ | help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified | 8 | let lit: Select<{closure@src/lib.rs:8:22: 8:25}, I> = select(|x| match x { | ++++++++++++++++++++++++++++++++++++++++++++ Some errors have detailed explanations: E0282, E0308. For more information about an error, try `rustc --explain E0282`. ```
2024-06-30Rollup merge of #127038 - BoxyUwU:reword_comment, r=camelidMatthias Krüger-10/+14
Update test comment r? `@camelid` Rewrote this comment since it mixed up a/b in one place and was generally a bit confusing
2024-06-30Rollup merge of #126018 - nnethercote:rm-box_pointers-lint, r=lcnrMatthias Krüger-36/+4
Remove the `box_pointers` lint. As the comment says, this lint "is mostly historical, and not particularly useful". It's not worth keeping it around. r? ``@estebank``
2024-06-30Update test commentBoxy-10/+14
2024-06-30Add a regression test for #123630Michael Baikov-0/+43
compiler should not suggest nonsensical signatures, original suggestion was error[E0308]: mismatched types --> src/lib.rs:3:31 | 3 | fn select<F, I>(filter: F) -> Select<F, I> { | ------ ^^^^^^^^^^^^ expected `Select<F, I>`, found `()` | | | implicitly returns `()` as its body has no tail or `return` expression | = note: expected struct `Select<F, I>` found unit type `()` error[E0282]: type annotations needed for `Select<{closure@src/lib.rs:8:22: 8:25}, I>` --> src/lib.rs:8:9 | 8 | let lit = select(|x| match x { | ^^^ | help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified | 8 | let lit: Select<{closure@src/lib.rs:8:22: 8:25}, I> = select(|x| match x { | ++++++++++++++++++++++++++++++++++++++++++++ Some errors have detailed explanations: E0282, E0308. For more information about an error, try `rustc --explain E0282`.
2024-06-30Auto merge of #127024 - cjgillot:jump-prof, r=oli-obkbors-1/+2
Avoid cloning jump threading state when possible The current implementation of jump threading passes most of its time cloning its state. This PR attempts to avoid such clones by special-casing the last predecessor when recursing through a terminator. This is not optimal, but a first step while I refactor the state data structure to be sparse. The two other commits are drive-by. Fixes https://github.com/rust-lang/rust/issues/116721 r? `@oli-obk`
2024-06-30Improve `run-make-support` library `args` APIGuillaume Gomez-16/+12
2024-06-30Auto merge of #127133 - matthiaskrgr:rollup-jxkp3yf, r=matthiaskrgrbors-41/+183
Rollup of 9 pull requests Successful merges: - #123237 (Various rustc_codegen_ssa cleanups) - #126960 (Improve error message in tidy) - #127002 (Implement `x perf` as a separate tool) - #127081 (Add a run-make test that LLD is not being used by default on the x64 beta/stable channel) - #127106 (Improve unsafe extern blocks diagnostics) - #127110 (Fix a error suggestion for E0121 when using placeholder _ as return types on function signature.) - #127114 (fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer) - #127118 (Show `used attribute`'s kind for user when find it isn't applied to a `static` variable.) - #127122 (Remove uneccessary condition in `div_ceil`) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-30Auto merge of #126869 - matthiaskrgr:kaboom, r=jieyouxubors-0/+142
crashes: add more tests
2024-06-29Rollup merge of #127118 - surechen:fix_126789, r=jieyouxuMatthias Krüger-0/+24
Show `used attribute`'s kind for user when find it isn't applied to a `static` variable. For example : ```rust extern "C" { #[used] //~ ERROR attribute must be applied to a `static` variable static FOO: i32; // show the kind of this item to help user understand why the error is reported. } ``` fixes #126789
2024-06-29Rollup merge of #127114 - linyihai:issue-126863, r=NadrierilMatthias Krüger-24/+6
fix: prefer `(*p).clone` to `p.clone` if the `p` is a raw pointer Fixes https://github.com/rust-lang/rust/issues/126863 I wonder if there is a better way to solve the regression problem of this test case: `tests/ui/borrowck/issue-20801.rs`. It's okay to drop the dereference symbol in this scenario. But it's not correct in https://github.com/rust-lang/rust/issues/126863 ``` help: consider removing the dereference here | 5 - let inner: String = *p; 5 + let inner: String = p; ``` I haven't found out how to tell if clone pointer is allowed, i.e. no type mismatch occurs
2024-06-29Rollup merge of #127110 - surechen:fix_125488_06, r=compiler-errorsMatthias Krüger-10/+109
Fix a error suggestion for E0121 when using placeholder _ as return types on function signature. Recommit after refactoring based on comment: https://github.com/rust-lang/rust/pull/126017#issuecomment-2189149361 But when changing return type's lifetime to `ReError` will affect the subsequent borrow check process and cause test11 in typeck_type_placeholder_item.rs to lost E0515 message. ```rust fn test11(x: &usize) -> &_ { //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types &x //~ ERROR cannot return reference to function parameter(this E0515 msg will disappear) } ``` fixes #125488 r? ``@pnkfelix``
2024-06-29Rollup merge of #127106 - ↵Matthias Krüger-5/+12
spastorino:improve-unsafe-extern-blocks-diagnostics, r=compiler-errors Improve unsafe extern blocks diagnostics Closes #126327 For this code: ```rust extern { pub fn foo(); pub safe fn bar(); } ``` We get ... ``` error: items in unadorned `extern` blocks cannot have safety qualifiers --> test.rs:3:5 | 3 | pub safe fn bar(); | ^^^^^^^^^^^^^^^^^^ | help: add unsafe to this `extern` block | 1 | unsafe extern { | ++++++ error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental --> test.rs:3:9 | 3 | pub safe fn bar(); | ^^^^ | = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. ``` And then making the extern block unsafe, we get ... ``` error: extern block cannot be declared unsafe --> test.rs:1:1 | 1 | unsafe extern { | ^^^^^^ | = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable error: items in unadorned `extern` blocks cannot have safety qualifiers --> test.rs:3:5 | 3 | pub safe fn bar(); | ^^^^^^^^^^^^^^^^^^ error[E0658]: `unsafe extern {}` blocks and `safe` keyword are experimental --> test.rs:3:9 | 3 | pub safe fn bar(); | ^^^^ | = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information = help: add `#![feature(unsafe_extern_blocks)]` to the crate attributes to enable error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`. ``` r? ``@compiler-errors``
2024-06-29Rollup merge of #127081 - Kobzol:lld-test, r=onur-ozkanMatthias Krüger-2/+32
Add a run-make test that LLD is not being used by default on the x64 beta/stable channel https://github.com/rust-lang/rust/pull/126701 showed that the handling of `lld` in bootstrap is currently not ideal. While it would be nice to refactor it eventually, we should also make sure that we have a test that checks that `lld` is not used (yet!) by default on the x64 Linux stable channel. CC ``@lqd`` r? ``@onur-ozkan``
2024-06-29Auto merge of #120639 - fee1-dead-contrib:new-effects-desugaring, r=oli-obkbors-1333/+1401
Implement new effects desugaring cc `@rust-lang/project-const-traits.` Will write down notes once I have finished. * [x] See if we want `T: Tr` to desugar into `T: Tr, T::Effects: Compat<true>` * [x] Fix ICEs on `type Assoc: ~const Tr` and `type Assoc<T: ~const Tr>` * [ ] add types and traits to minicore test * [ ] update rustc-dev-guide Fixes #119717 Fixes #123664 Fixes #124857 Fixes #126148
2024-06-29Auto merge of #126801 - Oneirical:seek-and-testroy, r=Kobzolbors-75/+151
Migrate `remap-path-prefix`, `debug-assertions` and `emit-stack-sizes` `run-make` tests to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Needs OSX/MSVC try jobs. try-job: aarch64-apple try-job: x86_64-msvc
2024-06-29Avoid suggesting to add unsafe when the extern block is already unsafeSantiago Pastorino-5/+0
2024-06-29Refactor `compressed-debuginfo` to use `llvm_readobj`Jerry Wang-3/+2
2024-06-29Refactor `wasm-abi` to use `cmd`Jerry Wang-7/+4
2024-06-29Migrate `wasm-exceptions-nostd` to `rmake`Jerry Wang-14/+20
2024-06-29Migrate `wasm-override-linker` to `rmake`Jerry Wang-16/+17
2024-06-29Migrate `weird-output-filenames` to `rmake`Jerry Wang-15/+19
2024-06-29Migrate `volatile-intrinsics` to `rmake`Jerry Wang-10/+18
2024-06-29Rollup merge of #127116 - GuillaumeGomez:run-make-return-non-c-like-enum, ↵Guillaume Gomez-8/+18
r=Kobzol,jieyouxu Migrate `run-make/return-non-c-like-enum` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. r? `@Kobzol`
2024-06-29Rollup merge of #127041 - GuillaumeGomez:run-make-override-aliased-flags, ↵Guillaume Gomez-23/+24
r=Kobzol Migrate `run-make/override-aliased-flags` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. I voluntarily didn't use the helper methods to make it obvious what's tested. r? `@jieyouxu`