about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-06-04Auto merge of #125989 - GuillaumeGomez:rollup-xu69i13, r=GuillaumeGomezbors-495/+18
Rollup of 11 pull requests Successful merges: - #106186 (Add function `core::iter::chain`) - #125596 (Convert `proc_macro_back_compat` lint to an unconditional error.) - #125696 (Explain differences between `{Once,Lazy}{Cell,Lock}` types) - #125917 (Create `run-make` `env_var` and `env_var_os` helpers) - #125927 (Ignore `vec_deque_alloc_error::test_shrink_to_unwind` test on non-unwind targets) - #125930 (feat(opt-dist): new flag `--benchmark-cargo-config`) - #125932 (Fix typo in the docs of `HashMap::raw_entry_mut`) - #125933 (Update books) - #125944 (Update fuchsia maintainers) - #125946 (Include trailing commas in wrapped function declarations [RustDoc]) - #125973 (Remove `tests/run-make-fulldeps/pretty-expanded`) Failed merges: - #125815 (`rustc_parse` top-level cleanups) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-04Rollup merge of #125973 - Zalathar:pretty, r=lqdGuillaume Gomez-29/+0
Remove `tests/run-make-fulldeps/pretty-expanded` This was an ancient regression test for #12685, caused by `-Zunpretty=expanded` crashing on certain code produced by `#[derive(RustcEncodable)]`. Given that this test predates `//@ pretty-expanded` tests, and was tied to ancient implementation details of the pretty-printer and `#[derive(RustcEncodable)]` (which the test no longer even uses), I think we can safely delete it. --- Spotted via #125948.
2024-06-04Rollup merge of #125946 - Sergi-Ferrez:master, r=notriddle,fmeaseGuillaume Gomez-8/+7
Include trailing commas in wrapped function declarations [RustDoc] Fixes #125901.
2024-06-04Rollup merge of #125917 - GuillaumeGomez:env-var-helpers, r=jieyouxuGuillaume Gomez-8/+7
Create `run-make` `env_var` and `env_var_os` helpers As mentioned in https://github.com/rust-lang/rust/pull/125886. It's quite useful to know which environment variable failed, so better provide a helper helping with that. r? `@jieyouxu`
2024-06-04Rollup merge of #125596 - nnethercote:rental-hard-error, r=estebankGuillaume Gomez-450/+4
Convert `proc_macro_back_compat` lint to an unconditional error. We still check for the `rental`/`allsorts-rental` crates. But now if they are detected we just emit a fatal error, instead of emitting a warning and providing alternative behaviour. The original "hack" implementing alternative behaviour was added in #73345. The lint was added in #83127. The tracking issue is #83125. The direct motivation for the change is that providing the alternative behaviour is interfering with #125174 and follow-on work. r? ``@estebank``
2024-06-04Auto merge of #125426 - jieyouxu:rmake-support-env-reset, r=saethlinbors-1/+0
Update `compiler-builtins` test to not clear essential env vars Noticed in https://github.com/rust-lang/rust/pull/122580#issuecomment-2125755689, the `compiler-builtins` test failed on Windows for a `cargo` invocation because necessary env vars `TMP` and `TEMP` were cleared by `Command::env_clear`, causing temp dir eventually used by codegen to fallback to the Windows directory, which will trigger permission errors. This PR removes the `env_clear` on the cargo invocation. r? `@saethlin` (feel free to reroll, since you authored the test) try-job: x86_64-msvc try-job: test-various
2024-06-04Create `run-make` `env_var` and `env_var_os` helpersGuillaume Gomez-8/+7
2024-06-04Auto merge of #123536 - compiler-errors:simplify-int-float, r=lcnrbors-9/+0
Simplify `IntVarValue`/`FloatVarValue` r? `@ghost`
2024-06-05Remove `tests/run-make-fulldeps/pretty-expanded`Zalathar-29/+0
This was an ancient regression test for #12685, caused by `-Zunpretty=expanded` crashing on certain code produced by `#[derive(RustcEncodable)]`.
2024-06-04Auto merge of #125976 - compiler-errors:rollup-xt3le7w, r=compiler-errorsbors-310/+423
Rollup of 8 pull requests Successful merges: - #125667 (Silence follow-up errors directly based on error types and regions) - #125717 (Refactor `#[diagnostic::do_not_recommend]` support) - #125795 (Improve renaming suggestion for names with leading underscores) - #125865 (Fix ICE caused by ignoring EffectVars in type inference) - #125953 (Streamline `nested` calls.) - #125959 (Reduce `pub` exposure in `rustc_mir_build`) - #125967 (Split smir `Const` into `TyConst` and `MirConst`) - #125968 (Store the types of `ty::Expr` arguments in the `ty::Expr`) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-04Rollup merge of #125968 - BoxyUwU:shrink_ty_expr, r=oli-obkMichael Goulet-2/+26
Store the types of `ty::Expr` arguments in the `ty::Expr` Part of #125958 In attempting to remove the `ty` field on `Const` it will become necessary to store the `Ty<'tcx>` inside of `Expr<'tcx>`. In order to do this without blowing up the size of `ConstKind`, we start storing the type/const args as `GenericArgs` r? `@oli-obk`
2024-06-04Rollup merge of #125967 - BoxyUwU:split_smir_const, r=oli-obkMichael Goulet-3/+3
Split smir `Const` into `TyConst` and `MirConst` Part of #125958 Building a `smir::Const` currently requires accessing the `Ty<'tcx>` of a `ty::Const`. This will stop being possible in the future. Replicate the split in rustc of having a representation of type level constants and mir constants with the latter being able to store the former. Ideally we wouldnt have `MirConst::Ty` but :woman_shrugging: r? `@oli-obk`
2024-06-04Rollup merge of #125865 - ajwock:ice_not_fully_resolved, r=fee1-deadMichael Goulet-11/+93
Fix ICE caused by ignoring EffectVars in type inference Fixes #119830 ​r? ```@matthiaskrgr```
2024-06-04Rollup merge of #125795 - lucasscharenbroch:undescore-prefix-suggestion, ↵Michael Goulet-3/+5
r=compiler-errors Improve renaming suggestion for names with leading underscores Fixes #125650 Before: ``` error[E0425]: cannot find value `p` in this scope --> test.rs:2:13 | 2 | let _ = p; | ^ | help: a local variable with a similar name exists, consider renaming `_p` into `p` | 1 | fn a(p: i32) { | ~ ``` After: ``` error[E0425]: cannot find value `p` in this scope --> test.rs:2:13 | 1 | fn a(_p: i32) { | -- `_p` defined here 2 | let _ = p; | ^ | help: the leading underscore in `_p` marks it as unused, consider renaming it to `p` | 1 | fn a(p: i32) { | ~ ``` This change doesn't exactly conform to what was proposed in the issue: 1. I've kept the suggested code instead of solely replacing it with the label 2. I've removed the "...similar name exists..." message instead of relocating to the usage span 3. You could argue that it still isn't completely clear that the change is referring to the definition (not the usage), but I'm not sure how to do this without playing down the fact that the error was caused by the usage of an undefined name.
2024-06-04Rollup merge of #125717 - ↵Michael Goulet-0/+57
weiznich:move/do_not_recommend_to_diganostic_namespace, r=compiler-errors Refactor `#[diagnostic::do_not_recommend]` support This commit refactors the `#[do_not_recommend]` support in the old parser to also apply to projection errors and not only to selection errors. This allows the attribute to be used more widely. Part of #51992 r? `@compiler-errors` <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> -->
2024-06-04Rollup merge of #125667 - oli-obk:taintify, r=TaKO8KiMichael Goulet-291/+239
Silence follow-up errors directly based on error types and regions During type_of, we used to just return an error type if there were any errors encountered. This is problematic, because it means a struct declared as `struct Foo<'static>` will end up not finding any inherent or trait impls because those impl blocks' `Self` type will be `{type error}` instead of `Foo<'re_error>`. Now it's the latter, silencing nonsensical follow-up errors about `Foo` not having any methods. Unfortunately that now allows for new follow-up errors, because borrowck treats `'re_error` as `'static`, causing nonsensical errors about non-error lifetimes not outliving `'static`. So what I also did was to just strip all outlives bounds that borrowck found, thus never letting it check them. There are probably more nuanced ways to do this, but I worried there would be other nonsensical errors if some outlives bounds were missing. Also from the test changes, it looked like an improvement everywhere.
2024-06-04Auto merge of #125948 - nnethercote:rustfmt-more-tests, r=lqdbors-178/+345
rustfmt more tests This finishes the formatting of tests begun in #125759 and continued in #125912. r? `@lqd`
2024-06-04Update code format and testsSergi-Ferrez-8/+7
2024-06-04bless privacy tests (only diagnostic duplication)Oli Scherer-2/+26
2024-06-04Split smir `Const` into `TyConst` and `MirConst`Boxy-3/+3
2024-06-04compiler-builtins: don't clear env vars for cargo invocation许杰友 Jieyou Xu (Joe)-1/+0
2024-06-04Rollup merge of #125909 - fmease:rustdoc-add-test-synth-blanket-impls, ↵许杰友 Jieyou Xu (Joe)-0/+19
r=GuillaumeGomez rustdoc: add a regression test for a former blanket impl synthesis ICE Fixes #119792 (also passes in #125907 in case you were wondering). r? rustdoc
2024-06-04Rollup merge of #125818 - Urgau:print-check-cfg-no-values, r=petrochenkov许杰友 Jieyou Xu (Joe)-0/+14
Handle no values cfgs with `--print=check-cfg` This PR fix a bug with `--print=check-cfg`, where no values cfgs where not printed since we only printed cfgs that had at least one values. The representation I choose is `CFG=`, since it doesn't correspond to any valid config, it also IMO nicely complements the `values()` (to indicate no values). Representing the absence of value by the absence of the value. So for `cfg(feature, values())` we would print `feature=`. I also added the missing tracking issue number in the doc. r? ```@petrochenkov```
2024-06-04Rollup merge of #125608 - oli-obk:subsequent_lifetime_errors, r=BoxyUwU许杰友 Jieyou Xu (Joe)-128/+147
Avoid follow-up errors if the number of generic parameters already doesn't match fixes #125604 best reviewed commit-by-commit
2024-06-04Rollup merge of #124486 - beetrees:vectorcall-tracking-issue, r=ehuss许杰友 Jieyou Xu (Joe)-0/+7
Add tracking issue and unstable book page for `"vectorcall"` ABI Originally added in 2015 by #30567, the Windows `"vectorcall"` ABI didn't have a tracking issue until now. Tracking issue: #124485
2024-06-04Auto merge of #125525 - joboet:tls_accessor, r=cuviperbors-91/+21
Make TLS accessors closures that return pointers The current TLS macros generate a function that returns an `Option<&'static T>`. This is both risky as we lie about lifetimes, and necessitates that those functions are `unsafe`. By returning a `*const T` instead, the accessor function do not have safety requirements any longer and can be made closures without hassle. This PR does exactly that! For native TLS, the closure approach makes it trivial to select the right accessor function at compile-time, which could result in a slight speed-up (I have the hope that the accessors are now simple enough for the MIR-inliner to kick in).
2024-06-04rustfmt `tests/rustdoc-json/`.Nicholas Nethercote-12/+18
2024-06-04rustfmt `tests/rustdoc-js/`.Nicholas Nethercote-132/+240
2024-06-04Auto merge of #125380 - compiler-errors:wc-obj-safety, r=oli-obkbors-37/+71
Make `WHERE_CLAUSES_OBJECT_SAFETY` a regular object safety violation #### The issue In #50781, we have known about unsound `where` clauses in function arguments: ```rust trait Impossible {} trait Foo { fn impossible(&self) where Self: Impossible; } impl Foo for &() { fn impossible(&self) where Self: Impossible, {} } // `where` clause satisfied for the object, meaning that the function now *looks* callable. impl Impossible for dyn Foo {} fn main() { let x: &dyn Foo = &&(); x.impossible(); } ``` ... which currently segfaults at runtime because we try to call a method in the vtable that doesn't exist. :( #### What did u change This PR removes the `WHERE_CLAUSES_OBJECT_SAFETY` lint and instead makes it a regular object safety violation. I choose to make this into a hard error immediately rather than a `deny` because of the time that has passed since this lint was authored, and the single (1) regression (see below). That means that it's OK to mention `where Self: Trait` where clauses in your trait, but making such a trait into a `dyn Trait` object will report an object safety violation just like `where Self: Sized`, etc. ```rust trait Impossible {} trait Foo { fn impossible(&self) where Self: Impossible; // <~ This definition is valid, just not object-safe. } impl Foo for &() { fn impossible(&self) where Self: Impossible, {} } fn main() { let x: &dyn Foo = &&(); // <~ THIS is where we emit an error. } ``` #### Regressions From a recent crater run, there's only one crate that relies on this behavior: https://github.com/rust-lang/rust/pull/124305#issuecomment-2122381740. The crate looks unmaintained and there seems to be no dependents. #### Further We may later choose to relax this (e.g. when the where clause is implied by the supertraits of the trait or something), but this is not something I propose to do in this FCP. For example, given: ``` trait Tr { fn f(&self) where Self: Blanket; } impl<T: ?Sized> Blanket for T {} ``` Proving that some placeholder `S` implements `S: Blanket` would be sufficient to prove that the same (blanket) impl applies for both `Concerete: Blanket` and `dyn Trait: Blanket`. Repeating here that I don't think we need to implement this behavior right now. ---- r? lcnr
2024-06-04Auto merge of #122597 - pacak:master, r=bjorn3bors-0/+66
Show files produced by `--emit foo` in json artifact notifications Right now it is possible to ask `rustc` to save some intermediate representation into one or more files with `--emit=foo`, but figuring out what exactly was produced is difficult. This pull request adds information about `llvm_ir` and `asm` intermediate files into notifications produced by `--json=artifacts`. Related discussion: https://internals.rust-lang.org/t/easier-access-to-files-generated-by-emit-foo/20477 Motivation - `cargo-show-asm` parses those intermediate files and presents them in a user friendly way, but right now I have to apply some dirty hacks. Hacks make behavior confusing: https://github.com/hintron/computer-enhance/issues/35 This pull request introduces a new behavior: now `rustc` will emit a new artifact notification for every artifact type user asked to `--emit`, for example for `--emit asm` those will include all the `.s` files. Most users won't notice this behavior, to be affected by it all of the following must hold: - user must use `rustc` binary directly (when `cargo` invokes `rustc` - it consumes artifact notifications and doesn't emit anything) - user must specify both `--emit xxx` and `--json artifacts` - user must refuse to handle unknown artifact types - user must disable incremental compilation (or deal with it better than cargo does, or use a workaround like `save-temps`) in order not to hit #88829 / #89149
2024-06-04rustfmt `tests/run-pass-valgrind/`.Nicholas Nethercote-26/+57
2024-06-04rustfmt `tests/run-make-fulldeps/`.Nicholas Nethercote-8/+30
Note: I inserted blank lines between the items in `pretty-expanded/input.rs` because it looked better that way.
2024-06-03Auto merge of #125383 - Oneirical:bundle-them-up, r=jieyouxubors-106/+128
Rewrite `emit`, `mixing-formats` and `bare-outfile` `run-make` tests in `rmake.rs` format Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). try-job: x86_64-msvc
2024-06-03Make WHERE_CLAUSES_OBJECT_SAFETY a regular object safety violationMichael Goulet-37/+71
2024-06-03Mark all extraneous generic args as errorsOli Scherer-63/+58
2024-06-03Mark all missing generic args as errorsOli Scherer-59/+33
2024-06-03Hide some follow-up errorsOli Scherer-6/+6
2024-06-03Add regression testOli Scherer-0/+50
2024-06-03Fix ICE caused by ignoring EffectVars in type inferenceAndrew Wock-11/+93
Signed-off-by: Andrew Wock <ajwock@gmail.com>
2024-06-03Auto merge of #125912 - nnethercote:rustfmt-tests-mir-opt, r=oli-obkbors-508/+567
rustfmt `tests/mir-opt` Continuing the work started in #125759. Details in individual commit log messages. r? `@oli-obk`
2024-06-03Auto merge of #125778 - estebank:issue-67100, r=compiler-errorsbors-79/+79
Use parenthetical notation for `Fn` traits Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`. Address #67100: ``` error[E0277]: expected a `Fn()` closure, found `F` --> file.rs:6:13 | 6 | call_fn(f) | ------- ^ expected an `Fn()` closure, found `F` | | | required by a bound introduced by this call | = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `call_fn` --> file.rs:1:15 | 1 | fn call_fn<F: Fn() -> ()>(f: &F) { | ^^^^^^^^^^ required by this bound in `call_fn` help: consider further restricting this bound | 5 | fn call_any<F: std::any::Any + Fn()>(f: &F) { | ++++++ ```
2024-06-03Auto merge of #125904 - workingjubilee:test-packed-simd-more, r=calebzulawskibors-0/+44
Test codegen for `repr(packed,simd)` -> `repr(simd)` This adds the codegen test originally requested in #117116 but exploiting the collection of features in FileCheck and compiletest to make it more resilient to expectations being broken by optimization levels. Mostly by presetting optimization levels for each revision of the tests. I do not think the dereferenceable attribute's presence or absence is that important. r? `@calebzulawski`
2024-06-03rustfmt `tests/mir-opt`.Nicholas Nethercote-227/+246
The only non-obvious changes: - `building/storage_live_dead_in_statics.rs` has a `#[rustfmt::skip]` attribute to avoid reformating a table of data. - Two `.mir` files have slight changes involving line numbers. - In `unusual_item_types.rs` an `EMIT_MIR` annotation is moved to outside a function, which is the usual spot, because `tidy` complains if such a comment is indented. The commit also tweaks the comments in `rustfmt.toml`.
2024-06-03Reformat `mir!` macro invocations to use braces.Nicholas Nethercote-281/+321
The `mir!` macro has multiple parts: - An optional return type annotation. - A sequence of zero or more local declarations. - A mandatory starting anonymous basic block, which is brace-delimited. - A sequence of zero of more additional named basic blocks. Some `mir!` invocations use braces with a "block" style, like so: ``` mir! { let _unit: (); { let non_copy = S(42); let ptr = std::ptr::addr_of_mut!(non_copy); // Inside `callee`, the first argument and `*ptr` are basically // aliasing places! Call(_unit = callee(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue()) } after_call = { Return() } } ``` Some invocations use parens with a "block" style, like so: ``` mir!( let x: [i32; 2]; let one: i32; { x = [42, 43]; one = 1; x = [one, 2]; RET = Move(x); Return() } ) ``` And some invocations uses parens with a "tighter" style, like so: ``` mir!({ SetDiscriminant(*b, 0); Return() }) ``` This last style is generally used for cases where just the mandatory starting basic block is present. Its braces are placed next to the parens. This commit changes all `mir!` invocations to use braces with a "block" style. Why? - Consistency is good. - The contents of the invocation is a block of code, so it's odd to use parens. They are more normally used for function-like macros. - Most importantly, the next commit will enable rustfmt for `tests/mir-opt/`. rustfmt is more aggressive about formatting macros that use parens than macros that use braces. Without this commit's changes, rustfmt would break a couple of `mir!` macro invocations that use braces within `tests/mir-opt` by inserting an extraneous comma. E.g.: ``` mir!(type RET = (i32, bool);, { // extraneous comma after ';' RET.0 = 1; RET.1 = true; Return() }) ``` Switching those `mir!` invocations to use braces avoids that problem, resulting in this, which is nicer to read as well as being valid syntax: ``` mir! { type RET = (i32, bool); { RET.0 = 1; RET.1 = true; Return() } } ```
2024-06-03Auto merge of #125397 - gurry:125303-wrong-builder-suggestion, r=compiler-errorsbors-22/+117
Do not suggest unresolvable builder methods Fixes #125303 The issue was that when a builder method cannot be resolved we are suggesting alternatives that themselves cannot be resolved. This PR adds a check that filters them from the list of suggestions.
2024-06-02Test codegen for repr(packed,simd) -> repr(simd)Jubilee Young-0/+44
2024-06-02Remove some allowed-makefilesOneirical-70/+77
2024-06-03Add a regression test for a former blanket impl synthesis ICELeón Orell Valerian Liehr-0/+19
2024-06-02Rollup merge of #125808 - ↵Jubilee-21/+41
GuillaumeGomez:migrate-run-make-c-link-to-rust-dylib, r=jieyouxu Migrate `run-make/c-link-to-rust-dylib` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. First commit comes from https://github.com/rust-lang/rust/pull/125773. r? `@jieyouxu`
2024-06-02Rollup merge of #125849 - GuillaumeGomez:migrate-emit-named-files, r=jieyouxuJubilee-33/+25
Migrate `run-make/emit-named-files` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. r? `@jieyouxu`