-
Notifications
You must be signed in to change notification settings - Fork 530
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
Add Spec Glossary #1537
Add Spec Glossary #1537
Changes from all commits
dcdeb9c
e1fd482
f4ab575
8f464ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,34 @@ | ||
# Glossary | ||
|
||
## Terms used in the Specification | ||
|
||
### Ill-formed program | ||
|
||
r[requirement.error] | ||
|
||
A Rust program is ill-formed if it violates a static constraint of the language. | ||
Unless otherwise stated (See ["no diagnostic required"][requirement.ndr]), it is an error to have an ill-formed program. | ||
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 that be
or something like that? "it is an error" sounds like something the user isn't supposed to do, not necessarily like something that results in an error message. |
||
|
||
#### No diagnostic required | ||
|
||
r[requirement.ndr] | ||
|
||
When No diagnostic is required for a static constraint, the implementation may (but is not required to) issue an compile-time error or other diagnostic, and may translate the program. | ||
|
||
If such a program is succesfully translated, no constraints are placed on the result of executing the program. | ||
|
||
> [!NOTE] | ||
> The constraint which is modified by the phrase "No Diagnostic Required" may be defined implicitly, such as with the term "shall", rather than explicitly stating that the program is ill-formed. | ||
ehuss marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
> [!NOTE] | ||
> Such constraints are used only when it may be unreasonable or impossible to check the constraints statically, and where the result of violating the constraints makes it impossible to ensure the required behaviour of the program | ||
|
||
### Shall | ||
|
||
The word "shall" is a static constraint placed upon the program. A program that violates a constraint that uses "shall" is ill-formed. | ||
Comment on lines
+26
to
+28
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. I don't entirely object to specifying this, but I just want to call out that it seems unusual to do so. At least, I have not seen any other languages do that. Is there a precedent that shows this needing definition or way this could be confusing otherwise? 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. I thought C++ did but I checked and am incorrect. 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. The Ada standards do (since Ada 95; Ada 83 used "must"). See eg Ada 2012 §1.1.5:3. |
||
|
||
## Rust Specific Terms | ||
|
||
### Abstract syntax tree | ||
|
||
An ‘abstract syntax tree’, or ‘AST’, is an intermediate representation of | ||
|
@@ -105,6 +134,7 @@ are also considered local. Fundamental type constructors cannot [cover](#uncover | |
Any time the term "covered type" is used, | ||
the `T` in `&T`, `&mut T`, `Box<T>`, and `Pin<T>` is not considered covered. | ||
|
||
|
||
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. Looks like a stray newline? |
||
### Inhabited | ||
|
||
A type is inhabited if it has constructors and therefore can be instantiated. An inhabited type is | ||
|
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.
Can you say more about why this would be separated?
I think that generally we shouldn't need to separate this out. I don't think there should be terms here that aren't used in the specification (unless they are aliases for ones that are).
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.
I'm back and forth on this.
The main thing I would put in the section would be prescriptive terms, rather than semantic terms (IE. terms used to express the requirements of the spec, not terms that refer to a construct). IE. a term like "function" wouldn't go in this section, but would go into the rest of the glossary.
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.
Might be something to discuss tomorrow.