Discussion summary

A project called `crustc` translates Rust to C, sparking varied opinions on its purpose and implications. Some see it as a way to improve portability and debugging, while others question its direction.

What the discussion says

  • Some believe it broadens debugging help for portability issues.
  • Others think it might lead to feature creep or trust issues with Microsoft/ISO.
  • Critics warn about AI-generated content and its impact on discussions.
  • Enthusiasts appreciate the project's name and concept.
  • There is excitement about Rust and C competition.
Rust is finally memory safe enough to become C
micheleeet
Let Rust vs C battle commence with renewed haste!
moezd

Comments

Hacker News

i believe the author is confused

this is the wrong direction

(jk i read the readme)

by dangoodmanUT

Nope, and c++ should get the same thing.

But we now all know rust is microsoft and c++ ISO. I don't think we can trust much more ISO than microsoft to produce less feature creep over the currently known planned obsolescence cycle of 5-10 years.

by sylware

The most interesting part of this to me is not “Rust to C” by itself, but the fact that it widens the pool of people who can help debug portability problems.

There are relatively few people who understand Rust’s compiler internals, LLVM backends, and obscure target support deeply. But there are many engineers who understand C compilers, ABIs, linkers, makefiles, cross-compilation, old operating systems, and weird platform-specific compiler behavior.

If Rust can be lowered into target-specific C, then some problems stop being exclusively “Rust compiler problems” and also become C toolchain problems. That means more people can inspect the generated C, build failures, linker errors, ABI mismatches, and compiler-specific behavior.

C is obviously not a magic portability layer. ABI details, integer widths, alignment, TLS, aliasing, and undefined behavior still matter. But as an ecosystem boundary, C gives many more engineers a way to participate in debugging and porting work.

I think that social/maintenance aspect may be more important than the language translation itself.

by unjuno

I think you're probably using DeepL or some other AI translation. When you use DeepL, most sentences become flat and end up being judged as GenAI. I also used DeepL to communicate on Hacker News in the early days.I had a similar problem

by jdw64

Guideline:

> Don't post generated text or AI-edited text. HN is for conversation between humans.

by jolmg

Quite an interesting project, lol. I like the name `crustc` :)

by linzhangrun

Kudos.

by fithisux

Rust is finally memory safe enough to become C

by micheleeet

"You have become the very thing you swore to destroy"

by Sharlin

Let Rust vs C battle commence with renewed haste!

by moezd

this is really cool but it seems very unlikely that someone targeting an exotic system not supported by rust (mostly embedded and ancient mainframe targets) would be willing to trust a beta transpiler to not inject any bugs or leaks in the process of turning rust to c. nevertheless, very cool.

by nxtfari

What sort of hardware would this be useful for?

by kube-system

We should port it to Rust.

by db48x

If I understand this correctly, you could run this compiler on iPadOS (since it's plain C). But you cannot mark it's output executable, since that would require JIT entitlement.

by Archit3ch

Target WASM then

by ronsor

I wonder how the performance looks like, because this can be interesting even for non-porting reasons ;)

by Tiberium

It is very unlikely that it would be faster.

by adastra22

I'll wait for rustcrustc

by adithyassekhar

There are discussions of round-trip between Rust and C;

Would this be useful for this too?

From https://news.ycombinator.com/item?id=46265855 :

> To better port C to Rust: 3C (Checked C), c2rust, Crown ownership analysis, RustMap, c2saferrust (LLM), Laertes

C -> Checked C -> Rust

Because Checked C will annotate the raw and other C pointers first.

by westurner

I wonder if this could be used in PPC Mac OS X, where LLVM isn't supported and most graphical applications need to use GCC 4 with Apple's SDK.

by SpecialistK

> The primary goal of this is support for old/obscure hardware with no LLVM/GCC support

Wouldn't it be easier to add old hardware support to LLVM/GCC instead? I adore the project scale and determination, but for this goal extending existing projects seems more logical than building a language translator.

by ivanjermakov

Some architecture lacks documentation, if you have a working C compiler, it's easier to use it than working on a compiler to target it.

by claudex

rust to c supports infinite platforms that already have a c compiler by implementing a single rust to c program

on the other hand, porting llvm to an infinite number of platforms requires an infinite amount of work

so, it is less work this way

by jitl

> Wouldn't it be easier to add old hardware support to LLVM/GCC instead?

No, in fact it's much, much harded. You have no idea of the scope. I have no idea of the scope. Nobody does. There are obscure machines we've never heard about and there are C compilers for them. Targeting and supporting them from modern toolchains is a fool's errand.

by Perz1val

As an ex C++ compiler developer, I heartily approve of this project. Kudos.

by groos

Rewrite in C is the new Rewrite in Rust.

by npalli

GTA VI out in Rust before C++?

by keyle

Finally we can rewrite all the Rust in C. ;)

by layer8

As long as we rewrite all the C++ in Rust first.

by avadodin

Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • i believe the author is confused

    this is the wrong direction

    (jk i read the readme)

    by dangoodmanUT
  • Nope, and c++ should get the same thing.

    But we now all know rust is microsoft and c++ ISO. I don't think we can trust much more ISO than microsoft to produce less feature creep over the currently known planned obsolescence cycle of 5-10 years.

    by sylware
  • The most interesting part of this to me is not “Rust to C” by itself, but the fact that it widens the pool of people who can help debug portability problems.

    There are relatively few people who understand Rust’s compiler internals, LLVM backends, and obscure target support deeply. But there are many engineers who understand C compilers, ABIs, linkers, makefiles, cross-compilation, old operating systems, and weird platform-specific compiler behavior.

    If Rust can be lowered into target-specific C, then some problems stop being exclusively “Rust compiler problems” and also become C toolchain problems. That means more people can inspect the generated C, build failures, linker errors, ABI mismatches, and compiler-specific behavior.

    C is obviously not a magic portability layer. ABI details, integer widths, alignment, TLS, aliasing, and undefined behavior still matter. But as an ecosystem boundary, C gives many more engineers a way to participate in debugging and porting work.

    I think that social/maintenance aspect may be more important than the language translation itself.

    by unjuno
  • I think you're probably using DeepL or some other AI translation. When you use DeepL, most sentences become flat and end up being judged as GenAI. I also used DeepL to communicate on Hacker News in the early days.I had a similar problem
    by jdw64
  • Guideline:

    > Don't post generated text or AI-edited text. HN is for conversation between humans.

    by jolmg
  • Quite an interesting project, lol. I like the name `crustc` :)
    by linzhangrun
  • Kudos.
    by fithisux
  • Rust is finally memory safe enough to become C
    by micheleeet
  • "You have become the very thing you swore to destroy"
    by Sharlin
  • Let Rust vs C battle commence with renewed haste!
    by moezd
  • this is really cool but it seems very unlikely that someone targeting an exotic system not supported by rust (mostly embedded and ancient mainframe targets) would be willing to trust a beta transpiler to not inject any bugs or leaks in the process of turning rust to c. nevertheless, very cool.
    by nxtfari
  • What sort of hardware would this be useful for?
    by kube-system
  • We should port it to Rust.
    by db48x
  • If I understand this correctly, you could run this compiler on iPadOS (since it's plain C). But you cannot mark it's output executable, since that would require JIT entitlement.
    by Archit3ch
  • Target WASM then
    by ronsor
  • Not to be confused with crust [1] the dialect of rust B [2][3] is written in.

    [1] https://github.com/tsoding/crust [2] https://github.com/bext-lang/b [3] https://www.nokia.com/bell-labs/about/dennis-m-ritchie/kbman...

    by casey2
  • I wonder how the performance looks like, because this can be interesting even for non-porting reasons ;)
    by Tiberium
  • It is very unlikely that it would be faster.
    by adastra22
  • I'll wait for rustcrustc
    by adithyassekhar
  • There are discussions of round-trip between Rust and C;

    Would this be useful for this too?

    From https://news.ycombinator.com/item?id=46265855 :

    > To better port C to Rust: 3C (Checked C), c2rust, Crown ownership analysis, RustMap, c2saferrust (LLM), Laertes

    C -> Checked C -> Rust

    Because Checked C will annotate the raw and other C pointers first.

    by westurner
  • I wonder if this could be used in PPC Mac OS X, where LLVM isn't supported and most graphical applications need to use GCC 4 with Apple's SDK.
    by SpecialistK
  • > The primary goal of this is support for old/obscure hardware with no LLVM/GCC support

    Wouldn't it be easier to add old hardware support to LLVM/GCC instead? I adore the project scale and determination, but for this goal extending existing projects seems more logical than building a language translator.

    by ivanjermakov
  • Some architecture lacks documentation, if you have a working C compiler, it's easier to use it than working on a compiler to target it.
    by claudex
  • rust to c supports infinite platforms that already have a c compiler by implementing a single rust to c program

    on the other hand, porting llvm to an infinite number of platforms requires an infinite amount of work

    so, it is less work this way

    by jitl
  • > Wouldn't it be easier to add old hardware support to LLVM/GCC instead?

    No, in fact it's much, much harded. You have no idea of the scope. I have no idea of the scope. Nobody does. There are obscure machines we've never heard about and there are C compilers for them. Targeting and supporting them from modern toolchains is a fool's errand.

    by Perz1val
  • As an ex C++ compiler developer, I heartily approve of this project. Kudos.
    by groos
  • Rewrite in C is the new Rewrite in Rust.
    by npalli
  • GTA VI out in Rust before C++?
    by keyle
  • Finally we can rewrite all the Rust in C. ;)
    by layer8
  • As long as we rewrite all the C++ in Rust first.
    by avadodin

Related stories