Skip to content

Link to feature_err in stability section #1022

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

Merged
merged 1 commit into from
Jan 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/implementing_new_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ a new unstable feature:

If the feature gate is not set, you should either maintain
the pre-feature behavior or raise an error, depending on
what makes sense.
what makes sense. Errors should generally use [`rustc_session::parse::feature_err`].
For an example of adding an error, see [#81015].

For features introducing new syntax, pre-expansion gating should be used instead.
To do so, extend the [`GatedSpans`] struct, add spans to it during parsing,
Expand All @@ -160,6 +161,8 @@ a new unstable feature:
implemented a feature in Rust!

[`GatedSpans`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/parse/struct.GatedSpans.html
[#81015]: https://github.com/rust-lang/rust/pull/81015
[`rustc_session::parse::feature_err`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/parse/fn.feature_err.html
[`rustc_ast_passes::feature_gate::check_crate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_passes/feature_gate/fn.check_crate.html
[value the stability of Rust]: https://github.com/rust-lang/rfcs/blob/master/text/1122-language-semver.md
[stability in code]: #stability-in-code
Expand Down