Skip to content

Rollup of 14 pull requests #140321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c5c9362
Stabilize proc_macro::Span::{start, end, line, column}.
m-ou-se Apr 15, 2025
1632f62
Add `#[rustc_no_implicit_autorefs]` and apply it to std methods
Urgau Mar 30, 2024
40ba47d
Implement lint against dangerous implicit autorefs
Urgau Feb 10, 2024
e8a6c17
Allow `dangerous_implicit_autorefs` lint in some tests
Urgau Mar 30, 2024
3536324
Fix detection of `main` function if there are expressions around it
GuillaumeGomez Apr 23, 2025
81438c0
Add regression ui test for #140162 and for #139651
GuillaumeGomez Apr 23, 2025
5b5f55b
Update wasm-component-ld to 0.5.13
alexcrichton Apr 23, 2025
2afb117
feat: Add XtensaAsmPrinter
SergioGasquez Apr 24, 2025
c07054b
Retry if creating temp fails with access denied
ChrisDenton Apr 20, 2025
f072d30
resolved conflict
Kivooeo Apr 25, 2025
f769f42
Move inline_asm to typeck, properly handle aliases
compiler-errors Apr 25, 2025
009db53
handle specialization in the new trait solver
lcnr Apr 25, 2025
31c8d10
Track per-obligation recursion depth only if there is inference
compiler-errors Apr 25, 2025
ee9bdca
add regression test
lcnr Apr 25, 2025
ae0c2fe
transmutability: Support char, NonZeroXxx
joshlf Apr 22, 2025
3ededc1
Improve code
GuillaumeGomez Apr 25, 2025
3ef98a5
If there is a `;` alone, we consider that the doctest needs to be put…
GuillaumeGomez Apr 25, 2025
1862feb
Update `extern` docs for Rust 2024 and add safety remarks
t5kd Apr 23, 2025
1ec3e62
Remove redundant check
mejrs Apr 25, 2025
fd1fbb5
Rollup merge of #123239 - Urgau:dangerous_implicit_autorefs, r=jdonsz…
jhpratt Apr 26, 2025
95c2471
Rollup merge of #139865 - m-ou-se:stabilize-proc-macro-span-location,…
jhpratt Apr 26, 2025
f0438d7
Rollup merge of #140086 - ChrisDenton:backoff, r=petrochenkov
jhpratt Apr 26, 2025
796c35e
Rollup merge of #140215 - joshlf:transmutability-char-nonzero, r=jswrenn
jhpratt Apr 26, 2025
d03f72c
Rollup merge of #140216 - t5kd:master, r=tgross35
jhpratt Apr 26, 2025
38e59a8
Rollup merge of #140220 - GuillaumeGomez:doctest-main-wrapping, r=fmease
jhpratt Apr 26, 2025
132d084
Rollup merge of #140226 - alexcrichton:update-wasm-component-ld, r=ji…
jhpratt Apr 26, 2025
c32180b
Rollup merge of #140253 - SergioGasquez:feat/xtensa-asm-printer, r=cu…
jhpratt Apr 26, 2025
17c6af9
Rollup merge of #140272 - Kivooeo:new-fix-four, r=est31
jhpratt Apr 26, 2025
76f9fa6
Rollup merge of #140302 - compiler-errors:inline_asm-bug, r=lcnr
jhpratt Apr 26, 2025
0189019
Rollup merge of #140305 - compiler-errors:coerce-loop, r=lcnr
jhpratt Apr 26, 2025
b80b2f4
Rollup merge of #140306 - lcnr:specialization-new, r=compiler-errors
jhpratt Apr 26, 2025
eca2b1f
Rollup merge of #140308 - lcnr:add-ui-test, r=compiler-errors
jhpratt Apr 26, 2025
9efd1d8
Rollup merge of #140317 - mejrs:check_on_uni, r=compiler-errors
jhpratt Apr 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 30 additions & 63 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3699,6 +3699,9 @@ dependencies = [
[[package]]
name = "rustc_fs_util"
version = "0.0.0"
dependencies = [
"tempfile",
]

[[package]]
name = "rustc_graphviz"
Expand Down Expand Up @@ -3753,7 +3756,6 @@ dependencies = [
"rustc_middle",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"smallvec",
"tracing",
Expand Down Expand Up @@ -3792,6 +3794,7 @@ dependencies = [
"rustc_middle",
"rustc_session",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"smallvec",
"tracing",
Expand Down Expand Up @@ -4011,7 +4014,6 @@ dependencies = [
"rustc_session",
"rustc_span",
"rustc_target",
"tempfile",
"tracing",
]

Expand Down Expand Up @@ -4915,15 +4917,6 @@ dependencies = [
"color-eyre",
]

[[package]]
name = "spdx"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58b69356da67e2fc1f542c71ea7e654a361a79c938e4424392ecf4fa065d2193"
dependencies = [
"smallvec",
]

[[package]]
name = "spdx-expression"
version = "0.5.2"
Expand Down Expand Up @@ -5743,9 +5736,9 @@ dependencies = [

[[package]]
name = "wasi-preview1-component-adapter-provider"
version = "29.0.1"
version = "31.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcd9f21bbde82ba59e415a8725e6ad0d0d7e9e460b1a3ccbca5bdee952c1a324"
checksum = "86fabda09a0d89ffd1615b297b4a5d4b4d99df9598aeb24685837e63019e927b"

[[package]]
name = "wasm-bindgen"
Expand Down Expand Up @@ -5807,17 +5800,17 @@ dependencies = [

[[package]]
name = "wasm-component-ld"
version = "0.5.12"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "580305a8e3f1b7a79859a8db897de643533b2851c5eb080fe5800233f16dec88"
checksum = "a60a07a994a3538b57d8c5f8caba19f4793fb4c7156276e5e90e90acbb829e20"
dependencies = [
"anyhow",
"clap",
"lexopt",
"libc",
"tempfile",
"wasi-preview1-component-adapter-provider",
"wasmparser 0.223.1",
"wasmparser 0.229.0",
"wat",
"windows-sys 0.59.0",
"winsplit",
Expand All @@ -5844,39 +5837,24 @@ dependencies = [

[[package]]
name = "wasm-encoder"
version = "0.223.1"
version = "0.229.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a0a96fdeaee8fbeb4bd917fb8157d48c0d61c3b1f4ee4c363c8e8d68b2f4fe8"
dependencies = [
"leb128",
"wasmparser 0.223.1",
]

[[package]]
name = "wasm-encoder"
version = "0.228.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05d30290541f2d4242a162bbda76b8f2d8b1ac59eab3568ed6f2327d52c9b2c4"
checksum = "38ba1d491ecacb085a2552025c10a675a6fddcbd03b1fc9b36c536010ce265d2"
dependencies = [
"leb128fmt",
"wasmparser 0.228.0",
"wasmparser 0.229.0",
]

[[package]]
name = "wasm-metadata"
version = "0.223.1"
version = "0.229.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7e37883181704d96b89dbd8f1291be13694c71cd0663aebb94b46d235a377"
checksum = "78fdb7d29a79191ab363dc90c1ddd3a1e880ffd5348d92d48482393a9e6c5f4d"
dependencies = [
"anyhow",
"indexmap",
"serde",
"serde_derive",
"serde_json",
"spdx",
"url",
"wasm-encoder 0.223.1",
"wasmparser 0.223.1",
"wasm-encoder 0.229.0",
"wasmparser 0.229.0",
]

[[package]]
Expand All @@ -5900,9 +5878,9 @@ dependencies = [

[[package]]
name = "wasmparser"
version = "0.223.1"
version = "0.229.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "664b980991ed9a8c834eb528a8979ab1109edcf52dc05dd5751e2cc3fb31035d"
checksum = "0cc3b1f053f5d41aa55640a1fa9b6d1b8a9e4418d118ce308d20e24ff3575a8c"
dependencies = [
"bitflags",
"hashbrown",
Expand All @@ -5911,35 +5889,24 @@ dependencies = [
"serde",
]

[[package]]
name = "wasmparser"
version = "0.228.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4abf1132c1fdf747d56bbc1bb52152400c70f336870f968b85e89ea422198ae3"
dependencies = [
"bitflags",
"indexmap",
"semver",
]

[[package]]
name = "wast"
version = "228.0.0"
version = "229.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5aae124478cb51439f6587f074a3a5e835afd22751c59a87b2e2a882727c97"
checksum = "63fcaff613c12225696bb163f79ca38ffb40e9300eff0ff4b8aa8b2f7eadf0d9"
dependencies = [
"bumpalo",
"leb128fmt",
"memchr",
"unicode-width 0.2.0",
"wasm-encoder 0.228.0",
"wasm-encoder 0.229.0",
]

[[package]]
name = "wat"
version = "1.228.0"
version = "1.229.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ec29c89a8d055df988de7236483bf569988ac3d6905899f6af5ef920f9385ad"
checksum = "4189bad08b70455a9e9e67dc126d2dcf91fac143a80f1046747a5dde6d4c33e0"
dependencies = [
"wast",
]
Expand Down Expand Up @@ -6398,9 +6365,9 @@ dependencies = [

[[package]]
name = "wit-component"
version = "0.223.1"
version = "0.229.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fc2fcc52a79f6f010a89c867e53e06d4227f86c58984add3e37f32b8e7af5f0"
checksum = "7f550067740e223bfe6c4878998e81cdbe2529dd9a793dc49248dd6613394e8b"
dependencies = [
"anyhow",
"bitflags",
Expand All @@ -6409,17 +6376,17 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"wasm-encoder 0.223.1",
"wasm-encoder 0.229.0",
"wasm-metadata",
"wasmparser 0.223.1",
"wasmparser 0.229.0",
"wit-parser",
]

[[package]]
name = "wit-parser"
version = "0.223.1"
version = "0.229.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "263fde17f1fbe55a413f16eb59094bf751795c6da469a05c3d45ea6c77df6b40"
checksum = "459c6ba62bf511d6b5f2a845a2a736822e38059c1cfa0b644b467bbbfae4efa6"
dependencies = [
"anyhow",
"id-arena",
Expand All @@ -6430,7 +6397,7 @@ dependencies = [
"serde_derive",
"serde_json",
"unicode-xid",
"wasmparser 0.223.1",
"wasmparser 0.229.0",
]

[[package]]
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use object::read::archive::ArchiveFile;
use object::read::macho::FatArch;
use rustc_data_structures::fx::FxIndexSet;
use rustc_data_structures::memmap::Mmap;
use rustc_fs_util::TempDirBuilder;
use rustc_session::Session;
use rustc_span::Symbol;
use tempfile::Builder as TempFileBuilder;
use tracing::trace;

use super::metadata::search_for_section;
Expand Down Expand Up @@ -501,7 +501,7 @@ impl<'a> ArArchiveBuilder<'a> {
// it creates. We need it to be the default mode for back compat reasons however. (See
// #107495) To handle this we are telling tempfile to create a temporary directory instead
// and then inside this directory create a file using File::create.
let archive_tmpdir = TempFileBuilder::new()
let archive_tmpdir = TempDirBuilder::new()
.suffix(".temp-archive")
.tempdir_in(output.parent().unwrap_or_else(|| Path::new("")))
.map_err(|err| {
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use rustc_data_structures::fx::FxIndexSet;
use rustc_data_structures::memmap::Mmap;
use rustc_data_structures::temp_dir::MaybeTempDir;
use rustc_errors::{DiagCtxtHandle, LintDiagnostic};
use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
use rustc_fs_util::{TempDirBuilder, fix_windows_verbatim_for_gcc, try_canonicalize};
use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc_macros::LintDiagnostic;
use rustc_metadata::fs::{METADATA_FILENAME, copy_to_stdout, emit_wrapper_file};
Expand Down Expand Up @@ -48,7 +48,6 @@ use rustc_target::spec::{
LinkerFeatures, LinkerFlavor, LinkerFlavorCli, Lld, PanicStrategy, RelocModel, RelroLevel,
SanitizerSet, SplitDebuginfo,
};
use tempfile::Builder as TempFileBuilder;
use tracing::{debug, info, warn};

use super::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
Expand Down Expand Up @@ -100,7 +99,7 @@ pub fn link_binary(
});

if outputs.outputs.should_link() {
let tmpdir = TempFileBuilder::new()
let tmpdir = TempDirBuilder::new()
.prefix("rustc")
.tempdir()
.unwrap_or_else(|error| sess.dcx().emit_fatal(errors::CreateTempDir { error }));
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,10 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
EncodeCrossCrate::Yes,
"#[rustc_never_returns_null_ptr] is used to mark functions returning non-null pointers."
),
rustc_attr!(
rustc_no_implicit_autorefs, AttributeType::Normal, template!(Word), ErrorFollowing, EncodeCrossCrate::Yes,
"`#[rustc_no_implicit_autorefs]` is used to mark functions for which an autoref to the dereference of a raw pointer should not be used as an argument."
),
rustc_attr!(
rustc_coherence_is_core, AttributeType::CrateLevel, template!(Word), ErrorFollowing, EncodeCrossCrate::No,
"#![rustc_coherence_is_core] allows inherent methods on builtin types, only intended to be used in `core`."
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_fs_util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ edition = "2024"

[dependencies]
# tidy-alphabetical-start
tempfile = "3.7.1"
# tidy-alphabetical-end
46 changes: 44 additions & 2 deletions compiler/rustc_fs_util/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::ffi::CString;
use std::ffi::{CString, OsStr};
use std::path::{Path, PathBuf, absolute};
use std::{fs, io};
use std::{env, fs, io};

use tempfile::TempDir;

// Unfortunately, on windows, it looks like msvcrt.dll is silently translating
// verbatim paths under the hood to non-verbatim paths! This manifests itself as
Expand Down Expand Up @@ -102,3 +104,43 @@ pub fn path_to_c_string(p: &Path) -> CString {
pub fn try_canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
fs::canonicalize(&path).or_else(|_| absolute(&path))
}

pub struct TempDirBuilder<'a, 'b> {
builder: tempfile::Builder<'a, 'b>,
}

impl<'a, 'b> TempDirBuilder<'a, 'b> {
pub fn new() -> Self {
Self { builder: tempfile::Builder::new() }
}

pub fn prefix<S: AsRef<OsStr> + ?Sized>(&mut self, prefix: &'a S) -> &mut Self {
self.builder.prefix(prefix);
self
}

pub fn suffix<S: AsRef<OsStr> + ?Sized>(&mut self, suffix: &'b S) -> &mut Self {
self.builder.suffix(suffix);
self
}

pub fn tempdir_in<P: AsRef<Path>>(&self, dir: P) -> io::Result<TempDir> {
let dir = dir.as_ref();
// On Windows in CI, we had been getting fairly frequent "Access is denied"
// errors when creating temporary directories.
// So this implements a simple retry with backoff loop.
#[cfg(windows)]
for wait in 1..11 {
match self.builder.tempdir_in(dir) {
Err(e) if e.kind() == io::ErrorKind::PermissionDenied => {}
t => return t,
}
std::thread::sleep(std::time::Duration::from_millis(1 << wait));
}
self.builder.tempdir_in(dir)
}

pub fn tempdir(&self) -> io::Result<TempDir> {
self.tempdir_in(env::temp_dir())
}
}
1 change: 0 additions & 1 deletion compiler/rustc_hir_analysis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ rustc_macros = { path = "../rustc_macros" }
rustc_middle = { path = "../rustc_middle" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
rustc_target = { path = "../rustc_target" }
rustc_trait_selection = { path = "../rustc_trait_selection" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
tracing = "0.1"
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_hir_analysis/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,6 @@ hir_analysis_recursive_generic_parameter = {$param_def_kind} `{$param_name}` is
hir_analysis_redundant_lifetime_args = unnecessary lifetime parameter `{$victim}`
.note = you can use the `{$candidate}` lifetime directly, in place of `{$victim}`

hir_analysis_register_type_unstable =
type `{$ty}` cannot be used with this register class in stable

hir_analysis_requires_note = the `{$trait_name}` impl for `{$ty}` requires that `{$error_predicate}`

hir_analysis_return_type_notation_equality_bound =
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir_analysis/src/check/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,6 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
.is_ok()
{
check_impl_items_against_trait(tcx, def_id, impl_trait_header);
check_on_unimplemented(tcx, def_id);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir_analysis/src/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ mod check;
mod compare_impl_item;
mod entry;
pub mod intrinsic;
pub mod intrinsicck;
mod region;
pub mod wfcheck;

Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_hir_analysis/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1675,14 +1675,6 @@ pub(crate) struct CmseEntryGeneric {
pub span: Span,
}

#[derive(Diagnostic)]
#[diag(hir_analysis_register_type_unstable)]
pub(crate) struct RegisterTypeUnstable<'a> {
#[primary_span]
pub span: Span,
pub ty: Ty<'a>,
}

#[derive(LintDiagnostic)]
#[diag(hir_analysis_supertrait_item_shadowing)]
pub(crate) struct SupertraitItemShadowing {
Expand Down
Loading
Loading