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
22 changes: 15 additions & 7 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1349,17 +1349,25 @@ fn link_natively(
continue;
}

// Detect '-static-pie' used with an older version of gcc or clang not supporting it.
// Fallback from '-static-pie' to '-static' in that case.
// Detect '-static-pie' used with an older version of gcc or clang not supporting it,
// or with glibc that's missing crt objects, e.g. for arches that don't support it.
// Fallback from '-static-pie' to '-static' in either case.
let mut static_pie_message = None;
if matches!(flavor, LinkerFlavor::Gnu(Cc::Yes, _))
&& unknown_arg_regex.is_match(&out)
&& (out.contains("-static-pie") || out.contains("--no-dynamic-linker"))
&& cmd.get_args().iter().any(|e| e == "-static-pie")
{
if unknown_arg_regex.is_match(&out)
&& (out.contains("-static-pie") || out.contains("--no-dynamic-linker"))
{
static_pie_message =
Some("Linker does not support -static-pie command line option.");
} else if Regex::new(r"cannot (find|open) g?rcrt1\.o:").unwrap().is_match(&out) {
static_pie_message = Some("C library is missing static-PIE startup objects.");
}
}
if let Some(message) = static_pie_message {
info!("linker output: {:?}", out);
warn!(
"Linker does not support -static-pie command line option. Retrying with -static instead."
);
warn!("{message} Retrying with -static instead.");
// Mirror `add_(pre,post)_link_objects` to replace CRT objects.
let self_contained_crt_objects = self_contained_components.is_crt_objects_enabled();
let opts = &sess.target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6764,7 +6764,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
tcx,
ObligationCause::dummy(),
param_env,
ty::TraitRef::new(tcx, trait_def_id, trait_args),
parent_trait_pred.rebind(ty::TraitRef::new(tcx, trait_def_id, trait_args)),
);
self.predicate_may_hold(&obligation)
})
Expand Down
133 changes: 107 additions & 26 deletions library/alloc/src/boxed.rs

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,10 @@ impl String {
/// into a `String` with the [`from_raw_parts`] function, allowing
/// the destructor to perform the cleanup.
///
/// If `capacity == 0`, then `pointer` may be dangling. Otherwise,
/// it will always be valid for reads and writes over `capacity`
/// bytes, and point to the start of the string.
///
/// [`from_raw_parts`]: String::from_raw_parts
///
/// # Examples
Expand Down
237 changes: 82 additions & 155 deletions library/alloc/src/vec/mod.rs

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions library/core/src/convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,28 @@ const impl AsMut<str> for str {
}
}

#[stable(feature = "never_type", since = "1.100.0")]
#[expect(
clippy::explicit_auto_deref,
reason = "https://github.com/rust-lang/rust-clippy/issues/17713"
)]
impl<T: ?Sized> AsRef<T> for ! {
fn as_ref(&self) -> &T {
*self
}
}

#[stable(feature = "never_type", since = "1.100.0")]
#[expect(
clippy::explicit_auto_deref,
reason = "https://github.com/rust-lang/rust-clippy/issues/17713"
)]
impl<T: ?Sized> AsMut<T> for ! {
fn as_mut(&mut self) -> &mut T {
*self
}
}

////////////////////////////////////////////////////////////////////////////////
// THE NO-ERROR ERROR TYPE
////////////////////////////////////////////////////////////////////////////////
Expand Down
16 changes: 8 additions & 8 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -621,10 +621,10 @@ auto:
--skip tests
--skip library
--skip tidyselftest
&& ./x.py --stage 2 test
--host=aarch64-apple-darwin
--target=aarch64-apple-darwin
src/tools/cargo
# && ./x.py --stage 2 test
# --host=aarch64-apple-darwin
# --target=aarch64-apple-darwin
# src/tools/cargo
RUST_CONFIGURE_ARGS: >-
--enable-sanitizers
--enable-profiler
Expand Down Expand Up @@ -674,10 +674,10 @@ auto:
--skip tests
--skip library
--skip tidyselftest
&& ./x.py --stage 2 test
--host=aarch64-apple-darwin
--target=aarch64-apple-darwin
src/tools/cargo
# && ./x.py --stage 2 test
# --host=aarch64-apple-darwin
# --target=aarch64-apple-darwin
# src/tools/cargo
RUST_CONFIGURE_ARGS: >-
--enable-sanitizers
--enable-profiler
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-project
Submodule llvm-project updated 49 files
+3 −2 clang/lib/AST/ByteCode/Interp.cpp
+31 −61 clang/lib/CodeGen/CGExpr.cpp
+11 −11 clang/test/CodeGen/attr-counted-by-issue200014.c
+4 −4 clang/test/CodeGen/attr-counted-by-nested-structs.c
+47 −0 clang/test/CodeGen/attr-counted-by-union-storage.c
+16 −16 clang/test/CodeGen/builtin-counted-by-ref.c
+7 −6 lld/ELF/Writer.cpp
+16 −0 lld/test/ELF/randomize-section-padding.test
+22 −0 lld/test/ELF/x86-64-relax-jump-tables-eh-frame-hdr.s
+9 −0 llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+2 −2 llvm/lib/Target/ARM/ARMISelLowering.cpp
+6 −7 llvm/lib/Target/Mips/Mips16ISelLowering.cpp
+5 −6 llvm/lib/Target/Mips/Mips16ISelLowering.h
+1 −2 llvm/lib/Target/Mips/MipsFastISel.cpp
+22 −21 llvm/lib/Target/Mips/MipsISelLowering.cpp
+1 −1 llvm/lib/Target/Mips/MipsISelLowering.h
+6 −7 llvm/lib/Target/Mips/MipsSEISelLowering.cpp
+5 −6 llvm/lib/Target/Mips/MipsSEISelLowering.h
+19 −0 llvm/lib/Target/PowerPC/PPCInstrInfo.cpp
+23 −1 llvm/lib/Target/Sparc/SparcISelLowering.cpp
+11 −6 llvm/lib/Target/X86/X86ISelLowering.cpp
+23 −2 llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+4 −3 llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+8 −8 llvm/test/CodeGen/AArch64/GlobalISel/legalize-fshl.mir
+8 −8 llvm/test/CodeGen/AArch64/GlobalISel/legalize-fshr.mir
+2 −2 llvm/test/CodeGen/AMDGPU/GlobalISel/fshl.ll
+2 −2 llvm/test/CodeGen/AMDGPU/GlobalISel/fshr.ll
+6 −6 llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-fshl.mir
+6 −6 llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-fshr.mir
+3 −3 llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-rotl-rotr.mir
+259 −0 llvm/test/CodeGen/ARM/longMAC-overflow.ll
+0 −21 llvm/test/CodeGen/Mips/Fast-ISel/private-fn.ll
+42 −0 llvm/test/CodeGen/Mips/private-fn.ll
+2 −1 llvm/test/CodeGen/Mips/private.ll
+72 −0 llvm/test/CodeGen/PowerPC/cmp-opt-cr0-live.mir
+4 −4 llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-fshl-fshr-rv32.mir
+6 −6 llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-fshl-fshr-rv64.mir
+4 −4 llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-rotate-rv32.mir
+6 −6 llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-rotate-rv64.mir
+24 −4 llvm/test/CodeGen/SPARC/vector-extract-elt.ll
+4 −4 llvm/test/CodeGen/WebAssembly/GlobalISel/instructions/rotl.mir
+4 −4 llvm/test/CodeGen/WebAssembly/GlobalISel/instructions/rotr.mir
+31 −0 llvm/test/CodeGen/X86/combine-add.ll
+1,593 −0 llvm/test/CodeGen/X86/vector-i64-div-rem-32bit.ll
+126 −0 llvm/test/Transforms/InstCombine/clamp-range-attr.ll
+20 −0 llvm/test/Transforms/InstCombine/memchr-6.ll
+14 −0 llvm/test/Transforms/InstCombine/memrchr-4.ll
+51 −0 llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp
+17 −3 llvm/utils/release/github-upload-release.py
11 changes: 11 additions & 0 deletions tests/ui/derives/imperfect-derive-higher-ranked.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// regression test for #164376

#[derive(Clone)]
struct S<'a, T>(&'a T);

fn require<T>() where for<'a> S<'a, T>: Clone {}

fn main() {
require::<&'static mut u8>();
//~^ ERROR the trait bound `&'static mut u8: Clone` is not satisfied
}
29 changes: 29 additions & 0 deletions tests/ui/derives/imperfect-derive-higher-ranked.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
error[E0277]: the trait bound `&'static mut u8: Clone` is not satisfied
--> $DIR/imperfect-derive-higher-ranked.rs:9:15
|
LL | require::<&'static mut u8>();
| ^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&'static mut u8`
|
help: the trait `Clone` is implemented for `u8`
--> $SRC_DIR/core/src/clone.rs:LL:COL
::: $SRC_DIR/core/src/clone.rs:LL:COL
|
= note: in this macro invocation
note: required for `S<'a, &'static mut u8>` to implement `for<'a> Clone`
--> $DIR/imperfect-derive-higher-ranked.rs:4:8
|
LL | #[derive(Clone)]
| ----- in this derive macro expansion
LL | struct S<'a, T>(&'a T);
| ^ - type parameter would need to implement `for<'a> Clone`
= help: consider manually implementing `for<'a> Clone` to avoid undesired bounds caused by "imperfect derives"
= note: to learn more, visit <https://github.com/rust-lang/rust/issues/26925>
note: required by a bound in `require`
--> $DIR/imperfect-derive-higher-ranked.rs:6:41
|
LL | fn require<T>() where for<'a> S<'a, T>: Clone {}
| ^^^^^ required by this bound in `require`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
error[E0277]: the trait bound `!: AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied
error[E0277]: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied
--> $DIR/generic-with-implicit-hrtb-without-dyn.rs:7:13
|
LL | fn ice() -> impl AsRef<Fn(&())> {
| ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not implemented for `!`
| ^^^^^^^^^^^^^^^^^^^ the trait `AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not implemented for `()`
...
LL | todo!()
| ------- return type was inferred to be `!` here
|
help: `!` can be coerced to any type; consider casting it to a concrete type that implements the trait
|
LL | todo!() as /* Type */
| +++++++++++++
LL | ()
| -- return type was inferred to be `()` here

error: aborting due to 1 previous error

Expand Down
4 changes: 2 additions & 2 deletions tests/ui/impl-trait/generic-with-implicit-hrtb-without-dyn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
#![allow(warnings)]

fn ice() -> impl AsRef<Fn(&())> {
//[pre2021]~^ ERROR: the trait bound `!: AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied [E0277]
//[pre2021]~^ ERROR: the trait bound `(): AsRef<(dyn for<'a> Fn(&'a ()) + 'static)>` is not satisfied [E0277]
//[edition2021]~^^ ERROR: expected a type, found a trait [E0782]
//[edition2021]~| ERROR: expected a type, found a trait [E0782]
todo!()
()
}

fn main() {}
Loading