profile
viewpoint
Florian Diebold flodiebold Hamburg

flodiebold/cargo-metadata-bug 1

Reproducing a cargo-metadata problem

flodiebold/crawl-versions 1

Manages multiple versions of DCSS and allows users to choose whether to upgrade.

flodiebold/luakit 1

Fast, small, webkit based browser framework extensible by Lua.

flodiebold/ansible 0

Model-driven configuration management, multi-node deployment, and remote task execution system. Uses SSH, so no special software has to be installed on the nodes you manage. Ansible can be extended in any language. Note: The default branch is the development branch, if you need a stable version, see the release-XX branches.

flodiebold/chalk 0

A PROLOG-ish interpreter written in Rust, intended eventually for use in the compiler

flodiebold/clj-http 0

An idiomatic clojure http client wrapping the apache client. Offically supported version.

flodiebold/company-lsp 0

Company completion backend for lsp-mode

Pull request review commentrust-lang/rust-analyzer

Lower const params with a bad id

 impl TypeBound { }  #[derive(Debug, Clone, PartialEq, Eq, Hash)]-pub enum ConstRefOrPath {-    Scalar(ConstRef),+pub enum ConstRef {+    Scalar(ConcreteConstRef),     Path(Name),+    Complex(InFile<FileAstId<ast::Expr>>), } -impl ConstRefOrPath {-    pub(crate) fn from_expr_opt(expr: Option<ast::Expr>) -> Self {+impl ConstRef {+    pub(crate) fn from_expr_opt(lower_ctx: &LowerCtx<'_>, expr: Option<ast::Expr>) -> Self {         match expr {-            Some(x) => Self::from_expr(x),-            None => Self::Scalar(ConstRef::Unknown),+            Some(x) => {+                let ast_id = lower_ctx.ast_id(&x);+                Self::from_expr(x, ast_id)+            }+            None => Self::Scalar(ConcreteConstRef::Unknown),         }     }      pub fn display<'a>(&'a self, db: &'a dyn ExpandDatabase) -> impl fmt::Display + 'a {-        struct Display<'a>(&'a dyn ExpandDatabase, &'a ConstRefOrPath);+        struct Display<'a>(&'a dyn ExpandDatabase, &'a ConstRef);         impl fmt::Display for Display<'_> {             fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {                 match self.1 {-                    ConstRefOrPath::Scalar(s) => s.fmt(f),-                    ConstRefOrPath::Path(n) => n.display(self.0).fmt(f),+                    ConstRef::Scalar(s) => s.fmt(f),+                    ConstRef::Path(n) => n.display(self.0).fmt(f),+                    ConstRef::Complex(_) => f.write_str("{const}"),                 }             }         }         Display(db, self)     } -    // FIXME: as per the comments on `TypeRef::Array`, this evaluation should not happen at this-    // parse stage.-    fn from_expr(expr: ast::Expr) -> Self {+    // We special case literals and single identifiers, to speed up things.+    fn from_expr(expr: ast::Expr, ast_id: Option<InFile<FileAstId<ast::Expr>>>) -> Self {+        fn is_path_ident(p: &ast::PathExpr) -> bool {+            let Some(path) = p.path() else {+                return false;+            };+            if path.coloncolon_token().is_some() {+                return false;+            }+            if let Some(s) = path.segment() {+                if s.coloncolon_token().is_some() || s.generic_arg_list().is_some() {+                    return false;+                }+            }+            true+        }         match expr {-            ast::Expr::PathExpr(p) => {+            ast::Expr::PathExpr(p) if is_path_ident(&p) => {                 match p.path().and_then(|x| x.segment()).and_then(|x| x.name_ref()) {                     Some(x) => Self::Path(x.as_name()),-                    None => Self::Scalar(ConstRef::Unknown),+                    None => Self::Scalar(ConcreteConstRef::Unknown),                 }             }-            ast::Expr::PrefixExpr(prefix_expr) => match prefix_expr.op_kind() {-                Some(ast::UnaryOp::Neg) => {-                    let unsigned = Self::from_expr_opt(prefix_expr.expr());-                    // Add sign-                    match unsigned {-                        Self::Scalar(ConstRef::UInt(num)) => {-                            Self::Scalar(ConstRef::Int(-(num as i128)))-                        }-                        other => other,-                    }-                }-                _ => Self::from_expr_opt(prefix_expr.expr()),-            },             ast::Expr::Literal(literal) => Self::Scalar(match literal.kind() {                 ast::LiteralKind::IntNumber(num) => {-                    num.value().map(ConstRef::UInt).unwrap_or(ConstRef::Unknown)+                    num.value().map(ConcreteConstRef::UInt).unwrap_or(ConcreteConstRef::Unknown)                 }                 ast::LiteralKind::Char(c) => {-                    c.value().map(ConstRef::Char).unwrap_or(ConstRef::Unknown)+                    c.value().map(ConcreteConstRef::Char).unwrap_or(ConcreteConstRef::Unknown)                 }-                ast::LiteralKind::Bool(f) => ConstRef::Bool(f),-                _ => ConstRef::Unknown,+                ast::LiteralKind::Bool(f) => ConcreteConstRef::Bool(f),+                _ => ConcreteConstRef::Unknown,             }),-            _ => Self::Scalar(ConstRef::Unknown),+            _ => {+                if let Some(ast_id) = ast_id {+                    Self::Complex(ast_id)+                } else {+                    Self::Scalar(ConcreteConstRef::Unknown)+                }+            }         }     } }  /// A concrete constant value #[derive(Debug, Clone, PartialEq, Eq, Hash)]-pub enum ConstRef {+pub enum ConcreteConstRef {

SimpleConstRef maybe... or PrimitiveConstRef

HKalbasi

comment created time in 3 days

Pull request review commentrust-lang/rust-analyzer

Lower const params with a bad id

 pub(crate) fn infer_query(db: &dyn HirDatabase, def: DefWithBodyId) -> Arc<Infer                 },             });         }+        DefWithBodyId::InTypeConstId(_) => {+            // FIXME: We should know the expected type here.

yeah, but this is one of the hard parts, isn't it... IIRC there's a pretty hacky hack for this in rustc

HKalbasi

comment created time in 3 days

Pull request review commentrust-lang/rust-analyzer

Lower const params with a bad id

 impl_from!(     for ModuleDefId ); -// FIXME: make this a DefWithBodyId #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] pub struct AnonymousConstId(InternId); impl_intern_key!(AnonymousConstId); +#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]+pub enum TypeOwnerId {+    ModuleId(ModuleId),

how can a module be a TypeOwner?

HKalbasi

comment created time in 3 days

PullRequestReviewEvent

Pull request review commentrust-lang/rust-analyzer

Lower const params with a bad id

 impl_from!(     for ModuleDefId ); -// FIXME: make this a DefWithBodyId+/// Id of the anonymous const block expression and patterns. This is very similar to `ClosureId` and+/// shouldn't be a `DefWithBodyId` since its type inference is dependent on its parent. #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] pub struct AnonymousConstId(InternId); impl_intern_key!(AnonymousConstId); +#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]+pub enum TypeOwnerId {+    ModuleId(ModuleId),+    DefWithBodyId(DefWithBodyId),+    GenericDefId(GenericDefId),+}

this should IMO not reuse DefWithBodyId and GenericDefId. It should just list all the cases (FunctionId etc.), we should never have multiple levels of these "ID set enums". This case would be especially weird since DefWithBodyId and GenericDefId share quite a few types, and on the other hand have variants that don't make sense here (InTypeConstId for example :smile: )

HKalbasi

comment created time in 12 hours

PullRequestReviewEvent

Pull request review commentrust-lang/rust-analyzer

Lower const params with a bad id

 impl AstIdMap {                 || ast::Variant::can_cast(kind)                 || ast::RecordField::can_cast(kind)                 || ast::TupleField::can_cast(kind)+                || ast::Expr::can_cast(kind)

can we instead only do this for const args?

HKalbasi

comment created time in 3 days

issue openedonepub-dev/fixed

`toInt` implementation wrong?

https://github.com/onepub-dev/fixed/blob/d25fe302681b2f553dd4ec21ac9761eced4ceeec/lib/src/fixed.dart#L476

Am I completely misunderstanding what toInt is supposed to do, or should this rather be BigInt.from(10).pow(scale)?

created time in 12 hours

issue commentrust-lang/rust-analyzer

GAT patterns causes type inference to fail on unrelated `Option::take`

There should be some mechanisms to ensure method resolution precedence rule, that inherent methods should always resolve over trait method.

That's not the full rule. Trait methods that take self take precedence over inherent methods that take &mut self, as the page you linked also explains. Or as an example, here's a playground that demonstrates what would happen if Option actually did implement Iterator.

ZhennanWu

comment created time in 2 days

issue commentrust-lang/rust-analyzer

GAT patterns causes type inference to fail on unrelated `Option::take`

This confuses rust-analyzer greatly and somehow it starts to ask chalk to check if <E as IntoIterator>::IntoIter = Option<i32> because they have similarly named method called take

No confusion there; any .take() might well be Iterator::take, so we have to check whether the type implements Iterator, and it's Chalk which tries to go down the IntoIter route. The problem is chalk#727; the other steps are working as intended.

ZhennanWu

comment created time in 2 days

issue commentrust-lang/rust-analyzer

My guy be usin' 8GB of memory

Also, how big is the project you had open (including dependencies)?

J-Cake

comment created time in 2 days

issue commentrust-lang/rust-analyzer

RA duplicates subdiagnostics as top-level diagnostics making the list less readable in Kate

IMO ideally the client would tell RA whether to apply the workaround or not. Not sure a config is the best way to do something like that, maybe the initializationOptions?

tanriol

comment created time in 6 days

issue commentrust-lang/rust-analyzer

False type-mismatch for derive(Hash) for structs with fields called "state"

Maybe we could use a name that's less likely to collide until then?

valyagolev

comment created time in 16 days

issue commentrust-lang/rust-analyzer

Extend selection behaves differently between single- and multi-line statements

We could at least note it in the manual section for the feature.

YaLTeR

comment created time in 16 days

issue commentrust-lang/rust-analyzer

How to sync rustc_abi with the "current" stable release

But that kind of breakage is probably very low so maybe we can do that in a best effort basis (being compatible with both stable and nightly with a switch until a breakage happen, and then drop one of them until they become sync again).

Just to provide some more options: We could even keep supporting both versions, and decide either based on rustc version or even through some kind of feature detection which implementation to use / whether to use a specific layout feature. We'd have to see how much maintenance effort that actually is.

Yet another option would be to go the proc macro way and have a relatively lightweight separate component that we distribute with rustc that either does the layout calculations, or provides us enough information to do them correctly.

Veykril

comment created time in 17 days

issue closedrust-lang/rust-analyzer

Activate all features in Emacs

Hi, I try to activate the compilation with all features enabled in emacs. I found for VSCode which is:

➜  User: cat settings.json 
{
    "window.zoomLevel": 2,
    "rust-analyzer.cargo.features": [
        "features_to_enable"
    ]
}
➜  User: pwd
/home/user/.config/Code/User

But I cannot find:

  • how to do the same for emacs
  • activate all features instead of one by one

Can someone help please?

closed time in 17 days

dannywillems

issue commentrust-lang/rust-analyzer

Activate all features in Emacs

Yeah, that should do it.

dannywillems

comment created time in 17 days

issue commentrust-lang/rust-analyzer

VSCode - Suppress Error Toast

To clarify why this isn't fixable by "just reporting the crash": it's normal part of the workflow for workspace to intermittently be non-buildable, or to open a project that we know has errors. As long as the discussion keeps derailing towards "report why it crashes", it's off-topic and doesn't bring us anywhere closer to the solution.

We agree that normal cargo check errors shouldn't cause an error notification. That argument is what's actually off-topic, because if you read the original issue it's about whether crashes should cause an error notification.

AThilenius

comment created time in 20 days

issue commentrust-lang/rust-analyzer

RA incorrectly suggests importing `println` from `std` when using `println!()`

Caused by #14781, cc @lowr

lh123

comment created time in 20 days

issue commentrust-lang/rust-analyzer

Complete statement command for Rust Analyzer

We could try, but I think they are likely to differ since they serve very different purposes.

gnut-neygun

comment created time in a month

startedeqlog/eqlog

started time in a month

issue commentrust-lang/rust-analyzer

Methods provided via Deref<Target> are not being found

@zhiqiangxu probably not the same issue.

woody77

comment created time in a month

Pull request review commentrust-lang/rust-analyzer

Consider subst in prioritising placeholder inherent methods

 fn test() { S2.into(); }     ); } +#[test]+fn method_resolution_prefer_explicit_bound() {+    check_types(+        r#"+trait Tr<T> {+    fn tr(self) -> T;+}++impl<T> Tr<T> for T {+    fn tr(self) -> T {+        self+    }+}+fn test<T: Tr<i32>>(x: T) { x.tr(); }+                          //^^^^^^ i32+fn test<T: Tr<i32> + Tr<i64>>(x: T) { let x: i64 = x.tr(); }+                                                 //^^^^^^ i64+"#,+    );+}+

Yeah, I don't think we should do this. This needs to be fixed in Chalk.

HKalbasi

comment created time in a month

PullRequestReviewEvent

pull request commentrust-lang/rust-analyzer

feat: Drop support for non-syroot proc macro ABIs

I wonder if that fallback still makes sense then? I guess it can be useful if you built RA with the feature, but it's also just likely to break then if you're not using the exact right rustc version. Maybe we should just give an error message on the server side instead?

Veykril

comment created time in a month

pull request commentrust-lang/rust-analyzer

feat: Drop support for non-syroot proc macro ABIs

That code lives inside the proc macro server, and unless I'm misunderstanding how this works now (which is possible), you should be running the proc macro server bundled with your rustc installation. So you should only run into this error if you're using a sysroot that doesn't have the bundled proc macro server, which should only happen if your rustc is too old or you built it yourself, I think. (I guess we fall back to using rust-analyzer as the proc macro server, which is how you then get the error message?)

Veykril

comment created time in a month

pull request commentrust-lang/rust-analyzer

feat: Drop support for non-syroot proc macro ABIs

It's also not necessary, right? It only needs to be enabled when building the proc macro server, which you only need to do when building rustc yourself, not if you just want to build rust-analyzer.

Veykril

comment created time in a month

issue commentrust-lang/rust-analyzer

dev-dependencies on workspace member cause cyclic dependency issues

Yeah. :thinking: How exactly do cyclic dev dependencies work with Cargo? I'm not sure why it doesn't run into the same problem?

Veykril

comment created time in a month

issue commentrust-lang/rust-analyzer

proc macro `Serialize` not expanded: server is built without sysroot support

That does not fix the problem, only hide it. @Jake-Jensen what does ls $(rustc --print sysroot)/libexec say?

antonilol

comment created time in 2 months

issue commentrust-lang/rust-analyzer

Type name matches silence function/method matches in global symbol search

This is mostly working as intended: the symbol search only looks for types by default, but it falls back to functions if there are no results. In editors other than VSCode, you should be able to append # to extend the search to functions, but this doesn't work in VSCode anymore because it swallows special characters. You can configure the search to always include functions though.

crumblingstatue

comment created time in 2 months

more