Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8b9fb9f

Browse files
committedMay 24, 2025·
Auto merge of #141473 - matthiaskrgr:rollup-y3vhivo, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #140790 (Enable xray support for Mac) - #141405 (GetUserProfileDirectoryW is now documented to always store the size) - #141413 (Make #[cfg(version)] respect RUSTC_OVERRIDE_VERSION_STRING) - #141427 (Disable `triagebot`'s `glacier` handler) - #141429 (Dont walk into unsafe binders when emiting error for non-structural type match) - #141438 (Do not try to confirm non-dyn compatible method) - #141444 (Improve CONTRIBUTING.md grammar and clarity) - #141446 (Add 2nd Solaris target maintainer) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 80c3498 + e590661 commit 8b9fb9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+243
-327
lines changed
 

‎CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ and we appreciate all of them.
55

66
The best way to get started is by asking for help in the [#new
77
members](https://rust-lang.zulipchat.com/#narrow/stream/122652-new-members)
8-
Zulip stream. We have lots of docs below of how to get started on your own, but
8+
Zulip stream. We have a lot of documentation below on how to get started on your own, but
99
the Zulip stream is the best place to *ask* for help.
1010

1111
Documentation for contributing to the compiler or tooling is located in the [Guide to Rustc
@@ -14,7 +14,7 @@ standard library in the [Standard library developers Guide][std-dev-guide], comm
1414

1515
## Making changes to subtrees and submodules
1616

17-
For submodules, changes need to be made against the repository corresponding the
17+
For submodules, changes need to be made against the repository corresponding to the
1818
submodule, and not the main `rust-lang/rust` repository.
1919

2020
For subtrees, prefer sending a PR against the subtree's repository if it does
@@ -25,15 +25,15 @@ rustc-dev-guide change that does not accompany a compiler change).
2525

2626
The [rustc-dev-guide] is meant to help document how rustc –the Rust compiler– works,
2727
as well as to help new contributors get involved in rustc development. It is recommended
28-
to read and understand the [rustc-dev-guide] before making a contribution. This guide
28+
that you read and understand the [rustc-dev-guide] before making a contribution. This guide
2929
talks about the different bots in the Rust ecosystem, the Rust development tools,
3030
bootstrapping, the compiler architecture, source code representation, and more.
3131

3232
## [Getting help](https://rustc-dev-guide.rust-lang.org/getting-started.html#asking-questions)
3333

3434
There are many ways you can get help when you're stuck. Rust has many platforms for this:
3535
[internals], [rust-zulip], and [rust-discord]. It is recommended to ask for help on
36-
the [rust-zulip], but any of these platforms are a great way to seek help and even
36+
the [rust-zulip], but any of these platforms are great ways to seek help and even
3737
find a mentor! You can learn more about asking questions and getting help in the
3838
[Asking Questions](https://rustc-dev-guide.rust-lang.org/getting-started.html#asking-questions) chapter of the [rustc-dev-guide].
3939

‎compiler/rustc_attr_data_structures/src/version.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::fmt::{self, Display};
2+
use std::sync::OnceLock;
23

34
use rustc_macros::{
45
Decodable, Encodable, HashStable_Generic, PrintAttribute, current_rustc_version,
@@ -16,8 +17,29 @@ pub struct RustcVersion {
1617

1718
impl RustcVersion {
1819
pub const CURRENT: Self = current_rustc_version!();
20+
pub fn current_overridable() -> Self {
21+
*CURRENT_OVERRIDABLE.get_or_init(|| {
22+
if let Ok(override_var) = std::env::var("RUSTC_OVERRIDE_VERSION_STRING")
23+
&& let Some(override_) = Self::parse_str(&override_var)
24+
{
25+
override_
26+
} else {
27+
Self::CURRENT
28+
}
29+
})
30+
}
31+
fn parse_str(value: &str) -> Option<Self> {
32+
// Ignore any suffixes such as "-dev" or "-nightly".
33+
let mut components = value.split('-').next().unwrap().splitn(3, '.');
34+
let major = components.next()?.parse().ok()?;
35+
let minor = components.next()?.parse().ok()?;
36+
let patch = components.next().unwrap_or("0").parse().ok()?;
37+
Some(RustcVersion { major, minor, patch })
38+
}
1939
}
2040

41+
static CURRENT_OVERRIDABLE: OnceLock<RustcVersion> = OnceLock::new();
42+
2143
impl Display for RustcVersion {
2244
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
2345
write!(formatter, "{}.{}.{}", self.major, self.minor, self.patch)

0 commit comments

Comments
 (0)
Please sign in to comment.