News for hackers. Stuff that matters.
Re:GCC Rust Monthly Report #9 August 2021 by simion314 on Tuesday August 31, 2021 @04:45AM (#28365358)
If you have only one compiler then the compiler becomes the standard, so you get an IE like situation where standards would be ignored and implementation details would be abused.

My question is why not have a GCC front end for all major used languages?

Re:GCC Rust Monthly Report #9 August 2021 by paavohtl on Tuesday August 31, 2021 @04:50AM (#28365403)
> so you get an IE like situation where standards would be ignored and implementation details would be abused

This is only the case when there already is a standard. If rustc is the only Rust compiler in existence, it effectively defines what Rust is. With one compiler there is no meaningful difference between implementation details and "standard" language behaviour.

Re:GCC Rust Monthly Report #9 August 2021 by pornel on Tuesday August 31, 2021 @06:15AM (#28365997)
> With one compiler there is no meaningful difference between implementation details and "standard" language behaviour.

That's the point.

There are odd edge cases that rustc has accepted by accident. Without a second opinion it's hard to tell what was intended, and what is a compiler bug.

Re:GCC Rust Monthly Report #9 August 2021 by volta83 on Tuesday August 31, 2021 @07:10AM (#28366347)
To provide a second opinion, you can just open a rustc bug.

In fact, the Rust bug repository has thousands of opinions about thousands of things.

Re:GCC Rust Monthly Report #9 August 2021 by Subsentient on Tuesday August 31, 2021 @07:22AM (#28366445)
And if you disagree with the unilateral decisions of the rustc developers? "Go fork it or write your own"? Yeah that's what we're doing. Don't be surprised when what was often a taunt in Rust-related arguments actually ends up happening. :^P
Re:GCC Rust Monthly Report #9 August 2021 by volta83 on Tuesday August 31, 2021 @07:34AM (#28366558)
> if you disagree with the unilateral decisions of the rustc developers? "Go fork it or write your own"? Yeah that's what we're doing

If that's what you want to do, that's great. If you experiment with new stuff, and it pans out, Rust itself might benefit from that.

Since your goal is implementing something that differs from "Rust", calling it "Rust", is misleading at best, I think is unethical, and given the intent, probably illegal in most of the world since "Rust" is a registered trademark... (IANAL but if you were implementing a frontend for Rust, you could maybe use it, but for an intentionally different language, doesn't sound like it)

Re:GCC Rust Monthly Report #9 August 2021 by southerntofu on Tuesday August 31, 2021 @02:03PM (#28371375)
I've been reading comments in this thread and i wonder what actual arguments you have against gccrs, if you have links to more detailed resources. As a Rust user, i'm happy people are working on alternative implementations so specs can get new eyes.

> implementing something that differs from "Rust" (...) I think is unethical, and given the intent, probably illegal

I don't understand this statement. One of the contributors said earlier in the thread something that sounds opposed to your interpretation:

> For inconsistencies, we have stated in our FAQ that if GCC rust does not behave the same as rustc. Then it is a bug with GCC rust.

Also, "your code is illegal" is not very much an ethics argument in my book. Digital weaponry like mass-surveillance systems are mostly legal, while harmless ThePirateBay/PopcornTime are illegal.

Re:GCC Rust Monthly Report #9 August 2021 by volta83 on Tuesday August 31, 2021 @03:39PM (#28372531)
One of the main GCC rs devs wrote, I quote (https://news.ycombinator.com/item?id=28366445):

> And if you disagree with the unilateral decisions of the rustc developers? "Go fork it or write your own"? Yeah that's what we're doing.

I think that the main value of implementing a new Rust frontend, is discovering issues in the Rust spec.

They seem to, however, disagree with some Rust specification issues, and creating an incompatible frontend, not with the intent of making the spec better, but rather just doing something different.

They are calling this different thing "Rust", which I believe is a misleading, and unethical thing to do. (Its as if I make my own language, and call it C++). I think this could also be illegal, since Rust is a trademark of the Rust foundation, which if they don't defend, e.g., in cases like these, makes the trademark irrelevant, e.g., allowing corporations to fork Rust, change the language, and still use the Rust name, cause they did not enforce it here. But as mentioned IANAL, my only point is that you probably want to be very careful in most juristictions in the world about using a trademark in this way.

Others seem to also believe that finding issues in the Rust spec is one of the most valuable things for Rust that can come out of this project. But the main devs haven't been able to point at issues they have filled about it in Rust upstream (as opposed to other projects like have implemented rust frontends before, like mrustc, rust-analyzer, rustc_codegen_gcc, etc. which have found many bugs and filled many issues that have been fixed, submitted patches, etc.).

> I've been reading comments in this thread and i wonder what actual arguments you have against gccrs,

I don't have any arguments against gccrs.

I've been looking for arguments in favor of gccrs, but was not able to find any.

Most arguments mentioned here are incorrect, e.g., gcc-rs being necessary to get rustc access to more targets (incorrect since rustc_codegen_gcc is a thing), gcc-rs resulting in Rust spec improvements (incorrect since they aren't filling any bugs / helping in improving the spec), etc.

If you have an argument in favor of gccrs, please go ahead, I am all ears.

Re:GCC Rust Monthly Report #9 August 2021 by philberty on Wednesday September 01, 2021 @09:06AM (#28379332)
Hello this is Philip the author of these reports and lead for the GCC Rust project. I feel its only fair to point out that the comment you link to the author is not a "main dev for gccrs".

I wrote part of the reasons for why I am working on gccrs here: https://news.ycombinator.com/item?id=28368924

Overall I feel sad that this effort has been perceived as some kind of attack against Rustc and its community by some. This effort of mine dates back to 2014 and then I was able to get quite alot of rust working in a short time but the language changed far too much to keep up as a solo effort. Since late 2018 I restarted the effort and seriously almost started the track to develop the a gcc backend using libgccjit, it is 100% something i have considered and thought through.

I will be giving a talk on this project at LPC if you wish to hear more about my reasons please listen then https://linuxplumbersconf.org/event/11/contributions/911/

Re:GCC Rust Monthly Report #9 August 2021 by steveklabnik on Tuesday August 31, 2021 @04:29PM (#28373194)
Is that person a gcc-rs dev? I didn't think that was true.

One argument in favor of gcc-rs is related to bootstrapping; right now you need both a previous Rust compiler, as well as a C compiler, to compile Rust. With gcc-rs, you need only gcc. I don't personally think that the bootstrapping situation is onerous, but there are some folks who are looking forward to that.

Re:GCC Rust Monthly Report #9 August 2021 by volta83 on Tuesday August 31, 2021 @05:09PM (#28373698)
I thought that mrustc was a different more portable way of solving the bootstrapping problem, since it compiles Rust to C.
Re:GCC Rust Monthly Report #9 August 2021 by steveklabnik on Wednesday September 01, 2021 @11:10AM (#28380807)
It is different, and is a great project. At the end of the day, with that strategy, you still end up with two compilers, not one single compiler, and some folks are attached to "we use this single compiler to build our entire base system." You also have to then continue the bootstrap chain to get up to current rustc, and I think folks hope that this project will track upstream more closely.

I also don't think that because it compiles to C it automatically supports all of the platforms gcc does, but I haven't personally investigated that because I don't have any of that exotic hardware.

EDIT: oh yeah and the project itself describes this stuff here https://github.com/Rust-GCC/gccrs/wiki/Frequently-Asked-Ques...

Re:GCC Rust Monthly Report #9 August 2021 by southerntofu on Monday September 06, 2021 @05:28AM (#28431927)
>> And if you disagree with the unilateral decisions of the rustc developers? "Go fork it or write your own"? Yeah that's what we're doing.

I don't interpret that to mean they intend to insert breaking changes (especially since another comment and their FAQ directly contradicted that idea), but rather that they may explore different ways of implementing things, which i think is a great idea.

> But the main devs haven't been able to point at issues they have filled about it in Rust upstream

Maybe they're busy actually working on something and don't have time to look for specific instances? Or maybe a lot of questions/issues have been documented internally are have not been sufficiently reviewed yet to be opened upstream? There's a lot of room for interpretation here, but i see no reason to assume bad faith on their part.

> If you have an argument in favor of gccrs, please go ahead, I am all ears.

It's been rehearsed over and over, but if you want to build an actual standard, having many eyes/implementations is a good thing. Feedback from people trying different implementation approaches is crucial to making a specification robust.

Re:GCC Rust Monthly Report #9 August 2021 by simion314 on Wednesday September 01, 2021 @02:00AM (#28376818)
>I've been looking for arguments in favor of gccrs, but was not able to find any.

GCC can be faster in some cases and despite other claims there are many platforms that only work with GCC, I was offered in the past a job to work on implementing code optimizations for gcc by a company that had such a embeded board platform - so if Rust wants to run everywhere C runs then the community should try to explain the fanboys that gcc is not a bad thing.

Re:GCC Rust Monthly Report #9 August 2021 by volta83 on Wednesday September 01, 2021 @11:38AM (#28381172)
> GCC can be faster in some cases

How?

The Rust compiler frontend already can use GCC as a backend.

This project - GCC rs - is a different frontend, which also happens to use GCC as a backend.

The number of targets and performance that both can have is the same.

So the argument "GCC can be faster than GCC" is illogical. You are talking about the same thing.

Re:GCC Rust Monthly Report #9 August 2021 by simion314 on Wednesday September 01, 2021 @03:38PM (#28384619)
My bad, thanks for clarifying my confusion
Re:GCC Rust Monthly Report #9 August 2021 by simion314 on Tuesday August 31, 2021 @06:41AM (#28366151)
>If rustc is the only Rust compiler in existence, it effectively defines what Rust is.

You can have 2 different version of the same compiler that makes 2 different things for the same code, or you can have a bugged compiler that on Thursday produces different output, I assume you notice now the problem with not having a standard and the documentation is "go read the compiler source code from tonight commit, yesterday code migtht not be fresh enough"