about summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2024-06-03Reformat `mir!` macro invocations to use braces.Nicholas Nethercote-18/+24
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-02Remove some allowed-makefilesOneirical-5/+2
2024-06-02Rollup merge of #125896 - jieyouxu:compiletest-rmake-comment, r=compiler-errorsJubilee-5/+5
compiletest: fix outdated rmake.rs comment Noticed in https://github.com/rust-lang/rust/pull/125827#discussion_r1623420820. I fixed the PR description but forgot to update the comment.
2024-06-02Rollup merge of #125890 - Nilstrieb:gay-compiletest, r=jieyouxuJubilee-6/+34
Improve compiletest expected/not found formatting compiletest, oh compiletest, you are truly one of the tools in this repository. You're the omnipresent gatekeeper, ensuring that every new change works, doesn't break the world, and is nice. We thank you for your work, for your tests, for your test runs, for your features that help writing tests, for all the stability and and good you have caused. Without you, Rust wouldn't exist as it does, without you, nothing would work, without you, we would all go insane from having changes break and having to test them all by hand. Thank you, compiletest. but holy shit i fucking hate your stupid debug output so much i simply cannot take this anymore aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa By changing a few magic lines in this file called "runtest.rs", we can cause compiletest to emit nicer messages. This is widely regarded as a good thing. We stop wasting vertical space, allowing more errors to be displayed at once. Additionally, we add colors, which make it so much more pretty *and* gay, both of which are very good and useful. There's a bit of fuckery needed to get the colors to work. `colored` checks whether stdout is a terminal. We also print to stdout, so that works well. But.... for some stupid reason that I absolutely refuse to even attempt to debug, stdout is *not* a terminal when executing tests *in a terminal*. But stderr is >:). So this just checks whether stderr is a terminal. If you have a use case where you dump compiletest stdout into a place where colors are not supported while having stderr be a terminal, then I'm sorry for you, but you are gonna get colors and you're gonna like it. Stop it with the usual environment variable, which `colored` also respects by default. ### before (bad, hurts your brain, makes you want to cry) ![image](https://github.com/rust-lang/rust/assets/48135649/cbeecb5d-fc25-460b-b192-9808f8fa2079) ## after (good, gay, makes you want to cry) ![image](https://github.com/rust-lang/rust/assets/48135649/a655b220-8841-443e-a825-72a835d56882) r? jieyouxu said he wants to review the PR
2024-06-02Rollup merge of #125808 - ↵Jubilee-13/+26
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-02Add path info to `AbsPathBuf::assert`'s assertLukas Wirth-1/+1
2024-06-02fix typos & formattingDropDemBits-3/+7
2024-06-02Make `extract_expressions_from_format_string` only use snippets when availableDropDemBits-55/+98
2024-06-02Add `ast::Expr::parse`DropDemBits-0/+32
2024-06-02minor: tidy up `Parse` a little bitDropDemBits-11/+10
- Add doc comments to some `Parse` methods - Uses `Parse::new` more
2024-06-02Add `tt_from_syntax`DropDemBits-2/+45
Used for inserting syntax nodes into existing token trees
2024-06-02compiletest: fix outdated rmake.rs comment许杰友 Jieyou Xu (Joe)-5/+5
2024-06-02Auto merge of #125892 - workingjubilee:rollup-gytt1q7, r=workingjubileebors-1/+0
Rollup of 3 pull requests Successful merges: - #125311 (Make repr(packed) vectors work with SIMD intrinsics) - #125849 (Migrate `run-make/emit-named-files` to `rmake.rs`) - #125851 (Add some more specific checks to the MIR validator) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-02Don't mark `#[rustc_deprecated_safe_2024]` functions as unsafeNilstrieb-0/+23
`std::env::set_var` will be unsafe in edition 2024, but not before it. I couldn't quite figure out how to check for the span properly, so for now we just turn the false positives into false negatives, which are less bad.
2024-06-02Improve compiletest expected/not found formattingNilstrieb-6/+34
compiletest, oh compiletest, you are truly one of the tools in this repository. You're the omnipresent gatekeeper, ensuring that every new change works, doesn't break the world, and is nice. We thank you for your work, for your tests, for your test runs, for your features that help writing tests, for all the stability and and good you have caused. Without you, Rust wouldn't exist as it does, without you, nothing would work, without you, we would all go insane from having changes break and having to test them all by hand. Thank you, compiletest. but holy shit i fucking hate your stupid debug output so much i simply cannot take this anymore aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa By changing a few magic lines in this file called "runtest.rs", we can cause compiletest to emit nicer messages. This is widely regarded as a good thing. We stop wasting vertical space, allowing more errors to be displayed at once. Additionally, we add colors, which make it so much more pretty *and* gay, both of which are very good and useful. There's a bit of fuckery needed to get the colors to work. `colored` checks whether stdout is a terminal. We also print to stdout, so that works well. But.... for some stupid reason that I absolutely refuse to even attempt to debug, stdout is *not* a terminal when executing tests *in a terminal*. But stderr is >:). So this just checks whether stderr is a terminal. If you have a use case where you dump compiletest stdout into a place where colors are not supported while having stderr be a terminal, then I'm sorry for you, but you are gonna get colors and you're gonna like it. Stop it with the usual environment variable, which `colored` also respects by default.
2024-06-02Rollup merge of #125849 - GuillaumeGomez:migrate-emit-named-files, r=jieyouxuJubilee-1/+0
Migrate `run-make/emit-named-files` to `rmake.rs` Part of https://github.com/rust-lang/rust/issues/121876. r? `@jieyouxu`
2024-06-02Auto merge of #125887 - lnicola:sync-from-ra, r=lnicolabors-191/+1715
Subtree update of `rust-analyzer` r? `@ghost`
2024-06-02Migrate `run-make/c-link-to-rust-dylib` to `rmake.rs`Guillaume Gomez-1/+0
2024-06-02Add `dynamic_lib_extension` and `read_dir` functions to `run-make-support` ↵Guillaume Gomez-12/+26
library
2024-06-02Auto merge of #17328 - Veykril:derive-helper-completions, r=Veykrilbors-98/+209
feat: Enable completions within derive helper attributes ![Code_zG5qInoQ6B](https://github.com/rust-lang/rust-analyzer/assets/3757771/db30b98d-4981-45e3-83a5-7ff23fbd3f66)
2024-06-02feat: Enable completions within derive helper attributesLukas Wirth-98/+209
2024-06-02compiletest: split rmake executable from scratch dir许杰友 Jieyou Xu (Joe)-9/+24
When implementing support for rmake.rs, I copied over the `$TMPDIR` directory logic from the legacy Makefile setup. In doing so, I also compiled recipe `rmake.rs` into executables which unfortunately are placed into `$TMPDIR` as well. This causes a problem on Windows where: - The `rmake.exe` executable is placed in `$TMPDIR`. - We run the `rmake.exe` as a process. - The process uses `rmake.exe` inside `$TMPDIR`. - Windows prevents the .exe file from being deleted when the process is still alive. - The recipe test code tries to `remove_dir_all($TMPDIR)`, which fails with access denied because `rmake.exe` is still being used. We fix this by separating the recipe executable and the sratch directory: ``` base_dir/ rmake.exe scratch/ ``` We construct a base directory, unique to each run-make test, under which we place rmake.exe alongside a `scratch/` directory. This `scratch/` directory is what is passed to rmake.rs tests as `$TMPDIR`, so now `remove_dir_all($TMPDIR)` has a chance to succeed because it no longer contains `rmake.exe`. Oops. This was a fun one to try figure out.
2024-06-02Auto merge of #125773 - GuillaumeGomez:migrate-run-make-cdylib, r=jieyouxubors-1/+7
Migrate run make cdylib Part of https://github.com/rust-lang/rust/issues/121876. r? `@jieyouxu`
2024-06-01Auto merge of #125775 - compiler-errors:uplift-closure-args, r=lcnrbors-2/+2
Uplift `{Closure,Coroutine,CoroutineClosure}Args` and friends to `rustc_type_ir` Part of converting the new solver's `structural_traits.rs` to be interner-agnostic. I decided against aliasing `ClosureArgs<TyCtxt<'tcx>>` to `ClosureArgs<'tcx>` because it seemed so rare. I could do so if desired, though. r? lcnr
2024-06-01Auto merge of #17326 - Veykril:fix-attr-derive-container, r=Veykrilbors-40/+48
fix: Fix container search failing for tokens originating within derive attributes
2024-06-01fix: Fix container search failing for tokens originating within derive ↵Lukas Wirth-40/+48
attributes
2024-06-01Uplift TypeRelation and RelateMichael Goulet-2/+2
2024-06-01Auto merge of #17302 - mladedav:dm/fix-clear, r=Veykrilbors-13/+30
fix diagnostics clearing when flychecks run per-workspace This might be causing #17300 or it's a different bug with the same functionality. I wonder if the decision to clear diagnostics should stay in the main loop or maybe the flycheck itself should track it and tell the mainloop? I have used a hash map but we could just as well use a vector since the IDs are `usizes` in some given range starting at 0. It would be probably faster but this just felt a bit cleaner and it allows us to change the ID to newtype later and we can just use a hasher that returns the underlying integer.
2024-06-01Move state trackig of diagnostic clearing inside `FlycheckActor`David Mládek-41/+31
2024-06-01Deduplicate supertrait_def_ids codeMark Rousskov-1/+1
2024-06-01Auto merge of #17278 - chenx97:flycheck-process-wrap, r=lnicolabors-45/+73
internal: replace command-group with process-wrap Because command-group no longer receives updates and depends on an older version of nix.
2024-06-01Migrate `run-make/emit-named-files` to `rmake.rs`Guillaume Gomez-1/+0
2024-06-01Migrate `run-make/cdylib` to `rmake.rs`Guillaume Gomez-1/+0
2024-06-01Add `Cc::output` methodGuillaume Gomez-0/+7
2024-06-01Auto merge of #125835 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 9 commits in 431db31d0dbeda320caf8ef8535ea48eb3093407..7a6fad0984d28c8330974636972aa296b67c4513 2024-05-28 18:17:31 +0000 to 2024-05-31 22:26:03 +0000 - fix(config): Ensure `--config net.git-fetch-with-cli=true` is respected (rust-lang/cargo#13992) - Fix libcurl proxy documentation link (rust-lang/cargo#13990) - fix(new): Dont say were adding to a workspace when a regular package is in root (rust-lang/cargo#13987) - fix: adjust custom err from cert-check due to libgit2 1.8 change (rust-lang/cargo#13970) - fix(toml): Ensure targets are in a deterministic order (rust-lang/cargo#13989) - doc(cargo-package): explain no guarantee of vcs provenance (rust-lang/cargo#13984) - chore: fix some comments (rust-lang/cargo#13982) - feat: stabilize `cargo update --precise &lt;yanked&gt;` (rust-lang/cargo#13974) - Update openssl-src to 111.28.2+1.1.1w (rust-lang/cargo#13976) r? ghost
2024-05-31Update cargoWeihang Lo-0/+0
2024-05-31Auto merge of #125408 - chriskrycho:chriskrycho/book-updates, r=ehussbors-0/+13
Support mdBook preprocessors for TRPL in rustbook `rust-lang/book` recently added two mdBook preprocessors. Enable `rustbook` to use those preprocessors for books where they are requested by the `book.toml` by adding the preprocessors as path dependencies, and ignoring them where they are not requested, i.e. by all the books other than TRPL at present. Addresses rust-lang/book#3927
2024-05-31docs: Missing word typoLuke Franceschini-1/+1
2024-05-31Rollup merge of #125816 - Zalathar:demangler, r=oli-obkMatthias Krüger-15/+36
Don't build the `rust-demangler` binary for coverage tests The coverage-run tests invoke `llvm-cov`, which requires us to specify a command-line demangler that it can use to demangle Rust symbol names. Historically this used `src/tools/rust-demangler`, which means that we currently build two different command-line tools to help with the coverage tests (`rust-demangler` and `coverage-dump`). However, it occurred to me that if we add a demangler mode to `coverage-dump` (which is only a handful of lines and no extra dependencies), then we only need to build one helper binary for the coverage tests, and there is no need for tests to build `rust-demangler` at all. --- Note that the `rust-demangler` binary is separate from the `rustc-demangle` crate (which both `rust-demangler` and `coverage-dump` use as a dependency to do the actual demangling). --- So the main benefits/motivations here are: - Slightly faster builds after a fresh checkout or bootstrap bump. - Making it clear that currently no tests actually need the `rust-demangler` binary, since the coverage tests can use their own tool instead.
2024-05-31Remove unused rust-demangler support from compiletestZalathar-10/+0
2024-05-31Use `coverage-dump --demangle` as the demangler for coverage-run testsZalathar-5/+12
This avoids the need to build `rust-demangler` when running coverage tests, since we typically need to build `coverage-dump` anyway.
2024-05-31Add an alternate `--demangle` mode to coverage-dumpZalathar-0/+24
The coverage-dump tool already needs `rustc_demangle` for its own purposes, so the amount of extra code needed for a demangle mode is very small.
2024-05-31Auto merge of #124662 - zetanumbers:needs_async_drop, r=oli-obkbors-0/+5
Implement `needs_async_drop` in rustc and optimize async drop glue This PR expands on #121801 and implements `Ty::needs_async_drop` which works almost exactly the same as `Ty::needs_drop`, which is needed for #123948. Also made compiler's async drop code to look more like compiler's regular drop code, which enabled me to write an optimization where types which do not use `AsyncDrop` can simply forward async drop glue to `drop_in_place`. This made size of the async block from the [async_drop test](https://github.com/zetanumbers/rust/blob/67980dd6fb11917d23d01a19c2cf4cfc3978aac8/tests/ui/async-await/async-drop.rs) to decrease by 12%.
2024-05-31Rollup merge of #125635 - fmease:mv-type-binding-assoc-item-constraint, ↵Matthias Krüger-57/+50
r=compiler-errors Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology. Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense. --- Old terminology (HIR, rustdoc): ``` `TypeBinding`: (associated) type binding ├── `Constraint`: associated type bound └── `Equality`: (associated) equality constraint (?) ├── `Ty`: (associated) type binding └── `Const`: associated const equality (constraint) ``` Old terminology (AST, abbrev.): ``` `AssocConstraint` ├── `Bound` └── `Equality` ├── `Ty` └── `Const` ``` New terminology (AST, HIR, rustdoc): ``` `AssocItemConstraint`: associated item constraint ├── `Bound`: associated type bound └── `Equality`: associated item equality constraint OR associated item binding (for short) ├── `Ty`: associated type equality constraint OR associated type binding (for short) └── `Const`: associated const equality constraint OR associated const binding (for short) ``` r? compiler-errors
2024-05-31minor: replace command-group with process-wrapHenry Chen-45/+73
Because command-group no longer receives updates and depends on an older version of nix.
2024-05-30fix: formatting in `handlers/unresolved_method.rs`Hamir Mahal-2/+1
2024-05-30style: simplify string interpolationHamir Mahal-78/+71
2024-05-30Auto merge of #125710 - RalfJung:compiletest-components, r=workingjubileebors-3/+9
compiletest: clarify COMPILETEST_NEEDS_ALL_LLVM_COMPONENTS error COMPILETEST_NEEDS_ALL_LLVM_COMPONENTS is a confusing name because elsewhere "needs" means "ignore when requirement not met", but here it means "fail when requirement not met".
2024-05-30Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanupLeón Orell Valerian Liehr-57/+50
2024-05-30Auto merge of #125764 - flip1995:clippy-subtree-update, r=Manishearthbors-676/+1422
Clippy subtree update r? `@Manishearth`