Skip to content

Rollup of 5 pull requests #143250

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

Closed
wants to merge 142 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
6c982df
Remove get_dbg_loc from DebugInfoBuilderMethods
bjorn3 Jun 3, 2025
9eced6c
Remove type_test from IntrinsicCallBuilderMethods
bjorn3 Jun 3, 2025
46575f1
Only borrow EncodedMetadata in codegen_crate
bjorn3 May 30, 2025
7ed4c58
Move metadata object generation for dylibs to the linker code
bjorn3 May 30, 2025
0f7ec70
cg_gcc: convert to CanonAbi
workingjubilee May 21, 2025
906fc5c
Rollup merge of #141569 - workingjubilee:canonicalize-abi, r=bjorn3
matthiaskrgr Jun 3, 2025
620a4f3
Add new Tier-3 targets: `loongarch32-unknown-none*`
heiher Jan 9, 2025
3f2666c
store `target.min_global_align` as an `Align`
folkertdev Jun 7, 2025
10129e4
Use the in-tree `compiler-builtins`
tgross35 Jun 4, 2025
5f20249
Remove all unused feature gates from the compiler
bjorn3 Jun 8, 2025
732253f
Rollup merge of #142179 - folkertdev:min-global-align-parse, r=workin…
workingjubilee Jun 9, 2025
9f85857
Rollup merge of #142194 - bjorn3:less_unstable_features, r=jieyouxu
workingjubilee Jun 9, 2025
f485c26
-Zretpoline and -Zretpoline-external-thunk flags (target modifiers) t…
azhogin Jan 15, 2025
98e21c8
Rollup merge of #141993 - tgross35:use-in-tree-builtins, r=bjorn3
tgross35 Jun 9, 2025
fa425db
Simplify implementation of Rust intrinsics by using type parameters i…
sayantn May 30, 2025
f5c6288
intrinsics: rename min_align_of to align_of
RalfJung Jun 12, 2025
65042d6
add `extern "custom"` functions
folkertdev May 7, 2025
1ff33b5
Unimplement unsized_locals
mejrs Jun 12, 2025
ad90ea8
Rollup merge of #135927 - azhogin:azhogin/retpoline, r=davidtwco
matthiaskrgr Jun 13, 2025
3766fb2
Rollup merge of #140770 - folkertdev:custom-abi, r=tgross35
matthiaskrgr Jun 13, 2025
baaf8da
Auto merge of #142443 - matthiaskrgr:rollup-l1l6d0v, r=matthiaskrgr
bors Jun 13, 2025
4ffcf80
Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errors
matthiaskrgr Jun 14, 2025
3c96f6e
Remove all support for wasm's legacy ABI
bjorn3 Dec 6, 2024
5b660c5
Auto merge of #142259 - sayantn:simplify-intrinsics, r=workingjubilee
bors Jun 14, 2025
29e0e4f
Rollup merge of #133952 - bjorn3:remove_wasm_legacy_abi, r=alexcrichton
fmease Jun 15, 2025
8f47346
Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, r=wo…
fmease Jun 15, 2025
308ca33
Fix RISC-V C function ABI when passing/returning structs containing f…
beetrees Apr 3, 2025
de5c506
update to literal-escaper 0.0.4 for better API without `unreachable` …
hkBst Mar 7, 2025
74e92a8
Format goto_type_definition
lnicola Jun 16, 2025
5615d05
Change __rust_no_alloc_shim_is_unstable to be a function
dpaoliello May 15, 2025
e9d795d
cranelift/gcc: `{Meta,Pointee,}Sized` in minicore
davidtwco Mar 5, 2025
2811b34
Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obk
bors Jun 17, 2025
265f4a7
Auto merge of #141061 - dpaoliello:shimasfn, r=bjorn3
bors Jun 18, 2025
efb7997
Merge commit 'fda0bb9588912a3e0606e880ca9f6e913cf8a5a4' into subtree-…
GuillaumeGomez Jun 18, 2025
6bbf8b1
GCC backend: Remove `add_eval` if no function is created
GuillaumeGomez Jun 18, 2025
25eb2ee
move cfg(target_feature) computation into shared place
RalfJung May 10, 2025
63c9292
move -Ctarget-feature handling into shared code
RalfJung May 23, 2025
3a0881c
cg_gcc: properly populate cfg(target_features) with -Ctarget-features
RalfJung May 11, 2025
1aabebc
various minor target feature cleanups
RalfJung Jun 14, 2025
f8db66b
Remove dead instructions in terminate blocks
Mark-Simulacrum Jun 22, 2025
47b29ea
In "Wrap return type" assist, don't wrap exit points if they already …
ChayimFriedman2 Jun 22, 2025
a78bc7c
Don't run doctests
ChayimFriedman2 Jun 22, 2025
3db7cff
Preparing for merge from rust-lang/rust
lnicola Jun 23, 2025
3c4a690
Merge from rust-lang/rust
lnicola Jun 23, 2025
18855c9
Document sysroot_project field in rust-project.json
Wilfred Jun 23, 2025
4b37534
Merge pull request #20063 from lnicola/sync-from-rust
lnicola Jun 23, 2025
d0ebff0
fix: Fix cargo project manifest not pointing to the workspace root
Veykril Jun 23, 2025
6c3a870
Merge pull request #20069 from Veykril/push-mnqkqxomtlxn
Veykril Jun 23, 2025
b3c7913
fix: Use `ROOT` hygiene for `args` inside new `format_args!` expansion
ShoyuVanilla Jun 23, 2025
dd142e4
Merge pull request #20073 from ShoyuVanilla/fix-fmt-args-hygiene
ChayimFriedman2 Jun 23, 2025
c37994c
fix: Respect `.cargo/config.toml` `build.target-dir`
Veykril Jun 23, 2025
e40aa42
Add troubleshooting FAQ to the book
ChayimFriedman2 Jun 23, 2025
c751049
Merge pull request #20076 from ChayimFriedman2/faq
lnicola Jun 23, 2025
98e7b94
feat: Extend vscode 'run' command with optional mode argument for run…
markpots5 Jun 23, 2025
7ce7c2e
Merge pull request #20072 from Veykril/push-sorvvvzskywv
Veykril Jun 24, 2025
c30af1b
Merge pull request #20062 from ChayimFriedman2/doctests
Veykril Jun 24, 2025
1d3b517
Do not default to 'static for trait object lifetimes
Veykril Jun 18, 2025
bb164bf
Merge pull request #20036 from Veykril/push-yquvoyrxkksx
Veykril Jun 24, 2025
04c9089
Merge pull request #20064 from Wilfred/document_sysroot_project
Veykril Jun 24, 2025
e8388b0
Merge pull request #20061 from ChayimFriedman2/wrap-ret-ty
Veykril Jun 24, 2025
40aeda9
Cleanup `folding_ranges` and support more things
Veykril Jun 24, 2025
1fffcff
Merge pull request #20080 from Veykril/push-vnrwqppplykm
Veykril Jun 24, 2025
0b648f8
Merge pull request #20012 from lnicola/bump-literal-escaper
Veykril Jun 24, 2025
7eb776e
Remove special casing in command factory (revert changes in ctx.ts), …
markpots5 Jun 24, 2025
18e008b
ci: Fix cancel parallel jobs on windows
ShoyuVanilla Jun 24, 2025
8b52bab
Short circuit a couple hir-ty/lower queries
Veykril Jun 24, 2025
6968130
Merge pull request #20087 from Veykril/push-rrtkwpzmmwwz
Veykril Jun 24, 2025
abb956b
Fix link in the book
ChayimFriedman2 Jun 25, 2025
4e61517
Merge pull request #20089 from ChayimFriedman2/faq
ChayimFriedman2 Jun 25, 2025
19b1938
De-arc trait items query
Veykril Jun 24, 2025
d083ae8
Merge pull request #20084 from ShoyuVanilla/fix-windows-cancel-par
Veykril Jun 25, 2025
0876a56
Merge pull request #20077 from markpots5/master
Veykril Jun 25, 2025
ca062eb
Merge pull request #20088 from Veykril/push-qrslvzzlqqoz
Veykril Jun 25, 2025
7d6f77f
Drop rustc workspace loading error, if we don't needs its sources
Veykril Jun 25, 2025
cd4100d
Merge pull request #20092 from Veykril/push-kollxvpyknqs
Veykril Jun 25, 2025
a12b96f
Don't show notifications on failed rustfmt calls
lnicola Jun 25, 2025
a010990
Adjust minicore for Sized Hierarchy changes
Veykril Jun 25, 2025
889770a
Merge pull request #20096 from lnicola/silence-rustfmt-failed
Veykril Jun 25, 2025
587ded9
Unify formatting of progress messages
regexident Jun 25, 2025
ed5618f
minor: Decrease minimal toolchain version for `comp-time-deps` by `0.1`
ShoyuVanilla Jun 25, 2025
fb8ff25
Merge pull request #20098 from regexident/cleanup-progress-messages
davidbarsky Jun 25, 2025
3e5c46f
Merge pull request #20101 from ShoyuVanilla/comp-time-deps-sooner
lnicola Jun 26, 2025
62e112a
feat: highlighting of related return values while the cursor is on an…
roife Apr 9, 2025
4373a5d
refactor: improve macro handling in navigation for control-flow kws
roife Apr 9, 2025
7ab46b4
refactor: rename `branches` to `branch_exit_points` in highlight_related
roife Apr 15, 2025
bff9f4c
refactor: simplify functions related to branch_exit_points in highlig…
roife Apr 15, 2025
dc9e9fd
refactor: enhance highlighting for control flow kws in macros
roife Jun 26, 2025
54c14fc
Prettify AST in `PathTransform` if it's coming from a macro
ChayimFriedman2 Jun 26, 2025
a45726d
Merge pull request #19546 from roife/branch-value-highlights
Veykril Jun 26, 2025
0af0367
Cleanup `provideCodeActions` vscode hook
Veykril Jun 26, 2025
50a540c
Merge pull request #20104 from Veykril/push-nqnmmlvksyty
Veykril Jun 26, 2025
c190510
Parse new const trait syntax
Veykril Jun 26, 2025
4a50562
Merge pull request #20105 from Veykril/push-qtmwnuqvsruw
Veykril Jun 26, 2025
919e8ef
Salsa idiomize `VariantFields` query
Veykril Jun 26, 2025
d3b9969
Merge pull request #20103 from ChayimFriedman2/path-transform-prettify
Veykril Jun 26, 2025
e019a37
Bring back the firewall query
Veykril Jun 26, 2025
7f03278
Merge pull request #20106 from Veykril/push-pytuxksnntux
Veykril Jun 26, 2025
1bd7565
Backport new sized-hierarchy trait bounds in old ways
ShoyuVanilla Jun 25, 2025
1a2e7aa
Merge pull request #20100 from ShoyuVanilla/ignore-sized-hierarchy
ChayimFriedman2 Jun 26, 2025
5996241
Fix completion in when typing `integer.|`
ChayimFriedman2 Jun 26, 2025
502bac3
Merge pull request #20110 from ChayimFriedman2/ambiguous-float
Veykril Jun 27, 2025
7014ca4
rustc_codegen_gcc: Fix clippy::manual_is_multiple_of
flip1995 Jun 27, 2025
ea2e042
ci: Cancel workflow only after the main matrix has finished
Veykril Jun 28, 2025
9cd5826
Merge pull request #20116 from Veykril/push-uypnmlyvotlm
Veykril Jun 28, 2025
0f93d8a
ci: Fix up release workflow
Veykril Jun 28, 2025
7d5579d
Merge pull request #20118 from Veykril/push-nolsxzxmykls
Veykril Jun 28, 2025
a836612
Merge branch 'master' into sync_from_rust_2025_06_28
antoyo Jun 28, 2025
a80f3c4
Fix clippy warnings
antoyo Jun 28, 2025
38fa4a4
Fix sysroot Cargo.toml for compiler-builtins
antoyo Jun 28, 2025
e3bb127
Add support for copysignf16 intrinsic
antoyo Jun 28, 2025
fe8b5e6
Remove now useless patch for run-make test
antoyo Jun 28, 2025
99780df
Fix intrinsic copysignf128
antoyo Jun 29, 2025
0609735
Do not append `--compile-time-deps` to overwritten build script commands
Veykril Jun 29, 2025
638329b
Merge pull request #20121 from Veykril/push-vkkuutpsuypq
Veykril Jun 29, 2025
a203e41
Remove unnecessary parens in closure
chenyukang Jun 29, 2025
769fb75
Fix exactudiv and exactsdiv for gcc without 128-bit integers
antoyo Jun 29, 2025
2a66a5b
Merge pull request #20122 from chenyukang/yukang-fix-remove-parens
ChayimFriedman2 Jun 29, 2025
bcf5105
inherit `#[align]` from trait method prototypes
folkertdev Jun 28, 2025
67d8469
Add support for a few missing LLVM intrinsics
antoyo Jun 29, 2025
88db589
Changed intrinsic generation to include full intrinsic names in panic…
FractalFir Jun 29, 2025
c57393e
Regenerated intrinsics
FractalFir Jun 29, 2025
4347a92
Fix handling of __builtin_ia32_rdtscp
antoyo Jun 29, 2025
15d23bd
Merge pull request #723 from rust-lang/sync_from_rust_2025_06_28
antoyo Jun 30, 2025
25a6fd3
Augment the macro-stats test.
nnethercote Jun 30, 2025
e0761a5
Improve macro-stats printing.
nnethercote Jun 30, 2025
bc06bb1
Remove last use of `rustc_pat_analysis::Captures`
zachs18 Jun 30, 2025
863d0b5
Merge pull request #20124 from zachs18/patch-1
Veykril Jun 30, 2025
c8cef5b
Move some early config checks to the compiletest lib
jieyouxu Jun 30, 2025
f03074d
Move compiletest `main.rs` to `src/bin/`
jieyouxu Jun 30, 2025
e664e7e
Move `RUST_TEST_NOCAPTURE` warning to early config check
jieyouxu Jun 30, 2025
1926f60
Fix const_undef
antoyo Jun 30, 2025
ce73bab
Merge pull request #726 from rust-lang/fix/const_undef
antoyo Jun 30, 2025
4b5c44b
Merge pull request #725 from FractalFir/intrinsic_fix
antoyo Jun 30, 2025
666934a
Merge commit '4b5c44b14166083eef8d71f15f5ea1f53fc976a0' into subtree-…
GuillaumeGomez Jun 30, 2025
3b5b350
Preparing for merge from rust-lang/rust
lnicola Jun 30, 2025
0edf572
Merge from rust-lang/rust
lnicola Jun 30, 2025
c5f4b80
Merge pull request #20128 from lnicola/sync-from-rust
lnicola Jun 30, 2025
58a61dc
Rollup merge of #143156 - folkertdev:fn-align-inherit-from-trait, r=w…
matthiaskrgr Jun 30, 2025
73ccbaa
Rollup merge of #143223 - nnethercote:improve-macro-stats-printing, r…
matthiaskrgr Jun 30, 2025
69e7487
Rollup merge of #143229 - jieyouxu:compiletest-maintenance-1, r=Kobzol
matthiaskrgr Jun 30, 2025
22e443d
Rollup merge of #143239 - GuillaumeGomez:subtree-update_cg_gcc_2025-0…
matthiaskrgr Jun 30, 2025
bcd7053
Rollup merge of #143246 - lnicola:sync-from-ra, r=lnicola
matthiaskrgr Jun 30, 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ resolver = "2"

[dependencies]
core = { path = "./sysroot_src/library/core" }
compiler_builtins = { path = "./sysroot_src/library/compiler-builtins/compiler-builtins" }
alloc = { path = "./sysroot_src/library/alloc" }
std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] }
test = { path = "./sysroot_src/library/test" }
Expand Down
28 changes: 2 additions & 26 deletions compiler/rustc_codegen_gcc/build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use crate::build;
use crate::config::{Channel, ConfigInfo};
use crate::utils::{
create_dir, get_sysroot_dir, get_toolchain, git_clone, git_clone_root_dir, remove_file,
run_command, run_command_with_env, run_command_with_output, run_command_with_output_and_env,
rustc_version_info, split_args, walk_dir,
run_command, run_command_with_env, run_command_with_output_and_env, rustc_version_info,
split_args, walk_dir,
};

type Env = HashMap<String, String>;
Expand Down Expand Up @@ -485,30 +485,6 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
run_command_with_output_and_env(&[&"git", &"checkout"], rust_dir, Some(env))?;
}

let mut patches = Vec::new();
walk_dir(
"patches/tests",
&mut |_| Ok(()),
&mut |file_path: &Path| {
patches.push(file_path.to_path_buf());
Ok(())
},
false,
)?;
patches.sort();
// TODO: remove duplication with prepare.rs by creating a apply_patch function in the utils
// module.
for file_path in patches {
println!("[GIT] apply `{}`", file_path.display());
let path = Path::new("../..").join(file_path);
run_command_with_output(&[&"git", &"apply", &path], rust_dir)?;
run_command_with_output(&[&"git", &"add", &"-A"], rust_dir)?;
run_command_with_output(
&[&"git", &"commit", &"--no-gpg-sign", &"-m", &format!("Patch {}", path.display())],
rust_dir,
)?;
}

let cargo = String::from_utf8(
run_command_with_env(&[&"rustup", &"which", &"cargo"], rust_dir, Some(env))?.stdout,
)
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2025-06-02"
channel = "nightly-2025-06-28"
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_gcc/src/abi.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#[cfg(feature = "master")]
use gccjit::FnAttribute;
use gccjit::{ToLValue, ToRValue, Type};
use rustc_abi::{ArmCall, CanonAbi, InterruptKind, Reg, RegKind, X86Call};
#[cfg(feature = "master")]
use rustc_abi::{ArmCall, CanonAbi, InterruptKind, X86Call};
use rustc_abi::{Reg, RegKind};
use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods};
use rustc_data_structures::fx::FxHashSet;
use rustc_middle::bug;
Expand Down
46 changes: 11 additions & 35 deletions compiler/rustc_codegen_gcc/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
}

fn ret(&mut self, mut value: RValue<'gcc>) {
if self.structs_as_pointer.borrow().contains(&value) {
// NOTE: hack to workaround a limitation of the rustc API: see comment on
// CodegenCx.structs_as_pointer
value = value.dereference(self.location).to_rvalue();
}
let expected_return_type = self.current_func().get_return_type();
if !expected_return_type.is_compatible_with(value.get_type()) {
// NOTE: due to opaque pointers now being used, we need to cast here.
Expand Down Expand Up @@ -700,7 +695,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
let a = self.gcc_int_cast(a, a_type);
let b_type = b.get_type().to_unsigned(self);
let b = self.gcc_int_cast(b, b_type);
a / b
self.gcc_udiv(a, b)
}

fn sdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
Expand All @@ -712,8 +707,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
// FIXME(antoyo): rustc_codegen_ssa::mir::intrinsic uses different types for a and b but they
// should be the same.
let typ = a.get_type().to_signed(self);
let b = self.context.new_cast(self.location, b, typ);
a / b
let b = self.gcc_int_cast(b, typ);
self.gcc_sdiv(a, b)
}

fn fdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
Expand Down Expand Up @@ -1119,13 +1114,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
// TODO(antoyo)
}

fn store(&mut self, mut val: RValue<'gcc>, ptr: RValue<'gcc>, align: Align) -> RValue<'gcc> {
if self.structs_as_pointer.borrow().contains(&val) {
// NOTE: hack to workaround a limitation of the rustc API: see comment on
// CodegenCx.structs_as_pointer
val = val.dereference(self.location).to_rvalue();
}

fn store(&mut self, val: RValue<'gcc>, ptr: RValue<'gcc>, align: Align) -> RValue<'gcc> {
self.store_with_flags(val, ptr, align, MemFlags::empty())
}

Expand Down Expand Up @@ -1508,16 +1497,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
element.get_address(self.location)
} else if value_type.dyncast_vector().is_some() {
panic!();
} else if let Some(pointer_type) = value_type.get_pointee() {
if let Some(struct_type) = pointer_type.is_struct() {
// NOTE: hack to workaround a limitation of the rustc API: see comment on
// CodegenCx.structs_as_pointer
aggregate_value
.dereference_field(self.location, struct_type.get_field(idx as i32))
.to_rvalue()
} else {
panic!("Unexpected type {:?}", value_type);
}
} else if let Some(struct_type) = value_type.is_struct() {
aggregate_value
.access_field(self.location, struct_type.get_field(idx as i32))
Expand All @@ -1537,21 +1516,18 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
assert_eq!(idx as usize as u64, idx);
let value_type = aggregate_value.get_type();

let new_val = self.current_func().new_local(None, value_type, "aggregate_value");
self.block.add_assignment(None, new_val, aggregate_value);

let lvalue = if value_type.dyncast_array().is_some() {
let index = self
.context
.new_rvalue_from_long(self.u64_type, i64::try_from(idx).expect("i64::try_from"));
self.context.new_array_access(self.location, aggregate_value, index)
self.context.new_array_access(self.location, new_val, index)
} else if value_type.dyncast_vector().is_some() {
panic!();
} else if let Some(pointer_type) = value_type.get_pointee() {
if let Some(struct_type) = pointer_type.is_struct() {
// NOTE: hack to workaround a limitation of the rustc API: see comment on
// CodegenCx.structs_as_pointer
aggregate_value.dereference_field(self.location, struct_type.get_field(idx as i32))
} else {
panic!("Unexpected type {:?}", value_type);
}
} else if let Some(struct_type) = value_type.is_struct() {
new_val.access_field(None, struct_type.get_field(idx as i32))
} else {
panic!("Unexpected type {:?}", value_type);
};
Expand All @@ -1568,7 +1544,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {

self.llbb().add_assignment(self.location, lvalue, value);

aggregate_value
new_val.to_rvalue()
}

fn set_personality_fn(&mut self, _personality: Function<'gcc>) {
Expand Down
10 changes: 1 addition & 9 deletions compiler/rustc_codegen_gcc/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,7 @@ impl<'gcc, 'tcx> ConstCodegenMethods for CodegenCx<'gcc, 'tcx> {

fn const_undef(&self, typ: Type<'gcc>) -> RValue<'gcc> {
let local = self.current_func.borrow().expect("func").new_local(None, typ, "undefined");
if typ.is_struct().is_some() {
// NOTE: hack to workaround a limitation of the rustc API: see comment on
// CodegenCx.structs_as_pointer
let pointer = local.get_address(None);
self.structs_as_pointer.borrow_mut().insert(pointer);
pointer
} else {
local.to_rvalue()
}
local.to_rvalue()
}

fn const_poison(&self, typ: Type<'gcc>) -> RValue<'gcc> {
Expand Down
9 changes: 0 additions & 9 deletions compiler/rustc_codegen_gcc/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,6 @@ pub struct CodegenCx<'gcc, 'tcx> {

pub pointee_infos: RefCell<FxHashMap<(Ty<'tcx>, Size), Option<PointeeInfo>>>,

/// NOTE: a hack is used because the rustc API is not suitable to libgccjit and as such,
/// `const_undef()` returns struct as pointer so that they can later be assigned a value (in
/// e.g. Builder::insert_value).
/// As such, this set remembers which of these pointers were returned by this function so that
/// they can be dereferenced later.
/// FIXME(antoyo): fix the rustc API to avoid having this hack.
pub structs_as_pointer: RefCell<FxHashSet<RValue<'gcc>>>,

#[cfg(feature = "master")]
pub cleanup_blocks: RefCell<FxHashSet<Block<'gcc>>>,
/// The alignment of a u128/i128 type.
Expand Down Expand Up @@ -304,7 +296,6 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
#[cfg(feature = "master")]
rust_try_fn: Cell::new(None),
pointee_infos: Default::default(),
structs_as_pointer: Default::default(),
#[cfg(feature = "master")]
cleanup_blocks: Default::default(),
};
Expand Down
Loading
Loading