Auto merge of #120393 - Urgau:rfc3373-non-local-defs, r=WaffleLapkin
Implement RFC 3373: Avoid non-local definitions in functions This PR implements [RFC 3373: Avoid non-local definitions in functions](https://github.com/rust-lang/rust/issues/120363).
This commit is contained in:
commit
b0d3e04ca9
59 changed files with 1518 additions and 92 deletions
|
@ -55,7 +55,8 @@ use synstructure::Structure;
|
|||
///
|
||||
/// See rustc dev guide for more examples on using the `#[derive(Diagnostic)]`:
|
||||
/// <https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html>
|
||||
pub fn session_diagnostic_derive(s: Structure<'_>) -> TokenStream {
|
||||
pub fn session_diagnostic_derive(mut s: Structure<'_>) -> TokenStream {
|
||||
s.underscore_const(true);
|
||||
DiagnosticDerive::new(s).into_tokens()
|
||||
}
|
||||
|
||||
|
@ -101,7 +102,8 @@ pub fn session_diagnostic_derive(s: Structure<'_>) -> TokenStream {
|
|||
///
|
||||
/// See rustc dev guide for more examples on using the `#[derive(LintDiagnostic)]`:
|
||||
/// <https://rustc-dev-guide.rust-lang.org/diagnostics/diagnostic-structs.html#reference>
|
||||
pub fn lint_diagnostic_derive(s: Structure<'_>) -> TokenStream {
|
||||
pub fn lint_diagnostic_derive(mut s: Structure<'_>) -> TokenStream {
|
||||
s.underscore_const(true);
|
||||
LintDiagnosticDerive::new(s).into_tokens()
|
||||
}
|
||||
|
||||
|
@ -151,6 +153,7 @@ pub fn lint_diagnostic_derive(s: Structure<'_>) -> TokenStream {
|
|||
///
|
||||
/// diag.subdiagnostic(RawIdentifierSuggestion { span, applicability, ident });
|
||||
/// ```
|
||||
pub fn session_subdiagnostic_derive(s: Structure<'_>) -> TokenStream {
|
||||
pub fn session_subdiagnostic_derive(mut s: Structure<'_>) -> TokenStream {
|
||||
s.underscore_const(true);
|
||||
SubdiagnosticDeriveBuilder::new().into_tokens(s)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue