惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
T
The Blog of Author Tim Ferriss
S
SegmentFault 最新的问题
D
DataBreaches.Net
博客园_首页
罗磊的独立博客
B
Blog
T
Threat Research - Cisco Blogs
C
Cisco Blogs
GbyAI
GbyAI
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
G
GRAHAM CLULEY
H
Help Net Security
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
爱范儿
爱范儿
SecWiki News
SecWiki News
T
Threatpost
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Schneier on Security
Schneier on Security
T
The Exploit Database - CXSecurity.com
Google Online Security Blog
Google Online Security Blog
T
Tor Project blog
小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Y
Y Combinator Blog
H
Hacker News: Front Page
V
V2EX
Security Latest
Security Latest
Cloudbric
Cloudbric
Simon Willison's Weblog
Simon Willison's Weblog
Attack and Defense Labs
Attack and Defense Labs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed
博客园 - 三生石上(FineUI控件)
NISL@THU
NISL@THU
S
Secure Thoughts
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
V2EX - 技术
V2EX - 技术
Vercel News
Vercel News
P
Palo Alto Networks Blog
IT之家
IT之家
MyScale Blog
MyScale Blog
有赞技术团队
有赞技术团队
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
Google DeepMind News
Google DeepMind News
Webroot Blog
Webroot Blog

Rust Blog

Security Advisory for Cargo (CVE-2026-5223) | Rust Blog Security Advisory for Cargo (CVE-2026-5222) | Rust Blog Project goals update — April 2026 (end of 2025H2) | Rust Blog Rust is participating in Outreachy | Rust Blog Raising the baseline for the `nvptx64-nvidia-cuda` target | Rust Blog Announcing Google Summer of Code 2026 selected projects | Rust Blog Announcing Rust 1.95.0 | Rust Blog docs.rs: building fewer targets by default | Rust Blog Changes to WebAssembly targets and handling undefined symbols | Rust Blog Announcing Rust 1.94.1 | Rust Blog Security advisory for Cargo | Rust Blog What we heard about Rust's challenges | Rust Blog Call for Testing: Build Dir Layout v2 | Rust Blog Announcing rustup 1.29.0 | Rust Blog Announcing Rust 1.94.0 | Rust Blog 2025 State of Rust Survey Results | Rust Blog Rust debugging survey 2026 | Rust Blog Update on the October 15, 2018 incident on crates.io Announcing Rust 1.29.2 Announcing Rust 1.29 Announcing Rust 1.28 What is Rust 2018? Announcing Rust 1.27.2 Announcing Rust 1.27.1 Security Advisory for rustdoc Announcing Rust 1.27 Announcing Rust 1.26.2 Announcing Rust 1.26.1 Rust turns three Announcing Rust 1.26 The Rust Team All Hands in Berlin: a Recap Increasing Rust’s Reach 2018 Announcing Rust 1.25 Rust's 2018 roadmap Announcing Rust 1.24.1 Announcing Rust 1.24 The 2018 Rust Event Lineup Announcing Rust 1.23 New Year's Rust: A Call for Community Blogposts Rust in 2017: what we achieved Announcing Rust 1.22 (and 1.22.1) Fearless Concurrency in Firefox Quantum Announcing Rust 1.21 impl Future for Rust Rust 2017 Survey Results Announcing Rust 1.20 Announcing Rust 1.19 The 2017 Rust Conference Lineup Rust's 2017 roadmap, six months in Increasing Rust’s Reach Announcing Rust 1.18 Two years of Rust The Rust Libz Blitz Launching the 2017 State of Rust Survey Announcing Rust 1.17 Announcing Rust 1.16 Rust's language ergonomics initiative Announcing Rust 1.15.1 Rust's 2017 roadmap Announcing Rust 1.15 Announcing Rust 1.14 Announcing the First Underhanded Rust Contest Announcing Rust 1.13 Announcing Rust 1.12.1 Announcing Rust 1.12 Incremental Compilation Announcing Rust 1.11 Shape of errors to come The 2016 Rust Conference Lineup Announcing Rust 1.10 State of Rust Survey 2016 Announcing Rust 1.9 One year of Rust Taking Rust everywhere with rustup Launching the 2016 State of Rust Survey Cargo: predictable dependency management Introducing MIR Announcing Rust 1.8 Announcing Rust 1.7 Announcing Rust 1.6 Announcing Rust 1.5 Announcing Rust 1.4 Announcing Rust 1.3 Rust in 2016 Announcing Rust 1.2 Rust 1.1 stable, the Community Subteam, and RustCamp Announcing Rust 1.0 Abstraction without overhead: traits in Rust Rust Once, Run Everywhere Mixing matching, mutation, and moves in Rust Fearless Concurrency with Rust Announcing Rust 1.0 Beta Announcing Rust 1.0.0.alpha.2 Rust 1.0: status report and final timeline Announcing Rust 1.0 Alpha Rust 1.0: Scheduling the trains Yehuda Katz and Steve Klabnik are joining the Rust Core Team Cargo: Rust's community crate host Stability as a Deliverable Road to Rust 1.0
Formatting the compiler tree | Inside Rust Blog
Mark Rousskov on behalf of the compiler team · 2019-12-23 · via Rust Blog

What happened

We recently landed two PRs which together reformatted essentially all code in the compiler tree.

The first one, #65939, contained the initial formatting infrastructure. We currently use rustfmt directly, pinned to a version specified in src/stage0.txt. We expect to update it as needed, and otherwise once per cycle (coinciding with the bootstrap bump, most likely).

The second one which reformatted the majority of the codebase is #67540.

This change landed with the following rustfmt config. Note that this configuration is subject to change (in particular, merge_derives may be removed in the future), but should be fairly stable. Your editor should automatically pick this configuration up inside the rust-lang/rust repository (it is located in the rustfmt.toml file in the root).

version = "Two"
use_small_heuristics = "Max"
merge_derives = false

How to use formatting

You can reformat the repository with x.py fmt and x.py fmt --check to verify formatting; these commands are unfortunately somewhat slow today. Tidy will also currently run the latter of these two checks (x.py fmt --check) internally, but this may change in the future if we can't improve the speed of formatting the entire codebase.

Resolving conflicts

If you have an ongoing branch, you're likely to have merge conflicts. The following should help you resolve them:

#!/bin/bash

set -xeo pipefail

if [ "$1" = "from-rebase" ] ; then
	git rev-parse HEAD > /tmp/commit
	git rev-parse HEAD >> /tmp/old.shas
	./x.py fmt
	git commit -a --amend --no-edit
	git rev-parse HEAD >> /tmp/new.shas
	git reset --hard $(cat /tmp/commit)
else
	rm -f /tmp/old.shas /tmp/commit /tmp/new.shas
	git rebase 8eb7c58dbb7 --exec '../format.sh from-rebase'
	branch=$(git rev-parse --abbrev-ref HEAD) # get branch name
	git reset --hard 8eb7c58dbb7
	for sha in $(cat /tmp/new.shas); do
		git cherry-pick $sha -Xtheirs
	done
  # put yourself atop the format the world PR
  git rebase -Xtheirs a916ac22b9f7f1f0f7aba0a41a789b3ecd765018
fi

This script should be saved to format.sh in the parent directory of your Rust checkout, and then run git fetch upstream && ../format.sh. upstream should be the name of the rust-lang/rust remote.

Once the script runs, you will be based on the a916ac22b9f7f commit. You likely want to then run git rebase -i upstream/master or so to finish, but the script above gets you past the formatting PR at least.

This should mostly resolve conflicts correctly, but occasionally if you've edited something in imports (a common case I've encountered) or otherwise this will not resolve quite right. Usually though this will solve 99% of the problems and the rest can be fixed up manually afterwards.