Skip to content
Open
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
10 changes: 8 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/link_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,14 @@ impl<S: Stage> SingleAttributeParser<S> for LinkSectionParser {
const PATH: &[Symbol] = &[sym::link_section];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError;
const ALLOWED_TARGETS: AllowedTargets =
AllowedTargets::AllowListWarnRest(&[Allow(Target::Static), Allow(Target::Fn)]);
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowListWarnRest(&[
Allow(Target::Static),
Allow(Target::Fn),
Allow(Target::Method(MethodKind::Inherent)),
Allow(Target::Method(MethodKind::Trait { body: false })),
Allow(Target::Method(MethodKind::Trait { body: true })),
Allow(Target::Method(MethodKind::TraitImpl)),
]);
const TEMPLATE: AttributeTemplate = template!(
NameValueStr: "name",
"https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute"
Expand Down
31 changes: 18 additions & 13 deletions compiler/rustc_trait_selection/src/traits/select/confirmation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,19 +423,24 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
constituents.types,
);

// FIXME(coroutine_clone): We could uplift this into `collect_predicates_for_types`
// and do this for `Copy`/`Clone` too, but that's feature-gated so it doesn't really
// matter yet.
for assumption in constituents.assumptions {
let assumption = normalize_with_depth_to(
self,
obligation.param_env,
cause.clone(),
obligation.recursion_depth + 1,
assumption,
&mut obligations,
);
self.infcx.register_region_assumption(assumption);
// Only normalize these goals if `-Zhigher-ranked-assumptions` is enabled, since
// we don't want to cause ourselves to do extra work if we're not even able to
// take advantage of these assumption clauses.
if self.tcx().sess.opts.unstable_opts.higher_ranked_assumptions {
// FIXME(coroutine_clone): We could uplift this into `collect_predicates_for_types`
// and do this for `Copy`/`Clone` too, but that's feature-gated so it doesn't really
// matter yet.
for assumption in constituents.assumptions {
let assumption = normalize_with_depth_to(
self,
obligation.param_env,
cause.clone(),
obligation.recursion_depth + 1,
assumption,
&mut obligations,
);
self.infcx.register_region_assumption(assumption);
}
}

Ok(obligations)
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, cargo: &mut Car
// Query rustc for the deployment target, and the associated env var.
// The env var is one of the standard `*_DEPLOYMENT_TARGET` vars, i.e.
// `MACOSX_DEPLOYMENT_TARGET`, `IPHONEOS_DEPLOYMENT_TARGET`, etc.
let mut cmd = command(builder.rustc(cargo.compiler()));
let mut cmd = builder.rustc_cmd(cargo.compiler());
cmd.arg("--target").arg(target.rustc_target_arg());
cmd.arg("--print=deployment-target");
let output = cmd.run_capture_stdout(builder).stdout();
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ fn generate_target_spec_json_schema(builder: &Builder<'_>, sysroot: &Path) {
// We do this by using the stage 1 compiler, which is always compiled for the host,
// even in a cross build.
let stage1_host = builder.compiler(1, builder.host_target);
let mut rustc = command(builder.rustc(stage1_host)).fail_fast();
let mut rustc = builder.rustc_cmd(stage1_host).fail_fast();
rustc
.env("RUSTC_BOOTSTRAP", "1")
.args(["--print=target-spec-json-schema", "-Zunstable-options"]);
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/src/core/build_steps/synthetic_targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use crate::Compiler;
use crate::core::builder::{Builder, ShouldRun, Step};
use crate::core::config::TargetSelection;
use crate::utils::exec::command;

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub(crate) struct MirOptPanicAbortSyntheticTarget {
Expand Down Expand Up @@ -55,7 +54,7 @@ fn create_synthetic_target(
return TargetSelection::create_synthetic(&name, path.to_str().unwrap());
}

let mut cmd = command(builder.rustc(compiler));
let mut cmd = builder.rustc_cmd(compiler);
cmd.arg("--target").arg(base.rustc_target_arg());
cmd.args(["-Zunstable-options", "--print", "target-spec-json"]);

Expand Down
6 changes: 6 additions & 0 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3263,6 +3263,8 @@ fn distcheck_plain_source_tarball(builder: &Builder<'_>, plain_src_dir: &Path) {
.env("GITHUB_ACTIONS", "0")
.current_dir(plain_src_dir)
.run(builder);
// Mitigate pressure on small-capacity disks.
builder.remove_dir(plain_src_dir);
}

/// Check that rust-src has all of libstd's dependencies
Expand All @@ -3288,6 +3290,8 @@ fn distcheck_rust_src(builder: &Builder<'_>, src_dir: &Path) {
.arg(&toml)
.current_dir(src_dir)
.run(builder);
// Mitigate pressure on small-capacity disks.
builder.remove_dir(src_dir);
}

/// Check that rustc-dev's compiler crate source code can be loaded with `cargo metadata`
Expand All @@ -3312,6 +3316,8 @@ fn distcheck_rustc_dev(builder: &Builder<'_>, dir: &Path) {
.env("RUSTC", &builder.initial_rustc)
.current_dir(dir)
.run(builder);
// Mitigate pressure on small-capacity disks.
builder.remove_dir(dir);
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
Expand Down
6 changes: 2 additions & 4 deletions src/bootstrap/src/core/builder/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,10 +722,8 @@ impl Builder<'_> {
// Build proc macros both for the host and the target unless proc-macros are not
// supported by the target.
if target != compiler.host && cmd_kind != Kind::Check {
let mut rustc_cmd = command(self.rustc(compiler));
self.add_rustc_lib_path(compiler, &mut rustc_cmd);

let error = rustc_cmd
let error = self
.rustc_cmd(compiler)
.arg("--target")
.arg(target.rustc_target_arg())
.arg("--print=file-names")
Expand Down
8 changes: 8 additions & 0 deletions src/bootstrap/src/core/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,14 @@ Alternatively, you can set `build.local-rebuild=true` and use a stage0 compiler
}
}

/// Gets a command to run the compiler specified, including the dynamic library
/// path in case the executable has not been build with `rpath` enabled.
pub fn rustc_cmd(&self, compiler: Compiler) -> BootstrapCommand {
let mut cmd = command(self.rustc(compiler));
self.add_rustc_lib_path(compiler, &mut cmd);
cmd
}

/// Gets the paths to all of the compiler's codegen backends.
fn codegen_backends(&self, compiler: Compiler) -> impl Iterator<Item = PathBuf> {
fs::read_dir(self.sysroot_codegen_backends(compiler))
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-project
Submodule llvm-project updated 68 files
+77 −858 clang/include/clang/Basic/riscv_vector.td
+2 −0 clang/lib/Basic/Targets/X86.h
+945 −4 clang/lib/CodeGen/TargetBuiltins/RISCV.cpp
+1 −0 clang/lib/Format/Format.cpp
+2 −0 clang/lib/Sema/SemaExprCXX.cpp
+4 −2 clang/test/CodeGen/mangle-windows.c
+3 −0 clang/test/CodeGenCXX/mangle-windows.cpp
+15 −0 clang/test/SemaTemplate/destructor-template.cpp
+7 −0 clang/unittests/Format/TokenAnnotatorTest.cpp
+1 −1 cmake/Modules/LLVMVersion.cmake
+12 −8 lld/ELF/LinkerScript.cpp
+31 −0 lld/test/ELF/linkerscript/orphan-relocation.s
+3 −0 lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h
+12 −0 lldb/include/lldb/Target/StackFrameList.h
+5 −0 lldb/include/lldb/Target/Thread.h
+42 −0 lldb/source/Target/InstrumentationRuntimeStopInfo.cpp
+8 −0 lldb/source/Target/Process.cpp
+2 −0 lldb/source/Target/StackFrameList.cpp
+11 −1 lldb/test/API/functionalities/asan/TestMemoryHistory.py
+6 −1 lldb/test/API/functionalities/asan/TestReportData.py
+5 −2 lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py
+5 −2 lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
+2 −0 llvm/docs/LangRef.rst
+25 −3 llvm/include/llvm/BinaryFormat/ELF.h
+3 −0 llvm/include/llvm/CodeGen/MachineOperand.h
+4 −0 llvm/include/llvm/MC/MCContext.h
+3 −0 llvm/include/llvm/MC/MCParser/MCAsmParser.h
+1 −0 llvm/include/llvm/Object/ELFObjectFile.h
+4 −1 llvm/lib/Analysis/Loads.cpp
+7 −2 llvm/lib/Analysis/ScalarEvolution.cpp
+13 −0 llvm/lib/CodeGen/MachineOperand.cpp
+28 −21 llvm/lib/MC/MCContext.cpp
+24 −41 llvm/lib/MC/MCParser/AsmParser.cpp
+22 −44 llvm/lib/MC/MCParser/COFFAsmParser.cpp
+9 −8 llvm/lib/MC/MCParser/COFFMasmParser.cpp
+14 −30 llvm/lib/MC/MCParser/DarwinAsmParser.cpp
+13 −21 llvm/lib/MC/MCParser/ELFAsmParser.cpp
+9 −0 llvm/lib/MC/MCParser/MCAsmParser.cpp
+2 −2 llvm/lib/MC/MCParser/MCAsmParserExtension.cpp
+13 −19 llvm/lib/MC/MCParser/MasmParser.cpp
+6 −9 llvm/lib/MC/MCParser/WasmAsmParser.cpp
+30 −2 llvm/lib/Object/ELFObjectFile.cpp
+1 −1 llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
+4 −0 llvm/lib/Target/LoongArch/LoongArchMergeBaseOffset.cpp
+6 −4 llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+4 −0 llvm/lib/Target/RISCV/RISCVCallingConv.td
+50 −37 llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+10 −1 llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
+7 −1 llvm/lib/Target/X86/X86ISelLowering.cpp
+6 −2 llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+9 −2 llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+38 −0 llvm/test/CodeGen/LoongArch/inline-asm-constraint-m.ll
+24 −0 llvm/test/CodeGen/PowerPC/pr160040.ll
+449 −0 llvm/test/CodeGen/RISCV/calling-conv-preserve-most.ll
+23 −0 llvm/test/CodeGen/RISCV/rvv/fixed-vectors-vw-web-simplification.ll
+51 −0 llvm/test/CodeGen/X86/kmov.ll
+5 −0 llvm/test/CodeGen/X86/symbol-name.ll
+5 −5 llvm/test/MC/ELF/cgprofile.s
+3 −0 llvm/test/MC/ELF/symbol-names.s
+79 −0 llvm/test/Transforms/LoopVectorize/AArch64/transform-narrow-interleave-to-widen-memory-with-wide-ops.ll
+73 −0 llvm/test/Transforms/LoopVectorize/AArch64/transform-narrow-interleave-to-widen-memory.ll
+130 −0 llvm/test/Transforms/LoopVectorize/load-deref-pred-align.ll
+36 −0 llvm/test/Transforms/VectorCombine/AArch64/scalarize-ext-extract-endian.ll
+2 −0 llvm/test/Transforms/VectorCombine/PowerPC/lit.local.cfg
+22 −0 llvm/test/Transforms/VectorCombine/PowerPC/scalarize-ext-extract.ll
+82 −32 llvm/tools/llvm-readobj/ELFDumper.cpp
+15 −8 offload/plugins-nextgen/common/src/Utils/ELF.cpp
+5 −1 offload/plugins-nextgen/cuda/src/rtl.cpp
38 changes: 38 additions & 0 deletions tests/ui/async-await/higher-ranked-normalize-assumptions-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//@ revisions: stock hr
//@[hr] compile-flags: -Zhigher-ranked-assumptions
//@ edition: 2024
//@ check-pass

// Test that we don't normalize the higher-ranked assumptions of an auto trait goal
// unless we have `-Zhigher-ranked-assumptions`, since obligations that result from
// this normalization may lead to higher-ranked lifetime errors when the flag is not
// enabled.

// Regression test for <https://github.com/rust-lang/rust/issues/147244>.

pub fn a() -> impl Future + Send {
async {
let queries = core::iter::empty().map(Thing::f);
b(queries).await;
}
}

async fn b(queries: impl IntoIterator) {
c(queries).await;
}

fn c<'a, I>(_queries: I) -> impl Future
where
I: IntoIterator,
I::IntoIter: 'a,
{
async {}
}

pub struct Thing<'a>(pub &'a ());

impl Thing<'_> {
fn f(_: &Self) {}
}

fn main() {}
51 changes: 51 additions & 0 deletions tests/ui/async-await/higher-ranked-normalize-assumptions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//@ revisions: stock hr
//@[hr] compile-flags: -Zhigher-ranked-assumptions
//@ edition: 2024
//@ check-pass

// Test that we don't normalize the higher-ranked assumptions of an auto trait goal
// unless we have `-Zhigher-ranked-assumptions`, since obligations that result from
// this normalization may lead to higher-ranked lifetime errors when the flag is not
// enabled.

// Regression test for <https://github.com/rust-lang/rust/issues/147285>.

pub trait Service {
type Response;
}

impl<T, R> Service for T
where
T: FnMut() -> R,
R: 'static,
{
type Response = R;
}

async fn serve<C>(_: C)
where
C: Service,
C::Response: 'static,
{
connect::<C>().await;
}

async fn connect<C>()
where
C: Service,
C::Response: 'static,
{
}

fn repro() -> impl Send {
async {
let server = || do_something();
serve(server).await;
}
}

fn do_something() -> Box<dyn std::error::Error> {
unimplemented!()
}

fn main() {}
2 changes: 1 addition & 1 deletion tests/ui/attributes/attr-on-mac-call.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ LL | #[link_section = "x"]
| ^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_section]` can be applied to statics and functions
= help: `#[link_section]` can be applied to functions and statics

warning: `#[link_ordinal]` attribute cannot be used on macro calls
--> $DIR/attr-on-mac-call.rs:33:5
Expand Down
26 changes: 26 additions & 0 deletions tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,32 @@ mod link_section {
//~| WARN previously accepted
//~| HELP can be applied to
//~| HELP remove the attribute

#[link_section = "1800"]
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
//~| HELP remove the attribute
trait Tr {
#[link_section = "1800"]
fn inside_tr_no_default(&self);

#[link_section = "1800"]
fn inside_tr_default(&self) { }
}

impl S {
#[link_section = "1800"]
fn inside_abc_123(&self) { }
}

impl Tr for S {
#[link_section = "1800"]
fn inside_tr_no_default(&self) { }
}

#[link_section = "1800"]
fn should_always_link() { }
}


Expand Down
Loading
Loading