Skip to content

Commit

Permalink
Auto merge of #3306 - rust-lang:rustup-2024-02-19, r=RalfJung
Browse files Browse the repository at this point in the history
Automatic Rustup
  • Loading branch information
bors committed Feb 19, 2024
2 parents 90fccaa + e118c3e commit 010f029
Show file tree
Hide file tree
Showing 460 changed files with 10,168 additions and 3,968 deletions.
80 changes: 23 additions & 57 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -931,43 +931,19 @@ dependencies = [

[[package]]
name = "darling"
version = "0.14.4"
version = "0.20.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
checksum = "c376d08ea6aa96aafe61237c7200d1241cb177b7d3a542d791f2d118e9cbb955"
dependencies = [
"darling_core 0.14.4",
"darling_macro 0.14.4",
]

[[package]]
name = "darling"
version = "0.20.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8"
dependencies = [
"darling_core 0.20.5",
"darling_macro 0.20.5",
"darling_core",
"darling_macro",
]

[[package]]
name = "darling_core"
version = "0.14.4"
version = "0.20.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim 0.10.0",
"syn 1.0.109",
]

[[package]]
name = "darling_core"
version = "0.20.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3"
checksum = "33043dcd19068b8192064c704b3f83eb464f91f1ff527b44a4e2b08d9cdb8855"
dependencies = [
"fnv",
"ident_case",
Expand All @@ -979,22 +955,11 @@ dependencies = [

[[package]]
name = "darling_macro"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
dependencies = [
"darling_core 0.14.4",
"quote",
"syn 1.0.109",
]

[[package]]
name = "darling_macro"
version = "0.20.5"
version = "0.20.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77"
checksum = "c5a91391accf613803c2a9bf9abccdbaa07c54b4244a5b64883f9c3c137c86be"
dependencies = [
"darling_core 0.20.5",
"darling_core",
"quote",
"syn 2.0.48",
]
Expand Down Expand Up @@ -1036,33 +1001,33 @@ dependencies = [

[[package]]
name = "derive_builder"
version = "0.12.0"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8"
checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7"
dependencies = [
"derive_builder_macro",
]

[[package]]
name = "derive_builder_core"
version = "0.12.0"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f"
checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d"
dependencies = [
"darling 0.14.4",
"darling",
"proc-macro2",
"quote",
"syn 1.0.109",
"syn 2.0.48",
]

[[package]]
name = "derive_builder_macro"
version = "0.12.0"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b"
dependencies = [
"derive_builder_core",
"syn 1.0.109",
"syn 2.0.48",
]

[[package]]
Expand All @@ -1084,7 +1049,7 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e8ef033054e131169b8f0f9a7af8f5533a9436fadf3c500ed547f730f07090d"
dependencies = [
"darling 0.20.5",
"darling",
"proc-macro2",
"quote",
"syn 2.0.48",
Expand Down Expand Up @@ -6206,11 +6171,12 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

[[package]]
name = "windows"
version = "0.48.0"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-targets 0.48.5",
"windows-core",
"windows-targets 0.52.0",
]

[[package]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ fn start<T: Termination + 'static>(

static mut NUM: u8 = 6 * 7;

// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
#[allow(static_mut_ref)]
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
#[allow(static_mut_refs)]
static NUM_REF: &'static u8 = unsafe { &NUM };

unsafe fn zeroed<T>() -> T {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ fn start<T: Termination + 'static>(

static mut NUM: u8 = 6 * 7;

// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
#[allow(static_mut_ref)]
// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
#[allow(static_mut_refs)]
static NUM_REF: &'static u8 = unsafe { &NUM };

macro_rules! assert {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ default-features = false
features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive", "write"]

[target.'cfg(windows)'.dependencies.windows]
version = "0.48.0"
version = "0.52.0"
features = ["Win32_Globalization"]
7 changes: 5 additions & 2 deletions compiler/rustc_codegen_ssa/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,11 @@ impl<G: EmissionGuarantee> IntoDiagnostic<'_, G> for LinkingFailed<'_> {
// which by now we have no way to translate.
if contains_undefined_ref {
diag.note(fluent::codegen_ssa_extern_funcs_not_found)
.note(fluent::codegen_ssa_specify_libraries_to_link)
.note(fluent::codegen_ssa_use_cargo_directive);
.note(fluent::codegen_ssa_specify_libraries_to_link);

if rustc_session::utils::was_invoked_from_cargo() {
diag.note(fluent::codegen_ssa_use_cargo_directive);
}
}
diag
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tracing = "0.1"
version = "0.12"

[target.'cfg(windows)'.dependencies.windows]
version = "0.48.0"
version = "0.52.0"
features = [
"Win32_Foundation",
"Win32_Storage_FileSystem",
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_data_structures/src/flock/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ impl Lock {
&mut overlapped,
)
}
.ok()
.map_err(|e| {
let err = io::Error::from_raw_os_error(e.code().0);
debug!("failed acquiring file lock: {}", err);
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_data_structures/src/owned_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::sync::Lrc;
// Use our fake Send/Sync traits when on not parallel compiler,
// so that `OwnedSlice` only implements/requires Send/Sync
// for parallel compiler builds.
use crate::sync::{Send, Sync};
use crate::sync;

/// An owned slice.
///
Expand Down Expand Up @@ -33,7 +33,7 @@ pub struct OwnedSlice {
// \/
// ⊂(´・◡・⊂ )∘˚˳° (I am the phantom remnant of #97770)
#[expect(dead_code)]
owner: Lrc<dyn Send + Sync>,
owner: Lrc<dyn sync::Send + sync::Sync>,
}

/// Makes an [`OwnedSlice`] out of an `owner` and a `slicer` function.
Expand All @@ -60,7 +60,7 @@ pub struct OwnedSlice {
/// ```
pub fn slice_owned<O, F>(owner: O, slicer: F) -> OwnedSlice
where
O: Send + Sync + 'static,
O: sync::Send + sync::Sync + 'static,
F: FnOnce(&O) -> &[u8],
{
try_slice_owned(owner, |x| Ok::<_, !>(slicer(x))).into_ok()
Expand All @@ -71,7 +71,7 @@ where
/// See [`slice_owned`] for the infallible version.
pub fn try_slice_owned<O, F, E>(owner: O, slicer: F) -> Result<OwnedSlice, E>
where
O: Send + Sync + 'static,
O: sync::Send + sync::Sync + 'static,
F: FnOnce(&O) -> Result<&[u8], E>,
{
// We wrap the owner of the bytes in, so it doesn't move.
Expand Down Expand Up @@ -139,11 +139,11 @@ impl Borrow<[u8]> for OwnedSlice {

// Safety: `OwnedSlice` is conceptually `(&'self.1 [u8], Arc<dyn Send + Sync>)`, which is `Send`
#[cfg(parallel_compiler)]
unsafe impl Send for OwnedSlice {}
unsafe impl sync::Send for OwnedSlice {}

// Safety: `OwnedSlice` is conceptually `(&'self.1 [u8], Arc<dyn Send + Sync>)`, which is `Sync`
#[cfg(parallel_compiler)]
unsafe impl Sync for OwnedSlice {}
unsafe impl sync::Sync for OwnedSlice {}

#[cfg(test)]
mod tests;
6 changes: 2 additions & 4 deletions compiler/rustc_data_structures/src/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,16 +866,14 @@ cfg_match! {
use std::mem;

use windows::{
// FIXME: change back to K32GetProcessMemoryInfo when windows crate
// updated to 0.49.0+ to drop dependency on psapi.dll
Win32::System::ProcessStatus::{GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS},
Win32::System::ProcessStatus::{K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS},
Win32::System::Threading::GetCurrentProcess,
};

let mut pmc = PROCESS_MEMORY_COUNTERS::default();
let pmc_size = mem::size_of_val(&pmc);
unsafe {
GetProcessMemoryInfo(
K32GetProcessMemoryInfo(
GetCurrentProcess(),
&mut pmc,
pmc_size as u32,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_driver_impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ libc = "0.2"
# tidy-alphabetical-end

[target.'cfg(windows)'.dependencies.windows]
version = "0.48.0"
version = "0.52.0"
features = [
"Win32_System_Diagnostics_Debug",
]
Expand Down
26 changes: 15 additions & 11 deletions compiler/rustc_error_codes/src/error_codes/E0796.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
Reference of mutable static.
You have created a reference to a mutable static.

Erroneous code example:

```compile_fail,edition2024,E0796
static mut X: i32 = 23;
static mut Y: i32 = 24;
unsafe {
let y = &X;
let ref x = X;
let (x, y) = (&X, &Y);
foo(&X);
fn work() {
let _val = unsafe { X };
}
fn foo<'a>(_x: &'a i32) {}
let x_ref = unsafe { &mut X };
work();
// The next line has Undefined Behavior!
// `x_ref` is a mutable reference and allows no aliases,
// but `work` has been reading the reference between
// the moment `x_ref` was created and when it was used.
// This violates the uniqueness of `x_ref`.
*x_ref = 42;
```

Mutable statics can be written to by multiple threads: aliasing violations or
data races will cause undefined behavior.
A reference to a mutable static has lifetime `'static`. This is very dangerous
as it is easy to accidentally overlap the lifetime of that reference with
other, conflicting accesses to the same static.

Reference of mutable static is a hard error from 2024 edition.
References to mutable statics are a hard error in the 2024 edition.
2 changes: 1 addition & 1 deletion compiler/rustc_errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ unicode-width = "0.1.4"
# tidy-alphabetical-end

[target.'cfg(windows)'.dependencies.windows]
version = "0.48.0"
version = "0.52.0"
features = [
"Win32_Foundation",
"Win32_Security",
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_errors/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
impl Drop for Handle {
fn drop(&mut self) {
unsafe {
CloseHandle(self.0);
// FIXME can panic here
CloseHandle(self.0).unwrap();
}
}
}
Expand All @@ -37,7 +38,8 @@ pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
impl Drop for Guard {
fn drop(&mut self) {
unsafe {
ReleaseMutex((self.0).0);
// FIXME can panic here
ReleaseMutex((self.0).0).unwrap();
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_expand/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ expand_invalid_cfg_multiple_predicates = multiple `cfg` predicates are specified
expand_invalid_cfg_no_parens = `cfg` is not followed by parentheses
expand_invalid_cfg_no_predicate = `cfg` predicate is not specified
expand_invalid_cfg_predicate_literal = `cfg` predicate key cannot be a literal
expand_invalid_fragment_specifier =
invalid fragment specifier `{$fragment}`
.help = {$help}
expand_macro_body_stability =
macros cannot have body stability attributes
.label = invalid body stability attribute
Expand Down
10 changes: 10 additions & 0 deletions compiler/rustc_expand/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,13 @@ pub struct DuplicateMatcherBinding {
#[label(expand_label2)]
pub prev: Span,
}

#[derive(Diagnostic)]
#[diag(expand_invalid_fragment_specifier)]
#[help]
pub struct InvalidFragmentSpecifier {
#[primary_span]
pub span: Span,
pub fragment: Ident,
pub help: String,
}
1 change: 1 addition & 0 deletions compiler/rustc_expand/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(macro_metavar_expr)]
#![feature(map_try_insert)]
#![feature(proc_macro_diagnostic)]
#![feature(proc_macro_internals)]
#![feature(proc_macro_span)]
Expand Down
Loading

0 comments on commit 010f029

Please sign in to comment.