-
Notifications
You must be signed in to change notification settings - Fork 157
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
gccrs: Add base documentation for using the Rust frontend. #2966
Open
CohenArthur
wants to merge
3
commits into
Rust-GCC:master
Choose a base branch
from
CohenArthur:document-rust-more
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,207 @@ | ||||||||||||||||
\input texinfo @c -*-texinfo-*- | ||||||||||||||||
@setfilename gccrs.info | ||||||||||||||||
@settitle The GNU Rust Compiler | ||||||||||||||||
|
||||||||||||||||
@c Merge the standard indexes into a single one. | ||||||||||||||||
@syncodeindex fn cp | ||||||||||||||||
@syncodeindex vr cp | ||||||||||||||||
@syncodeindex ky cp | ||||||||||||||||
@syncodeindex pg cp | ||||||||||||||||
@syncodeindex tp cp | ||||||||||||||||
|
||||||||||||||||
@include gcc-common.texi | ||||||||||||||||
|
||||||||||||||||
@c Copyright years for this manual. | ||||||||||||||||
@set copyrights-gccrs 2024 | ||||||||||||||||
|
||||||||||||||||
@copying | ||||||||||||||||
@c man begin COPYRIGHT | ||||||||||||||||
Copyright @copyright{} @value{copyrights-gccrs} Free Software Foundation, Inc. | ||||||||||||||||
|
||||||||||||||||
Permission is granted to copy, distribute and/or modify this document | ||||||||||||||||
under the terms of the GNU Free Documentation License, Version 1.3 or | ||||||||||||||||
any later version published by the Free Software Foundation; with no | ||||||||||||||||
Invariant Sections, the Front-Cover Texts being (a) (see below), and | ||||||||||||||||
with the Back-Cover Texts being (b) (see below). | ||||||||||||||||
A copy of the license is included in the | ||||||||||||||||
@c man end | ||||||||||||||||
section entitled ``GNU Free Documentation License''. | ||||||||||||||||
@ignore | ||||||||||||||||
@c man begin COPYRIGHT | ||||||||||||||||
man page gfdl(7). | ||||||||||||||||
@c man end | ||||||||||||||||
@end ignore | ||||||||||||||||
|
||||||||||||||||
@c man begin COPYRIGHT | ||||||||||||||||
|
||||||||||||||||
(a) The FSF's Front-Cover Text is: | ||||||||||||||||
|
||||||||||||||||
A GNU Manual | ||||||||||||||||
|
||||||||||||||||
(b) The FSF's Back-Cover Text is: | ||||||||||||||||
|
||||||||||||||||
You have freedom to copy and modify this GNU Manual, like GNU | ||||||||||||||||
software. Copies published by the Free Software Foundation raise | ||||||||||||||||
funds for GNU development. | ||||||||||||||||
@c man end | ||||||||||||||||
@end copying | ||||||||||||||||
|
||||||||||||||||
@ifinfo | ||||||||||||||||
@format | ||||||||||||||||
@dircategory Software development | ||||||||||||||||
@direntry | ||||||||||||||||
* gccrs: (gccrs). A GCC-based compiler for the Rust programming language | ||||||||||||||||
@end direntry | ||||||||||||||||
@end format | ||||||||||||||||
|
||||||||||||||||
@insertcopying | ||||||||||||||||
@end ifinfo | ||||||||||||||||
|
||||||||||||||||
@titlepage | ||||||||||||||||
@title The GNU Rust Compiler | ||||||||||||||||
@versionsubtitle | ||||||||||||||||
@author The gccrs team | ||||||||||||||||
|
||||||||||||||||
@page | ||||||||||||||||
@vskip 0pt plus 1filll | ||||||||||||||||
Published by the Free Software Foundation @* | ||||||||||||||||
51 Franklin Street, Fifth Floor@* | ||||||||||||||||
Boston, MA 02110-1301, USA@* | ||||||||||||||||
@sp 1 | ||||||||||||||||
@insertcopying | ||||||||||||||||
@end titlepage | ||||||||||||||||
@contents | ||||||||||||||||
@page | ||||||||||||||||
|
||||||||||||||||
@node Top | ||||||||||||||||
@top Introduction | ||||||||||||||||
|
||||||||||||||||
This manual describes how to use @command{gccrs}, the GNU compiler for | ||||||||||||||||
the Rust programming language. This manual is specifically about | ||||||||||||||||
@command{gccrs}. For more information about the Rust programming | ||||||||||||||||
language, see @uref{https//rust-lang.org}. | ||||||||||||||||
|
||||||||||||||||
@menu | ||||||||||||||||
* Copying:: The GNU General Public License. | ||||||||||||||||
* GNU Free Documentation License:: | ||||||||||||||||
How you can share and copy this manual. | ||||||||||||||||
* Invoking gccrs:: How to run gccrs. | ||||||||||||||||
* Index:: Index. | ||||||||||||||||
@end menu | ||||||||||||||||
|
||||||||||||||||
|
||||||||||||||||
@include gpl_v3.texi | ||||||||||||||||
|
||||||||||||||||
@include fdl.texi | ||||||||||||||||
|
||||||||||||||||
@node Invoking gccrs | ||||||||||||||||
@chapter Invoking gccrs | ||||||||||||||||
|
||||||||||||||||
@c man title gccrs A GCC-based compiler for the Rust programming language | ||||||||||||||||
|
||||||||||||||||
@c man begin DESCRIPTION gccrs | ||||||||||||||||
|
||||||||||||||||
The @command{gccrs} command is a frontend to @command{gcc} and | ||||||||||||||||
supports many of the same options, @xref{Option Summary, , Option | ||||||||||||||||
Summary, gcc, Using the GNU Compiler Collection (GCC)}, as well | ||||||||||||||||
as some @command{gccrs} specific ones. This manual only documents | ||||||||||||||||
the options that are specific to @command{gccrs}. | ||||||||||||||||
|
||||||||||||||||
@c man end | ||||||||||||||||
|
||||||||||||||||
@c man begin OPTIONS gccrust | ||||||||||||||||
|
||||||||||||||||
@table @gcctabopt | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-incomplete-and-experimental-compiler-do-not-use} | ||||||||||||||||
@item -frust-incomplete-and-experimental-compiler-do-not-use | ||||||||||||||||
This flag enables the compilation of Rust code with the GCC Rust compiler. | ||||||||||||||||
It is used to indicate the unstability of the compiler, and reminds the user | ||||||||||||||||
about the expected incoming breakage. @command{gccrs} is not yet able to | ||||||||||||||||
compile real Rust code, or to report valid errors when seeing incorrect Rust. | ||||||||||||||||
It also does not compile and link to the Rust standard library, meaning you | ||||||||||||||||
are not able to access most existing Rust types, macros and functions. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-mini-std} | ||||||||||||||||
@item -frust-mini-std | ||||||||||||||||
Add the @code{mini_std} module to the crate you are currently compiling. This miniature | ||||||||||||||||
standard library is experimental, and does not represent a strict subset of Rust's | ||||||||||||||||
standard library. It is there so that you can have access to basic Rust functionality, | ||||||||||||||||
such as common arithmetic operations on natural numbers or printing basic strings to | ||||||||||||||||
the standard output streams. | ||||||||||||||||
Comment on lines
+125
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably not be mentioned.
Suggested change
|
||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-borrowcheck} | ||||||||||||||||
@item -frust-borrowcheck | ||||||||||||||||
Enable the experimental borrow-checking pass in the @command{gccrs} pipeline. This pass | ||||||||||||||||
feeds information to @command{polonius}, a next-generation borrow-checking algorithm for | ||||||||||||||||
Rust. It is incomplete and cannot be used to safely analyze Rust borrowing rules with | ||||||||||||||||
@command{gccrs} yet. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-cfg} | ||||||||||||||||
@item -frust-cfg=@var{input} | ||||||||||||||||
Specify a @code{#[cfg]} directive for the Rust compiler. This is used in Rust code | ||||||||||||||||
to perform conditional compilation. The input can be of the form @code{key} or @code{key=value}. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-compile-until} | ||||||||||||||||
@item -frust-compile-until=@var{step} | ||||||||||||||||
Stop the compilation at a certain stage in the @command{gccrs} pipeline. The available steps are: | ||||||||||||||||
@code{ast}, @code{attributecheck}, @code{expansion}, @code{astvalidation}, @code{featuregating}, @code{nameresolution}, @code{lowering}, @code{typecheck}, @code{privacy}, @code{unsafety}, @code{const}, @code{borrowcheck}, @code{compilation}, @code{end}. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-crate-type} | ||||||||||||||||
@item -frust-crate-type=@var{type} | ||||||||||||||||
What type of crate to produce using @command{gccrs}. While the official Rust compiler supports | ||||||||||||||||
multiple options such as @code{staticlib} or @code{rlib}, the Rust compiler for GCC does not. | ||||||||||||||||
The complete list of accepted @code{type}s is as follows: @code{bin}, @code{lib}, @code{rlib}, @code{dylib}, @code{cdylib}, @code{staticlib}, @code{proc_macro}. | ||||||||||||||||
The list of supported @code{type}s is: @code{bin}, @code{proc_macro}. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-crate} | ||||||||||||||||
@item -frust-crate=@var{name} | ||||||||||||||||
Specify the name to use for the crate we are producing. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-edition} | ||||||||||||||||
@item -frust-edition=@var{year} | ||||||||||||||||
Rust edition to use when compiling the code. Available editions are @code{2015}, @code{2018} and @code{2021}. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-embed-metadata} | ||||||||||||||||
@item -frust-embed-metadata | ||||||||||||||||
Enable embedding metadata directly into object files. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-metadata-output} | ||||||||||||||||
@item -frust-metadata-output=@var{path} | ||||||||||||||||
Path where crate metadata should be written. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-extern} | ||||||||||||||||
@item -frust-extern=@var{path} | ||||||||||||||||
Specify a path from which an external crate should be loaded. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-mangling} | ||||||||||||||||
@item -frust-mangling=@var{version} | ||||||||||||||||
Mangling algorithm to use: @code{legacy} or @code{v0}. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-max-recursion-depth} | ||||||||||||||||
@item -frust-max-recursion-depth=@var{max_value} | ||||||||||||||||
Set the maximum recursion depth for macro expansion. The default is 128. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-name-resolution-2.0} | ||||||||||||||||
@item -frust-name-resolution-2.0 | ||||||||||||||||
Switch to the experimental name resolution algorithm which is currently being rewritten. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-debug} | ||||||||||||||||
@item -frust-debug | ||||||||||||||||
Turn on debug printing from the Rust compiler frontend. This does not turn on debug | ||||||||||||||||
information for the produced binaries, and will create a lot of noise on the output. | ||||||||||||||||
This option is aimed for the developers of @command{gccrs}. | ||||||||||||||||
|
||||||||||||||||
@cindex @option{-frust-dump-} | ||||||||||||||||
@item -frust-dump-@var{to_dump} | ||||||||||||||||
Create debug dump files from various passes of the @command{gccrs} pipeline. | ||||||||||||||||
CohenArthur marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||
Available dumps are: @code{lex}, @code{ast-pretty}, @code{register_plugins}, @code{injection}, @code{expansion}, @code{resolution}, @code{target_options}, @code{hir}, @code{hir-pretty}, @code{all} | ||||||||||||||||
|
||||||||||||||||
@end table | ||||||||||||||||
|
||||||||||||||||
@node Index | ||||||||||||||||
@unnumbered Index | ||||||||||||||||
|
||||||||||||||||
@printindex cp | ||||||||||||||||
|
||||||||||||||||
@bye |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be sure, is that the "blessed" name, wrt the Rust® ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question :) I think we can leave it like this for now, and be open to changing it