Skip to content

Commit 8c0b915

Browse files
committed
Auto merge of rust-lang#134019 - workingjubilee:rollup-9lskq1o, r=workingjubilee
Rollup of 10 pull requests Successful merges: - rust-lang#133522 (Don't suggest restricting bound with unstable traits on stable and mention it's unstable on nightly) - rust-lang#133733 ( compiletest: show the difference between the normalized output and the actual output for lines which didn't match) - rust-lang#133861 (Add allocate_bytes and refactor allocate_str in InterpCx for raw byte…) - rust-lang#133967 ([AIX] Pass -bnoipath when adding rust upstream dynamic crates) - rust-lang#133976 (Removed Unnecessary Spaces From RELEASES.md) - rust-lang#133980 ([AIX] Remove option "-n" from AIX "ln" command) - rust-lang#133987 (Define acronym for thread local storage) - rust-lang#133992 (Actually walk into lifetimes and attrs in `EarlyContextAndPass`) - rust-lang#133993 (Fix: typo in E0751 error explanation) - rust-lang#133996 (Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 728f2da + f47a3f3 commit 8c0b915

File tree

230 files changed

+764
-440
lines changed

Some content is hidden

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

230 files changed

+764
-440
lines changed

Diff for: RELEASES.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ Compatibility Notes
503503
* We have renamed `std::panic::PanicInfo` to `std::panic::PanicHookInfo`. The old name will continue to work as an alias, but will result in a deprecation warning starting in Rust 1.82.0.
504504

505505
`core::panic::PanicInfo` will remain unchanged, however, as this is now a *different type*.
506-
506+
507507
The reason is that these types have different roles: `std::panic::PanicHookInfo` is the argument to the [panic hook](https://doc.rust-lang.org/stable/std/panic/fn.set_hook.html) in std context (where panics can have an arbitrary payload), while `core::panic::PanicInfo` is the argument to the [`#[panic_handler]`](https://doc.rust-lang.org/nomicon/panic-handler.html) in no_std context (where panics always carry a formatted *message*). Separating these types allows us to add more useful methods to these types, such as `std::panic::PanicHookInfo::payload_as_str()` and `core::panic::PanicInfo::message()`.
508508

509509
* The new sort implementations may panic if a type's implementation of [`Ord`](https://doc.rust-lang.org/std/cmp/trait.Ord.html) (or the given comparison function) does not implement a [total order](https://en.wikipedia.org/wiki/Total_order) as the trait requires. `Ord`'s supertraits (`PartialOrd`, `Eq`, and `PartialEq`) must also be consistent. The previous implementations would not "notice" any problem, but the new implementations have a good chance of detecting inconsistencies, throwing a panic rather than returning knowingly unsorted data.
@@ -584,7 +584,7 @@ Stabilized APIs
584584
- [`impl Default for Arc<CStr>`](https://doc.rust-lang.org/beta/alloc/sync/struct.Arc.html#impl-Default-for-Arc%3CCStr%3E)
585585
- [`impl Default for Arc<[T]>`](https://doc.rust-lang.org/beta/alloc/sync/struct.Arc.html#impl-Default-for-Arc%3C%5BT%5D%3E)
586586
- [`impl IntoIterator for Box<[T]>`](https://doc.rust-lang.org/beta/alloc/boxed/struct.Box.html#impl-IntoIterator-for-Box%3C%5BI%5D,+A%3E)
587-
- [`impl FromIterator<String> for Box<str>`](https://doc.rust-lang.org/beta/alloc/boxed/struct.Box.html#impl-FromIterator%3CString%3E-for-Box%3Cstr%3E)
587+
- [`impl FromIterator<String> for Box<str>`](https://doc.rust-lang.org/beta/alloc/boxed/struct.Box.html#impl-FromIterator%3CString%3E-for-Box%3Cstr%3E)
588588
- [`impl FromIterator<char> for Box<str>`](https://doc.rust-lang.org/beta/alloc/boxed/struct.Box.html#impl-FromIterator%3Cchar%3E-for-Box%3Cstr%3E)
589589
- [`LazyCell`](https://doc.rust-lang.org/beta/core/cell/struct.LazyCell.html)
590590
- [`LazyLock`](https://doc.rust-lang.org/beta/std/sync/struct.LazyLock.html)
@@ -1816,7 +1816,7 @@ Compiler
18161816
- [Detect uninhabited types early in const eval](https://github.com/rust-lang/rust/pull/109435/)
18171817
- [Switch to LLD as default linker for {arm,thumb}v4t-none-eabi](https://github.com/rust-lang/rust/pull/109721/)
18181818
- [Add tier 3 target `loongarch64-unknown-linux-gnu`](https://github.com/rust-lang/rust/pull/96971)
1819-
- [Add tier 3 target for `i586-pc-nto-qnx700` (QNX Neutrino RTOS, version 7.0)](https://github.com/rust-lang/rust/pull/109173/),
1819+
- [Add tier 3 target for `i586-pc-nto-qnx700` (QNX Neutrino RTOS, version 7.0)](https://github.com/rust-lang/rust/pull/109173/),
18201820
- [Insert alignment checks for pointer dereferences as debug assertions](https://github.com/rust-lang/rust/pull/98112)
18211821
This catches undefined behavior at runtime, and may cause existing code to fail.
18221822

@@ -2023,7 +2023,7 @@ Compatibility Notes
20232023
If `tools = [...]` is set in config.toml, we will respect a missing rustdoc in that list. By
20242024
default rustdoc remains included. To retain the prior behavior explicitly add `"rustdoc"` to the
20252025
list.
2026-
2026+
20272027
<a id="1.69.0-Internal-Changes"></a>
20282028

20292029
Internal Changes

Diff for: compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
14501450
ty::Param(param_ty) => Ok((
14511451
generics.type_param(param_ty, tcx),
14521452
predicate.trait_ref.print_trait_sugared().to_string(),
1453+
Some(predicate.trait_ref.def_id),
14531454
)),
14541455
_ => Err(()),
14551456
}
@@ -1463,9 +1464,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
14631464
tcx,
14641465
hir_generics,
14651466
err,
1466-
predicates
1467-
.iter()
1468-
.map(|(param, constraint)| (param.name.as_str(), &**constraint, None)),
1467+
predicates.iter().map(|(param, constraint, def_id)| {
1468+
(param.name.as_str(), &**constraint, *def_id)
1469+
}),
14691470
None,
14701471
);
14711472
}

Diff for: compiler/rustc_codegen_ssa/src/back/link.rs

+9
Original file line numberDiff line numberDiff line change
@@ -2753,6 +2753,15 @@ fn add_upstream_rust_crates(
27532753
.find(|(ty, _)| *ty == crate_type)
27542754
.expect("failed to find crate type in dependency format list");
27552755

2756+
if sess.target.is_like_aix {
2757+
// Unlike ELF linkers, AIX doesn't feature `DT_SONAME` to override
2758+
// the dependency name when outputing a shared library. Thus, `ld` will
2759+
// use the full path to shared libraries as the dependency if passed it
2760+
// by default unless `noipath` is passed.
2761+
// https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command.
2762+
cmd.link_or_cc_arg("-bnoipath");
2763+
}
2764+
27562765
for &cnum in &codegen_results.crate_info.used_crates {
27572766
// We may not pass all crates through to the linker. Some crates may appear statically in
27582767
// an existing dylib, meaning we'll pick up all the symbols from the dylib.

Diff for: compiler/rustc_const_eval/src/check_consts/ops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
140140
err,
141141
param_ty.name.as_str(),
142142
&constraint,
143-
None,
143+
Some(trait_ref.def_id),
144144
None,
145145
);
146146
}

Diff for: compiler/rustc_const_eval/src/interpret/place.rs

+32-13
Original file line numberDiff line numberDiff line change
@@ -1018,29 +1018,48 @@ where
10181018
self.allocate_dyn(layout, kind, MemPlaceMeta::None)
10191019
}
10201020

1021-
/// Returns a wide MPlace of type `str` to a new 1-aligned allocation.
1022-
/// Immutable strings are deduplicated and stored in global memory.
1023-
pub fn allocate_str(
1021+
/// Allocates a sequence of bytes in the interpreter's memory.
1022+
/// For immutable allocations, uses deduplication to reuse existing memory.
1023+
/// For mutable allocations, creates a new unique allocation.
1024+
pub fn allocate_bytes(
10241025
&mut self,
1025-
str: &str,
1026+
bytes: &[u8],
1027+
align: Align,
10261028
kind: MemoryKind<M::MemoryKind>,
10271029
mutbl: Mutability,
1028-
) -> InterpResult<'tcx, MPlaceTy<'tcx, M::Provenance>> {
1029-
let tcx = self.tcx.tcx;
1030-
1030+
) -> InterpResult<'tcx, Pointer<M::Provenance>> {
10311031
// Use cache for immutable strings.
1032-
let ptr = if mutbl.is_not() {
1032+
if mutbl.is_not() {
10331033
// Use dedup'd allocation function.
10341034
let salt = M::get_global_alloc_salt(self, None);
1035-
let id = tcx.allocate_bytes_dedup(str.as_bytes(), salt);
1035+
let id = self.tcx.allocate_bytes_dedup(bytes, salt);
10361036

10371037
// Turn untagged "global" pointers (obtained via `tcx`) into the machine pointer to the allocation.
1038-
M::adjust_alloc_root_pointer(&self, Pointer::from(id), Some(kind))?
1038+
M::adjust_alloc_root_pointer(&self, Pointer::from(id), Some(kind))
10391039
} else {
1040-
self.allocate_bytes_ptr(str.as_bytes(), Align::ONE, kind, mutbl)?
1041-
};
1042-
let meta = Scalar::from_target_usize(u64::try_from(str.len()).unwrap(), self);
1040+
// Allocate new memory for mutable data.
1041+
self.allocate_bytes_ptr(bytes, align, kind, mutbl)
1042+
}
1043+
}
1044+
1045+
/// Allocates a string in the interpreter's memory with metadata for length.
1046+
/// Uses `allocate_bytes` internally but adds string-specific metadata handling.
1047+
pub fn allocate_str(
1048+
&mut self,
1049+
str: &str,
1050+
kind: MemoryKind<M::MemoryKind>,
1051+
mutbl: Mutability,
1052+
) -> InterpResult<'tcx, MPlaceTy<'tcx, M::Provenance>> {
1053+
let bytes = str.as_bytes();
1054+
let ptr = self.allocate_bytes(bytes, Align::ONE, kind, mutbl)?;
1055+
1056+
// Create length metadata for the string.
1057+
let meta = Scalar::from_target_usize(u64::try_from(bytes.len()).unwrap(), self);
1058+
1059+
// Get layout for Rust's str type.
10431060
let layout = self.layout_of(self.tcx.types.str_).unwrap();
1061+
1062+
// Combine pointer and metadata into a wide pointer.
10441063
interp_ok(self.ptr_with_meta_to_mplace(
10451064
ptr.into(),
10461065
MemPlaceMeta::Meta(meta),

Diff for: compiler/rustc_error_codes/src/error_codes/E0751.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ impl !MyTrait for i32 { } // error!
99
```
1010

1111
Negative implementations are a promise that the trait will never be implemented
12-
for the given types. Therefore, both cannot exists at the same time.
12+
for the given types. Therefore, both cannot exist at the same time.

Diff for: compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
279279
} else {
280280
let mut err = self.dcx().create_err(err);
281281
if suggest_constraining_type_param(
282-
tcx, generics, &mut err, &qself_str, &trait_ref, None, None,
282+
tcx,
283+
generics,
284+
&mut err,
285+
&qself_str,
286+
&trait_ref,
287+
Some(best_trait),
288+
None,
283289
) && !identically_named
284290
{
285291
// We suggested constraining a type parameter, but the associated item on it

Diff for: compiler/rustc_lint/src/early.rs

+2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
245245

246246
fn visit_lifetime(&mut self, lt: &'a ast::Lifetime, _: ast_visit::LifetimeCtxt) {
247247
self.check_id(lt.id);
248+
ast_visit::walk_lifetime(self, lt);
248249
}
249250

250251
fn visit_path(&mut self, p: &'a ast::Path, id: ast::NodeId) {
@@ -259,6 +260,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
259260

260261
fn visit_attribute(&mut self, attr: &'a ast::Attribute) {
261262
lint_callback!(self, check_attribute, attr);
263+
ast_visit::walk_attribute(self, attr);
262264
}
263265

264266
fn visit_mac_def(&mut self, mac: &'a ast::MacroDef, id: ast::NodeId) {

Diff for: compiler/rustc_lint/src/hidden_unicode_codepoints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::lints::{
99
use crate::{EarlyContext, EarlyLintPass, LintContext};
1010

1111
declare_lint! {
12+
#[allow(text_direction_codepoint_in_literal)]
1213
/// The `text_direction_codepoint_in_literal` lint detects Unicode codepoints that change the
1314
/// visual representation of text on screen in a way that does not correspond to their on
1415
/// memory representation.

Diff for: compiler/rustc_lint_defs/src/builtin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3929,6 +3929,7 @@ declare_lint! {
39293929
}
39303930

39313931
declare_lint! {
3932+
#[allow(text_direction_codepoint_in_literal)]
39323933
/// The `text_direction_codepoint_in_comment` lint detects Unicode codepoints in comments that
39333934
/// change the visual representation of text on screen in a way that does not correspond to
39343935
/// their on memory representation.

0 commit comments

Comments
 (0)