Skip to content

Rollup of 14 pull requests #144269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 70 commits into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
eda2d0d
fix typos
ffengyu Jul 18, 2025
de3578a
Merge pull request #2511 from ffengyu/errata
tshepang Jul 18, 2025
b2e94bf
Add test demonstrating current beta `#[align]` name resolution regres…
jieyouxu Jul 17, 2025
69b71e4
Mitigate `#[align]` name resolution ambiguity regression with a rename
jieyouxu Jul 17, 2025
966fc57
`SmirCtxt` to `CompilerCtxt`, `SmirInterface` to `CompilerInterface`
makai410 Jul 15, 2025
7f22e88
`SmirContainer` to `Container`
makai410 Jul 15, 2025
ad0de06
use "helper" as a more descriptive name
makai410 Jul 15, 2025
08e3cf5
rename `ui-fulldeps/stable-mir`
makai410 Jul 15, 2025
9a37aab
rename `ui/stable-mir-print`
makai410 Jul 15, 2025
a1deaa7
`SmirError` to `Error`
makai410 Jul 15, 2025
9533871
Update docs in `rustc_public_bridge`
makai410 Jul 15, 2025
483877a
Update docs in `rustc_public`
makai410 Jul 15, 2025
4d79328
use `RustcPublic` instead of `StableMir`
makai410 Jul 15, 2025
20a7f72
fix `ui/rustc_public-ir-print` outputs
makai410 Jul 17, 2025
3fb1af3
enzyme submodule update
ZuseZ4 Jul 18, 2025
42d6b0d
make more builder functions generic
ZuseZ4 Jun 18, 2025
6340164
add -Zoffload=Enable flag behind -Zunstable-options, to enable gpu (h…
ZuseZ4 Jun 18, 2025
5958ebe
add various wrappers for gpu code generation
ZuseZ4 Jul 2, 2025
4a1a5a4
gpu host code generation
ZuseZ4 Jul 2, 2025
e2ab312
add gpu offload codegen host side test
ZuseZ4 Jul 18, 2025
c068599
add unstable-books doc for offload
ZuseZ4 Jul 18, 2025
196833c
Fix ide-assist: Deref transtive
A4-Tacks Jul 19, 2025
54d9743
Add Deref -> DerefMut for generate_mut_trait_impl
A4-Tacks Jul 19, 2025
2f46cde
minor: remove unused var
Young-Flash Jul 19, 2025
e49e107
Merge pull request #20258 from Young-Flash/remove_unused
lnicola Jul 19, 2025
bb46b8c
Allow selecting check tool `Mode` based on `Builder`
Kobzol Jul 11, 2025
245d2c9
Implement `check::Compiletest` using the `tool_check_step` macro
Kobzol Jul 11, 2025
fc74c22
Add approval blocking labels for new bors
Kobzol Jul 19, 2025
a6c7cea
Fix search of raw labels and lifetimes
ChayimFriedman2 Jul 19, 2025
8b6559b
Support `cfg_select!`
ChayimFriedman2 Jul 20, 2025
fdf8bdb
Remove the ptr_unique lang item
bjorn3 Jul 20, 2025
2eaba02
Merge pull request #20265 from ChayimFriedman2/cfg-select
lnicola Jul 20, 2025
fa0320d
Merge pull request #20255 from A4-Tacks/deref-intranstive
lnicola Jul 20, 2025
313dff1
Add test.
cjgillot Jul 4, 2025
7da6fd1
Lower extra lifetimes before normal generic params.
cjgillot Jul 4, 2025
3f9be40
fix handling of base address for TypeId allocations
RalfJung Jul 19, 2025
e68f5fe
Implement `check::RustAnalyzer` using the `tool_check_step` macro
Kobzol Jul 11, 2025
192efbb
clippy: make tests work in stage 1
RalfJung Jul 16, 2025
897d007
Prepare for merging from rust-lang/rust
invalid-email-address Jul 21, 2025
ad20b06
Merge ref '460259d14de0' from rust-lang/rust
invalid-email-address Jul 21, 2025
33d62b5
Merge pull request #20262 from ChayimFriedman2/goto-ref-raw
ShoyuVanilla Jul 21, 2025
4bbe74b
Merge pull request #20256 from A4-Tacks/gen-mut-trait-deref
ShoyuVanilla Jul 21, 2025
750c1e9
Preparing for merge from rust-lang/rust
lnicola Jul 21, 2025
2f14119
Merge from rust-lang/rust
lnicola Jul 21, 2025
1482809
Bump rustc crates
lnicola Jul 21, 2025
f263364
Bump rustc-literal-escaper
lnicola Jul 21, 2025
2050358
Revert "Bump rustc-literal-escaper"
lnicola Jul 21, 2025
da90db7
Downgrade ra-ap-rustc_parse_format
lnicola Jul 21, 2025
8f67bcf
Merge pull request #20268 from lnicola/sync-from-rust
lnicola Jul 21, 2025
1fd0697
Remove Retag for Unique
bjorn3 Jul 21, 2025
79e3c7d
fix some typos
tshepang Jul 21, 2025
4a45ab5
Merge pull request #2513 from rust-lang/tshepang/typos
tshepang Jul 21, 2025
74ba9cb
Don't use another main test file as auxiliary
jieyouxu Jul 21, 2025
62e3a05
Merge pull request #2512 from rust-lang/rustc-pull
tshepang Jul 21, 2025
3c76e3d
Constify Try, From, TryFrom
Randl Jul 21, 2025
c193f30
opt-dist: make `artifact-dir` an absolute path for `opt-dist local`
ognevny Jul 21, 2025
5e3eb25
Rollup merge of #142097 - ZuseZ4:offload-host1, r=oli-obk
jieyouxu Jul 21, 2025
a99f3af
Rollup merge of #143430 - cjgillot:extra-lifetime-swap, r=oli-obk
jieyouxu Jul 21, 2025
1f8b531
Rollup merge of #143768 - Randl:const-try, r=oli-obk
jieyouxu Jul 21, 2025
38efe38
Rollup merge of #143816 - Kobzol:compiletest-check-macro, r=jieyouxu
jieyouxu Jul 21, 2025
2e0748b
Rollup merge of #143985 - makai410:rp-rename, r=oli-obk
jieyouxu Jul 21, 2025
a3ab807
Rollup merge of #144027 - RalfJung:clippy, r=Mark-Simulacrum
jieyouxu Jul 21, 2025
ef4a7fb
Rollup merge of #144080 - jieyouxu:realign, r=BoxyUwU
jieyouxu Jul 21, 2025
0fd009f
Rollup merge of #144176 - Kobzol:bors-labels-blocking, r=oli-obk
jieyouxu Jul 21, 2025
9e9399f
Rollup merge of #144187 - RalfJung:type-id-base-addr, r=oli-obk
jieyouxu Jul 21, 2025
551cef9
Rollup merge of #144212 - bjorn3:remove_unique_lang_item, r=oli-obk
jieyouxu Jul 21, 2025
05f80f7
Rollup merge of #144243 - lnicola:sync-from-ra, r=lnicola
jieyouxu Jul 21, 2025
55a477e
Rollup merge of #144246 - jieyouxu:no-dual-test, r=lqd,RalfJung
jieyouxu Jul 21, 2025
43fa3f5
Rollup merge of #144251 - tshepang:rdg-sync, r=jieyouxu
jieyouxu Jul 21, 2025
6628a4a
Rollup merge of #144254 - ognevny:opt-dist-artifact-dir, r=Kobzol
jieyouxu Jul 21, 2025
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
29 changes: 18 additions & 11 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -874,25 +874,32 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
/// name resolver owing to lifetime elision; this also populates the resolver's node-id->def-id
/// map, so that later calls to `opt_node_id_to_def_id` that refer to these extra lifetime
/// parameters will be successful.
#[instrument(level = "debug", skip(self))]
#[instrument(level = "debug", skip(self), ret)]
#[inline]
fn lower_lifetime_binder(
&mut self,
binder: NodeId,
generic_params: &[GenericParam],
) -> &'hir [hir::GenericParam<'hir>] {
let mut generic_params: Vec<_> = self
.lower_generic_params_mut(generic_params, hir::GenericParamSource::Binder)
.collect();
// Start by creating params for extra lifetimes params, as this creates the definitions
// that may be referred to by the AST inside `generic_params`.
let extra_lifetimes = self.resolver.extra_lifetime_params(binder);
debug!(?extra_lifetimes);
generic_params.extend(extra_lifetimes.into_iter().filter_map(|(ident, node_id, res)| {
self.lifetime_res_to_generic_param(ident, node_id, res, hir::GenericParamSource::Binder)
}));
let generic_params = self.arena.alloc_from_iter(generic_params);
debug!(?generic_params);

generic_params
let extra_lifetimes: Vec<_> = extra_lifetimes
.into_iter()
.filter_map(|(ident, node_id, res)| {
self.lifetime_res_to_generic_param(
ident,
node_id,
res,
hir::GenericParamSource::Binder,
)
})
.collect();
let arena = self.arena;
let explicit_generic_params =
self.lower_generic_params_mut(generic_params, hir::GenericParamSource::Binder);
arena.alloc_from_iter(explicit_generic_params.chain(extra_lifetimes.into_iter()))
}

fn with_dyn_type_scope<T>(&mut self, in_scope: bool, f: impl FnOnce(&mut Self) -> T) -> T {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_attr_data_structures/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ pub enum CfgEntry {
pub enum AttributeKind {
// tidy-alphabetical-start
/// Represents `#[align(N)]`.
// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
Align { align: Align, span: Span },

/// Represents `#[rustc_allow_const_fn_unstable]`.
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ impl<S: Stage> AttributeParser<S> for NakedParser {
sym::instruction_set,
sym::repr,
sym::rustc_std_internal_symbol,
sym::align,
// FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity
sym::rustc_align,
// obviously compatible with self
sym::naked,
// documentation
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ fn parse_alignment(node: &LitKind) -> Result<Align, &'static str> {
pub(crate) struct AlignParser(Option<(Align, Span)>);

impl AlignParser {
const PATH: &'static [Symbol] = &[sym::align];
const PATH: &'static [Symbol] = &[sym::rustc_align];
const TEMPLATE: AttributeTemplate = template!(List: "<alignment in bytes>");

fn parse<'c, S: Stage>(
Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ pub(crate) fn run_pass_manager(
// We then run the llvm_optimize function a second time, to optimize the code which we generated
// in the enzyme differentiation pass.
let enable_ad = config.autodiff.contains(&config::AutoDiff::Enable);
let enable_gpu = config.offload.contains(&config::Offload::Enable);
let stage = if thin {
write::AutodiffStage::PreAD
} else {
Expand All @@ -668,6 +669,12 @@ pub(crate) fn run_pass_manager(
write::llvm_optimize(cgcx, dcx, module, None, config, opt_level, opt_stage, stage)?;
}

if enable_gpu && !thin {
let cx =
SimpleCx::new(module.module_llvm.llmod(), &module.module_llvm.llcx, cgcx.pointer_size);
crate::builder::gpu_offload::handle_gpu_code(cgcx, &cx);
}

if cfg!(llvm_enzyme) && enable_ad && !thin {
let cx =
SimpleCx::new(module.module_llvm.llmod(), &module.module_llvm.llcx, cgcx.pointer_size);
Expand Down
69 changes: 69 additions & 0 deletions compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::ops::Deref;
use std::{iter, ptr};

pub(crate) mod autodiff;
pub(crate) mod gpu_offload;

use libc::{c_char, c_uint, size_t};
use rustc_abi as abi;
Expand Down Expand Up @@ -117,6 +118,74 @@ impl<'a, 'll, CX: Borrow<SCx<'ll>>> GenericBuilder<'a, 'll, CX> {
}
bx
}

// The generic builder has less functionality and thus (unlike the other alloca) we can not
// easily jump to the beginning of the function to place our allocas there. We trust the user
// to manually do that. FIXME(offload): improve the genericCx and add more llvm wrappers to
// handle this.
pub(crate) fn direct_alloca(&mut self, ty: &'ll Type, align: Align, name: &str) -> &'ll Value {
let val = unsafe {
let alloca = llvm::LLVMBuildAlloca(self.llbuilder, ty, UNNAMED);
llvm::LLVMSetAlignment(alloca, align.bytes() as c_uint);
// Cast to default addrspace if necessary
llvm::LLVMBuildPointerCast(self.llbuilder, alloca, self.cx.type_ptr(), UNNAMED)
};
if name != "" {
let name = std::ffi::CString::new(name).unwrap();
llvm::set_value_name(val, &name.as_bytes());
}
val
}

pub(crate) fn inbounds_gep(
&mut self,
ty: &'ll Type,
ptr: &'ll Value,
indices: &[&'ll Value],
) -> &'ll Value {
unsafe {
llvm::LLVMBuildGEPWithNoWrapFlags(
self.llbuilder,
ty,
ptr,
indices.as_ptr(),
indices.len() as c_uint,
UNNAMED,
GEPNoWrapFlags::InBounds,
)
}
}

pub(crate) fn store(&mut self, val: &'ll Value, ptr: &'ll Value, align: Align) -> &'ll Value {
debug!("Store {:?} -> {:?}", val, ptr);
assert_eq!(self.cx.type_kind(self.cx.val_ty(ptr)), TypeKind::Pointer);
unsafe {
let store = llvm::LLVMBuildStore(self.llbuilder, val, ptr);
llvm::LLVMSetAlignment(store, align.bytes() as c_uint);
store
}
}

pub(crate) fn load(&mut self, ty: &'ll Type, ptr: &'ll Value, align: Align) -> &'ll Value {
unsafe {
let load = llvm::LLVMBuildLoad2(self.llbuilder, ty, ptr, UNNAMED);
llvm::LLVMSetAlignment(load, align.bytes() as c_uint);
load
}
}

fn memset(&mut self, ptr: &'ll Value, fill_byte: &'ll Value, size: &'ll Value, align: Align) {
unsafe {
llvm::LLVMRustBuildMemSet(
self.llbuilder,
ptr,
align.bytes() as c_uint,
fill_byte,
size,
false,
);
}
}
}

/// Empty string, to be used where LLVM expects an instruction name, indicating
Expand Down
Loading
Loading