about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-03-05Rollup merge of #122018 - RalfJung:box-custom-alloc, r=oli-obkMatthias Krüger-0/+11
only set noalias on Box with the global allocator As discovered in https://github.com/rust-lang/miri/issues/3341, `noalias` and custom allocators don't go well together. rustc can now check whether a Box uses the global allocator. This replaces the previous ad-hoc and rather unprincipled check for a zero-sized allocator. This is the rustc part of fixing that; Miri will also need a patch.
2024-03-05Rollup merge of #121894 - RalfJung:const_eval_select, r=oli-obkMatthias Krüger-12/+8
const_eval_select: make it safe but be careful with what we expose on stable for now As this is all still nightly-only I think `````@rust-lang/wg-const-eval````` can do that without involving t-lang. r? `````@oli-obk````` Cc `````@Nilstrieb````` -- the updated version of your RFC would basically say that we can remove these comments about not making behavior differences visible in stable `const fn`
2024-03-05Rollup merge of #121857 - compiler-errors:async-closure-signature-deduction, ↵Matthias Krüger-0/+10
r=oli-obk Implement async closure signature deduction Self-explanatory from title. Regarding the interaction between signature deduction, fulfillment, and the new trait solver: I'm not worried about implementing closure signature deduction here because: 1. async closures are unstable, and 2. I'm reasonably confident we'll need to support signature deduction in the new solver somehow (i.e. via proof trees, which seem very promising). This is in contrast to #109338, which was closed because it generalizes signature deduction for a *stable* kind of expression (`async {}` blocks and `Future` traits), and which proliferated usage may pose a stabilization hazard for the new solver. I'll be certain to make sure sure we revisit the closure signature deduction problem by the time that async closures are being stabilized (which isn't particularly soon) (edit: Put it into the async closure tracking issue). cc `````@lcnr````` r? `````@oli-obk`````
2024-03-05only set noalias on Box with the global allocatorRalf Jung-0/+11
2024-03-05Auto merge of #121992 - jieyouxu:fix-tidy-unpaired-revision, r=onur-ozkanbors-1/+8
tidy: split dots in filename not the entire path when checking for stray stdout/stderr files I committed a path crime by splitting the entire path on `.`, when I meant to split on the filename. This means that any parent folders which contain `.` will cause tidy failure. Added a regression test so that doesn't happen again. ### Follow-up - [ ] Adjust rustc-dev-guide to document assert on test name not containing dots. https://github.com/rust-lang/rustc-dev-guide/pull/1927 Fixes #121986.
2024-03-05Update test names to not have dots许杰友 Jieyou Xu (Joe)-1/+1
2024-03-05Rollup merge of #121838 - oli-obk:impl_trait_in_assoc_tys_fix, r=compiler-errorsMatthias Krüger-0/+43
Use the correct logic for nested impl trait in assoc types Previously we accidentally continued with the TAIT visitor, which allowed more than we wanted to. r? ```@compiler-errors```
2024-03-05Rollup merge of #121826 - estebank:e0277-root-obligation-2, r=oli-obkMatthias Krüger-115/+105
Use root obligation on E0277 for some cases When encountering trait bound errors that satisfy some heuristics that tell us that the relevant trait for the user comes from the root obligation and not the current obligation, we use the root predicate for the main message. This allows to talk about "X doesn't implement Pattern<'_>" over the most specific case that just happened to fail, like "char doesn't implement Fn(&mut char)" in `tests/ui/traits/suggest-dereferences/root-obligation.rs` The heuristics are: - the type of the leaf predicate is (roughly) the same as the type from the root predicate, as a proxy for "we care about the root" - the leaf trait and the root trait are different, so as to avoid talking about `&mut T: Trait` and instead remain talking about `T: Trait` instead - the root trait is not `Unsize`, as to avoid talking about it in `tests/ui/coercion/coerce-issue-49593-box-never.rs`. ``` error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied --> $DIR/root-obligation.rs:6:38 | LL | .filter(|c| "aeiou".contains(c)) | -------- ^ the trait `Fn<(char,)>` is not implemented for `&char`, which is required by `&char: Pattern<'_>` | | | required by a bound introduced by this call | = note: required for `&char` to implement `FnOnce<(char,)>` = note: required for `&char` to implement `Pattern<'_>` note: required by a bound in `core::str::<impl str>::contains` --> $SRC_DIR/core/src/str/mod.rs:LL:COL help: consider dereferencing here | LL | .filter(|c| "aeiou".contains(*c)) | + ``` Fix #79359, fix #119983, fix #118779, cc #118415 (the suggestion needs to change), cc #121398 (doesn't fix the underlying issue).
2024-03-05Rollup merge of #121664 - compiler-errors:adjust-error-yield-lowering, ↵Matthias Krüger-0/+21
r=spastorino Adjust error `yield`/`await` lowering Adjust the lowering of `yield`/`await` outside of their correct scopes so that we no longer make orpan HIR exprs. Previously, `yield EXPR` would be lowered directly to `hir::TyKind::Error` (which I'll call `<error>`) which means that `EXPR` was not present in the HIR, but now we lower it to `{ EXPR; <error> }` so that `EXPR` is not orphaned. Fixes #121096
2024-03-05Auto merge of #121780 - nnethercote:diag-renaming2, r=davidtwcobors-20/+21
Diagnostic renaming 2 A sequel to #121489. r? `@davidtwco`
2024-03-05Rename `SubdiagnosticMessageOp` as `SubdiagMessageOp`.Nicholas Nethercote-3/+3
2024-03-05Rename `SubdiagnosticMessage` as `SubdiagMessage`.Nicholas Nethercote-7/+7
2024-03-05Rename `DiagnosticMessage` as `DiagMessage`.Nicholas Nethercote-7/+7
2024-03-05Disable `tests/ui-fulldeps/internal-lints/diagnostics.rs` on stage 1.Nicholas Nethercote-7/+8
When you make a change to the diagnostic lints, it uses the old version of the lints with stage 1 and the new version with stage 2, which often leads to failures in stage 1. Let's just stick to stage 2.
2024-03-05Auto merge of #120675 - oli-obk:intrinsics3.0, r=pnkfelixbors-0/+48
Add a scheme for moving away from `extern "rust-intrinsic"` entirely All `rust-intrinsic`s can become free functions now, either with a fallback body, or with a dummy body and an attribute, requiring backends to actually implement the intrinsic. This PR demonstrates the dummy-body scheme with the `vtable_size` intrinsic. cc https://github.com/rust-lang/rust/issues/63585 follow-up to #120500 MCP at https://github.com/rust-lang/compiler-team/issues/720
2024-03-04Auto merge of #121998 - matthiaskrgr:rollup-l7lzwpb, r=matthiaskrgrbors-16/+26
Rollup of 10 pull requests Successful merges: - #120976 (constify a couple thread_local statics) - #121683 (Fix LVI tests after frame pointers are enabled by default) - #121703 (Add a way to add constructors for `rustc_type_ir` types) - #121732 (Improve assert_matches! documentation) - #121928 (Extract an arguments struct for `Builder::then_else_break`) - #121939 (Small enhancement to description of From trait) - #121968 (Don't run test_get_os_named_thread on win7) - #121969 (`ParseSess` cleanups) - #121977 (Doc: Fix incorrect reference to integer in Atomic{Ptr,Bool}::as_ptr.) - #121994 (Update platform-support.md with supported musl version) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-04Rollup merge of #121969 - nnethercote:ParseSess-cleanups, r=wesleywiserMatthias Krüger-12/+8
`ParseSess` cleanups The main change here is to rename all `ParseSess` values as `psess`. Plus a few other small cleanups. r? `@wesleywiser`
2024-03-04Rollup merge of #121683 - fortanix:raoul/lvi_fixes, r=cuviperMatthias Krüger-4/+18
Fix LVI tests after frame pointers are enabled by default #121203 enables frame pointers by default. This affects LVI mitigations for the `x86_64-fortanix-unknown-sgx` target. LVI remained mitigated correctly, but the tests were too strict. ``@nshyrei`` , ``@jethrogb``
2024-03-05Rename all `ParseSess` variables/fields/lifetimes as `psess`.Nicholas Nethercote-7/+7
Existing names for values of this type are `sess`, `parse_sess`, `parse_session`, and `ps`. `sess` is particularly annoying because that's also used for `Session` values, which are often co-located, and it can be difficult to know which type a value named `sess` refers to. (That annoyance is the main motivation for this change.) `psess` is nice and short, which is good for a name used this much. The commit also renames some `parse_sess_created` values as `psess_created`.
2024-03-04Split dots in filename, not the entire path许杰友 Jieyou Xu (Joe)-0/+7
2024-03-04Auto merge of #120468 - alexcrichton:start-wasm32-wasi-rename, r=wesleywiserbors-4/+7
Add a new `wasm32-wasip1` target to rustc This commit adds a new target called `wasm32-wasip1` to rustc. This new target is explained in these two MCPs: * https://github.com/rust-lang/compiler-team/issues/607 * https://github.com/rust-lang/compiler-team/issues/695 In short, the previous `wasm32-wasi` target is going to be renamed to `wasm32-wasip1` to better live alongside the [new `wasm32-wasip2` target](https://github.com/rust-lang/rust/pull/119616). This new target is added alongside the `wasm32-wasi` target and has the exact same definition as the previous target. This PR is effectively a rename of `wasm32-wasi` to `wasm32-wasip1`. Note, however, that as explained in rust-lang/compiler-team#695 the previous `wasm32-wasi` target is not being removed at this time. This change will reach stable Rust before even a warning about the rename will be printed. At this time this change is just the start where a new target is introduced and users can start migrating if they support only Nightly for example.
2024-03-04Add a scheme for moving away from `extern "rust-intrinsic"` entirelyOli Scherer-0/+48
2024-03-04Merge the impl trait in assoc type collector into the opaque type collector ↵Oli Scherer-1/+16
and use a runtime switch instead
2024-03-04Fix LVI tests after making frame pointers easily enableableRaoul Strackx-4/+18
2024-03-04Auto merge of #121964 - matthiaskrgr:rollup-rtcju5m, r=matthiaskrgrbors-0/+99
Rollup of 3 pull requests Successful merges: - #121130 (Suggest moving definition if non-found macro_rules! is defined later) - #121912 (Properly deal with GATs when looking for method chains to point at) - #121927 (Add a proper `with_no_queries` to printing) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-04Rollup merge of #121912 - fmease:diag-method-chains-gat, ↵Matthias Krüger-0/+49
r=compiler-errors,estebank Properly deal with GATs when looking for method chains to point at Fixes #121898. ~~While it prevents an ICE and the structured suggestion is correct, the method chain diagnostic notes are weird / useless / incorrect judging by a quick look. I guess I should improve that in this PR.~~ Sufficiently taken care of. r? estebank or compiler-errors (#105332, #105674).
2024-03-04Rollup merge of #121130 - chenyukang:yukang-fix-121061-macro-later, ↵Matthias Krüger-0/+50
r=matthiaskrgr Suggest moving definition if non-found macro_rules! is defined later Fixes #121061
2024-03-04Auto merge of #121900 - chenyukang:yukang-fix-121425-repr-pack-error, ↵bors-34/+103
r=compiler-errors Fix misleading message in struct repr alignment and packed Fixes #121425 By the way, fix the spans for the argument in the second commit.
2024-03-04Remove `file_path_mapping` param from `ParseSess::new`.Nicholas Nethercote-7/+3
It's always empty.
2024-03-04Auto merge of #121955 - matthiaskrgr:rollup-1i3lo0j, r=matthiaskrgrbors-29/+259
Rollup of 5 pull requests Successful merges: - #121248 (Move some tests) - #121528 (Consider middle segments of paths in `unused_qualifications`) - #121749 (Don't lint on executable crates with `non_snake_case` names) - #121935 (library/ptr: mention that ptr::without_provenance is equivalent to deriving from the null ptr) - #121945 (Run some ui-fulldeps tests on stage 1 again) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-03Auto merge of #121665 - erikdesjardins:ptradd, r=nikicbors-6/+49
Always generate GEP i8 / ptradd for struct offsets This implements #98615, and goes a bit further to remove `struct_gep` entirely. Upstream LLVM is in the beginning stages of [migrating to `ptradd`](https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699). LLVM 19 will [canonicalize](https://github.com/llvm/llvm-project/pull/68882) all constant-offset GEPs to i8, which has roughly the same effect as this change. Fixes #121719. Split out from #121577. r? `@nikic`
2024-03-03Rollup merge of #121945 - Nilstrieb:ignore-stage1, r=compiler-errorsMatthias Krüger-8/+6
Run some ui-fulldeps tests on stage 1 again This is the second time I'm doing this... I'm starting to feel like stage1 ui-fulldeps tests were a mistake. Maybe I should have just put `#[cfg(bootstrap)]` there to let the bootstrap bumper fix it. `@George-lewis` :) finishes https://github.com/rust-lang/rust/pull/119088#issuecomment-1890389583
2024-03-03Rollup merge of #121749 - jieyouxu:issue-45127-fix, r=petrochenkovMatthias Krüger-14/+126
Don't lint on executable crates with `non_snake_case` names Revives #111130, cc `@GilShoshan94.` Closes #45127.
2024-03-03Rollup merge of #121528 - Alexendoo:unused_qualifications, r=petrochenkovMatthias Krüger-7/+127
Consider middle segments of paths in `unused_qualifications` Currently `unused_qualifications` looks at the last segment of a path to see if it can be trimmed, this PR extends the check to the middle segments also ```rust // currently linted use std::env::args(); std::env::args(); // Removes `std::env::` ``` ```rust // newly linted use std::env; std::env::args(); // Removes `std::` ``` Paths with generics in them are now linted as long as the part being trimmed is before any generic args, e.g. it will now suggest trimming `std::vec::` from `std::vec::Vec<usize>` Paths with any segments that are from an expansion are no longer linted Fixes #100979 Fixes #96698
2024-03-03Move testsCaio-0/+0
2024-03-03Consider middle segments of paths in `unused_qualifications`Alex Macleod-7/+127
2024-03-03Be more lax in `.into_iter()` suggestion when encountering `Iterator` ↵Esteban Küber-26/+36
methods on non-`Iterator` ``` error[E0599]: no method named `map` found for struct `Vec<bool>` in the current scope --> $DIR/vec-on-unimplemented.rs:3:23 | LL | vec![true, false].map(|v| !v).collect::<Vec<_>>(); | ^^^ `Vec<bool>` is not an iterator | help: call `.into_iter()` first | LL | vec![true, false].into_iter().map(|v| !v).collect::<Vec<_>>(); | ++++++++++++ ``` We used to provide some help through `rustc_on_unimplemented` on non-`impl Trait` and non-type-params, but this lets us get rid of some otherwise unnecessary conditions in the annotation on `Iterator`.
2024-03-03Use root obligation on E0277 for some casesEsteban Küber-89/+69
When encountering trait bound errors that satisfy some heuristics that tell us that the relevant trait for the user comes from the root obligation and not the current obligation, we use the root predicate for the main message. This allows to talk about "X doesn't implement Pattern<'_>" over the most specific case that just happened to fail, like "char doesn't implement Fn(&mut char)" in `tests/ui/traits/suggest-dereferences/root-obligation.rs` The heuristics are: - the type of the leaf predicate is (roughly) the same as the type from the root predicate, as a proxy for "we care about the root" - the leaf trait and the root trait are different, so as to avoid talking about `&mut T: Trait` and instead remain talking about `T: Trait` instead - the root trait is not `Unsize`, as to avoid talking about it in `tests/ui/coercion/coerce-issue-49593-box-never.rs`. ``` error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied --> $DIR/root-obligation.rs:6:38 | LL | .filter(|c| "aeiou".contains(c)) | -------- ^ the trait `Fn<(char,)>` is not implemented for `&char`, which is required by `&char: Pattern<'_>` | | | required by a bound introduced by this call | = note: required for `&char` to implement `FnOnce<(char,)>` = note: required for `&char` to implement `Pattern<'_>` note: required by a bound in `core::str::<impl str>::contains` --> $SRC_DIR/core/src/str/mod.rs:LL:COL help: consider dereferencing here | LL | .filter(|c| "aeiou".contains(*c)) | + ``` Fix #79359, fix #119983, fix #118779, cc #118415 (the suggestion needs to change).
2024-03-03Run some ui-fulldeps tests on stage 1 againNilstrieb-8/+6
This is the second time I'm doing this... I'm starting to feel like stage1 ui-fulldeps tests were a mistake. Maybe I should have just put `#[cfg(bootstrap)]` there to let the bootstrap bumper fix it.
2024-03-03Auto merge of #121937 - GuillaumeGomez:rollup-9684vg3, r=GuillaumeGomezbors-0/+141
Rollup of 3 pull requests Successful merges: - #121917 (Add new `pattern_complexity` attribute to add possibility to limit and check recursion in pattern matching) - #121933 (Add missing get_name for wasm::thread.) - #121934 (rustc_log: expose tracing-tree "wraparound" in an env var) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-03Only run lint tests on x86_64-unknown-linux-gnu许杰友 Jieyou Xu (Joe)-13/+17
We're trying to test lint behavior, not per-target crate-type support.
2024-03-03Rollup merge of #121917 - GuillaumeGomez:pattern-complexity_limit.rs, ↵Guillaume Gomez-0/+141
r=Nadrieril Add new `pattern_complexity` attribute to add possibility to limit and check recursion in pattern matching Needed for https://github.com/rust-lang/rust-analyzer/issues/9528. This PR adds a new attribute only available when running rust testsuite called `pattern_complexity` which allows to set the maximum recursion for the pattern matching. It is quite useful to ensure the complexity doesn't grow, like in `tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs`. r? `@Nadrieril`
2024-03-03Ignore cdylib test for i686-unknown-linux-musl许杰友 Jieyou Xu (Joe)-0/+1
2024-03-03Add feature gate test for `pattern_complexity` attributeGuillaume Gomez-0/+18
2024-03-03Add and update tests to use `pattern_complexity`Guillaume Gomez-0/+123
2024-03-03Auto merge of #121903 - Nilstrieb:rename-qnx-file, r=WaffleLapkinbors-3/+3
Remove underscore from QNX target file name For consistency with the other QNX targets and the actual target names.
2024-03-03Auto merge of #121877 - estebank:fancy-svg, r=compiler-errorsbors-147/+421
On tests that specify `--color=always` emit SVG file with stderr output Leverage `anstyle-svg`, as `cargo` does now, to emit `.svg` files instead of `.stderr` files for tests that explicitly enable color output. This will make reviewing changes to the graphical output of tests much more human friendly. <img src="https://raw.githubusercontent.com/rust-lang/rust/b4bdb56f86e136ca63bf71dca3034200c6c25900/tests/ui/error-emitter/highlighting.svg">
2024-03-03fix spans of arguments in diagnosticyukang-33/+33
2024-03-03Properly deal with GATs when looking for method chains to point atLeón Orell Valerian Liehr-0/+49
2024-03-02Auto merge of #121914 - Nadrieril:rollup-ol98ncg, r=Nadrierilbors-49/+705
Rollup of 5 pull requests Successful merges: - #120761 (Add initial support for DataFlowSanitizer) - #121622 (Preserve same vtable pointer when cloning raw waker, to fix Waker::will_wake) - #121716 (match lowering: Lower bindings in a predictable order) - #121731 (Now that inlining, mir validation and const eval all use reveal-all, we won't be constraining hidden types here anymore) - #121841 (`f16` and `f128` step 2: intrinsics) r? `@ghost` `@rustbot` modify labels: rollup