5 ms·
Was it actually done tabulā rasā?, why? Certainly quite a bit of rustc could be cannibalized? Surely the parsing, type, and borrow checking stage or perhaps
by Blikkentrekker 5y ago
Was it actually done tabulā rasā?, why?
Certainly quite a bit of rustc could be cannibalized? Surely the parsing, type, and borrow checking stage or perhaps all the way to the m.i.r. could have been shared.
- steveklabnik 5y agoPart of the point is that you won’t need a Rust compiler to compile this. If you did that, you would. There is another project pursuing that approach. Both are valid strategies with different pros and cons.
- IshKebab 5y agoDidn't that recent critique of this project say that they've already imported some Rust code, so that wouldn't be true.
- steveklabnik 5y agoI don’t know what you’re referring to, exactly. I’m pretty sure you’re talking about the post linked above but I don’t remember reading that in it. It’s possible I missed it!
- raphlinus 5y agoI believe gcc-rs has a dependency on Polonius, the new(ish) experimental Rust borrow checker.
- steveklabnik 5y agoGotcha, thanks. I wonder about the details here; you could imagine that as either a temporary step until things are further along, or possibly a thing only introduced later in the bootstrap process after you’ve built a stage1 compiler, which you could use to build this without an external rustc.
- qzw 5y agoPolonius is an awesome name for a borrow checker! Just hope there’s a —no-verbose flag.
- karatinversion 5y agoPhilosophically, I think the view is that two independent implementations will give the language more long term stability by helping it avoid the trap of a single implementation, with its bugs, being the definitive version of the language. On the practical level, rustc is written in rust and self-hosting, so reusing code from it in gcc would mean that you needed a rust compiler as well as a c compiler to compile gcc. Also, rustc and gcc have incompatible licenses.
- raphlinus 5y agoI am not a licensing lawyer, but the license for rustc (and its standard library, and a great many infrastructural crates in the ecosystem) is dual MIT + Apache 2, which was explicitly chosen so that it would be compatible with both GPL v2 and GPL v3.
- estebank 5y agoI think that the biggest barrier to having GCC use the rustc frontend isn't technical, it's the requirement of copyright assignment to the FSF.
- pjmlp 5y agoThat wasn't a problem when GCC was a requirement to keep free beer UNIX alive, how quickly people forget.
- estebank 5y agoIt is a problem when trying to bring code from an existing codebase that has no such copyright assignment clauses. Bringing the rustc frontend code into gcc would be unlikely because getting a copyright release to GNU from everyone that contributed to rustc would be unlikely.
- nextaccountic 5y agoDo you know whether the GCC Ada, Fortran, Go, D and Java frontends also assign full copyright to the FSF? Are the copyright of all dependencies likewise assigned to them?
- raphlinus 5y agoThere is a different project that grafts the existing rustc frontend to the gcc backend: rustc_codegen_gcc. The existence of both projects is currently very contentious, as there are concerns about duplicated effort and possible fragmentation of the community. Some of the goals, like the ability to target more architectures, are equally supported by both projects, but for other goals (mostly more organizational and less technical, to my ears) they're pretty different.