profile
viewpoint
Jonas Schievink jonas-schievink @ferrous-systems Berlin, Germany compilers; embedded systems; emulators; Linux; please do not send me blockchain recruiting emails

dac-gmbh/serde_postgres 51

Easily Deserialize Postgres rows.

dac-gmbh/golomb-set 28

A Golomb Coded Set implementation in Rust

dac-gmbh/mail 21

mail, facade for a number of mail related crates for creating and sending mails

dac-gmbh/derefable 16

Automatically derive Deref/DerefMut implementations in Rust.

dac-gmbh/new-tokio-smtp 12

extendible SMTP (Simple Mail Transfer Protocol) implementation using tokio

helium/longfi-device 11

C library of device-side LongFi Protocol

dac-gmbh/asn1 10

An implementation of the ITU ASN.1 (X.680–X.699) specifications in Rust.

dac-gmbh/hyperdrive 6

Declarative HTTP request routing, guarding and decoding

dac-gmbh/gbl 5

GBL firmware file manipulation library

dac-gmbh/Variation 5

A procedural macro to generate variant based methods.

issue commentrust-lang/rust

Stack overflow in fmt::Display impl

Marking as E-hard since this requires not just a fix for https://github.com/rust-lang/rust/issues/57965, but also a complete rewrite of the formatting infrastructure to avoid dynamic dispatch

brayniac

comment created time in 7 hours

delete branch jonas-schievink/rubble

delete branch : gatt-codegen

delete time in 11 hours

delete branch jonas-schievink/rubble

delete branch : dbg

delete time in 11 hours

issue closedrust-lang/rust

Is it possible to implement **foldmap** function for *Iterator*?

Hi guys,

Is it possible to implement foldmap function for Iterator?

Like this:

fn funny(v: Vec<i32>) -> Vec<i32> {
	v.iter()
		.foldmap(0, |acc, x| acc + x)
		.collect()
}

which is equals to :

fn funny(v: Vec<i32>) -> Vec<i32> {
        let mut total = 0;
	v.iter()
		.map(|x| {total = total + x; total})
		.collect()
}

Thanks.

closed time in 14 hours

zhibo501

issue commentrust-lang/rust

Is it possible to implement **foldmap** function for *Iterator*?

Hi! This issue tracker is mainly meant for bug reports and concrete, small feature requests. Questions like this are better asked in the user forum at https://users.rust-lang.org/ or on one of the chat platforms used by the Rust community.

zhibo501

comment created time in 14 hours

issue commentrust-lang/rust

Rustdoc needs to handle conditional compilation somehow

Reading my comment from back then again, it seems fairly clear that it doesn't apply to the example given above:

One potential problem with trying to do the AST approach is if the same function/type is defined for multiple platforms with different doc comments, which doc comment do we show for the item?

In this case, I think we should emit a warning (that can be made into an error via a command line flag, to make this useful for CI or local testing, but still preserves compatibility) and just pick one (maybe the native one for compatibility).

It only concerns different versions of an item that both have different documentation, but @eggyal's example does not contain any documentation. This doesn't solve the issue with different item definitions depending on #[cfg] flags, of course.

brson

comment created time in 14 hours

pull request commentrust-analyzer/rust-analyzer

Return InvalidRequest if Shutdown has been requested

bors r+

kjeremy

comment created time in 15 hours

pull request commentrust-analyzer/rust-analyzer

Remove workaround for semantic token flickering

bors r+

kjeremy

comment created time in 15 hours

pull request commentrust-lang/rust

:arrow_up: rust-analyzer

r? @ghost

@bors r+

jonas-schievink

comment created time in 16 hours

create barnchjonas-schievink/rust

branch : rust-analyzer-2020-08-10

created branch time in 16 hours

PR opened rust-lang/rust

:arrow_up: rust-analyzer
+1 -1

0 comment

1 changed file

pr created time in 16 hours

push eventrust-analyzer/rust-analyzer.github.io

Jonas Schievink

commit sha 22906e84408b392e8d9764b34780b66f5a173f4e

Changelog 37

view details

push time in 17 hours

push eventrust-analyzer/rust-analyzer

kjeremy

commit sha fcfd7cb1e38bc20240e466dbda64386e0cc89247

Handle semantic token deltas

view details

David Lattimore

commit sha 6bbeffc8c56893548f5667844f59ce5a76f9fd98

SSR: Allow `self` in patterns. It's now consistent with other variables in that if the pattern references self, only the `self` in scope where the rule is invoked will be accepted. Since `self` doesn't work the same as other paths, this is implemented by restricting the search to just the current function. Prior to this change (since path resolution was implemented), having self in a pattern would just result in no matches.

view details

Aleksei Trifonov

commit sha 85d5ed367579fb9e868517be0f0df636f6277363

Fix test code lens

view details

unexge

commit sha edd79a6b1c6e019d69d8d1304686391ea9cb4209

Add expand glob import assist

view details

unexge

commit sha a05a2ab1bb942c7b950f270ff1a31ba67518ae14

Rename ast::UseItem to ast::Use

view details

unexge

commit sha 544322e66aacb763f8c824b5a572f8d7b93c9a6f

Generate doctest

view details

unexge

commit sha bdb97756ca4c2710061fc49a5e2c2c10f5cc1eb6

Simplify `find_mod_path` with use of `node.ancestors`

view details

Jacob Rothstein

commit sha 03a61134f22fae8574766313f6ffd39d1007c7fe

do not add to `pub use` statements

view details

bors[bot]

commit sha af6e9a7eb3c321ea43d3ac14c2b05f8c58e1abac

Merge #5658 5658: do not add to `pub use` in assists that insert a use statement r=jonas-schievink a=jbr closes #5657 , see issue for rationale Initially I wrote a version of this that changed the signature of `insert_use_statement` to take an `Option<VisibilityKind>` and only add to use statements with the same visibility, but that didn't make sense for any of the current uses of `insert_use_statement` (they all expected private visibility). Co-authored-by: Jacob Rothstein <hi@jbr.me>

view details

Paul Daniel Faria

commit sha cc3eb8531177940ad34ff505f0426151b985daf3

Add test showing unresolved module rename

view details

Paul Daniel Faria

commit sha 4e2e3543c72b5963eb91b94b8180fecf268930e3

When resolving a rename, fallback to the name higher in the use tree if the path segment is `self`

view details

unexge

commit sha 5214b4cdba2c4976cb1ca4724a008268cdaf3e61

Look for trait methods in expand glob import assist

view details

unexge

commit sha 6cb090345ece4a97c640159240594f3902e37032

Pattern match on slice elements instead of using `.first().unwrap()`

view details

Aleksey Kladov

commit sha ffe4a5e114a1b62620546c20f3621b2151d4eeb7

Fix relative path handling for custom rustfmt `current_dir` and relative paths to executables works differently on unix and windows (unix behavior does not make sense), see: https://github.com/oconnor663/duct.rs/blob/17e30e83a16b202551df4d70d0b2cc174cb53e5d/src/lib.rs#L295-L324 The original motivation to set cwd was to make rustfmt read the correct rustfmt.toml, but that was future proofing, rather than a bug fix. So, let's just remove this and see if breaks or fixes more use-cases. If support for per-file config is needed, we could use `--config-path` flag.

view details

bors[bot]

commit sha 2ad29eb23167273f2e101b44c1f21b4ec2821bc2

Merge #5668 5668: Fix relative path handling for custom rustfmt r=matklad a=matklad `current_dir` and relative paths to executables works differently on unix and windows (unix behavior does not make sense), see: https://github.com/oconnor663/duct.rs/blob/17e30e83a16b202551df4d70d0b2cc174cb53e5d/src/lib.rs#L295-L324 The original motivation to set cwd was to make rustfmt read the correct rustfmt.toml, but that was future proofing, rather than a bug fix. So, let's just remove this and see if breaks or fixes more use-cases. If support for per-file config is needed, we could use `--config-path` flag. bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

Aleksey Kladov

commit sha 36d75f31051b456f0423eb4444b997fd4e70f075

Document release process

view details

Aleksey Kladov

commit sha 33447e285594189aed368ac48f6326b62d2c3806

Update docs/dev/README.md Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>

view details

Aleksey Kladov

commit sha edd4a83ee3c887670afd077eeb1ddb8ce1976108

Use salsa's purge to account for all memory

view details

bors[bot]

commit sha 5721cca2f3a469954a4e778b6a24c0d530f531c3

Merge #5494 5494: Use salsa's purge to account for all memory r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

bors[bot]

commit sha dab810b1e623449cf3e9a422cf49d89cac17507f

Merge #5669 5669: Document release process r=jonas-schievink a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

push time in 17 hours

delete branch jonas-schievink/rust-analyzer

delete branch : release

delete time in 17 hours

push eventjonas-schievink/rubble

David Ross

commit sha cfd8d9ac68f490bb37dc901583ddc5ca26450cc9

Create constructor and value-getter for Attribute These works around the fact that Attribute stores its data inside a HexSlice, and that's a private uility type. Signed-off-by: David Ross <David.Ross@wdc.com>

view details

David Ross

commit sha be75d679611380a5e871f794ba54fc5c2d6b8a47

Add non-NULL handle check to Attribute::new This applies the suggested PR change. Signed-off-by: David Ross <David.Ross@wdc.com>

view details

Jonas Schievink

commit sha af0b61107fbda984af78d1ba54e5afa2a7437f4c

Merge pull request #139 from daboross/add-attribute-constructor Create constructor and value-getter for Attribute::value

view details

push time in 18 hours

PR merged jonas-schievink/rubble

Create constructor and value-getter for Attribute::value

Fixes #134! This adds an Attribute::new function taking &[u8] and Attribute::value function returning the value as &[u8].

I've made this as a minimal change - I think it could be reasonable to add getters for the other fields for consistency, and/or make the fields private, but those aren't strictly necessary to fix this issue.

Let me know if there's anything else I can do with this!

+17 -0

0 comment

1 changed file

daboross

pr closed time in 18 hours

issue closedjonas-schievink/rubble

Constructing Attribute requires costructing private HexSlice type

Hi!

It looks like rubble::att::Attribute, https://jonas-schievink.github.io/rubble/rubble/att/struct.Attribute.html, has the value data wrapped in a rubble::utils::HexSlice. But as the docs indicate, HexSlice isn't public - utils isn't public, and HexSlice isn't re-exported. Thus, as far as I can tell, it isn't possible to construct an Attribute from outside the crate?

If this is a problem, do you it'd be reasonable to just re-export HexSlice from the crate root, or would it be better to add a constructor and accessors to Attribute which allow interacting with value as an &[u8]?

closed time in 18 hours

daboross

issue commentrust-lang/rust

Failed to compile a graph test

Same underlying issue as https://github.com/rust-lang/rust/issues/74918, presumably

Deuchier

comment created time in 19 hours

issue commentrust-lang/rust

Small program causes internal compiler error on rustc 1.45.0

https://github.com/rust-lang/rust/issues/75361 shows that this can result in no user-facing error message. I suggest increasing priority to P-high.

jesperdj

comment created time in 19 hours

pull request commentrust-analyzer/rust-analyzer

Display the value of a const on the hover

bors r+

JmPotato

comment created time in 20 hours

Pull request review commentrust-analyzer/rust-analyzer

Display the value of a const on the hover

 impl ShortLabel for ast::TypeAlias {  impl ShortLabel for ast::Const {     fn short_label(&self) -> Option<String> {-        short_label_from_ty(self, self.ty(), "const ")+        match short_label_from_ty(self, self.ty(), "const ") {+            Some(buf) => {+                let mut new_buf = buf;+                let body = self.body().unwrap();+                format_to!(new_buf, " = {}", body.syntax());+                Some(new_buf)+            }+            None => None,

You can use ? here

JmPotato

comment created time in 21 hours

Pull request review commentrust-analyzer/rust-analyzer

Display the value of a const on the hover

 impl ShortLabel for ast::TypeAlias {  impl ShortLabel for ast::Const {     fn short_label(&self) -> Option<String> {-        short_label_from_ty(self, self.ty(), "const ")+        match short_label_from_ty(self, self.ty(), "const ") {+            Some(buf) => {+                let mut new_buf = buf;+                let body = self.body().unwrap();

This unwrap can fail if I'm not mistaken, in which case the value should just be left out (no panic)

JmPotato

comment created time in 21 hours

pull request commentrust-analyzer/rust-analyzer

Add support for extern crate

bors r+

Nashenas88

comment created time in a day

pull request commentrust-analyzer/rust-analyzer

Fix test code lens

bors r+

avrong

comment created time in a day

Pull request review commentrust-analyzer/rust-analyzer

Added completion for unstable features

+//! Generates descriptors structure for unstable feature from Unstable Book++use crate::codegen::update;+use crate::codegen::{self, project_root, Mode, Result};+use quote::quote;+use std::fs;+use std::process::Command;+use walkdir::WalkDir;++pub fn generate_unstable_future_descriptor(mode: Mode) -> Result<()> {+    let path = project_root().join(codegen::STORAGE);+    fs::create_dir_all(path.clone())?;++    Command::new("git").current_dir(path.clone()).arg("init").output()?;+    Command::new("git")+        .current_dir(path.clone())+        .args(&["remote", "add", "-f", "origin", codegen::REPOSITORY_URL])+        .output()?;+    Command::new("git")+        .current_dir(path.clone())+        .args(&["sparse-checkout", "set", "/src/doc/unstable-book/src/"])+        .output()?;+    Command::new("git").current_dir(path.clone()).args(&["pull", "origin", "master"]).output()?;+    //TODO: check git, and do pull++    let src_dir = path.join("src/doc/unstable-book/src");+    let files = WalkDir::new(src_dir.join("language-features"))+        .into_iter()+        .chain(WalkDir::new(src_dir.join("library-features")))+        .filter_map(|e| e.ok())+        .filter(|entry| {+            // Get all `.md ` files+            entry.file_type().is_file()+                && entry.path().extension().map(|ext| ext == "md").unwrap_or(false)+        })+        .collect::<Vec<_>>();++    let definitions = files+        .iter()+        .map(|entry| {+            let path = entry.path();+            let feature_ident =+                format!("{}", path.file_stem().unwrap().to_str().unwrap().replace("-", "_"));+            let doc = format!("{}", std::fs::read_to_string(path).unwrap());++            quote! { LintCompletion { label: #feature_ident, description: #doc } }+        })+        .collect::<Vec<_>>();++    let ts = quote! {+        use crate::completion::LintCompletion;++        #[rustfmt::skip]

I think this should be formatted like the other generated files (using the reformat function, I think)

Fihtangolz

comment created time in a day

pull request commentrust-analyzer/rust-analyzer

Fix no inlay hints / unresolved tokens until manual edit to refresh

I believe that there might be cases of overly big projects where the backoff logic we have setup in sendRequestWithRetry (which we use for inlay hints) might bail too early (currently the largest retry standby time is 10 seconds).

My understanding is that the Loading status only persists until the VFS has loaded all files into memory, which hopefully won't take that long.

I wouldn't be surprised if some clients will have problems with initialize returning ContentModified though, so I think I agree with @kjeremy that we shouldn't return it for initialize and shutdown.

Veetaha

comment created time in a day

pull request commentrust-analyzer/rust-analyzer

Format docs in to_proto::markup_content

bors r+

JmPotato

comment created time in 2 days

Pull request review commentrust-analyzer/rust-analyzer

Add support for extern crate

 pub enum NameClass { }  impl NameClass {-    pub fn into_definition(self) -> Option<Definition> {-        match self {-            NameClass::Definition(it) => Some(it),-            NameClass::ConstReference(_) => None,-            NameClass::FieldShorthand { local, field: _ } => Some(Definition::Local(local)),-        }+    pub fn into_definition(self, db: &dyn HirDatabase) -> Option<Definition> {+        Some(match self {+            NameClass::ExternCrate(krate) => Definition::ModuleDef(krate.root_module(db)?.into()),+            NameClass::Definition(it) => it,+            NameClass::ConstReference(_) => return None,+            NameClass::FieldShorthand { local, field: _ } => Definition::Local(local),+        })     } -    pub fn definition(self) -> Definition {-        match self {+    pub fn definition(self, db: &dyn HirDatabase) -> Option<Definition> {+        Some(match self {+            NameClass::ExternCrate(krate) => Definition::ModuleDef(krate.root_module(db)?.into()),

It looks like root_module won't actually ever return None, so the signature change shouldn't be necessary. Maybe root_module should just be changed to return Module, not Option<Module>.

Nashenas88

comment created time in 2 days

issue commentrust-lang/rust

Rustdoc needs to handle conditional compilation somehow

I'm not really sure what I was thinking 4.5 years ago :)

brson

comment created time in 2 days

pull request commentrust-embedded/cortex-m-rt

Fix possible overflow of .data region in FLASH

Since that PR has fixed linkage errors, but linking still works, I guess it didn't reintroduce those problems

Guilucand

comment created time in 2 days

push eventnrf-rs/nrf-hal

Jonas Schievink

commit sha 894125f7156b1e92b35f755659d08585c9bbf6c2

publish = false

view details

push time in 2 days

issue commentrust-lang/rust

Panic when compiling gluon on nightly

cc @RalfJung

nukeop

comment created time in 2 days

pull request commentrust-lang/rust

fix `min_const_generics` version

@bors r+ rollup

lcnr

comment created time in 3 days

pull request commentrust-lang/rust

Remove ambiguity from PathBuf pop example

@bors r+ rollup

pickfire

comment created time in 3 days

pull request commentrust-lang/rust

Use assert! for Path exists example to check bool

@bors r+ rollup

pickfire

comment created time in 3 days

pull request commentrust-lang/rust

Show Path extension example change multi extension

@bors r+ rollup

pickfire

comment created time in 3 days

pull request commentrust-lang/rust

Separate example for Path strip_prefix

@bors r+ rollup

pickfire

comment created time in 3 days

pull request commentrust-analyzer/rust-analyzer

Semantic highlighting for unsafe union field access

bors r+

Nashenas88

comment created time in 3 days

issue commentrust-lang/rust

Building cargo itself is non-reproducible

cc @ehuss

This might be a Cargo issue given that patch.

jgalenson

comment created time in 3 days

Pull request review commentrust-analyzer/rust-analyzer

Semantic highlighting for unsafe union field access

 impl<'a> InferenceContext<'a> {                 let ty = self.insert_type_vars(ty.subst(&substs));                 forbid_unresolved_segments((ty, Some(strukt.into())), unresolved)             }+            TypeNs::AdtId(AdtId::UnionId(u)) => {+                let substs = Ty::substs_from_path(&ctx, path, u.into(), true);+                let ty = self.db.ty(u.into());+                let ty = self.insert_type_vars(ty.subst(&substs));+                forbid_unresolved_segments((ty, Some(u.into())), unresolved)+            }

Can you also add an inference test for these changes?

Nashenas88

comment created time in 3 days

Pull request review commentrust-analyzer/rust-analyzer

Semantic highlighting for unsafe union field access

 fn highlight_element(         }         NAME_REF => {             let name_ref = element.into_node().and_then(ast::NameRef::cast).unwrap();-            match classify_name_ref(sema, &name_ref) {-                Some(name_kind) => match name_kind {+            match (classify_name_ref(sema, &name_ref), is_possibly_unsafe(&name_ref)) {

This match doesn't seem to inspect the is_possibly_unsafe(&name_ref), so maybe just put it in a variable before the match?

Nashenas88

comment created time in 3 days

pull request commentrust-embedded/cortex-m-rt

Fix possible overflow of .data region in FLASH

Could you maybe provide an example where this happens? I'd expect the linker to catch an issue like that, even without these changes.

Guilucand

comment created time in 4 days

pull request commentrust-analyzer/rust-analyzer

Account for static mut in missing unsafe diagnostic

bors r+

Nashenas88

comment created time in 4 days

pull request commentrust-analyzer/rust-analyzer

Static mut unsafe semantic highlighting

bors r+

Nashenas88

comment created time in 4 days

issue commentrust-lang/rust

Implicit lifetimes of type parameters does not work

I don't think this is supposed to work, implied bounds only work on impls

canova

comment created time in 4 days

pull request commentrust-lang/rust

Fix typo "biset" -> "bitset"

@bors r+ rollup

syntacticsugarglider

comment created time in 4 days

issue openednrf-rs/nrf-hal

Use html_root_url

All the [src] links on docs.rs are broken.

This should be automated so the version is bumped automatically (no idea how, cargo-release doesn't work on this repo).

created time in 4 days

pull request commentrust-lang/rust

Fix typo "TraitObligatiom" -> "TraitObligation"

@bors r+ rollup

leijurv

comment created time in 4 days

Pull request review commentrust-lang/rust

Add `array` lang item and `[T; N]::map(f: FnMut(T) -> S)`

 macro_rules! array_impl_default { }  array_impl_default! {32, T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T}++#[lang = "array"]+#[cfg(not(bootstrap))]+impl<T, const N: usize> [T; N] {+    /// Returns an array of the same aize as self, with `f` applied to each element.+    ///+    /// # Examples+    /// ```+    /// let x = [1,2,3];+    /// let y = x.map(|v| v + 1);+    /// assert_eq!(y, [2,3,4]);+    /// ```+    #[unstable(feature = "array_map", issue = "77777")]+    fn map<F, S>(self, f: F) -> [S; N]+    where+        F: FnMut(T) -> S,+    {+        use crate::mem::MaybeUninit;+        let dst = MaybeUninit::uninit_array::<N>();+        for (i, e) in self.into_iter().enumerate() {+            dst[i] = MaybeUninit::new(f(e));

of dst (since MaybeUninit won't run the destructor of the contained value)

JulianKnodt

comment created time in 4 days

issue commentrust-lang/rust

1.45.0 regression macro-related ICE on 32-bit arm/ppc in tests

This is a metadata panic, actually

infinity0

comment created time in 5 days

issue commentrust-lang/rust

1.45.0 regression macro-related ICE on 32-bit arm/ppc in tests

Isn't that just pointing to one of the panic!-family macros?

infinity0

comment created time in 5 days

Pull request review commentrust-lang/rust

Add `array` lang item and `[T; N]::map(f: FnMut(T) -> S)`

 macro_rules! array_impl_default { }  array_impl_default! {32, T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T}++#[lang = "array"]+#[cfg(not(bootstrap))]+impl<T, const N: usize> [T; N] {+    /// Returns an array of the same aize as self, with `f` applied to each element.+    ///+    /// # Examples+    /// ```+    /// let x = [1,2,3];+    /// let y = x.map(|v| v + 1);+    /// assert_eq!(y, [2,3,4]);+    /// ```+    #[unstable(feature = "array_map", issue = "77777")]+    fn map<F, S>(self, f: F) -> [S; N]+    where+        F: FnMut(T) -> S,+    {+        use crate::mem::MaybeUninit;+        let dst = MaybeUninit::uninit_array::<N>();+        for (i, e) in self.into_iter().enumerate() {+            dst[i] = MaybeUninit::new(f(e));

This looks like it would leak all previous elements if f panics

JulianKnodt

comment created time in 5 days

issue commentrust-lang/rust

Possible CString eq bug

The docs say:

This function will consume the provided data and use the underlying bytes to construct a new string, ensuring that there is a trailing 0 byte. This trailing 0 byte will be appended by this function; the provided data should not contain any 0 bytes in it.

So this seems to work as expected

mrclean71774

comment created time in 5 days

issue commentrust-embedded/bare-metal

Single-instruction-read/writes atomics

That was just an example of an assumption that a compiler might make. You'd have to ask that question in terms of Rust's language semantics to get a complete answer, and I'm not sure how the precise answer looks there.

Ten0

comment created time in 5 days

startedsaagarjha/TSOEnabler

started time in 5 days

issue commentrust-embedded/bare-metal

Single-instruction-read/writes atomics

The unsafe impl Sync allows use of SingleCoreAtomicUsize across threads, but there is no inner synchronization, so any usage of get or set from more than one thread would be a data race, as the stores and loads happen unsynchronized with each other.

This is still the case if you replace "thread" with "interrupt handler". For example, the compiler might assume that a value loaded by subsequent gets stays the same if there is no set inbetween. This is wrong in the presence of interrupts.

The Relaxed ordering is all you need as long as you only need to synchronize accesses of the AtomicUsize itself, not any other data (the other orderings are used when writing lock free data structures with atomics, and affect how the compiler synchronizes non-atomic accesses to the actual data stored in the data structure).

Ten0

comment created time in 5 days

issue commentrust-embedded/bare-metal

Single-instruction-read/writes atomics

The atomic types are available everywhere (if not, that's a bug in Rust or LLVM), but CAS operations might not be. load and store are always available.

You still need to synchronize access between interrupt handlers and idle. As written, SingleCoreAtomicUsize causes data races between every get and set, which is undefined behavior.

Ten0

comment created time in 5 days

issue commentrust-embedded/bare-metal

Single-instruction-read/writes atomics

This is AtomicUsize

Ten0

comment created time in 5 days

pull request commentrust-analyzer/rust-analyzer

SSR: Allow `self` in patterns.

bors r+

davidlattimore

comment created time in 5 days

Pull request review commentrust-analyzer/rust-analyzer

SSR: Allow `self` in patterns.

 impl<'db> ResolutionScope<'db> {         ResolutionScope {             scope,             hygiene: hir::Hygiene::new(sema.db, resolve_context.file_id.into()),+            node,         }     } +    /// Returns the function in which SSR was invoked, if any.+    pub(crate) fn current_function(&self) -> Option<SyntaxNode> {+        self.node.ancestors().find(|node| node.kind() == SyntaxKind::FN).map(|node| node.clone())

Ah, that seems fine then.

davidlattimore

comment created time in 5 days

push eventjonas-schievink/rubble

Jonas Schievink

commit sha 2d65601e610ace51f190d9f76b172b86a612863e

enum_with_unknown: work around rust-analyzer bug rust-analyzer/rust-analyzer#4777

view details

push time in 5 days

Pull request review commentrust-analyzer/rust-analyzer

SSR: Allow `self` in patterns.

 impl<'db> ResolutionScope<'db> {         ResolutionScope {             scope,             hygiene: hir::Hygiene::new(sema.db, resolve_context.file_id.into()),+            node,         }     } +    /// Returns the function in which SSR was invoked, if any.+    pub(crate) fn current_function(&self) -> Option<SyntaxNode> {+        self.node.ancestors().find(|node| node.kind() == SyntaxKind::FN).map(|node| node.clone())

This seems like it might be invoked a lot, maybe it should be precomputed and stored in a field? Other than that this looks good to me.

davidlattimore

comment created time in 5 days

push eventjonas-schievink/rubble

Jonas Schievink

commit sha b02dec6caab96d998615f44ceae4836a6e3b72da

Attempt to fix the docs upload

view details

push time in 5 days

push eventjonas-schievink/rubble

Jonas Schievink

commit sha 6cd6084fb8755ecb331bb50c7994d29cf67ccc5a

another noop

view details

Jonas Schievink

commit sha fe745d6a4103d12922936988b1cc6bb71ca94500

yaml is an inscrutable disgrace

view details

push time in 5 days

push eventjonas-schievink/rubble

push time in 5 days

push eventjonas-schievink/rubble

Jonas Schievink

commit sha 01c7d4312beafb10c48c9f4de42fdcf5680112df

another noop

view details

push time in 5 days

push eventjonas-schievink/rubble

Jonas Schievink

commit sha 391b806c67599bb1488caf7fc6ea05842f2a8dac

Run CI on dbg branch

view details

push time in 5 days

push eventjonas-schievink/rubble

Jonas Schievink

commit sha dbf2213bf9c288a9f1ae5b3347140e75043d387b

noop

view details

push time in 5 days

create barnchjonas-schievink/rubble

branch : dbg

created branch time in 5 days

delete branch jonas-schievink/rubble

delete branch : dbg

delete time in 5 days

create barnchjonas-schievink/rubble

branch : dbg

created branch time in 5 days

delete branch jonas-schievink/rubble

delete branch : dbg

delete time in 5 days

PR closed jonas-schievink/rubble

Debug CI
+1 -16

0 comment

1 changed file

jonas-schievink

pr closed time in 5 days

push eventjonas-schievink/rubble

Jonas Schievink

commit sha 6153e9783b3ac209f4100fc0b68e6745f4e24bb9

debug CI

view details

push time in 5 days

push eventjonas-schievink/rubble

Jonas Schievink

commit sha 6acbd9313ba106fe4b198696f24b7284a93156eb

debug CI

view details

push time in 5 days

PR opened jonas-schievink/rubble

Debug CI
+1 -5

0 comment

1 changed file

pr created time in 5 days

create barnchjonas-schievink/rubble

branch : dbg

created branch time in 5 days

push eventjonas-schievink/rubble

Jonas Schievink

commit sha cae9d2ccde67d97e732abc8556e033f1f091b854

Replace test.sh with `cargo test` driven workflow

view details

Jonas Schievink

commit sha 8379a8b48d1368c0eb1e04d2e055aaa080aee2d5

rename build -> test

view details

Jonas Schievink

commit sha ad4562ff7a7a2c97b39842aa29d39a7ed024a90e

Merge pull request #138 from jonas-schievink/cargo-test-ftw Replace test.sh with `cargo test` driven workflow

view details

push time in 6 days

delete branch jonas-schievink/rubble

delete branch : cargo-test-ftw

delete time in 6 days

PR merged jonas-schievink/rubble

Replace test.sh with `cargo test` driven workflow

Inspired by rust-analyzer's setup, this gets rid of the shell script and instead does the same stuff from a regular Rust unit test.

This simplifies the testing workflow to just running cargo test in the repo root, the same as for any old crate out there.

+87 -64

0 comment

5 changed files

jonas-schievink

pr closed time in 6 days

Pull request review commentrust-analyzer/rust-analyzer

SSR: Allow `self` in patterns.

 impl<'db> ResolutionScope<'db> {         ResolutionScope {             scope,             hygiene: hir::Hygiene::new(sema.db, resolve_context.file_id.into()),+            node,+        }+    }++    /// Returns the function in which SSR was invoked, if any.+    pub(crate) fn current_function(&self) -> Option<SyntaxNode> {+        let mut node = self.node.clone();+        loop {+            if node.kind() == SyntaxKind::FN {+                return Some(node);+            }+            node = node.parent()?;

Could this loop use node.ancestors() instead?

davidlattimore

comment created time in 6 days

pull request commentrust-analyzer/rust-analyzer

Add expand glob import assist

bors r+

unexge

comment created time in 6 days

pull request commentrust-analyzer/rust-analyzer

Fix renamed self module.

bors r+

Nashenas88

comment created time in 6 days

pull request commentrust-analyzer/rust-analyzer

Document release process

Great!

bors r+

matklad

comment created time in 6 days

Pull request review commentrust-analyzer/rust-analyzer

Add expand glob import assist

 fn replace_ast(     path: ast::Path,     used_names: Vec<Name>, ) {-    let new_use_tree_list = ast::make::use_tree_list(used_names.iter().map(|n| {-        ast::make::use_tree(ast::make::path_from_text(&n.to_string()), None, None, false)-    }));+    let replacement: Either<ast::UseTree, ast::UseTreeList> = if used_names.len() == 1 {

That looks nice, yeah

unexge

comment created time in 6 days

pull request commentjonas-schievink/rubble

Add function to `LinkLayer` for entering standby

Hmm, yeah, we want something like this eventually, but getting it correct is a bit more involved. For example, the low-priority part of the stack needs to know that the connection is being teared down to drain the packet queue before the operation can complete (otherwise establishing a new connection will start processing and transmitting packets from the old connection, which is pretty bad).

That said, going from "advertising" to "not advertising" should be trivial. Maybe we should have a stop_advertising function instead that will panic when a connection is established, if that helps with your use case?

daboross

comment created time in 6 days

Pull request review commentjonas-schievink/rubble

Create constructor and value-getter for Attribute::value

 pub struct Attribute<'a> {     pub value: HexSlice<&'a [u8]>, } +impl<'a> Attribute<'a> {+    /// Creates a new attribute.+    pub fn new(att_type: AttUuid, handle: Handle, value: &'a [u8]) -> Self {
    pub fn new(att_type: AttUuid, handle: Handle, value: &'a [u8]) -> Self {
        assert_ne!(handle, Handle::NULL);
daboross

comment created time in 6 days

Pull request review commentrust-analyzer/rust-analyzer

Add expand glob import assist

 fn replace_ast(     path: ast::Path,     used_names: Vec<Name>, ) {-    let new_use_tree_list = ast::make::use_tree_list(used_names.iter().map(|n| {-        ast::make::use_tree(ast::make::path_from_text(&n.to_string()), None, None, false)-    }));+    let replacement: Either<ast::UseTree, ast::UseTreeList> = if used_names.len() == 1 {

This can be rewritten as:

    let replacement: Either<ast::UseTree, ast::UseTreeList> = match used_names.first() {

...to avoid the .first().unwrap() below

unexge

comment created time in 6 days

push eventjonas-schievink/rubble

Jonas Schievink

commit sha 8379a8b48d1368c0eb1e04d2e055aaa080aee2d5

rename build -> test

view details

push time in 6 days

issue commentrust-analyzer/rust-analyzer

Rust analyzer reports arity error wrong when there is attributes on the function definition

Presumably the fix is to check for #[cfg] attributes when lowering function parameters here:

https://github.com/rust-analyzer/rust-analyzer/blob/af6e9a7eb3c321ea43d3ac14c2b05f8c58e1abac/crates/ra_hir_def/src/item_tree/lower.rs#L307-L310

GrayJack

comment created time in 6 days

pull request commentrust-analyzer/rust-analyzer

Fix renamed self module.

Okay, that makes sense

Nashenas88

comment created time in 6 days

Pull request review commentrust-analyzer/rust-analyzer

Add expand glob import assist

+use hir::{MacroDef, ModuleDef, Name, PathResolution, ScopeDef, SemanticsScope};+use ra_ide_db::{+    defs::{classify_name_ref, Definition, NameRefClass},+    RootDatabase,+};+use ra_syntax::{ast, match_ast, AstNode, SyntaxNode, SyntaxToken, T};++use crate::{+    assist_context::{AssistBuilder, AssistContext, Assists},+    AssistId, AssistKind,+};++// Assist: expand_glob_import+//+// Expands glob imports.+//+// ```+// mod foo {+//     pub struct Bar;+//     pub struct Baz;+// }+//+// use foo::*<|>;+//+// fn qux(bar: Bar, baz: Baz) {}+// ```+// ->+// ```+// mod foo {+//     pub struct Bar;+//     pub struct Baz;+// }+//+// use foo::{Baz, Bar};+//+// fn qux(bar: Bar, baz: Baz) {}+// ```+pub(crate) fn expand_glob_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {+    let star = ctx.find_token_at_offset(T![*])?;+    let mod_path = find_mod_path(&star)?;++    let source_file = ctx.source_file();+    let scope = ctx.sema.scope_at_offset(source_file.syntax(), ctx.offset());++    let defs_in_mod = find_defs_in_mod(ctx, scope, &mod_path)?;+    let name_refs_in_source_file =+        source_file.syntax().descendants().filter_map(ast::NameRef::cast).collect();+    let used_names = find_used_names(ctx, defs_in_mod, name_refs_in_source_file);++    let parent = star.parent().parent()?;+    acc.add(+        AssistId("expand_glob_import", AssistKind::RefactorRewrite),+        "Expand glob import",+        parent.text_range(),+        |builder| {+            replace_ast(builder, &parent, mod_path, used_names);+        },+    )+}++fn find_mod_path(star: &SyntaxToken) -> Option<ast::Path> {+    star.ancestors().find_map(|n| ast::UseTree::cast(n).and_then(|u| u.path()))+}++#[derive(PartialEq)]+enum Def {+    ModuleDef(ModuleDef),+    MacroDef(MacroDef),+}++impl Def {+    fn name(&self, db: &RootDatabase) -> Option<Name> {+        match self {+            Def::ModuleDef(def) => def.name(db),+            Def::MacroDef(def) => def.name(db),+        }+    }+}++fn find_defs_in_mod(+    ctx: &AssistContext,+    from: SemanticsScope<'_>,+    path: &ast::Path,+) -> Option<Vec<Def>> {+    let hir_path = ctx.sema.lower_path(&path)?;+    let module = if let Some(PathResolution::Def(ModuleDef::Module(module))) =+        from.resolve_hir_path_qualifier(&hir_path)+    {+        module+    } else {+        return None;+    };++    let module_scope = module.scope(ctx.db(), from.module());++    let mut defs = vec![];+    for (_, def) in module_scope {+        match def {+            ScopeDef::ModuleDef(def) => defs.push(Def::ModuleDef(def)),+            ScopeDef::MacroDef(def) => defs.push(Def::MacroDef(def)),+            _ => continue,+        }+    }++    Some(defs)+}++fn find_used_names(+    ctx: &AssistContext,+    defs_in_mod: Vec<Def>,+    name_refs_in_source_file: Vec<ast::NameRef>,+) -> Vec<Name> {+    let defs_in_source_file = name_refs_in_source_file+        .iter()+        .filter_map(|r| classify_name_ref(&ctx.sema, r))+        .filter_map(|rc| match rc {+            NameRefClass::Definition(Definition::ModuleDef(def)) => Some(Def::ModuleDef(def)),+            NameRefClass::Definition(Definition::Macro(def)) => Some(Def::MacroDef(def)),+            _ => None,+        })+        .collect::<Vec<Def>>();++    defs_in_mod+        .iter()+        .filter(|d| defs_in_source_file.contains(d))+        .filter_map(|d| d.name(ctx.db()))+        .collect()+}++fn replace_ast(+    builder: &mut AssistBuilder,+    node: &SyntaxNode,+    path: ast::Path,+    used_names: Vec<Name>,+) {+    let new_use_tree_list = ast::make::use_tree_list(used_names.iter().map(|n| {+        ast::make::use_tree(ast::make::path_from_text(&n.to_string()), None, None, false)+    }));++    match_ast! {+        match node {+            ast::UseTree(use_tree) => {+                builder.replace_ast(use_tree, make_use_tree(path, new_use_tree_list));+            },+            ast::UseTreeList(use_tree_list) => {+                builder.replace_ast(use_tree_list, new_use_tree_list);+            },+            ast::Use(use_item) => {+                builder.replace_ast(use_item, ast::make::use_item(make_use_tree(path, new_use_tree_list)));+            },+            _ => {},+        }+    }++    fn make_use_tree(path: ast::Path, use_tree_list: ast::UseTreeList) -> ast::UseTree {+        ast::make::use_tree(path, Some(use_tree_list), None, false)+    }+}++#[cfg(test)]+mod tests {+    use crate::tests::{check_assist, check_assist_not_applicable};++    use super::*;++    #[test]+    fn expanding_glob_import() {+        check_assist(+            expand_glob_import,+            r"+mod foo {+    pub struct Bar;+    pub struct Baz;+    pub struct Qux;++    pub fn f() {}+}++use foo::*<|>;++fn qux(bar: Bar, baz: Baz) {+    f();+}+",+            r"+mod foo {+    pub struct Bar;+    pub struct Baz;+    pub struct Qux;++    pub fn f() {}+}++use foo::{Baz, Bar, f};++fn qux(bar: Bar, baz: Baz) {+    f();+}+",+        )+    }++    #[test]+    fn expanding_glob_import_with_existing_explicit_names() {+        check_assist(+            expand_glob_import,+            r"+mod foo {+    pub struct Bar;+    pub struct Baz;+    pub struct Qux;++    pub fn f() {}+}++use foo::{*<|>, f};++fn qux(bar: Bar, baz: Baz) {+    f();+}+",+            r"+mod foo {+    pub struct Bar;+    pub struct Baz;+    pub struct Qux;++    pub fn f() {}+}++use foo::{Baz, Bar, f};++fn qux(bar: Bar, baz: Baz) {+    f();+}+",+        )+    }++    #[test]+    fn expanding_nested_glob_import() {+        check_assist(+            expand_glob_import,+            r"+mod foo {+    mod bar {+        pub struct Bar;+        pub struct Baz;+        pub struct Qux;++        pub fn f() {}+    }++    mod baz {+        pub fn g() {}+    }+}++use foo::{bar::{*<|>, f}, baz::*};++fn qux(bar: Bar, baz: Baz) {+    f();+    g();+}+",+            r"+mod foo {+    mod bar {+        pub struct Bar;+        pub struct Baz;+        pub struct Qux;++        pub fn f() {}+    }++    mod baz {+        pub fn g() {}+    }+}++use foo::{bar::{Baz, Bar, f}, baz::*};++fn qux(bar: Bar, baz: Baz) {+    f();+    g();+}+",+        )+    }++    #[test]+    fn expanding_glob_import_with_macro_defs() {+        check_assist(+            expand_glob_import,+            r"+//- /lib.rs crate:foo+#[macro_export]+macro_rules! bar {+    () => ()+}++pub fn baz() {}++//- /main.rs crate:main deps:foo+use foo::*<|>;++fn main() {+    bar!();+    baz();+}+",+            r"+use foo::{bar, baz};++fn main() {+    bar!();+    baz();+}+",+        )+    }++    #[test]+    fn expanding_is_not_applicable_if_cursor_is_not_in_star_token() {+        check_assist_not_applicable(+            expand_glob_import,+            r"+    mod foo {+        pub struct Bar;+        pub struct Baz;+        pub struct Qux;+    }++    use foo::Bar<|>;++    fn qux(bar: Bar, baz: Baz) {}+    ",+        )+    }+}

Could you add a test like this?

//- /lib.rs crate:foo
pub trait Tr {
    fn method(&self) {}
}
impl Tr for () {}
//- /main.rs crate:main deps:foo
use foo::*<|>;
fn main() {
    ().method();
}

Should result in:

use foo::Tr;
fn main() {
    ().method();
}

despite the trait not being named anywhere

unexge

comment created time in 6 days

pull request commentrust-analyzer/rust-analyzer

Fix renamed self module.

Shouldn't this be done inside classify_name_ref?

Nashenas88

comment created time in 6 days

PR opened jonas-schievink/rubble

Replace test.sh with `cargo test` driven workflow

Inspired by rust-analyzer's setup, this gets rid of the shell script and instead does the same stuff from a regular Rust unit test.

This simplifies the testing workflow to just running cargo test in the repo root, the same as for any old crate out there.

+86 -63

0 comment

5 changed files

pr created time in 6 days

create barnchjonas-schievink/rubble

branch : cargo-test-ftw

created branch time in 6 days

issue openedrust-embedded/fixedvec-rs

Status of this crate?

Hi @nastevens!

It seems that this crate is a remnant from before the embedded working group was fully established, so it's not maintained by any team at the moment. Would you be up for transferring the crate/repo to the team? This crate is quite useful sometimes and it'd be great if we can keep it up to date.

created time in 6 days

pull request commentrust-embedded/cortex-m-rt

Try combining some steps to speed up CI

We could also collapse the Clippy and rustfmt builders into one

therealprof

comment created time in 6 days

Pull request review commentrust-embedded/cortex-m-rt

Try combining some steps to speed up CI

 jobs:         with:           profile: minimal           toolchain: ${{ matrix.rust }}-          target: ${{ matrix.TARGET }}+          target: thumbv6m-none-eabi thumbv7m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf thumbv8m.main-none-eabi

It might be easiest to just invoke rustup manually, it can take a list of targets to install

therealprof

comment created time in 6 days

more