summaryrefslogtreecommitdiff
path: root/rustfmt.toml
AgeCommit message (Collapse)Author
2024-03-08Remove exception for deleted file from rustfmt.tomlbjorn3
2024-01-11rustfmt.toml: don't ignore just any `tests` path, only root oneklensy
2023-11-23Fix fn_sig_for_fn_abi and the coroutine transform for generatorsbjorn3
There were three issues previously: * The self argument was pinned, despite Iterator::next taking an unpinned mutable reference. * A resume argument was passed, despite Iterator::next not having one. * The return value was CoroutineState<Item, ()> rather than Option<Item> While these things just so happened to work with the LLVM backend, cg_clif does much stricter checks when trying to assign a value to a place. In addition it can't handle the mismatch between the amount of arguments specified by the FnAbi and the FnSig.
2023-07-04rust-installer and rls no longer submodule, so fix rustfmt.tomlklensy
2023-06-19Format the examples directory of cg_clifbjorn3
Formatting has been enforced in cg_clif's CI for a while now.
2023-01-11Change `src/test` to `tests` in source files, fix tidy and testsAlbert Larsan
2022-01-01Enforce formatting for rustc_codegen_craneliftbjorn3
2021-11-12Expose portable-simd as core::simdJubilee Young
This enables programmers to use a safe alternative to the current `extern "platform-intrinsics"` API for writing portable SIMD code. This is `#![feature(portable_simd)]` as tracked in #86656
2021-08-12Fix tidyAntoni Boucher
2021-04-24`test tidy` should ignore alternative `build` dir patternsRich Kadel
I need to have multiple `build` directories, such as `build`, `build-fuchsia`, and `build-test`. But when I'm uploading a change, I run `./x.py test tidy`, and if I have a `build-something` directory with Rust sources, I git a bunch of formatting errors. `rustfmt.toml` only ignores the directory named `build`. This change extends the patterns to also ignore `build-*` and `*-build`. As a rustc contributor, I not only build the rust compiler to develop new features, but I also build alternative "distributions" (using secondary `*-config.toml` files with different configurations), including: * To occasionally rebuild a version of the compiler that `rust-analyzer` can use to `check` source (which fixes issues in the VS Code UI, so changing and rebuilding the compiler does not break VS Code editing Rust code). * To build custom distributions for Fuchsia * To build test distributions when working on changes to `bootstrap` (e.g., when I recently added `rust-demangler` to distributions)
2021-02-02Bump rustfmt versionMark Rousskov
Also switches on formatting of the mir build module
2020-11-22Drop support for cloudabi targetsLzu Tao
2020-10-26Add support for using cg_clif to bootstrap rustcbjorn3
2020-07-28std: Switch from libbacktrace to gimliAlex Crichton
This commit is a proof-of-concept for switching the standard library's backtrace symbolication mechanism on most platforms from libbacktrace to gimli. The standard library's support for `RUST_BACKTRACE=1` requires in-process parsing of object files and DWARF debug information to interpret it and print the filename/line number of stack frames as part of a backtrace. Historically this support in the standard library has come from a library called "libbacktrace". The libbacktrace library seems to have been extracted from gcc at some point and is written in C. We've had a lot of issues with libbacktrace over time, unfortunately, though. The library does not appear to be actively maintained since we've had patches sit for months-to-years without comments. We have discovered a good number of soundness issues with the library itself, both when parsing valid DWARF as well as invalid DWARF. This is enough of an issue that the libs team has previously decided that we cannot feed untrusted inputs to libbacktrace. This also doesn't take into account the portability of libbacktrace which has been difficult to manage and maintain over time. While possible there are lots of exceptions and it's the main C dependency of the standard library right now. For years it's been the desire to switch over to a Rust-based solution for symbolicating backtraces. It's been assumed that we'll be using the Gimli family of crates for this purpose, which are targeted at safely and efficiently parsing DWARF debug information. I've been working recently to shore up the Gimli support in the `backtrace` crate. As of a few weeks ago the `backtrace` crate, by default, uses Gimli when loaded from crates.io. This transition has gone well enough that I figured it was time to start talking seriously about this change to the standard library. This commit is a preview of what's probably the best way to integrate the `backtrace` crate into the standard library with the Gimli feature turned on. While today it's used as a crates.io dependency, this commit switches the `backtrace` crate to a submodule of this repository which will need to be updated manually. This is not done lightly, but is thought to be the best solution. The primary reason for this is that the `backtrace` crate needs to do some pretty nontrivial filesystem interactions to locate debug information. Working without `std::fs` is not an option, and while it might be possible to do some sort of trait-based solution when prototyped it was found to be too unergonomic. Using a submodule allows the `backtrace` crate to build as a submodule of the `std` crate itself, enabling it to use `std::fs` and such. Otherwise this adds new dependencies to the standard library. This step requires extra attention because this means that these crates are now going to be included with all Rust programs by default. It's important to note, however, that we're already shipping libbacktrace with all Rust programs by default and it has a bunch of C code implementing all of this internally anyway, so we're basically already switching already-shipping functionality to Rust from C. * `object` - this crate is used to parse object file headers and contents. Very low-level support is used from this crate and almost all of it is disabled. Largely we're just using struct definitions as well as convenience methods internally to read bytes and such. * `addr2line` - this is the main meat of the implementation for symbolication. This crate depends on `gimli` for DWARF parsing and then provides interfaces needed by the `backtrace` crate to turn an address into a filename / line number. This crate is actually pretty small (fits in a single file almost!) and mirrors most of what `dwarf.c` does for libbacktrace. * `miniz_oxide` - the libbacktrace crate transparently handles compressed debug information which is compressed with zlib. This crate is used to decompress compressed debug sections. * `gimli` - not actually used directly, but a dependency of `addr2line`. * `adler32`- not used directly either, but a dependency of `miniz_oxide`. The goal of this change is to improve the safety of backtrace symbolication in the standard library, especially in the face of possibly malformed DWARF debug information. Even to this day we're still seeing segfaults in libbacktrace which could possibly become security vulnerabilities. This change should almost entirely eliminate this possibility whilc also paving the way forward to adding more features like split debug information. Some references for those interested are: * Original addition of libbacktrace - #12602 * OOM with libbacktrace - #24231 * Backtrace failure due to use of uninitialized value - #28447 * Possibility to feed untrusted data to libbacktrace - #21889 * Soundness fix for libbacktrace - #33729 * Crash in libbacktrace - #39468 * Support for macOS, never merged - ianlancetaylor/libbacktrace#2 * Performance issues with libbacktrace - #29293, #37477 * Update procedure is quite complicated due to how many patches we need to carry - #50955 * Libbacktrace doesn't work on MinGW with dynamic libs - #71060 * Segfault in libbacktrace on macOS - #71397 Switching to Rust will not make us immune to all of these issues. The crashes are expected to go away, but correctness and performance may still have bugs arise. The gimli and `backtrace` crates, however, are actively maintained unlike libbacktrace, so this should enable us to at least efficiently apply fixes as situations come up.
2020-07-27mv std libs to library/mark
2020-07-22Revert "std: Switch from libbacktrace to gimli"Mark Rousskov
This reverts commit 13db3cc1e8d2fd4b8e7c74d91002274d7b62801b.
2020-07-17std: Switch from libbacktrace to gimliAlex Crichton
This commit is a proof-of-concept for switching the standard library's backtrace symbolication mechanism on most platforms from libbacktrace to gimli. The standard library's support for `RUST_BACKTRACE=1` requires in-process parsing of object files and DWARF debug information to interpret it and print the filename/line number of stack frames as part of a backtrace. Historically this support in the standard library has come from a library called "libbacktrace". The libbacktrace library seems to have been extracted from gcc at some point and is written in C. We've had a lot of issues with libbacktrace over time, unfortunately, though. The library does not appear to be actively maintained since we've had patches sit for months-to-years without comments. We have discovered a good number of soundness issues with the library itself, both when parsing valid DWARF as well as invalid DWARF. This is enough of an issue that the libs team has previously decided that we cannot feed untrusted inputs to libbacktrace. This also doesn't take into account the portability of libbacktrace which has been difficult to manage and maintain over time. While possible there are lots of exceptions and it's the main C dependency of the standard library right now. For years it's been the desire to switch over to a Rust-based solution for symbolicating backtraces. It's been assumed that we'll be using the Gimli family of crates for this purpose, which are targeted at safely and efficiently parsing DWARF debug information. I've been working recently to shore up the Gimli support in the `backtrace` crate. As of a few weeks ago the `backtrace` crate, by default, uses Gimli when loaded from crates.io. This transition has gone well enough that I figured it was time to start talking seriously about this change to the standard library. This commit is a preview of what's probably the best way to integrate the `backtrace` crate into the standard library with the Gimli feature turned on. While today it's used as a crates.io dependency, this commit switches the `backtrace` crate to a submodule of this repository which will need to be updated manually. This is not done lightly, but is thought to be the best solution. The primary reason for this is that the `backtrace` crate needs to do some pretty nontrivial filesystem interactions to locate debug information. Working without `std::fs` is not an option, and while it might be possible to do some sort of trait-based solution when prototyped it was found to be too unergonomic. Using a submodule allows the `backtrace` crate to build as a submodule of the `std` crate itself, enabling it to use `std::fs` and such. Otherwise this adds new dependencies to the standard library. This step requires extra attention because this means that these crates are now going to be included with all Rust programs by default. It's important to note, however, that we're already shipping libbacktrace with all Rust programs by default and it has a bunch of C code implementing all of this internally anyway, so we're basically already switching already-shipping functionality to Rust from C. * `object` - this crate is used to parse object file headers and contents. Very low-level support is used from this crate and almost all of it is disabled. Largely we're just using struct definitions as well as convenience methods internally to read bytes and such. * `addr2line` - this is the main meat of the implementation for symbolication. This crate depends on `gimli` for DWARF parsing and then provides interfaces needed by the `backtrace` crate to turn an address into a filename / line number. This crate is actually pretty small (fits in a single file almost!) and mirrors most of what `dwarf.c` does for libbacktrace. * `miniz_oxide` - the libbacktrace crate transparently handles compressed debug information which is compressed with zlib. This crate is used to decompress compressed debug sections. * `gimli` - not actually used directly, but a dependency of `addr2line`. * `adler32`- not used directly either, but a dependency of `miniz_oxide`. The goal of this change is to improve the safety of backtrace symbolication in the standard library, especially in the face of possibly malformed DWARF debug information. Even to this day we're still seeing segfaults in libbacktrace which could possibly become security vulnerabilities. This change should almost entirely eliminate this possibility whilc also paving the way forward to adding more features like split debug information. Some references for those interested are: * Original addition of libbacktrace - #12602 * OOM with libbacktrace - #24231 * Backtrace failure due to use of uninitialized value - #28447 * Possibility to feed untrusted data to libbacktrace - #21889 * Soundness fix for libbacktrace - #33729 * Crash in libbacktrace - #39468 * Support for macOS, never merged - ianlancetaylor/libbacktrace#2 * Performance issues with libbacktrace - #29293, #37477 * Update procedure is quite complicated due to how many patches we need to carry - #50955 * Libbacktrace doesn't work on MinGW with dynamic libs - #71060 * Segfault in libbacktrace on macOS - #71397 Switching to Rust will not make us immune to all of these issues. The crashes are expected to go away, but correctness and performance may still have bugs arise. The gimli and `backtrace` crates, however, are actively maintained unlike libbacktrace, so this should enable us to at least efficiently apply fixes as situations come up.
2020-07-03Add rust-analyzer submoduleAleksey Kladov
The current plan is that submodule tracks the `release` branch of rust-analyzer, which is updated once a week. rust-analyzer is a workspace (with a virtual manifest), the actual binary is provide by `crates/rust-analyzer` package. Note that we intentionally don't add rust-analyzer to `Kind::Test`, for two reasons. *First*, at the moment rust-analyzer's test suite does a couple of things which might not work in the context of rust repository. For example, it shells out directly to `rustup` and `rustfmt`. So, making this work requires non-trivial efforts. *Second*, it seems unlikely that running tests in rust-lang/rust repo would provide any additional guarantees. rust-analyzer builds with stable and does not depend on the specifics of the compiler, so changes to compiler can't break ra, unless they break stability guarantee. Additionally, rust-analyzer itself is gated on bors, so we are pretty confident that test suite passes.
2020-03-24Move rustc-guide submodule to rustc-dev-guideSantiago Pastorino
2020-02-10Don't rustfmt the vendor directory.Eric Huss
2020-01-31Ignore `build` dir formattingJonas Schievink
2019-12-24Format librustc_featureMark Rousskov
Use #[rustfmt::skip] on the tidy-parsed macro invocations
2019-12-24Silence line length warningsMark Rousskov
rustfmt tries its best already, we should not fight with it.
2019-12-22Remove most files from format ignore listMark Rousskov
Also moves formatting to use edition 2018, and to be done in parallel. This brings near-linear speed ups (at least with a small amount of cores).
2019-12-21Implement rustfmt running manually using ignore crateMark Rousskov
This replaces cargo-fmt with rustfmt with --skip-children which should allow us to format code without running into rust-lang/rustfmt#3930. This also bumps up the version of rustfmt used to a more recent one.
2019-12-21Format src/librustc_fs_util.Adam Perry
In total it's about 100 lines of code and has received less than 5 commits in 2019 -- a good starting point.
2019-12-21Add individual crates to rustfmt ignore list.Adam Perry
Co-Authored-By: Mark Rousskov <mark.simulacrum@gmail.com>
2019-05-03Add rustfmt tomlAleksey Kladov
This commit adds an rustfmt.toml for using for **new** code. Old code should continut to use old style, until we put automated style checks in place. See https://internals.rust-lang.org/t/running-rustfmt-on-rust-lang-rust-and-other-rust-lang-repositories/8732/81 for the reason why we deviate from the default formatting. The TL;DR is that currently compiler uses a pretty condensed style of code, and default settings both create a huge diff and inflate the number of lines. use_small_heuristics=Max fixes that. version=Two is required for bug-fixes, which technically can't be made to the stable first version