Compare commits
1
Commits
c6378d7cc7
...
62e57ed98b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62e57ed98b
|
@@ -0,0 +1,27 @@
|
|||||||
|
From 157772049aa7da13533026292cb4f67c1e8bf542 Mon Sep 17 00:00:00 2001
|
||||||
|
From: nobody <nobody@localhost>
|
||||||
|
Date: Sun, 19 Jul 2026 06:21:49 +0900
|
||||||
|
Subject: [PATCH 1/2] do not download rustc
|
||||||
|
|
||||||
|
The $(RUSTC_SRC_DL) file already exists, but for some reason Make wants
|
||||||
|
to rebuild this target when it has $(RUSTC_SRC_TARBALL) as a dependency.
|
||||||
|
---
|
||||||
|
minicargo.mk | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/minicargo.mk b/minicargo.mk
|
||||||
|
index 5cd3489c..eb869a1b 100644
|
||||||
|
--- a/minicargo.mk
|
||||||
|
+++ b/minicargo.mk
|
||||||
|
@@ -233,7 +233,7 @@ $(RUSTC_SRC_DL): rustc-$(RUSTC_VERSION)-src/extracted rustc-$(RUSTC_VERSION)-src
|
||||||
|
# - libstd, libpanic_unwind, libtest and libgetopts
|
||||||
|
# - libproc_macro (mrustc)
|
||||||
|
ifeq ($(USE_MERGED_BUILD),1)
|
||||||
|
-$(RUSTCSRC)mrustc-stdlib/Cargo.toml: $(RUSTC_SRC_DL) minicargo.mk
|
||||||
|
+$(RUSTCSRC)mrustc-stdlib/Cargo.toml: minicargo.mk
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
@echo "#![no_core]" > $(dir $@)/lib.rs
|
||||||
|
@echo "[package]" > $@
|
||||||
|
--
|
||||||
|
2.55.0
|
||||||
|
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
From 6e66feb3b6ae698c3d29211847c71c00f87fbf78 Mon Sep 17 00:00:00 2001
|
||||||
|
From: nobody <nobody@localhost>
|
||||||
|
Date: Sun, 19 Jul 2026 06:23:12 +0900
|
||||||
|
Subject: [PATCH 2/2] Revert "HIR Typecheck - Optimise by doing multiple checks
|
||||||
|
per pass"
|
||||||
|
|
||||||
|
This reverts commit 99d9bd0c788b0c72fc2f4fee6187a462ceb059f2.
|
||||||
|
---
|
||||||
|
src/hir_typeck/expr_cs.cpp | 71 ++++++++++++++++----------------------
|
||||||
|
1 file changed, 30 insertions(+), 41 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
|
||||||
|
index 366cf78e..874d25cc 100644
|
||||||
|
--- a/src/hir_typeck/expr_cs.cpp
|
||||||
|
+++ b/src/hir_typeck/expr_cs.cpp
|
||||||
|
@@ -8001,47 +8001,36 @@ void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR:
|
||||||
|
for(unsigned int i = 0; i < context.possible_ivar_vals.size(); i ++ )
|
||||||
|
{
|
||||||
|
if( check_ivar_poss(context, i, context.possible_ivar_vals[i]) ) {
|
||||||
|
- // Look at all other ivar possibility sets, and disable processing if they depend on this ivar (prevents races)
|
||||||
|
- auto contains_ty = [&i](const HIR::TypeRef& t) {
|
||||||
|
- auto cb = [&](const HIR::TypeRef& t) {
|
||||||
|
- // TODO: Resolve ivars
|
||||||
|
- return TU_TEST1(t.data(), Infer, .index == i);
|
||||||
|
- };
|
||||||
|
- return visit_ty_with( t, cb );
|
||||||
|
- };
|
||||||
|
- auto disable_in = [&context](const HIR::TypeRef& t)->bool {
|
||||||
|
- auto cb = [&](const HIR::TypeRef& tr) {
|
||||||
|
- const auto& t = context.m_ivars.get_type(tr);
|
||||||
|
- if(const auto* te = t.data().opt_Infer()) {
|
||||||
|
- DEBUG("Disable IVar " << te->index);
|
||||||
|
- context.possible_ivar_vals[te->index].force_disable = true;
|
||||||
|
- }
|
||||||
|
- return false;
|
||||||
|
- };
|
||||||
|
- return visit_ty_with( t, cb );
|
||||||
|
- };
|
||||||
|
- for(const auto& r : context.link_assoc) {
|
||||||
|
- if( contains_ty(r.impl_ty) || contains_ty(r.left_ty) || ::std::any_of(r.params.m_types.begin(), r.params.m_types.end(), contains_ty) ) {
|
||||||
|
- disable_in(r.impl_ty);
|
||||||
|
- for(const auto& t : r.params.m_types) {
|
||||||
|
- disable_in(t);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- for(auto& e : context.possible_ivar_vals) {
|
||||||
|
- bool references_this = false;
|
||||||
|
- for(const auto& t : e.types_coerce_from) {
|
||||||
|
- references_this |= contains_ty(t.ty);
|
||||||
|
- }
|
||||||
|
- for(const auto& t : e.types_coerce_to) {
|
||||||
|
- references_this |= contains_ty(t.ty);
|
||||||
|
- }
|
||||||
|
- for(const auto& t : e.bounded) {
|
||||||
|
- references_this |= contains_ty(t);
|
||||||
|
- }
|
||||||
|
- if(references_this) {
|
||||||
|
- DEBUG("Block IVar " << (&e - context.possible_ivar_vals.data()));
|
||||||
|
- e.force_disable = true;
|
||||||
|
+ // HACK: For `gix v0.73.0`, but really a good idea: only set one ivar per pass.
|
||||||
|
+ // - Ideally, would determine if this ivar is used in any other rules, and prevent ivars mentioned in those rules
|
||||||
|
+ // from also being guessed.
|
||||||
|
+ break;
|
||||||
|
+ static Span sp;
|
||||||
|
+ //assert( context.possible_ivar_vals[i].has_rules() );
|
||||||
|
+ // Disable all metioned ivars in the possibilities
|
||||||
|
+ for(const auto& ty : context.possible_ivar_vals[i].types_coerce_to)
|
||||||
|
+ context.possible_equate_type_unknown(sp, ty.ty, Context::IvarUnknownType::From);
|
||||||
|
+ for(const auto& ty : context.possible_ivar_vals[i].types_coerce_from)
|
||||||
|
+ context.possible_equate_type_unknown(sp, ty.ty, Context::IvarUnknownType::To);
|
||||||
|
+
|
||||||
|
+ // Also disable inferrence (for this pass) for all ivars in affected bounds
|
||||||
|
+ if(false)
|
||||||
|
+ for(const auto& la : context.link_assoc)
|
||||||
|
+ {
|
||||||
|
+ bool found = false;
|
||||||
|
+ auto cb = [&](const auto& t) { return TU_TEST1(t.data(), Infer, .index == i); };
|
||||||
|
+ if( la.left_ty != ::HIR::TypeRef() )
|
||||||
|
+ found |= visit_ty_with( la.left_ty, cb );
|
||||||
|
+ found |= visit_ty_with( la.impl_ty, cb );
|
||||||
|
+ for(const auto& t : la.params.m_types)
|
||||||
|
+ found |= visit_ty_with( t, cb );
|
||||||
|
+ if( found )
|
||||||
|
+ {
|
||||||
|
+ if(la.left_ty != ::HIR::TypeRef())
|
||||||
|
+ context.possible_equate_type_unknown(sp, la.left_ty, Context::IvarUnknownType::From);
|
||||||
|
+ context.possible_equate_type_unknown(sp, la.impl_ty, Context::IvarUnknownType::From);
|
||||||
|
+ for(const auto& t : la.params.m_types)
|
||||||
|
+ context.possible_equate_type_unknown(sp, t, Context::IvarUnknownType::From);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.55.0
|
||||||
|
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package rustc-bootstrap-source {
|
||||||
|
description = "rustc source tree used by mrustc";
|
||||||
|
exclude = true;
|
||||||
|
|
||||||
|
version# = "1.90.0";
|
||||||
|
output = remoteTar {
|
||||||
|
url = "https://static.rust-lang.org/dist/rustc-"+version+"-src.tar.gz";
|
||||||
|
compress = gzip;
|
||||||
|
checksum = "kUjk5mOHRc7cTom0uJ5afFTkhFcXLYK8tJl_aqduffGSHc0TH_a-KKz6PI0nk_xK";
|
||||||
|
};
|
||||||
|
chmod = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
package mrustc {
|
||||||
|
description = "alternative rust compiler (re-implementation)";
|
||||||
|
website = "https://github.com/thepowersgang/mrustc";
|
||||||
|
anitya = 391250;
|
||||||
|
|
||||||
|
version# = "0.12.0";
|
||||||
|
source = remoteGitHub {
|
||||||
|
suffix = "thepowersgang/mrustc";
|
||||||
|
tag = "v"+version;
|
||||||
|
checksum = "Db25OAKL_1yZIF6MlXOTHhrEJ-Pd-i-accVtt5rJollmpKm6B3bgS0xN7hoC1cVu";
|
||||||
|
};
|
||||||
|
patches = [
|
||||||
|
"0001-do-not-download-rustc.patch",
|
||||||
|
"0002-Revert-HIR-Typecheck-Optimise-by-doing-multiple-chec.patch",
|
||||||
|
];
|
||||||
|
extra = [ rustc-bootstrap-source ];
|
||||||
|
minimal = true;
|
||||||
|
|
||||||
|
enterSource = true;
|
||||||
|
writable = true;
|
||||||
|
chmod = true;
|
||||||
|
|
||||||
|
exec = make {
|
||||||
|
inPlace = true;
|
||||||
|
skipConfigure = true;
|
||||||
|
preMake = `
|
||||||
|
ln -sf gcc /system/bin/cc
|
||||||
|
ln -sf g++ /system/bin/c++
|
||||||
|
|
||||||
|
export PARLEVEL=`+jobsE+`
|
||||||
|
export RUSTC_SOURCE='../extra/rustc-bootstrap-source'
|
||||||
|
export RUSTC_VERSION="$(cut -d ' ' -f 1 "$RUSTC_SOURCE/version")"
|
||||||
|
export MRUSTC_TARGET_VER="$(cut -d '.' -f 1,2 <<< "$RUSTC_VERSION")"
|
||||||
|
export OUTDIR_SUF="-$RUSTC_VERSION"
|
||||||
|
patch -d "$RUSTC_SOURCE" -p0 < "rustc-$RUSTC_VERSION-src.patch"
|
||||||
|
touch "$RUSTC_SOURCE/dl-version"
|
||||||
|
ln -s "$RUSTC_SOURCE" "rustc-$RUSTC_VERSION-src"
|
||||||
|
|
||||||
|
sed -i 's/\$(shell git show --pretty=%H -s --no-show-signature)/unknown/' Makefile
|
||||||
|
sed -i 's/\$(shell git show -s --pretty=%h --no-show-signature)/unknown/' Makefile
|
||||||
|
sed -i 's/\$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)/v`+version+`/' Makefile
|
||||||
|
sed -i 's/\$(shell git diff-index --quiet HEAD; echo $$?)/0/' Makefile
|
||||||
|
sed -i 's/\$(shell env LC_TIME=C date -u +"%a, %e %b %Y %T +0000")/Thu, 1 Jan 1970 00:00:00 +0000/' Makefile
|
||||||
|
`;
|
||||||
|
preCheck = `
|
||||||
|
make -f minicargo.mk LIBS
|
||||||
|
make local_tests
|
||||||
|
`;
|
||||||
|
check = [ "test" ];
|
||||||
|
|
||||||
|
install = `
|
||||||
|
LLVM="$(which llvm-config)"
|
||||||
|
OUTDIR="output-$RUSTC_VERSION"
|
||||||
|
make -f minicargo.mk LLVM_CONFIG="$LLVM" "$OUTDIR/rustc"
|
||||||
|
make -f minicargo.mk LLVM_CONFIG="$LLVM" "$OUTDIR/cargo"
|
||||||
|
make -C LLVM_CONFIG="$LLVM" run_rustc
|
||||||
|
`;
|
||||||
|
};
|
||||||
|
|
||||||
|
inputs = [
|
||||||
|
bash,
|
||||||
|
patch,
|
||||||
|
llvm,
|
||||||
|
|
||||||
|
// mrustc requires buggy gcc behaviour
|
||||||
|
gcc,
|
||||||
|
];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user