Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
5b8f281
new branch, fresh git history.
TirushOne Sep 1, 2026
fc6fa6d
Syntactically reject leading parenthesized precise capturing lists in…
fmease Sep 11, 2026
a9caaf2
move everything into lint decorator
lcnr Oct 2, 2026
533e60d
Minor cleanup in rustc_hir_analysis::collect
fmease Aug 30, 2026
bb356c7
updates the expect message in library/core/src/time.rs
kenta-afk Oct 2, 2026
29d38e4
Support type-relative assoc item paths in generic param defaults & co…
fmease Aug 30, 2026
04a02fd
fix: improve formatting of duration sum calculation for readability
kenta-afk Oct 2, 2026
b6d09f9
replace`fully_monomorphized` with `cx.typing_env()`
lcnr Oct 4, 2026
4fb4b8f
Re-introduce ResultsVisitor::visit_block_exit
Amanieu Sep 23, 2026
34f6848
rigid aliases to non-rigid for fully normalized check
lcnr Oct 3, 2026
6ddabeb
add comment
lcnr Oct 8, 2026
7b151cf
fix(bootstrap/darwin): fix rpath for distributed LLD
rami3l Oct 7, 2026
86a1b2f
When mentioning that closure doesn't implement trait, point at closure
estebank Oct 8, 2026
8f2db6e
Correctly represent doctest source as a `RealFileName` plus line
Urgau Oct 7, 2026
3e422d6
Prefer local paths over remote ones when foreign item is locally reex…
GuillaumeGomez Oct 8, 2026
5941c0b
properly ignore the current goal's usages
sjwang05 Oct 8, 2026
2f9523b
Fix debug assert failure in `note_obligation_cause_code_inner` on the…
RuleOfSix Oct 7, 2026
f774f61
Add precise MIR liveness analysis
Amanieu Sep 23, 2026
c645363
Add dataflow tests for PreciseLiveness
Amanieu Oct 5, 2026
9121436
Replace `CanonicalVarValues` with `I::GenericArgs` in some places
nnethercote Oct 9, 2026
cd7059c
More `CanonicalVarValues` replacement
nnethercote Oct 9, 2026
33bf3c7
Remove some freshly dead code
nnethercote Oct 9, 2026
7b22d00
Avoid some explicit casts to `*const c_char`
Zalathar Oct 9, 2026
de49a78
Remove some unnecessary pointer casts
Zalathar Oct 9, 2026
200fefd
fix `f128` on aarch64 Linux incorrectly sends `g`
cezarbbb Sep 23, 2026
58280c3
don't treat inherited opaques as defining
amirHdev Oct 7, 2026
f21a12a
In the `BestObligation` prooftree visitor, we now only skip any candi…
LorrensP-2158466 Sep 7, 2026
9bc17fd
Don't rewrite alias outlives in smaller universes
BoxyUwU Oct 7, 2026
7d43809
Produce less general higher ranked alias constraints
BoxyUwU Oct 7, 2026
07d67c6
Better debug impls for abby stuff
BoxyUwU Oct 7, 2026
f4b0976
Fix for const generic parameter checking
Jamesbarford Oct 9, 2026
901cebd
Update tests and create new tests for const generic parameter checking
Jamesbarford Oct 9, 2026
e3941d6
const-eval: ICE when we hit a non-const fn
RalfJung Oct 8, 2026
02dbf08
Allow testing cg-gcc on any target
Kobzol Oct 9, 2026
85b2304
Pass `--remap-path-{prefix,scope}` to the `rustc` doctest invocation
Urgau Oct 7, 2026
82be283
Rollup merge of #161998 - fmease:tyrel-in-gen-param-cx, r=jackh726
JonathanBrouwer Oct 9, 2026
05b6c8e
Rollup merge of #162106 - TirushOne:addr-mutability-suggestions, r=ja…
JonathanBrouwer Oct 9, 2026
79c674c
Rollup merge of #162652 - fmease:reject-bare-obj-paren-use, r=adwinwhite
JonathanBrouwer Oct 9, 2026
98476db
Rollup merge of #163337 - Amanieu:move-elimination/precise-liveness, …
JonathanBrouwer Oct 9, 2026
46d4e1d
Rollup merge of #163938 - BoxyUwU:abby_more_correct_alias_rewriting, …
JonathanBrouwer Oct 9, 2026
2d1877d
Rollup merge of #163939 - BoxyUwU:abby_slight_debug_impl_improvements…
JonathanBrouwer Oct 9, 2026
bd1692d
Rollup merge of #163954 - rami3l:fix/bootstrap-darwin-lld, r=Kobzol
JonathanBrouwer Oct 9, 2026
a2170e9
Rollup merge of #163956 - Urgau:rustdoc-doctest-scopes, r=GuillaumeGomez
JonathanBrouwer Oct 9, 2026
2492ed8
Rollup merge of #164042 - Kobzol:cg-gcc-target, r=GuillaumeGomez
JonathanBrouwer Oct 9, 2026
cea8afc
Rollup merge of #162443 - LorrensP-2158466:fix-best-obligation-visito…
JonathanBrouwer Oct 9, 2026
775dae7
Rollup merge of #162908 - Jamesbarford:fix/const-generic-bug, r=khyperia
JonathanBrouwer Oct 9, 2026
0dddb3c
Rollup merge of #163193 - cezarbbb:pac-f128-aarch64-e, r=tgross35
JonathanBrouwer Oct 9, 2026
0fd2196
Rollup merge of #163634 - lcnr:overflow-into-lint, r=adwinwhite
JonathanBrouwer Oct 9, 2026
befee76
Rollup merge of #163666 - kenta-afk:kenta-afk/fix-expect, r=JohnTitor
JonathanBrouwer Oct 9, 2026
b8b41c1
Rollup merge of #163727 - lcnr:check-normalize, r=adwinwhite
JonathanBrouwer Oct 9, 2026
b1d9885
Rollup merge of #163745 - lcnr:use-existing-typing-env-where-possible…
JonathanBrouwer Oct 9, 2026
9ae1a8a
Rollup merge of #163912 - RuleOfSix:ice-escaping-bounds, r=lcnr
JonathanBrouwer Oct 9, 2026
3459218
Rollup merge of #163950 - amirHdev:delegation-inherited-opaques, r=lcnr
JonathanBrouwer Oct 9, 2026
43a9a7f
Rollup merge of #163972 - RalfJung:non-const-eval, r=oli-obk
JonathanBrouwer Oct 9, 2026
c8b148f
Rollup merge of #164000 - estebank:point-at-closure, r=mati865
JonathanBrouwer Oct 9, 2026
c7293f9
Rollup merge of #164007 - GuillaumeGomez:local-path-preferred, r=Urgau
JonathanBrouwer Oct 9, 2026
87b85b0
Rollup merge of #164008 - sjwang05:ignore-usages, r=lcnr
JonathanBrouwer Oct 9, 2026
9a10987
Rollup merge of #164017 - Zalathar:char-ptr-cast, r=mati865
JonathanBrouwer Oct 9, 2026
457e599
Rollup merge of #164025 - nnethercote:less-CanonicalVarValues, r=lcnr
JonathanBrouwer Oct 9, 2026
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
1 change: 1 addition & 0 deletions compiler/rustc_attr_ir/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ pub enum RustcDumpLayoutKind {
#[derive(Clone, Debug, StableHash, Encodable, Decodable, PrintAttribute, PartialEq, Eq)]
pub enum RustcMirKind {
PrettyLiveLocals,
PrettyPreciseLiveness,
PrettyTransitiveLiveLocals,
PeekMaybeInit,
PeekMaybeUninit,
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/rustc_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ impl CombineAttributeParser for RustcMirParser {
cx.expect_no_args(mi.args())?;
Some(RustcMirKind::PrettyLiveLocals)
}
sym::rustc_pretty_precise_liveness => {
cx.expect_no_args(mi.args())?;
Some(RustcMirKind::PrettyPreciseLiveness)
}
sym::rustc_pretty_transitive_live_locals => {
cx.expect_no_args(mi.args())?;
Some(RustcMirKind::PrettyTransitiveLiveLocals)
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_cranelift/src/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_abi::{CanonAbi, ExternAbi, X86Call};
use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization;
use rustc_codegen_ssa::diagnostics::CompilerBuiltinsCannotCall;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::ty::layout::FnAbiOf;
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv as _};
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::{ShimKind, TypeVisitableExt};
use rustc_session::Session;
Expand Down Expand Up @@ -441,7 +441,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
let instance = if let ty::FnDef(def_id, fn_args) = *func.layout().ty.kind() {
let instance = ty::Instance::expect_resolve(
fx.tcx,
ty::TypingEnv::fully_monomorphized(),
fx.typing_env(),
def_id,
fn_args.no_bound_vars().unwrap(),
source_info.span,
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_codegen_cranelift/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
let func_ref = fx.get_function_ref(
Instance::resolve_for_fn_ptr(
fx.tcx,
ty::TypingEnv::fully_monomorphized(),
fx.typing_env(),
def_id,
args.no_bound_vars().unwrap(),
)
Expand Down Expand Up @@ -771,8 +771,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:

fn is_wide_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
ty.builtin_deref(true).is_some_and(|pointee_ty| {
fx.tcx
.type_has_metadata(pointee_ty, ty::TypingEnv::fully_monomorphized())
fx.tcx.type_has_metadata(pointee_ty, fx.typing_env())
})
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_cranelift/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use rustc_abi::{Float, Integer, Primitive};
use rustc_index::IndexVec;
use rustc_middle::ty::TypeFoldable;
use rustc_middle::ty::layout::{
self, FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers,
codegen_handle_fn_abi_err,
self, FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasTypingEnv as _, LayoutError,
LayoutOfHelpers, codegen_handle_fn_abi_err,
};
use rustc_span::Symbol;
use rustc_target::callconv::FnAbi;
Expand Down Expand Up @@ -351,7 +351,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
{
self.instance.instantiate_mir_and_normalize_erasing_regions(
self.tcx,
ty::TypingEnv::fully_monomorphized(),
self.typing_env(),
ty::EarlyBinder::bind(self.tcx, value),
)
}
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_cranelift/src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::mir::interpret::{
AllocId, GlobalAlloc, PointerArithmetic, Scalar, read_target_uint,
};
use rustc_middle::ty::layout::HasTypingEnv as _;
use rustc_middle::ty::{ExistentialTraitRef, ScalarInt};

use crate::prelude::*;
Expand Down Expand Up @@ -81,7 +82,7 @@ pub(crate) fn eval_mir_constant<'tcx>(
let cv = fx.monomorphize(constant.const_);
// This cannot fail because we checked all required_consts in advance.
let val = cv
.eval(fx.tcx, ty::TypingEnv::fully_monomorphized(), constant.span)
.eval(fx.tcx, fx.typing_env(), constant.span)
.expect("erroneous constant missed by mono item collection");
(val, cv.ty())
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_cranelift/src/inline_asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_abi::CanonAbi;
use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_attr_ir::lang_items::LangItem;
use rustc_middle::mir::interpret::{GlobalAlloc, PointerArithmetic, Scalar as ConstScalar};
use rustc_middle::ty::layout::FnAbiOf;
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv as _};
use rustc_span::sym;
use rustc_target::asm::*;
use rustc_target::spec::Arch;
Expand Down Expand Up @@ -175,7 +175,7 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
if let ty::FnDef(def_id, args) = *const_.ty().kind() {
let instance = ty::Instance::resolve_for_fn_ptr(
fx.tcx,
ty::TypingEnv::fully_monomorphized(),
fx.typing_env(),
def_id,
args.no_bound_vars().unwrap(),
)
Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use cranelift_codegen::ir::{
};
use rustc_middle::ty;
use rustc_middle::ty::GenericArgsRef;
use rustc_middle::ty::layout::ValidityRequirement;
use rustc_middle::ty::layout::{HasTypingEnv as _, ValidityRequirement};
use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
use rustc_span::{Spanned, Symbol, sym};
use rustc_target::spec::PanicStrategy;
Expand Down Expand Up @@ -729,10 +729,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
if let Some(requirement) = requirement {
let do_panic = !fx
.tcx
.check_validity_requirement((
requirement,
ty::TypingEnv::fully_monomorphized().as_query_input(ty),
))
.check_validity_requirement((requirement, fx.typing_env().as_query_input(ty)))
.expect("expect to have layout during codegen");

if do_panic {
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_cranelift/src/num.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! Various operations on integer and floating-point numbers

use rustc_middle::ty::layout::HasTypingEnv as _;

use crate::codegen_f16_f128;
use crate::prelude::*;

Expand Down Expand Up @@ -437,7 +439,7 @@ fn codegen_ptr_binop<'tcx>(
.layout()
.ty
.builtin_deref(true)
.map(|ty| !fx.tcx.type_has_metadata(ty, ty::TypingEnv::fully_monomorphized()))
.map(|ty| !fx.tcx.type_has_metadata(ty, fx.typing_env()))
.unwrap_or(true);

if is_thin_ptr {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_cranelift/src/value_and_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ impl<'tcx> CPlace<'tcx> {
};

let (field_ptr, field_layout) = codegen_field(fx, base, extra, layout, field);
if fx.tcx.type_has_metadata(field_layout.ty, ty::TypingEnv::fully_monomorphized()) {
if fx.tcx.type_has_metadata(field_layout.ty, fx.typing_env()) {
CPlace::for_ptr_with_extra(field_ptr, extra.unwrap(), field_layout)
} else {
CPlace::for_ptr(field_ptr, field_layout)
Expand Down Expand Up @@ -808,7 +808,7 @@ impl<'tcx> CPlace<'tcx> {

pub(crate) fn place_deref(self, fx: &mut FunctionCx<'_, '_, 'tcx>) -> CPlace<'tcx> {
let inner_layout = fx.layout_of(self.layout().ty.builtin_deref(true).unwrap());
if fx.tcx.type_has_metadata(inner_layout.ty, ty::TypingEnv::fully_monomorphized()) {
if fx.tcx.type_has_metadata(inner_layout.ty, fx.typing_env()) {
let (addr, extra) = self.to_cvalue(fx).load_scalar_pair(fx);
CPlace::for_ptr_with_extra(Pointer::new(addr), extra, inner_layout)
} else {
Expand All @@ -821,7 +821,7 @@ impl<'tcx> CPlace<'tcx> {
fx: &mut FunctionCx<'_, '_, 'tcx>,
layout: TyAndLayout<'tcx>,
) -> CValue<'tcx> {
if fx.tcx.type_has_metadata(self.layout().ty, ty::TypingEnv::fully_monomorphized()) {
if fx.tcx.type_has_metadata(self.layout().ty, fx.typing_env()) {
let (ptr, extra) = self.to_ptr_unsized();
CValue::by_val_pair(ptr.get_addr(fx), extra, layout)
} else {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_gcc/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use rustc_middle::mir::interpret::{
self, ConstAllocation, CtfeProvenance, ErrorHandled, Scalar as InterpScalar, read_target_uint,
};
use rustc_middle::mono::MonoItem;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, Instance};
use rustc_middle::ty::Instance;
use rustc_middle::ty::layout::{HasTypingEnv as _, LayoutOf};
use rustc_span::def_id::DefId;
use rustc_span::{bug, span_bug};

Expand Down Expand Up @@ -251,7 +251,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
let gcc_type = if nested {
self.type_i8()
} else {
let ty = instance.ty(self.tcx, ty::TypingEnv::fully_monomorphized());
let ty = instance.ty(self.tcx, self.typing_env());
self.layout_of(ty).gcc_type(self)
};

Expand Down
8 changes: 3 additions & 5 deletions compiler/rustc_codegen_gcc/src/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use gccjit::{
use rustc_abi::{CanonAbi, Endian, ExternAbi};
use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeCodegenMethods, BuilderMethods, OverflowOp};
use rustc_middle::ty::{self, Ty};
use rustc_middle::ty::Ty;
use rustc_middle::ty::layout::HasTypingEnv as _;
use rustc_target::callconv::{ArgAbi, ArgAttributes, FnAbi, PassMode};
use rustc_type_ir::{Interner, TyKind};

Expand Down Expand Up @@ -387,10 +388,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
128 => self.tcx.types.i128,
_ => unreachable!("unexpected integer size"),
};
let layout = self
.tcx
.layout_of(ty::TypingEnv::fully_monomorphized().as_query_input(res_ty))
.unwrap();
let layout = self.tcx.layout_of(self.cx.typing_env().as_query_input(res_ty)).unwrap();

let arg_abi = ArgAbi { layout, mode: PassMode::Direct(ArgAttributes::new()) };
let mut fn_abi = FnAbi {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_gcc/src/intrinsic/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, BuilderMethods, LayoutTy
use rustc_hir as hir;
use rustc_middle::mir::BinOp;
use rustc_middle::ty::consts::ConstExt;
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv as _, LayoutOf};
use rustc_middle::ty::{self, Ty};
use rustc_span::{ErrorGuaranteed, Span, Symbol, span_bug, sym};

Expand Down Expand Up @@ -540,7 +540,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
match *in_elem.kind() {
ty::RawPtr(p_ty, _) => {
let metadata = p_ty.ptr_metadata_ty(bx.tcx, |ty| {
bx.tcx.normalize_erasing_regions(ty::TypingEnv::fully_monomorphized(), ty)
bx.tcx.normalize_erasing_regions(bx.typing_env(), ty)
});
require!(
metadata.is_unit(),
Expand All @@ -554,7 +554,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
match *out_elem.kind() {
ty::RawPtr(p_ty, _) => {
let metadata = p_ty.ptr_metadata_ty(bx.tcx, |ty| {
bx.tcx.normalize_erasing_regions(ty::TypingEnv::fully_monomorphized(), ty)
bx.tcx.normalize_erasing_regions(bx.typing_env(), ty)
});
require!(
metadata.is_unit(),
Expand Down
9 changes: 2 additions & 7 deletions compiler/rustc_codegen_llvm/src/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,7 @@ fn fat_lto(
let data = bc_decoded.data();

unsafe {
if !llvm::LLVMRustLinkerAdd(
linker,
data.as_ptr() as *const libc::c_char,
data.len(),
) {
if !llvm::LLVMRustLinkerAdd(linker, data.as_ptr(), data.len()) {
llvm::LLVMRustLinkerFree(linker);
write::llvm_err(dcx, LlvmError::LoadBitcode { name })
}
Expand All @@ -327,10 +323,9 @@ fn fat_lto(

// Internalize everything below threshold to help strip out more modules and such.
unsafe {
let ptr = symbols_below_threshold.as_ptr();
llvm::LLVMRustRunRestrictionPass(
llmod,
ptr as *const *const libc::c_char,
symbols_below_threshold.as_ptr(),
symbols_below_threshold.len() as libc::size_t,
);
}
Expand Down
12 changes: 3 additions & 9 deletions compiler/rustc_codegen_llvm/src/builder/autodiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_codegen_ssa::mir::place::PlaceValue;
use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, BuilderMethods, ReturnSlot};
use rustc_data_structures::thin_vec::ThinVec;
use rustc_middle::ty;
use rustc_middle::ty::{PseudoCanonicalInput, Ty, TyCtxt, TypingEnv};
use rustc_middle::ty::{Ty, TyCtxt, TypingEnv};
use rustc_span::bug;
use rustc_target::callconv::PassMode;
use tracing::debug;
Expand Down Expand Up @@ -50,12 +50,8 @@ pub(crate) fn adjust_activity_to_abi<'tcx>(
if let ty::Slice(element_ty) = tail_ty.kind() {
// Now we need to figure out the size of each slice element in memory to allow
// safety checks and usability improvements in the backend.
let pci = PseudoCanonicalInput {
typing_env: TypingEnv::fully_monomorphized(),
value: *element_ty,
};

let layout = tcx.layout_of(pci);
let layout = tcx.layout_of(typing_env.as_query_input(*element_ty));
let elem_size = match layout {
Ok(layout) => layout.size,
Err(_) => {
Expand Down Expand Up @@ -91,9 +87,7 @@ pub(crate) fn adjust_activity_to_abi<'tcx>(
}
}

let pci = PseudoCanonicalInput { typing_env: TypingEnv::fully_monomorphized(), value: *ty };

let layout = match tcx.layout_of(pci) {
let layout = match tcx.layout_of(typing_env.as_query_input(*ty)) {
Ok(layout) => layout.layout,
Err(_) => {
bug!("failed to compute layout for type {:?}", ty);
Expand Down
10 changes: 2 additions & 8 deletions compiler/rustc_codegen_llvm/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,20 +470,14 @@ pub(crate) fn val_ty(v: &Value) -> &Type {
}

pub(crate) fn bytes_in_context<'ll>(llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
unsafe {
let ptr = bytes.as_ptr() as *const c_char;
llvm::LLVMConstStringInContext2(llcx, ptr, bytes.len(), TRUE)
}
unsafe { llvm::LLVMConstStringInContext2(llcx, bytes.as_ptr(), bytes.len(), TRUE) }
}

pub(crate) fn null_terminate_bytes_in_context<'ll>(
llcx: &'ll llvm::Context,
bytes: &[u8],
) -> &'ll Value {
unsafe {
let ptr = bytes.as_ptr() as *const c_char;
llvm::LLVMConstStringInContext2(llcx, ptr, bytes.len(), FALSE)
}
unsafe { llvm::LLVMConstStringInContext2(llcx, bytes.as_ptr(), bytes.len(), FALSE) }
}

pub(crate) fn named_struct<'ll>(ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
Expand Down
14 changes: 3 additions & 11 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::borrow::{Borrow, Cow};
use std::cell::{Cell, RefCell};
use std::ffi::{CStr, c_char, c_uint};
use std::ffi::{CStr, c_uint};
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
use std::str;
Expand Down Expand Up @@ -911,19 +911,11 @@ impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> {
}

pub(crate) fn get_md_kind_id(&self, name: &str) -> llvm::MetadataKindId {
unsafe {
llvm::LLVMGetMDKindIDInContext(
self.llcx(),
name.as_ptr() as *const c_char,
name.len() as c_uint,
)
}
unsafe { llvm::LLVMGetMDKindIDInContext(self.llcx(), name.as_ptr(), name.len() as c_uint) }
}

pub(crate) fn create_metadata(&self, name: &[u8]) -> &'ll Metadata {
unsafe {
llvm::LLVMMDStringInContext2(self.llcx(), name.as_ptr() as *const c_char, name.len())
}
unsafe { llvm::LLVMMDStringInContext2(self.llcx(), name.as_ptr(), name.len()) }
}

pub(crate) fn get_functions(&self) -> Vec<&'ll Value> {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use rustc_middle::mir::BinOp;
use rustc_middle::ty::consts::ConstExt;
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, HasTypingEnv, LayoutOf};
use rustc_middle::ty::offload_meta::OffloadMetadata;
use rustc_middle::ty::{self, GenericArgsRef, Instance, SimdAlign, Ty, TyCtxt, TypingEnv};
use rustc_middle::ty::{self, GenericArgsRef, Instance, SimdAlign, Ty, TyCtxt};
use rustc_session::diagnostics::feature_err;
use rustc_span::{ErrorGuaranteed, Span, Symbol, bug, span_bug, sym};
use rustc_structures::CrateType;
Expand Down Expand Up @@ -1886,7 +1886,7 @@ fn codegen_autodiff<'ll, 'tcx>(
adjust_activity_to_abi(
tcx,
source_fn_ptr_ty,
TypingEnv::fully_monomorphized(),
bx.cx.typing_env(),
&mut diff_attrs.input_activity,
);

Expand Down
5 changes: 1 addition & 4 deletions compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,7 @@ pub(crate) mod Enzyme_AD {
let c_fun_name = std::ffi::CString::new(fun_name)
.unwrap_or_else(|err| bug!("failed to set_print_type_fun: {err}"));
unsafe {
(self.EnzymeSetCLString)(
self.EnzymeFunctionToAnalyze,
c_fun_name.as_ptr() as *const c_char,
);
(self.EnzymeSetCLString)(self.EnzymeFunctionToAnalyze, c_fun_name.as_ptr());
}
}

Expand Down
Loading
Loading