| /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/drivers/android/binder/ |
| H A D | freeze.rs | 90 let _removed_listener; in do_work() 91 let mut node_refs = thread.process.node_refs.lock(); in do_work() 92 let Some(mut freeze_entry) = node_refs.freeze_listeners.find_mut(&self.cookie) else { in do_work() 95 let freeze = freeze_entry.get_mut(); in do_work() 124 let is_frozen = freeze.node.owner.inner.lock().is_frozen.is_fully_frozen(); in do_work() 129 let mut state_info = BinderFrozenStateInfo::default(); in do_work() 169 let hc = reader.read::<BinderHandleCookie>()?; in request_freeze_notif() 170 let handle = hc.handle; in request_freeze_notif() 171 let cookie = FreezeCookie(hc.cookie); in request_freeze_notif() 173 let msg = FreezeMessage::new(GFP_KERNEL)?; in request_freeze_notif() [all …]
|
| H A D | process.rs | 176 if let Some(thread) = self.ready_threads.pop_front() { in push_work() 186 let sync = work.should_sync_wakeup(); in push_work() 224 let push = node.update_refcount_locked(inc, strong, count, self); in update_node_refcount() 228 if let Some(node) = push { in update_node_refcount() 229 if let Some(thread) = othread { in update_node_refcount() 232 let _ = self.push_work(node); in update_node_refcount() 246 let strong_count = if strong { 1 } else { 0 }; in new_node_ref() 257 let push = match wrapper { in new_node_ref_with_thread() 263 if let Some(node) = push { in new_node_ref_with_thread() 266 let strong_count = if strong { 1 } else { 0 }; in new_node_ref_with_thread() [all …]
|
| H A D | transaction.rs | 59 let debug_id = super::next_debug_id(); in new() 60 let trd = &tr.transaction_data; in new() 61 let allow_fds = node_ref.node.flags & FLAT_BINDER_FLAG_ACCEPTS_FDS != 0; in new() 62 let txn_security_ctx = node_ref.node.flags & FLAT_BINDER_FLAG_TXN_SECURITY_CTX != 0; in new() 63 let mut txn_security_ctx_off = if txn_security_ctx { Some(0) } else { None }; in new() 64 let to = node_ref.node.owner.clone(); in new() 65 let mut alloc = match from.copy_transaction_data( in new() 80 let oneway_spam_detected = alloc.oneway_spam_detected; in new() 91 let target_node = node_ref.node.clone(); in new() 93 let data_address = alloc.ptr; in new() [all …]
|
| H A D | node.rs | 243 let inner = self.inner.access_mut(owner_inner); in has_oneway_transaction() 253 let inner = self.inner.access_mut(owner_inner); in full_debug_print() 336 let inner = self.inner.access_mut(owner_inner); in inc_ref_done_locked() 346 let strong = inner.strong.count > 0; in inc_ref_done_locked() 347 let has_strong = inner.strong.has_count; in inc_ref_done_locked() 348 let weak = strong || inner.weak.count > 0; in inc_ref_done_locked() 349 let has_weak = inner.weak.has_count; in inc_ref_done_locked() 351 let should_drop_weak = !weak && has_weak; in inc_ref_done_locked() 352 let should_drop_strong = !strong && has_strong; in inc_ref_done_locked() 356 let need_push = should_drop_weak || should_drop_strong; in inc_ref_done_locked() [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 …]
|
| H A D | fixup.rs | 36 // let _ = match x {} - 1; // no parens 44 // Example: `let _ = $match - 1;` 98 // if let _ = (Struct {}) {} // needs parens 101 // () if let _ = Struct {} => {} // no parens 127 // let _ = (return) - 1; // without paren, this would return -1 129 // let _ = return + 1; // no paren because '+' cannot begin expr 136 // let _ = 1 + return 1; // no parens if rightmost subexpression 138 // let _ = 1 + (return 1) + 1; // needs parens 145 // let _ = x as u8 + T; 147 // let _ = (x as u8) < T; [all …]
|
| H A D | generics.rs | 165 /// # let generics: syn::Generics = Default::default(); 166 /// # let name = Ident::new("MyType", Span::call_site()); 168 /// let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); 193 if let GenericParam::Lifetime(lifetime) = self.0.next()? { in next() 207 if let GenericParam::Lifetime(lifetime) = self.0.next()? { in next() 221 if let GenericParam::Type(type_param) = self.0.next()? { in next() 235 if let GenericParam::Type(type_param) = self.0.next()? { in next() 249 if let GenericParam::Const(const_param) = self.0.next()? { in next() 263 if let GenericParam::Const(const_param) = self.0.next()? { in next() 546 let lt_token: Token![<] = input.parse()?; in parse() [all …]
|
| H A D | pat.rs | 277 /// let _ = |Some(_) | None: Option<T>| {}; 290 let begin = input.fork(); in parse_single() 291 let lookahead = input.lookahead1(); in parse_single() 351 /// # let wat = None; 382 let leading_vert: Option<Token![|]> = input.parse()?; in parse_multi_with_leading_vert() 400 let mut pat = Pat::parse_single(input)?; in multi_pat_impl() 404 let mut cases = Punctuated::new(); in multi_pat_impl() 407 let punct = input.parse()?; in multi_pat_impl() 409 let pat = Pat::parse_single(input)?; in multi_pat_impl() 422 let expr_style = true; in pat_path_or_macro_or_struct_or_range() [all …]
|
| /linux/rust/macros/ |
| H A D | fmt.rs | 8 let mut input = input.into_iter(); in fmt() 10 let first_opt = input.next(); in fmt() 11 let first_owned_str; in fmt() 12 let mut names = BTreeSet::new(); in fmt() 13 let first_span = { in fmt() 14 let Some((mut first_str, first_span)) = (match first_opt.as_ref() { in fmt() 18 let first = first.strip_prefix('"')?; in fmt() 19 let first = first.strip_suffix('"')?; in fmt() 31 while let Some((_, rest)) = first_str.split_once('{') { in fmt() 33 if let Some(rest) = first_str.strip_prefix('{') { in fmt() [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/samples/rust/ |
| H A D | rust_driver_platform.rs | 107 let dev = pdev.as_ref(); in probe() 111 if let Some(info) = info { in probe() 119 let drvdata = KBox::new(Self { pdev: pdev.into() }, GFP_KERNEL)?; in probe() 127 let fwnode = dev.fwnode().ok_or(ENOENT)?; in properties_parse() 129 if let Ok(idx) = in properties_parse() 135 let name = c_str!("compatible"); in properties_parse() 136 let prop = fwnode.property_read::<CString>(name).required_by(dev)?; in properties_parse() 139 let name = c_str!("test,bool-prop"); in properties_parse() 140 let prop = fwnode.property_read_bool(c_str!("test,bool-prop")); in properties_parse() 147 let name = c_str!("test,u32-optional-prop"); in properties_parse() [all …]
|
| H A D | rust_debugfs_scoped.rs | 27 let mut buf = [0u8; 128]; in remove_file_write() 31 let n = reader.len(); in remove_file_write() 34 let s = core::str::from_utf8(&buf[..n]).map_err(|_| EINVAL)?.trim(); in remove_file_write() 35 let nul_idx = s.len(); in remove_file_write() 37 let to_remove = CStr::from_bytes_with_nul(&buf[..nul_idx + 1]).map_err(|_| EINVAL)?; in remove_file_write() 49 let mut buf = [0u8; 128]; in create_file_write() 53 let n = reader.len(); in create_file_write() 56 let mut nums = KVec::new(); in create_file_write() 58 let s = core::str::from_utf8(&buf[..n]).map_err(|_| EINVAL)?.trim(); in create_file_write() 59 let mut items = s.split_whitespace(); in create_file_write() [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 …]
|
| /linux/rust/kernel/io/ |
| H A D | mem.rs | 57 /// let offset = 0; // Some offset. 62 /// let request = pdev.io_request_by_index(0).ok_or(ENODEV)?; 63 /// let iomem = request.iomap_sized::<42>(); 64 /// let iomem = KBox::pin_init(iomem, GFP_KERNEL)?; 66 /// let io = iomem.access(pdev.as_ref())?; 69 /// let data = io.read32_relaxed(offset); 115 /// let offset = 0; // Some offset. 121 /// let request = pdev.io_request_by_index(0).ok_or(ENODEV)?; 122 /// let iomem = request.iomap(); 123 /// let iomem = KBox::pin_init(iomem, GFP_KERNEL)?; [all …]
|
| /linux/rust/kernel/alloc/ |
| H A D | kvec.rs | 38 /// let mut v = kernel::kvec![]; 42 /// let mut v = kernel::kvec![1; 3]?; 46 /// let mut v = kernel::kvec![1, 2, 3]?; 120 /// let mut v = KVec::new(); 133 /// let mut v = VVec::new(); 146 /// let mut v = KVVec::new(); 234 /// let mut v = KVec::new(); 270 /// let mut v = KVec::new(); 305 let ptr = unsafe { self.as_mut_ptr().add(self.len) }.cast::<MaybeUninit<T>>(); in spare_capacity_mut() 317 /// let mut v = KVec::new(); [all …]
|
| /linux/scripts/ |
| H A D | rustdoc_test_gen.rs | 51 let potential_components: Vec<&str> = file.strip_suffix("_rs").unwrap().split('_').collect(); in find_real_path() 62 let joined_potential_components = potential_components.join("_") + ".rs"; in find_real_path() 80 let (components_prefix, components_rest) = potential_components.split_at(i); in find_real_path() 81 let prefix = prefix.join(components_prefix.join("_")); in find_real_path() 97 let mut candidates = String::new(); in find_real_path() 110 let srctree = std::env::var("srctree").unwrap(); in main() 111 let srctree = Path::new(&srctree); in main() 113 let mut paths = fs::read_dir("rust/test/doctests/kernel") in main() 121 let mut rust_tests = String::new(); in main() 122 let mut c_test_declarations = String::new(); in main() [all …]
|