-
Couldn't load subscription status.
- Fork 13.9k
Stabilize Frontmatter #148051
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
Open
epage
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
epage:frontmatter
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
Stabilize Frontmatter #148051
Changes from all commits
Commits
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 hidden or 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
jieyouxu marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
25 changes: 0 additions & 25 deletions
25
src/doc/unstable-book/src/language-features/frontmatter.md
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -4,6 +4,4 @@ | |
|
|
||
| // infostrings cannot have leading dots | ||
|
|
||
| #![feature(frontmatter)] | ||
|
|
||
| fn main() {} | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,10 +1,8 @@ | ||
| #![feature(frontmatter)] | ||
| // frontmatters must be at the start of a file. This test ensures that. | ||
|
|
||
| --- | ||
| //~^ ERROR: expected item, found `-` | ||
| // FIXME(frontmatter): make this diagnostic better | ||
| --- | ||
|
|
||
| // frontmatters must be at the start of a file. This test ensures that. | ||
|
|
||
| fn main() {} |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -9,6 +9,4 @@ clap = "4" | |
|
|
||
| // crlf line endings should be accepted | ||
|
|
||
| #![feature(frontmatter)] | ||
|
|
||
| fn main() {} | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -5,6 +5,4 @@ x ---🚧️ | |
| // Regression test for #141483 | ||
| //@check-pass | ||
|
|
||
| #![feature(frontmatter)] | ||
|
|
||
| fn main() {} | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -6,6 +6,4 @@ x ---y | |
| // non-whitespace character preceding them. | ||
| //@check-pass | ||
|
|
||
| #![feature(frontmatter)] | ||
|
|
||
| fn main() {} | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,14 +1,12 @@ | ||
| ---cargo | ||
| //~^ ERROR: unclosed frontmatter | ||
|
|
||
| //@ compile-flags: --crate-type lib | ||
|
|
||
| #![feature(frontmatter)] | ||
|
|
||
| fn foo(x: i32) -> i32 { | ||
| ---x | ||
| //~^ WARNING: use of a double negation [double_negations] | ||
| } | ||
| //~^ ERROR: invalid preceding whitespace for frontmatter close | ||
| //~| ERROR: extra characters after frontmatter close are not allowed | ||
| } //~ ERROR: unexpected closing delimiter: `}` | ||
|
|
||
| // this test is for the weird case that valid Rust code can have three dashes | ||
| // within them and get treated as a frontmatter close. |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,30 +1,26 @@ | ||
| error: unclosed frontmatter | ||
| --> $DIR/frontmatter-whitespace-2.rs:1:1 | ||
| error: invalid preceding whitespace for frontmatter close | ||
| --> $DIR/frontmatter-whitespace-2.rs:6:1 | ||
| | | ||
| LL | / ---cargo | ||
| ... | | ||
| LL | | | ||
| | |_^ | ||
| LL | ---x | ||
| | ^^^^^^^^ | ||
| | | ||
| note: frontmatter opening here was not closed | ||
| --> $DIR/frontmatter-whitespace-2.rs:1:1 | ||
| note: frontmatter close should not be preceded by whitespace | ||
| --> $DIR/frontmatter-whitespace-2.rs:6:1 | ||
| | | ||
| LL | ---cargo | ||
| | ^^^ | ||
| LL | ---x | ||
| | ^^^^ | ||
|
|
||
| warning: use of a double negation | ||
| --> $DIR/frontmatter-whitespace-2.rs:9:6 | ||
| error: extra characters after frontmatter close are not allowed | ||
| --> $DIR/frontmatter-whitespace-2.rs:6:1 | ||
| | | ||
| LL | ---x | ||
| | ^^^ | ||
| | | ||
| = note: the prefix `--` could be misinterpreted as a decrement operator which exists in other languages | ||
| = note: use `-= 1` if you meant to decrement the value | ||
| = note: `#[warn(double_negations)]` on by default | ||
| help: add parentheses for clarity | ||
| | ^^^^^^^^ | ||
|
|
||
| error: unexpected closing delimiter: `}` | ||
| --> $DIR/frontmatter-whitespace-2.rs:9:1 | ||
| | | ||
| LL | --(-x) | ||
| | + + | ||
| LL | } | ||
| | ^ unexpected closing delimiter | ||
|
|
||
| error: aborting due to 1 previous error; 1 warning emitted | ||
| error: aborting due to 3 previous errors | ||
|
|
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -12,6 +12,4 @@ | |
| // ignore-tidy-leading-newlines | ||
| // ignore-tidy-tab | ||
|
|
||
| #![feature(frontmatter)] | ||
|
|
||
| fn main() {} | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -5,6 +5,4 @@ | |
| // ignore-tidy-tab | ||
| // A frontmatter infostring can have leading whitespace. | ||
|
|
||
| #![feature(frontmatter)] | ||
|
|
||
| fn main() {} | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -4,6 +4,4 @@ | |
|
|
||
| // infostrings cannot have leading hyphens | ||
|
|
||
| #![feature(frontmatter)] | ||
|
|
||
| fn main() {} | ||
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -4,6 +4,4 @@ | |
|
|
||
| // infostrings can only be a single identifier. | ||
|
|
||
| #![feature(frontmatter)] | ||
|
|
||
| fn main() {} | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
(Commenting on an arbitrary line to make this discussion threaded)
From the PR description (emphasis and ellipses mine):
In #146340 I actually struck a (temporary) compromise: We do still strip/lex/recognize frontmatter (and shebang) in item-context
include!s. However, we no longer strip frontmatter in expression/statement-contextinclude!s like inlet _ = include!(…);(to prevent the manifold negation backcompat issue you've rightly mentioned).Now, I don't know what's best here. I'm eager to know your and T-lang's stance on the matter. Note that we do strip shebang in expression/statement-context
include!s which I consider to be quite odd (but still understandable on a lexical level). I have an open PR #146377 which would stop stripping shebang in that position, too. I still need to rebase+polish, lang-nominate and possibly crater it. The outcome of that T-lang discussion likely affects the decision mentioned in the first paragraph (†).(†): If that PR was accepted it would mean that we would strip shebang+frontmatter in item-ctxt includes and wouldn't strip either(!) shebang or frontmatter in expr/stmt-ctxt includes which would make the behavior of shebang+frontmatter consistent thereby fulfilling the original goal of "This applies anywhere shebang stripping is performed." in this specific case (obviously the goal wasn't achieved in other cases, like in the proc_macro API case).