| /linux/rust/proc-macro2/ |
| H A D | parse.rs | 20 let (_front, rest) = self.rest.split_at(bytes); in advance() 80 let mut s = input; in skip_whitespace() 83 let byte = s.as_bytes()[0]; in skip_whitespace() 89 let (cursor, _) = take_until_newline_or_eof(s); in skip_whitespace() 115 let ch = s.chars().next().unwrap(); in skip_whitespace() 132 let mut depth = 0usize; in block_comment() 133 let bytes = input.as_bytes(); in block_comment() 134 let mut i = 0usize; in block_comment() 135 let upper = bytes.len() - 1; in block_comment() 171 let mut trees = TokenStreamBuilder::new(); in token_stream() [all …]
|
| H A D | fallback.rs | 78 let mut cursor = get_cursor(src); in from_str_checked() 99 let nodrop = ManuallyDrop::new(self); in take_inner() 122 let mut punct = crate::Punct::new('-', Spacing::Alone); in push_token_from_proc_macro() 132 let mut stack = Vec::new(); in drop() 133 let mut current = match self.inner.get_mut() { in drop() 138 while let Some(token) = current.next() { in drop() 139 let group = match token { in drop() 144 let group = match group { in drop() 148 let mut group = group; in drop() 149 if let Some(inner) = group.stream.inner.get_mut() { in drop() [all …]
|
| /linux/tools/memory-model/ |
| H A D | linux-kernel.cat | 28 let acq-po = [Acquire] ; po ; [M] 29 let po-rel = [M] ; po ; [Release] 30 let po-unlock-lock-po = po ; [UL] ; (po|rf) ; [LKR] ; po 33 let R4rmb = R \ Noreturn (* Reads for which rmb works *) 34 let rmb = [R4rmb] ; fencerel(Rmb) ; [R4rmb] 35 let wmb = [W] ; fencerel(Wmb) ; [W] 36 let mb = ([M] ; fencerel(Mb) ; [M]) | 64 let gp = po ; [Sync-rcu | Sync-srcu] ; po? 65 let strong-fence = mb | gp 67 let nonr [all...] |
| H A D | lock.cat | 33 let RL = try RL with emptyset 34 let RU = try RU with emptyset 37 let LF = LF | RL 40 let ALL-LOCKS = LKR | LKW | UL | LF | RU | Srcu-lock | Srcu-unlock | Sync-srcu 44 let lk-rmw = ([LKR] ; po-loc ; [LKW]) \ (po ; po) 45 let rmw = rmw | lk-rmw 70 let R = R | LKR | LF | RU 71 let W = W | LKW 73 let Release = Release | UL 74 let Acquire = Acquire | LKR [all …]
|
| /linux/rust/syn/ |
| H A D | item.rs | 814 let arg = self.inputs.first()?; in receiver() 942 let begin = input.fork(); in parse() 943 let attrs = input.call(Attribute::parse_outer)?; in parse() 953 let ahead = input.fork(); in parse_rest_of_item() 954 let vis: Visibility = ahead.parse()?; in parse_rest_of_item() 956 let lookahead = ahead.lookahead1(); in parse_rest_of_item() 957 let allow_safe = false; in parse_rest_of_item() 958 let mut item = if lookahead.peek(Token![fn]) || peek_signature(&ahead, allow_safe) { in parse_rest_of_item() 959 let vis: Visibility = input.parse()?; in parse_rest_of_item() 960 let sig: Signature = input.parse()?; in parse_rest_of_item() [all …]
|
| H A D | ty.rs | 300 let allow_plus = true; in parse() 301 let allow_group_generic = true; in parse() 314 let allow_plus = false; in without_plus() 315 let allow_group_generic = true; in without_plus() 325 let begin = input.fork(); in ambig_ty() 328 let mut group: TypeGroup = input.parse()?; in ambig_ty() 330 if let Type::Path(mut ty) = *group.elem { in ambig_ty() 348 if let Type::Path(mut ty) = *group.elem { in ambig_ty() 349 let arguments = &mut ty.path.segments.last_mut().unwrap().arguments; in ambig_ty() 362 let mut lifetimes = None::<BoundLifetimes>; in ambig_ty() [all …]
|
| H A D | stmt.rs | 24 /// A local (let) binding. 36 /// macro would expand to. It can be any of local variable (`let`), 43 /// A local `let` binding: `let x: u64 = s.parse()?;`. 47 pub let_token: Token![let], 55 /// The expression assigned in a local `let` binding, including optional 58 /// `LocalInit` represents `= s.parse()?` in `let x: u64 = s.parse()?` and 59 /// `= r else { return }` in `let Ok(x) = r else { return }`. 72 /// would expand to. It can be any of local variable (`let`), item, or 115 /// // let mut x = 1; 129 /// let outer_attrs = input.call(Attribute::parse_outer)?; [all …]
|
| H A D | lit.rs | 136 let mut token = Literal::string(value); in new() 147 let repr = self.repr.token.to_string(); in value() 148 let (value, _suffix) = value::parse_lit_str(&repr); in value() 171 /// if let Meta::NameValue(meta) = &attr.meta { 172 /// if let Expr::Lit(expr) = &meta.value { 173 /// if let Lit::Str(lit_str) = &expr.lit { 179 /// let message = "expected #[path = \"...\"]"; 200 /// # let lit_str = LitStr::new("a::b::c", Span::call_site()); 203 /// let lit_str: LitStr = /* ... */; 208 /// let basic_path = lit_str.parse_with(syn::Path::parse_mod_style)?; [all …]
|
| H A D | expr.rs | 53 /// let expr: Expr = /* ... */; 103 /// // assigning `*discriminant.base` without an `if let`. 104 /// if let Expr::Tuple(base) = *discriminant.base { 179 /// A `let` guard: `let Some(x) = opt`. 180 Let(ExprLet), 484 /// A `let` guard: `let Some(x) = opt`. 488 pub let_token: Token![let], 727 /// while let Expr::Paren(paren) = e { 733 /// let mut e: Expr = parse_quote! { ((1 + 1)) }; 767 /// let _ = *S {}; [all …]
|
| H A D | derive.rs | 84 let attrs = input.call(Attribute::parse_outer)?; in parse() 85 let vis = input.parse::<Visibility>()?; in parse() 87 let lookahead = input.lookahead1(); in parse() 89 let struct_token = input.parse::<Token![struct]>()?; in parse() 90 let ident = input.parse::<Ident>()?; in parse() 91 let generics = input.parse::<Generics>()?; in parse() 92 let (where_clause, fields, semi) = data_struct(input)?; in parse() 108 let enum_token = input.parse::<Token![enum]>()?; in parse() 109 let ident = input.parse::<Ident>()?; in parse() 110 let generics = input.parse::<Generics>()?; in parse() [all …]
|
| /linux/rust/zerocopy-derive/derive/ |
| H A D | try_from_bytes.rs | 33 let tags = data.variants.iter().map(|v| { in generate_tag_consts() 34 let variant_ident = &v.ident; in generate_tag_consts() 35 let tag_ident = tag_ident(variant_ident); in generate_tag_consts() 79 let (impl_generics, ty_generics, where_clause) = ctx.ast.generics.split_for_impl(); in generate_variant_structs() 81 let enum_name = &ctx.ast.ident; in generate_variant_structs() 86 let core = ctx.core_path(); in generate_variant_structs() 87 let phantom_ty = quote! { in generate_variant_structs() 91 let variant_structs = data.variants.iter().filter_map(|variant| { in generate_variant_structs() 98 let variant_struct_ident = variant_struct_ident(&variant.ident); in generate_variant_structs() 99 let field_types = variant.fields.iter().map(|f| &f.ty); in generate_variant_structs() [all …]
|
| H A D | known_layout.rs | 17 let (trailing_field, leading_fields) = fields.split_last()?; in derive_known_layout_for_repr_c_struct() 19 let (_vis, trailing_field_name, trailing_field_ty) = trailing_field; in derive_known_layout_for_repr_c_struct() 20 let leading_fields_tys = leading_fields.iter().map(|(_vis, _name, ty)| ty); in derive_known_layout_for_repr_c_struct() 22 let core = ctx.core_path(); in derive_known_layout_for_repr_c_struct() 23 let repr_align = repr in derive_known_layout_for_repr_c_struct() 26 let align = align.t.get(); in derive_known_layout_for_repr_c_struct() 30 let repr_packed = repr in derive_known_layout_for_repr_c_struct() 33 let packed = packed.get(); in derive_known_layout_for_repr_c_struct() 38 let zerocopy_crate = &ctx.zerocopy_crate; in derive_known_layout_for_repr_c_struct() 39 let make_methods = |trailing_field_ty| { in derive_known_layout_for_repr_c_struct() [all …]
|
| /linux/rust/macros/ |
| H A D | fmt.rs | 10 let mut input = input.into_iter(); in fmt() 12 let first_opt = input.next(); in fmt() 13 let first_owned_str; in fmt() 14 let mut names = BTreeSet::new(); in fmt() 15 let first_span = { in fmt() 16 let Some((mut first_str, first_span)) = (match first_opt.as_ref() { in fmt() 20 let first = first.strip_prefix('"')?; in fmt() 21 let first = first.strip_suffix('"')?; in fmt() 33 while let Some((_, rest)) = first_str.split_once('{') { in fmt() 35 if let Som in fmt() [all...] |
| /linux/rust/pin-init/internal/src/ |
| H A D | init.rs | 85 let error = error.map_or_else( 87 if let Some(default_error) = attrs.iter().fold(None, |acc, attr| { 89 if let InitializerAttribute::DefaultError(DefaultErrorAttribute { ty }) = attr { 96 } else if let Some(default_error) = default_error { 105 let slot = format_ident!("slot"); 106 let (has_data_trait, get_data, init_from_closure) = if pinned { 119 let init_kind = get_init_kind(rest, dcx); 120 let zeroable_check = match init_kind { 136 let this = match this { 141 let #iden [all...] |
| /linux/drivers/android/binder/range_alloc/ |
| H A D | tree.rs | 39 let mut tree = TreeRangeAllocator { in from_array() 46 let mut free_offset = 0; in from_array() 48 let free_size = range.offset - free_offset; in from_array() 50 let free_node = alloc.free_tree.pop().unwrap(); in from_array() 53 let tree_node = alloc.tree.pop().unwrap(); in from_array() 64 let free_res = alloc.free_tree.pop().unwrap(); in from_array() 65 let tree_node = alloc.tree.pop().unwrap(); in from_array() 66 let mut desc = Descriptor::new(range.offset, range.size); in from_array() 73 let free_size = size - free_offset; in from_array() 74 let free_node = alloc.free_tree.pop().unwrap(); in from_array() [all …]
|
| /linux/rust/zerocopy/src/ |
| H A D | macros.rs | 47 /// let u: u32 = transmute!(#![allow(shrink)] 0u64); 55 /// let one_dimensional: [u8; 8] = [0, 1, 2, 3, 4, 5, 6, 7]; 57 /// let two_dimensional: [[u8; 4]; 2] = transmute!(one_dimensional); 78 let mut e = $e; 89 let _ = src; 124 let u: Transmute<_, _> = unsafe { 135 let _ = e; 138 // SAFETY: Per the safety comment on `let u` above, the `dst` 156 let dst = unsafe { u.dst }; 162 let e = $e; [all …]
|
| H A D | ref.rs | 214 if let Err(err) = util::validate_aligned_to::<_, T>(bytes.deref()) { in sized_from() 232 if let Err(err) = util::validate_aligned_to::<_, T>(bytes.deref()) { in sized_from_prefix() 235 let (bytes, suffix) = bytes.split_at(mem::size_of::<T>()).map_err( in sized_from_prefix() 244 let r = unsafe { Ref::new_unchecked(bytes) }; in sized_from_prefix() 250 let bytes_len = bytes.len(); in sized_from_suffix() 251 let split_at = if let Some(split_at) = bytes_len.checked_sub(mem::size_of::<T>()) { in sized_from_suffix() 256 let (prefix, bytes) = bytes.split_at(split_at).map_err(|b| SizeError::new(b).into())?; in sized_from_suffix() 257 if let Err(err) = util::validate_aligned_to::<_, T>(bytes.deref()) { in sized_from_suffix() 261 // the `bytes` which results from `let (prefix, bytes) = in sized_from_suffix() 266 let r = unsafe { Ref::new_unchecked(bytes) }; in sized_from_suffix() [all …]
|
| H A D | split_at.rs | 122 /// let bytes = &[4, 1, 2, 3, 4, 5, 6, 7, 8, 9][..]; 124 /// let packet = Packet::ref_from_bytes(bytes).unwrap(); 130 /// let split = packet.split_at(packet.length as usize).unwrap(); 134 /// let (packet, rest) = split.via_immutable(); 210 /// let mut bytes = &mut [4, 1, 2, 3, 4, 5, 6, 7, 8, 9][..]; 212 /// let packet = Packet::<[u8]>::mut_from_bytes(bytes).unwrap(); 219 /// let split = packet.split_at_mut(packet.length as usize).unwrap(); 223 /// let (packet, rest) = split.via_into_bytes(); 308 let source = Ptr::from_ref(self.source); in into_ptr() 331 /// let bytes = &[4, 1, 2, 3, 4, 5, 6, 7, 8, 9][..]; [all …]
|
| H A D | layout.rs | 80 if let Some(elem_size) = NonZeroUsize::new(elem_size) { in try_to_nonzero_elem_size() 186 let align = match repr_align { in new_zst() 285 let mut layout = DstLayout::new_zst(repr_align); in for_repr_c_struct() 287 let mut i = 0; in for_repr_c_struct() 291 let field = fields[i]; in for_repr_c_struct() 346 let max_align = match repr_packed { in extend() 360 if let Some(repr_packed) = repr_packed { in extend() 373 let field_align = min(field.align, max_align); in extend() 377 let align = max(self.align, field_align); in extend() 379 let (interfield_padding, size_info) = match self.size_info { in extend() [all …]
|
| /linux/samples/rust/ |
| H A D | rust_debugfs_scoped.rs | 36 let mut buf = [0u8; 128]; in remove_file_write() 40 let n = reader.len(); in remove_file_write() 43 let s = core::str::from_utf8(&buf[..n]).map_err(|_| EINVAL)?.trim(); in remove_file_write() 44 let nul_idx = s.len(); in remove_file_write() 46 let to_remove = CStr::from_bytes_with_nul(&buf[..nul_idx + 1]).map_err(|_| EINVAL)?; in create_file_write() 58 let mut buf = [0u8; 128]; in create_file_write() 62 let n = reader.len(); in create_file_write() 65 let mut nums = KVec::new(); in create_file_write() 67 let s = core::str::from_utf8(&buf[..n]).map_err(|_| EINVAL)?.trim(); in create_file_write() 68 let mu in create_file_write() [all...] |
| H A D | rust_driver_platform.rs | 110 let dev = pdev.as_ref(); in probe() 114 if let Some(info) = info { in probe() 128 let fwnode = dev.fwnode().ok_or(ENOENT)?; in properties_parse() 130 if let Ok(idx) = fwnode.property_match_string(c"compatible", c"test,rust-device") { in properties_parse() 134 let name = c"compatible"; in properties_parse() 135 let prop = fwnode.property_read::<CString>(name).required_by(dev)?; in properties_parse() 138 let name = c"test,bool-prop"; in properties_parse() 139 let prop = fwnode.property_read_bool(c"test,bool-prop"); in properties_parse() 146 let name = c"test,u32-optional-prop"; in properties_parse() 147 let pro in properties_parse() [all...] |
| /linux/rust/zerocopy-derive/ |
| H A D | util.rs | 39 let mut path = parse_quote!(::zerocopy); in try_from_derive_input() 40 let mut skip_on_error = false; in try_from_derive_input() 41 let mut on_error_span = None; in try_from_derive_input() 44 if let Meta::List(ref meta_list) = attr.meta { in try_from_derive_input() 48 let expr = meta.value().and_then(|value| value.parse()); in try_from_derive_input() 49 if let Ok(Expr::Lit(ExprLit { lit: Lit::Str(lit), .. })) = expr { in try_from_derive_input() 50 if let Ok(path_lit) = lit.parse::<Ident>() { in try_from_derive_input() 64 let value = meta.value()?; in try_from_derive_input() 65 let s: LitStr = value.parse()?; in try_from_derive_input() 107 let zerocopy_crate = &self.zerocopy_crate; in core_path() [all …]
|
| /linux/rust/kernel/io/ |
| H A D | mem.rs | 75 /// let offset = 0; // Some offset. 80 /// let request = pdev.io_request_by_index(0).ok_or(ENODEV)?; 81 /// let iomem = request.iomap_sized::<42>()?; 84 /// let data = iomem.read32(offset); 135 /// let offset = 0; // Some offset. 141 /// let request = pdev.io_request_by_index(0).ok_or(ENODEV)?; 142 /// let iomem = request.iomap()?; 144 /// let data = iomem.try_read32(offset)?; in iomap() 195 let start = resource.start(); 196 let siz [all...] |
| /linux/rust/kernel/alloc/ |
| H A D | kvec.rs | 67 /// let mut v = kernel::kvec![]; 71 /// let mut v = kernel::kvec![1; 3]?; 75 /// let mut v = kernel::kvec![1, 2, 3]?; 149 /// let mut v = KVec::new(); 162 /// let mut v = VVec::new(); 175 /// let mut v = KVVec::new(); 263 /// let mut v = KVec::new(); 299 /// let mut v = KVec::new(); in new() 334 let ptr = unsafe { self.as_mut_ptr().add(self.len) }.cast::<MaybeUninit<T>>(); in push() 346 /// let mu [all...] |
| /linux/rust/kernel/ |
| H A D | maple_tree.rs | 57 let first = match range.start_bound() { in to_maple_range() 63 let last = match range.end_bound() { in to_maple_range() 103 /// let tree = KBox::pin_init(MapleTree::<KBox<i32>>::new(), GFP_KERNEL)?; 105 /// let ten = KBox::new(10, GFP_KERNEL)?; 106 /// let twenty = KBox::new(20, GFP_KERNEL)?; 107 /// let the_answer = KBox::new(42, GFP_KERNEL)?; 142 /// let tree = KBox::pin_init(MapleTree::<KBox<i32>>::new(), GFP_KERNEL)?; 144 /// let ten = KBox::new(10, GFP_KERNEL)?; 145 /// let twenty = KBox::new(20, GFP_KERNEL)?; 146 /// let the_answer = KBox::new(42, GFP_KERNEL)?; [all …]
|