Skip to content

Commit 8b9fb9f

Browse files
committed
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)

compiler/rustc_attr_parsing/src/attributes/cfg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ pub fn eval_condition(
129129

130130
// See https://github.com/rust-lang/rust/issues/64796#issuecomment-640851454 for details
131131
if sess.psess.assume_incomplete_release {
132-
RustcVersion::CURRENT > min_version
132+
RustcVersion::current_overridable() > min_version
133133
} else {
134-
RustcVersion::CURRENT >= min_version
134+
RustcVersion::current_overridable() >= min_version
135135
}
136136
}
137137
MetaItemKind::List(mis) => {

compiler/rustc_hir_typeck/src/method/confirm.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,14 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
291291
probe::ObjectPick => {
292292
let trait_def_id = pick.item.container_id(self.tcx);
293293

294+
// If the trait is not object safe (specifically, we care about when
295+
// the receiver is not valid), then there's a chance that we will not
296+
// actually be able to recover the object by derefing the receiver like
297+
// we should if it were valid.
298+
if !self.tcx.is_dyn_compatible(trait_def_id) {
299+
return ty::GenericArgs::extend_with_error(self.tcx, trait_def_id, &[]);
300+
}
301+
294302
// This shouldn't happen for non-region error kinds, but may occur
295303
// when we have error regions. Specifically, since we canonicalize
296304
// during method steps, we may successfully deref when we assemble

compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@ fn extend_type_not_partial_eq<'tcx>(
382382
fn visit_ty(&mut self, ty: Ty<'tcx>) -> Self::Result {
383383
match ty.kind() {
384384
ty::Dynamic(..) => return ControlFlow::Break(()),
385+
// Unsafe binders never implement `PartialEq`, so avoid walking into them
386+
// which would require instantiating its binder with placeholders too.
387+
ty::UnsafeBinder(..) => return ControlFlow::Break(()),
385388
ty::FnPtr(..) => return ControlFlow::Continue(()),
386389
ty::Adt(def, _args) => {
387390
let ty_def_id = def.did();

compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub(crate) fn target() -> Target {
2222
max_atomic_width: Some(128),
2323
// FIXME: The leak sanitizer currently fails the tests, see #88132.
2424
supported_sanitizers: SanitizerSet::ADDRESS | SanitizerSet::CFI | SanitizerSet::THREAD,
25+
supports_xray: true,
2526
..opts
2627
},
2728
}

compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub(crate) fn target() -> Target {
2323
| SanitizerSet::CFI
2424
| SanitizerSet::LEAK
2525
| SanitizerSet::THREAD,
26+
supports_xray: true,
2627
..opts
2728
},
2829
}

library/std/src/sys/pal/windows/os.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,6 @@ fn home_dir_crt() -> Option<PathBuf> {
202202
|buf, mut sz| {
203203
// GetUserProfileDirectoryW does not quite use the usual protocol for
204204
// negotiating the buffer size, so we have to translate.
205-
// FIXME(#141254): We rely on the *undocumented* property that this function will
206-
// always set the size, not just on failure.
207205
match c::GetUserProfileDirectoryW(
208206
ptr::without_provenance_mut(CURRENT_PROCESS_TOKEN),
209207
buf,

src/doc/rustc/src/platform-support/solaris.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Rust for Solaris operating system.
88
## Target maintainers
99

1010
[@psumbera](https://github.com/psumbera)
11+
[@kulikjak](https://github.com/kulikjak)
1112

1213
## Requirements
1314

src/tools/miri/src/shims/windows/env.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,16 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
230230
interp_ok(match directories::UserDirs::new() {
231231
Some(dirs) => {
232232
let home = dirs.home_dir();
233-
let size_avail = if this.ptr_is_null(size.ptr())? {
233+
let size_avail = if this.ptr_is_null(buf)? {
234234
0 // if the buf pointer is null, we can't write to it; `size` will be updated to the required length
235235
} else {
236236
this.read_scalar(&size)?.to_u32()?
237237
};
238238
// Of course we cannot use `windows_check_buffer_size` here since this uses
239239
// a different method for dealing with a too-small buffer than the other functions...
240240
let (success, len) = this.write_path_to_wide_str(home, buf, size_avail.into())?;
241-
// The Windows docs just say that this is written on failure, but std relies on it
242-
// always being written. Also see <https://github.com/rust-lang/rust/issues/141254>.
241+
// As per <https://github.com/MicrosoftDocs/sdk-api/pull/1810>, the size is always
242+
// written, not just on failure.
243243
this.write_scalar(Scalar::from_u32(len.try_into().unwrap()), &size)?;
244244
if success {
245245
Scalar::from_i32(1) // return TRUE

0 commit comments

Comments
 (0)