Skip to content

feat: Implement Return Position Impl Trait In Traits correctly #19394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
18 changes: 5 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ debug = 2
[patch.'crates-io']
# rowan = { path = "../rowan" }

# chalk-solve = { path = "../chalk/chalk-solve" }
# chalk-ir = { path = "../chalk/chalk-ir" }
# chalk-recursive = { path = "../chalk/chalk-recursive" }
# chalk-derive = { path = "../chalk/chalk-derive" }
chalk-solve = { path = "../chalk/chalk-solve" }
chalk-ir = { path = "../chalk/chalk-ir" }
chalk-recursive = { path = "../chalk/chalk-recursive" }
chalk-derive = { path = "../chalk/chalk-derive" }
# line-index = { path = "lib/line-index" }
# la-arena = { path = "lib/la-arena" }
# lsp-server = { path = "lib/lsp-server" }
Expand Down Expand Up @@ -105,10 +105,10 @@ arrayvec = "0.7.4"
bitflags = "2.4.1"
cargo_metadata = "0.18.1"
camino = "1.1.6"
chalk-solve = { version = "0.100.0", default-features = false }
chalk-ir = "0.100.0"
chalk-recursive = { version = "0.100.0", default-features = false }
chalk-derive = "0.100.0"
chalk-solve = { version = "0.101.0-dev.0", default-features = false }
chalk-ir = "0.101.0-dev.0"
chalk-recursive = { version = "0.101.0-dev.0", default-features = false }
chalk-derive = "0.101.0-dev.0"
crossbeam-channel = "0.5.8"
dissimilar = "1.0.7"
dot = "0.1.4"
Expand Down
21 changes: 21 additions & 0 deletions crates/base-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use syntax::{Parse, SyntaxError, ast};
use triomphe::Arc;
pub use vfs::{AnchoredPath, AnchoredPathBuf, FileId, VfsPath, file_set::FileSet};

/// Prefer to use `impl_intern_key_ref!()`, which will not clone the value.
#[macro_export]
macro_rules! impl_intern_key {
($id:ident, $loc:ident) => {
Expand All @@ -43,6 +44,26 @@ macro_rules! impl_intern_key {
};
}

#[macro_export]
macro_rules! impl_intern_key_ref {
($id:ident, $loc:ident) => {
#[salsa::interned(no_debug, no_lifetime)]
pub struct $id {
#[return_ref]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next salsa will hopefully flip this to be the default mode (once someone implements it salsa-rs/salsa#719)

pub loc: $loc,
}

// If we derive this salsa prints the values recursively, and this causes us to blow.
impl ::std::fmt::Debug for $id {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
f.debug_tuple(stringify!($id))
.field(&format_args!("{:04x}", self.0.as_u32()))
.finish()
}
}
};
}

pub trait Upcast<T: ?Sized> {
fn upcast(&self) -> &T;
}
Expand Down
Loading
Loading