Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Stabilized APIs
- [`FusedIterator for StepBy<I>`](https://doc.rust-lang.org/stable/std/iter/struct.StepBy.html#impl-FusedIterator-for-StepBy%3CI%3E)
- [`std::fs::set_times`](https://doc.rust-lang.org/stable/std/fs/fn.set_times.html)
- [`std::fs::set_times_nofollow`](https://doc.rust-lang.org/stable/std/fs/fn.set_times_nofollow.html)
- [`<LocalKey<Cell<T>>>::update`](https://doc.rust-lang.org/stable/std/thread/struct.LocalKey.html#method.update)

<a id="1.99.0-Cargo"></a>

Expand Down Expand Up @@ -216,6 +217,13 @@ Stabilized APIs
- [`std::range::legacy`](https://doc.rust-lang.org/stable/std/range/legacy/index.html)
- [`bool::ok_or`](https://doc.rust-lang.org/stable/std/primitive.bool.html#method.ok_or)
- [`bool::ok_or_else`](https://doc.rust-lang.org/stable/std/primitive.bool.html#method.ok_or_else)
- [`Option::map_or_default`](https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.map_or_default)
- [`Result::map_or_default`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.map_or_default)
- [`Box::as_ptr`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.as_ptr)
- [`Box::as_mut_ptr`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.as_mut_ptr)
- [`Path::is_empty`](https://doc.rust-lang.org/stable/std/path/struct.Path.html#method.is_empty)
- [`PathBuf::into_string`](https://doc.rust-lang.org/stable/std/path/struct.PathBuf.html#method.into_string)
- [`arch::{arm,aarch64}::vdot*`: NEON dot product intrinsics](https://github.com/rust-lang/rust/issues/117224)


<a id="1.98.0-Compatibility-Notes"></a>
Expand Down Expand Up @@ -539,6 +547,7 @@ Stabilized APIs
- [`Layout::repeat`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.repeat)
- [`Layout::repeat_packed`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.repeat_packed)
- [`Layout::extend_packed`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.extend_packed)
- [`core::arch::aarch64::__jcvt`](https://doc.rust-lang.org/stable/core/arch/aarch64/fn.__jcvt.html)

These previously stable APIs are now stable in const contexts:

Expand Down
11 changes: 11 additions & 0 deletions compiler/rustc_hir_typeck/src/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4548,6 +4548,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
name = item_name,
)
};
if candidates_len > 1 {
let rcvr_ty_kind = match rcvr_ty.peel_refs().kind() {
ty::Param(_) => "type parameter",
ty::Adt(def, _) => self.tcx.def_descr(def.did()),
_ => "type",
};
err.primary_message(format!(
"no method named `{item_name}` found for {rcvr_ty_kind} `{rcvr_ty}` in the \
current scope",
));
}
// Obtain the span for `param` and use it for a structured suggestion.
if let Some(param) = param_type {
let generics = self.tcx.generics_of(self.body_def_id.to_def_id());
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/types/improper_ctypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
debug_assert!(matches!(def.adt_kind(), AdtKind::Struct | AdtKind::Union));
use FfiResult::*;

if !def.repr().c() && !def.repr().transparent() {
if !def.repr().c() && !def.repr().transparent() && !def.repr().simd() {
return FfiUnsafe {
ty,
reason: if def.is_struct() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
if (Singlethread) {
Options.ThreadModel = ThreadModel::Single;
}
#endif

if (UseWasmEH)
Options.ExceptionModel = ExceptionHandling::Wasm;
#endif

Options.EmitStackSizeSection = EmitStackSizeSection;

Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_symbol_mangling/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ pub fn eh_personality_symbol<'tcx>(tcx: TyCtxt<'tcx>) -> String {

pub fn mangle_internal_symbol<'tcx>(tcx: TyCtxt<'tcx>, item_name: &str) -> String {
match item_name {
// Some projects manually define rust_eh_personality as they use no_std on a target where
// libcore is compiled with panic=unwind and thus need rust_eh_personality to be present
// while it is only defined in libstd. These projects don't want to use unstable features
// and thus can't use a proper #[lang = "eh_personality"]
// FIXME mangle again once no_std on a target with std support doesn't need it or build-std
// is possible on stable for non-Cargo build systems.
"rust_eh_personality" => return item_name.to_owned(),
// Apple availability symbols need to not be mangled to be usable by
// C/Objective-C code.
"__isPlatformVersionAtLeast" | "__isOSVersionAtLeast" => return item_name.to_owned(),
Expand Down
2 changes: 0 additions & 2 deletions library/alloc/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2431,8 +2431,6 @@ impl<T: fmt::Debug + ?Sized, A: Allocator> fmt::Debug for Box<T, A> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized, A: Allocator> fmt::Pointer for Box<T, A> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// It's not possible to extract the inner Uniq directly from the Box,
// instead we cast it to a *const which aliases the Unique
let ptr: *const T = &**self;
fmt::Pointer::fmt(&ptr, f)
}
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ impl char {
/// assert!(!' '.is_xid_continue());
/// ```
#[must_use]
#[unstable(feature = "char_is_xid", issue = "none", reason = "to be created")]
#[unstable(feature = "char_is_xid", issue = "164841")]
#[inline]
pub fn is_xid_continue(self) -> bool {
match self {
Expand Down Expand Up @@ -1157,7 +1157,7 @@ impl char {
/// assert!(!'_'.is_xid_start());
/// ```
#[must_use]
#[unstable(feature = "char_is_xid", issue = "none", reason = "to be created")]
#[unstable(feature = "char_is_xid", issue = "164841")]
#[inline]
pub fn is_xid_start(self) -> bool {
match self {
Expand Down
1 change: 0 additions & 1 deletion library/core/src/panic/unwind_safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ pub struct AssertUnwindSafe<T>(#[stable(feature = "catch_unwind", since = "1.9.0
//
// * By default everything is unwind safe
// * pointers T contains mutability of some form are not unwind safe
// * Unique, an owning pointer, lifts an implementation
// * Types like Mutex/RwLock which are explicitly poisoned are unwind safe
// * Our custom AssertUnwindSafe wrapper is indeed unwind safe

Expand Down
18 changes: 10 additions & 8 deletions src/etc/gdb_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
FIRST_FIELD = "__1"


def unwrap_unique_or_non_null(unique_or_nonnull):
# Gets the raw pointer out of a `NonNull` or a wrapper struct with a
# `pointer: NonNull` field (with that exact name)
def unwrap_non_null_or_wrapper(ptr):
# BACKCOMPAT: rust 1.32
# https://github.com/rust-lang/rust/commit/7a0911528058e87d22ea305695f4047572c5e067
# BACKCOMPAT: rust 1.60
# https://github.com/rust-lang/rust/commit/2a91eeac1a2d27dd3de1bf55515d765da20fd86f
ptr = unique_or_nonnull["pointer"]
ptr = ptr["pointer"]
return ptr if ptr.type.code == gdb.TYPE_CODE_PTR else ptr[ptr.type.fields()[0]]


Expand Down Expand Up @@ -62,7 +64,7 @@ def __init__(self, valobj):
self._valobj = valobj
vec = valobj["vec"]
self._length = int(vec["len"])
self._data_ptr = unwrap_unique_or_non_null(vec["buf"]["inner"]["ptr"])
self._data_ptr = unwrap_non_null_or_wrapper(vec["buf"]["inner"]["ptr"])

def to_string(self):
return self._data_ptr.lazy_string(encoding="utf-8", length=self._length)
Expand All @@ -80,7 +82,7 @@ def __init__(self, valobj):
vec = buf["bytes"] if is_windows else buf

self._length = int(vec["len"])
self._data_ptr = unwrap_unique_or_non_null(vec["buf"]["inner"]["ptr"])
self._data_ptr = unwrap_non_null_or_wrapper(vec["buf"]["inner"]["ptr"])

def to_string(self):
return self._data_ptr.lazy_string(encoding="utf-8", length=self._length)
Expand Down Expand Up @@ -160,7 +162,7 @@ class StdVecProvider(printer_base):
def __init__(self, valobj):
self._valobj = valobj
self._length = int(valobj["len"])
self._data_ptr = unwrap_unique_or_non_null(valobj["buf"]["inner"]["ptr"])
self._data_ptr = unwrap_non_null_or_wrapper(valobj["buf"]["inner"]["ptr"])
ptr_ty = gdb.Type.pointer(valobj.type.template_argument(0))
self._data_ptr = self._data_ptr.reinterpret_cast(ptr_ty)

Expand Down Expand Up @@ -196,7 +198,7 @@ def __init__(self, valobj):
if cap.type.code != gdb.TYPE_CODE_INT:
cap = cap[ZERO_FIELD]
self._cap = int(cap)
self._data_ptr = unwrap_unique_or_non_null(valobj["buf"]["inner"]["ptr"])
self._data_ptr = unwrap_non_null_or_wrapper(valobj["buf"]["inner"]["ptr"])
ptr_ty = gdb.Type.pointer(valobj.type.template_argument(0))
self._data_ptr = self._data_ptr.reinterpret_cast(ptr_ty)

Expand All @@ -221,7 +223,7 @@ class StdRcProvider(printer_base):
def __init__(self, valobj, is_atomic=False):
self._valobj = valobj
self._is_atomic = is_atomic
self._ptr = unwrap_unique_or_non_null(valobj["ptr"])
self._ptr = unwrap_non_null_or_wrapper(valobj["ptr"])
self._value = self._ptr["data" if is_atomic else "value"]
# FIXME(shua): the debuginfo template type should be 'str' not 'u8'
if self._ptr.type.target().name == "alloc::rc::RcInner<str>":
Expand Down Expand Up @@ -321,7 +323,7 @@ def cast_to_internal(node):
if node_ptr.type.name.startswith("alloc::collections::btree::node::BoxedNode<"):
# BACKCOMPAT: rust 1.49
node_ptr = node_ptr["ptr"]
node_ptr = unwrap_unique_or_non_null(node_ptr)
node_ptr = unwrap_non_null_or_wrapper(node_ptr)
leaf = node_ptr.dereference()
keys = leaf["keys"]
vals = leaf["vals"]
Expand Down
18 changes: 10 additions & 8 deletions src/etc/lldb_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,14 @@ def from_uint(self, name: str, value: int) -> SBValue:
return self.valobj.CreateValueFromData(name, data, type)


def unwrap_unique_or_non_null(unique_or_nonnull: SBValue) -> SBValue:
# Gets the raw pointer out of a `NonNull` or a wrapper struct with a
# `pointer: NonNull` field (with that exact name)
def unwrap_non_null_or_wrapper(ptr: SBValue) -> SBValue:
# BACKCOMPAT: rust 1.32
# https://github.com/rust-lang/rust/commit/7a0911528058e87d22ea305695f4047572c5e067
# BACKCOMPAT: rust 1.60
# https://github.com/rust-lang/rust/commit/2a91eeac1a2d27dd3de1bf55515d765da20fd86f
ptr = unique_or_nonnull.GetChildMemberWithName("pointer")
ptr = ptr.GetChildMemberWithName("pointer")
return ptr if ptr.TypeIsPointerType() else ptr.GetChildAtIndex(0)


Expand Down Expand Up @@ -417,7 +419,7 @@ def StdStringSummaryProvider(valobj: SBValue, dict: LLDBOpaque):
.GetNonSyntheticValue()
)

pointer = unwrap_unique_or_non_null(
pointer = unwrap_non_null_or_wrapper(
inner_vec.GetChildMemberWithName("buf")
.GetChildMemberWithName("inner")
.GetChildMemberWithName("ptr")
Expand Down Expand Up @@ -453,7 +455,7 @@ def StdOsStringSummaryProvider(valobj: SBValue, _dict: LLDBOpaque) -> str:
if is_windows:
inner_vec = inner_vec.GetChildAtIndex(0)

pointer = unwrap_unique_or_non_null(
pointer = unwrap_non_null_or_wrapper(
inner_vec.GetChildMemberWithName("buf")
.GetChildMemberWithName("inner")
.GetChildMemberWithName("ptr")
Expand Down Expand Up @@ -614,7 +616,7 @@ def __init__(self, valobj: SBValue, _dict: LLDBOpaque):

def update(self):
inner_vec = self.valobj.GetChildMemberWithName("vec").GetNonSyntheticValue()
self.data_ptr = unwrap_unique_or_non_null(
self.data_ptr = unwrap_non_null_or_wrapper(
inner_vec.GetChildMemberWithName("buf")
.GetChildMemberWithName("inner")
.GetChildMemberWithName("ptr")
Expand Down Expand Up @@ -1158,7 +1160,7 @@ def get_child_at_index(self, index: int) -> Optional[SBValue]:

def update(self):
buf: SBValue = self.valobj.GetChildMemberWithName("buf")
self.data_ptr = unwrap_unique_or_non_null(
self.data_ptr = unwrap_non_null_or_wrapper(
buf.GetChildMemberWithName("inner").GetChildMemberWithName("ptr")
)

Expand Down Expand Up @@ -1333,7 +1335,7 @@ def update(self):
cap = cap.GetChildAtIndex(0)
self.cap = cap.GetValueAsUnsigned()

self.data_ptr = unwrap_unique_or_non_null(
self.data_ptr = unwrap_non_null_or_wrapper(
self.buf.GetChildMemberWithName("ptr")
)

Expand Down Expand Up @@ -1569,7 +1571,7 @@ class StdRcSyntheticProvider:
def __init__(self, valobj: SBValue, _dict: LLDBOpaque, is_atomic: bool = False):
self.valobj = valobj

self.ptr = unwrap_unique_or_non_null(self.valobj.GetChildMemberWithName("ptr"))
self.ptr = unwrap_non_null_or_wrapper(self.valobj.GetChildMemberWithName("ptr"))

self.value = self.ptr.GetChildMemberWithName("data" if is_atomic else "value")

Expand Down
7 changes: 0 additions & 7 deletions src/etc/natvis/libcore.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,6 @@
</Expand>
</Type>

<Type Name="core::ptr::unique::Unique&lt;*&gt;">
<DisplayString>Unique({(void*)pointer.pointer}: {pointer.pointer})</DisplayString>
<Expand>
<ExpandedItem>pointer</ExpandedItem>
</Expand>
</Type>

<Type Name="core::sync::atomic::Atomic&lt;bool&gt;">
<DisplayString>{(bool)v.value.__0}</DisplayString>
</Type>
Expand Down
1 change: 0 additions & 1 deletion tests/assembly-llvm/asm/amdgpu-vec-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
unused_variables
)]
#![deny(unfulfilled_lint_expectations)]
#![expect(improper_ctypes_definitions)]

extern crate minicore;
use minicore::simd::*;
Expand Down
1 change: 0 additions & 1 deletion tests/assembly-llvm/asm/amdgpu-vec-types2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#![allow(
asm_sub_register,
improper_gpu_kernel_arg,
improper_ctypes_definitions,
non_camel_case_types,
unused_assignments,
unused_variables
Expand Down
1 change: 0 additions & 1 deletion tests/codegen-llvm/scalable-vectors/memcpy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

use std::arch::aarch64::*;

#[expect(improper_ctypes)]
unsafe extern "C" {
fn svcreate2_s16_wrapper(__dst: *mut svint16x2_t, x0: *const svint16_t, x1: *const svint16_t);
fn svcreate3_s16_wrapper(
Expand Down
4 changes: 4 additions & 0 deletions tests/run-make/symbols-all-mangled/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ fn is_symbol_ok(sym: &str) -> bool {
return true;
}

if sym == "rust_eh_personality" {
return true; // Unfortunately we have to not mangle this for now
}

false
}

Expand Down
1 change: 0 additions & 1 deletion tests/ui/abi/arm-unadjusted-intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ impl Copy for int8x16x4_t {}
#[target_feature(enable = "neon")]
#[cfg_attr(target_arch = "arm", target_feature(enable = "v7"))]
pub unsafe fn vld1q_s8_x4(a: *const i8) -> int8x16x4_t {
#[expect(improper_ctypes)]
extern "llvm-intrinsic" {
#[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vld1x4.v16i8.p0i8")]
#[cfg_attr(target_arch = "aarch64", link_name = "llvm.aarch64.neon.ld1x4.v16i8.p0i8")]
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/abi/simd-abi-checks-avx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#![feature(portable_simd)]
#![feature(simd_ffi)]
#![expect(improper_ctypes_definitions)]

use std::arch::x86_64::*;

Expand Down Expand Up @@ -82,7 +81,6 @@ fn main() {
}

unsafe {
#[expect(improper_ctypes)]
extern "C" {
fn some_extern() -> __m256;
}
Expand Down
Loading
Loading