Lines Matching +full:input +full:- +full:value
1 // SPDX-License-Identifier: Apache-2.0 OR MIT
38 Value { enumerator
40 value: Option<(Token![:], Expr)>,
44 _left_arrow_token: Token![<-],
45 value: Expr,
55 fn ident(&self) -> Option<&Ident> {
57 Self::Value { ident, .. } | Self::Init { ident, .. } => Some(ident),
84 ) -> Result<TokenStream, ErrorGuaranteed> {
146 // `mixed_site` ensures that the data is not accessible to the user-controlled code.
171 let init = move |slot| -> ::core::result::Result<(), #error> {
191 fn get_init_kind(rest: Option<(Token![..], Expr)>, dcx: &mut DiagCtxt) -> InitKind {
231 ) -> TokenStream {
242 InitializerKind::Value { ident, value } => {
244 let value_prep = value.as_ref().map(|value| &value.1).map(|value| {
245 // Setting the span of `value_ident` to `value`'s span improves error messages
246 // when the type of `value` is wrong.
247 value_ident.set_span(value.span());
248 quote!(let #value_ident = #value;)
261 InitializerKind::Init { ident, value, .. } => {
263 let init = format_ident!("init", span = value.span());
267 // - `slot` is valid, because we are inside of an initializer closure, we
269 // - We also use `#data` to require the correct trait (`Init` or `PinInit`)
288 let #init = #value;
293 InitializerKind::Code { block: value, .. } => quote! {
296 #value
301 // `mixed_site` ensures that the guard is not accessible to the user-controlled code.
324 // - `&raw mut (*slot).#ident` is valid.
325 // - `make_field_check` checks that `&raw mut (*slot).#ident` is properly aligned.
326 // - `(*slot).#ident` has been initialized above.
327 // - We only need the ownership to the pointee back when initialization has
359 ) -> TokenStream {
379 // `ptr::write` for value-initialization case has the same requirement.
401 fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
402 let attrs = input.call(Attribute::parse_outer)?;
403 let this = input.peek(Token![&]).then(|| input.parse()).transpose()?;
404 let path = input.parse()?;
406 let brace_token = braced!(content in input);
430 let error = input
432 .then(|| Ok::<_, syn::Error>((input.parse()?, input.parse()?)))
458 fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
459 Ok(Self { ty: input.parse()? })
464 fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
466 _and_token: input.parse()?,
467 ident: input.parse()?,
468 _in_token: input.parse()?,
474 fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
475 let attrs = input.call(Attribute::parse_outer)?;
478 kind: input.parse()?,
484 fn parse(input: syn::parse::ParseStream<'_>) -> syn::Result<Self> {
485 let lh = input.lookahead1();
488 _underscore_token: input.parse()?,
489 _colon_token: input.parse()?,
490 block: input.parse()?,
493 let ident = input.parse()?;
494 let lh = input.lookahead1();
495 if lh.peek(Token![<-]) {
498 _left_arrow_token: input.parse()?,
499 value: input.parse()?,
502 Ok(Self::Value {
504 value: Some((input.parse()?, input.parse()?)),
507 Ok(Self::Value { ident, value: None })