rust: syn: add SPDX License Identifiers

Originally, when the Rust upstream `alloc` standard library crate was
vendored in commit 057b8d2571 ("rust: adapt `alloc` crate to the
kernel"), the SPDX License Identifiers were added to every file so that
the license on those was clear.

Thus do the same for the `syn` crate.

This makes `scripts/spdxcheck.py` pass.

Reviewed-by: Gary Guo <gary@garyguo.net>
Tested-by: Gary Guo <gary@garyguo.net>
Tested-by: Jesung Yang <y.j3ms.n@gmail.com>
Link: https://patch.msgid.link/20251124151837.2184382-17-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
Miguel Ojeda 2025-11-24 16:18:28 +01:00
parent 808c999fc9
commit 69942c0a89
55 changed files with 110 additions and 0 deletions

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]
use crate::error::Error; use crate::error::Error;
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::ops::{AddAssign, MulAssign}; use std::ops::{AddAssign, MulAssign};
// For implementing base10_digits() accessor on LitInt. // For implementing base10_digits() accessor on LitInt.

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! A stably addressed token buffer supporting efficient traversal based on a //! A stably addressed token buffer supporting efficient traversal based on a
//! cheaply copyable cursor. //! cheaply copyable cursor.

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg(feature = "full")] #[cfg(feature = "full")]
use crate::expr::Expr; use crate::expr::Expr;
#[cfg(any(feature = "printing", feature = "full"))] #[cfg(any(feature = "printing", feature = "full"))]

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
/// Define a type that supports parsing and printing a given identifier as if it /// Define a type that supports parsing and printing a given identifier as if it
/// were a keyword. /// were a keyword.
/// ///

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
/// Define a type that supports parsing and printing a multi-character symbol /// Define a type that supports parsing and printing a multi-character symbol
/// as if it were a punctuation token. /// as if it were a punctuation token.
/// ///

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::attr::Attribute; use crate::attr::Attribute;
use crate::expr::{Expr, Index, Member}; use crate::expr::{Expr, Index, Member};
use crate::ident::Ident; use crate::ident::Ident;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::attr::Attribute; use crate::attr::Attribute;
use crate::data::{Fields, FieldsNamed, Variant}; use crate::data::{Fields, FieldsNamed, Variant};
use crate::generics::Generics; use crate::generics::Generics;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! Extensions to the parsing API with niche applicability. //! Extensions to the parsing API with niche applicability.
use crate::buffer::Cursor; use crate::buffer::Cursor;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::iter; use std::iter;
use std::mem::ManuallyDrop; use std::mem::ManuallyDrop;
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]
use crate::buffer::Cursor; use crate::buffer::Cursor;
use crate::thread::ThreadBound; use crate::thread::ThreadBound;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[doc(hidden)] #[doc(hidden)]
pub use std::clone::Clone; pub use std::clone::Clone;
#[doc(hidden)] #[doc(hidden)]

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::attr::Attribute; use crate::attr::Attribute;
#[cfg(all(feature = "parsing", feature = "full"))] #[cfg(all(feature = "parsing", feature = "full"))]
use crate::error::Result; use crate::error::Result;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! Extension traits to provide parsing methods on foreign types. //! Extension traits to provide parsing methods on foreign types.
use crate::buffer::Cursor; use crate::buffer::Cursor;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::attr::Attribute; use crate::attr::Attribute;
use crate::item::Item; use crate::item::Item;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::classify; use crate::classify;
use crate::expr::Expr; use crate::expr::Expr;
#[cfg(feature = "full")] #[cfg(feature = "full")]

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// This file is @generated by syn-internal-codegen. // This file is @generated by syn-internal-codegen.
// It is not intended for manual editing. // It is not intended for manual editing.

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// This file is @generated by syn-internal-codegen. // This file is @generated by syn-internal-codegen.
// It is not intended for manual editing. // It is not intended for manual editing.

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// This file is @generated by syn-internal-codegen. // This file is @generated by syn-internal-codegen.
// It is not intended for manual editing. // It is not intended for manual editing.

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// This file is @generated by syn-internal-codegen. // This file is @generated by syn-internal-codegen.
// It is not intended for manual editing. // It is not intended for manual editing.

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// This file is @generated by syn-internal-codegen. // This file is @generated by syn-internal-codegen.
// It is not intended for manual editing. // It is not intended for manual editing.

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// This file is @generated by syn-internal-codegen. // This file is @generated by syn-internal-codegen.
// It is not intended for manual editing. // It is not intended for manual editing.

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
// This file is @generated by syn-internal-codegen. // This file is @generated by syn-internal-codegen.
// It is not intended for manual editing. // It is not intended for manual editing.

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::attr::Attribute; use crate::attr::Attribute;
use crate::expr::Expr; use crate::expr::Expr;
use crate::ident::Ident; use crate::ident::Ident;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::error::Result; use crate::error::Result;
use crate::parse::ParseBuffer; use crate::parse::ParseBuffer;
use crate::token; use crate::token;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]
use crate::lookahead; use crate::lookahead;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::attr::Attribute; use crate::attr::Attribute;
use crate::data::{Fields, FieldsNamed, Variant}; use crate::data::{Fields, FieldsNamed, Variant};
use crate::derive::{Data, DataEnum, DataStruct, DataUnion, DeriveInput}; use crate::derive::{Data, DataEnum, DataStruct, DataUnion, DeriveInput};

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! [![github]](https://github.com/dtolnay/syn)&ensp;[![crates-io]](https://crates.io/crates/syn)&ensp;[![docs-rs]](crate) //! [![github]](https://github.com/dtolnay/syn)&ensp;[![crates-io]](https://crates.io/crates/syn)&ensp;[![docs-rs]](crate)
//! //!
//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github //! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]
use crate::lookahead; use crate::lookahead;
use proc_macro2::{Ident, Span}; use proc_macro2::{Ident, Span};

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]
use crate::lookahead; use crate::lookahead;
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::buffer::Cursor; use crate::buffer::Cursor;
use crate::error::{self, Error}; use crate::error::{self, Error};
use crate::sealed::lookahead::Sealed; use crate::sealed::lookahead::Sealed;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]
use crate::error::Result; use crate::error::Result;
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg_attr( #[cfg_attr(
not(any(feature = "full", feature = "derive")), not(any(feature = "full", feature = "derive")),
allow(unknown_lints, unused_macro_rules) allow(unknown_lints, unused_macro_rules)

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! Facility for interpreting structured content inside of an `Attribute`. //! Facility for interpreting structured content inside of an `Attribute`.
use crate::error::{Error, Result}; use crate::error::{Error, Result};

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
ast_enum! { ast_enum! {
/// A binary operator: `+`, `+=`, `&`. /// A binary operator: `+`, `+=`, `&`.
#[cfg_attr(docsrs, doc(cfg(any(feature = "full", feature = "derive"))))] #[cfg_attr(docsrs, doc(cfg(any(feature = "full", feature = "derive"))))]

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! Parsing interface for parsing a token stream into a syntax tree node. //! Parsing interface for parsing a token stream into a syntax tree node.
//! //!
//! Parsing in Syn is built on parser functions that take in a [`ParseStream`] //! Parsing in Syn is built on parser functions that take in a [`ParseStream`]

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
/// Parse the input TokenStream of a macro, triggering a compile error if the /// Parse the input TokenStream of a macro, triggering a compile error if the
/// tokens fail to parse. /// tokens fail to parse.
/// ///

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
/// Quasi-quotation macro that accepts input like the [`quote!`] macro but uses /// Quasi-quotation macro that accepts input like the [`quote!`] macro but uses
/// type inference to figure out a return type for those tokens. /// type inference to figure out a return type for those tokens.
/// ///

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::attr::Attribute; use crate::attr::Attribute;
use crate::expr::Member; use crate::expr::Member;
use crate::ident::Ident; use crate::ident::Ident;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]
use crate::error::Result; use crate::error::Result;
use crate::expr::Expr; use crate::expr::Expr;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg(all(feature = "printing", feature = "full"))] #[cfg(all(feature = "printing", feature = "full"))]
use crate::attr::{AttrStyle, Attribute}; use crate::attr::{AttrStyle, Attribute};
#[cfg(feature = "printing")] #[cfg(feature = "printing")]

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use proc_macro2::TokenStream; use proc_macro2::TokenStream;
use quote::ToTokens; use quote::ToTokens;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! A punctuated sequence of syntax tree nodes separated by punctuation. //! A punctuated sequence of syntax tree nodes separated by punctuation.
//! //!
//! Lots of things in Rust are punctuated sequences. //! Lots of things in Rust are punctuated sequences.

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::path::Path; use crate::path::Path;
use crate::token; use crate::token;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use self::{Action::*, Input::*}; use self::{Action::*, Input::*};
use proc_macro2::{Delimiter, Ident, Spacing, TokenTree}; use proc_macro2::{Delimiter, Ident, Spacing, TokenTree};
use syn::parse::{ParseStream, Result}; use syn::parse::{ParseStream, Result};

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
#[cfg(feature = "parsing")] #[cfg(feature = "parsing")]
pub(crate) mod lookahead { pub(crate) mod lookahead {
pub trait Sealed: Copy {} pub trait Sealed: Copy {}

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use proc_macro2::extra::DelimSpan; use proc_macro2::extra::DelimSpan;
use proc_macro2::{Delimiter, Group, Span, TokenStream}; use proc_macro2::{Delimiter, Group, Span, TokenStream};

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! A trait that can provide the `Span` of the complete contents of a syntax //! A trait that can provide the `Span` of the complete contents of a syntax
//! tree node. //! tree node.
//! //!

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::attr::Attribute; use crate::attr::Attribute;
use crate::expr::Expr; use crate::expr::Expr;
use crate::item::Item; use crate::item::Item;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use std::fmt::{self, Debug}; use std::fmt::{self, Debug};
use std::thread::{self, ThreadId}; use std::thread::{self, ThreadId};

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! Tokens representing Rust punctuation, keywords, and delimiters. //! Tokens representing Rust punctuation, keywords, and delimiters.
//! //!
//! The type names in this module can be difficult to keep straight, so we //! The type names in this module can be difficult to keep straight, so we

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use proc_macro2::{Delimiter, TokenStream, TokenTree}; use proc_macro2::{Delimiter, TokenStream, TokenTree};
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::attr::Attribute; use crate::attr::Attribute;
use crate::expr::Expr; use crate::expr::Expr;
use crate::generics::{BoundLifetimes, TypeParamBound}; use crate::generics::{BoundLifetimes, TypeParamBound};

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
use crate::parse::ParseStream; use crate::parse::ParseStream;
use proc_macro2::{Delimiter, TokenStream}; use proc_macro2::{Delimiter, TokenStream};
use std::cmp::Ordering; use std::cmp::Ordering;

View File

@ -1,3 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT
pub(crate) fn skip(mut s: &str) -> &str { pub(crate) fn skip(mut s: &str) -> &str {
'skip: while !s.is_empty() { 'skip: while !s.is_empty() {
let byte = s.as_bytes()[0]; let byte = s.as_bytes()[0];