Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions components/salsa-macro-rules/src/setup_input_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ macro_rules! setup_input_struct {
#[allow(clippy::all)]
#[allow(dead_code)]
const _: () = {
use salsa::plumbing as $zalsa;
use ::salsa::plumbing as $zalsa;
use $zalsa::input as $zalsa_struct;

type $Configuration = $Struct;
Expand Down Expand Up @@ -123,7 +123,7 @@ macro_rules! setup_input_struct {
fn serialize<S: $zalsa::serde::Serializer>(
fields: &Self::Fields,
serializer: S,
) -> Result<S::Ok, S::Error> {
) -> ::std::result::Result<S::Ok, S::Error> {
$zalsa::macro_if! {
if $persist {
$($serialize_fn(fields, serializer))?
Expand All @@ -135,7 +135,7 @@ macro_rules! setup_input_struct {

fn deserialize<'de, D: $zalsa::serde::Deserializer<'de>>(
deserializer: D,
) -> Result<Self::Fields, D::Error> {
) -> ::std::result::Result<Self::Fields, D::Error> {
$zalsa::macro_if! {
if $persist {
$($deserialize_fn(deserializer))?
Expand Down Expand Up @@ -198,8 +198,8 @@ macro_rules! setup_input_struct {
}

$zalsa::macro_if! { $generate_debug_impl =>
impl std::fmt::Debug for $Struct {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl ::std::fmt::Debug for $Struct {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
Self::default_debug_fmt(*self, f)
}
}
Expand Down Expand Up @@ -241,7 +241,7 @@ macro_rules! setup_input_struct {

$zalsa::macro_if! { $persist =>
impl $zalsa::serde::Serialize for $Struct {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
fn serialize<S>(&self, serializer: S) -> ::std::result::Result<S::Ok, S::Error>
where
S: $zalsa::serde::Serializer,
{
Expand All @@ -250,7 +250,7 @@ macro_rules! setup_input_struct {
}

impl<'de> $zalsa::serde::Deserialize<'de> for $Struct {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: $zalsa::serde::Deserializer<'de>,
{
Expand Down Expand Up @@ -310,7 +310,7 @@ macro_rules! setup_input_struct {
self,
$field_index,
ingredient,
|fields, f| std::mem::replace(&mut fields.$field_index, f),
|fields, f| ::std::mem::replace(&mut fields.$field_index, f),
)
}
)*
Expand All @@ -336,11 +336,11 @@ macro_rules! setup_input_struct {
}

/// Default debug formatting for this struct (may be useful if you define your own `Debug` impl)
pub fn default_debug_fmt(this: Self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
pub fn default_debug_fmt(this: Self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result
where
// rustc rejects trivial bounds, but it cannot see through higher-ranked bounds
// with its check :^)
$(for<'__trivial_bounds> $field_ty: std::fmt::Debug),*
$(for<'__trivial_bounds> $field_ty: ::std::fmt::Debug),*
{
$zalsa::with_attached_database(|db| {
let zalsa = db.zalsa();
Expand Down Expand Up @@ -371,7 +371,7 @@ macro_rules! setup_input_struct {
pub fn new<$Db>(self, db: &$Db) -> $Struct
where
// FIXME(rust-lang/rust#65991): The `db` argument *should* have the type `dyn Database`
$Db: ?Sized + salsa::Database
$Db: ?Sized + ::salsa::Database
{
let (zalsa, zalsa_local) = db.zalsas();
let current_revision = zalsa.current_revision();
Expand All @@ -384,15 +384,15 @@ macro_rules! setup_input_struct {
mod builder {
use super::*;

use salsa::plumbing as $zalsa;
use ::salsa::plumbing as $zalsa;
use $zalsa::input as $zalsa_struct;

// These are standalone functions instead of methods on `Builder` to prevent
// that the enclosing module can call them.
pub(super) fn new_builder($($field_id: $field_ty),*) -> $Builder {
$Builder {
fields: ($($field_id,)*),
durabilities: [salsa::Durability::default(); $N],
durabilities: [::salsa::Durability::default(); $N],
}
}

Expand All @@ -406,14 +406,14 @@ macro_rules! setup_input_struct {
fields: ($($field_ty,)*),

/// The durabilities per field.
durabilities: [salsa::Durability; $N],
durabilities: [::salsa::Durability; $N],
}

impl $Builder {
/// Sets the durability of all fields.
///
/// Overrides any previously set durabilities.
pub fn durability(mut self, durability: salsa::Durability) -> Self {
pub fn durability(mut self, durability: ::salsa::Durability) -> Self {
self.durabilities = [durability; $N];
self
}
Expand All @@ -431,7 +431,7 @@ macro_rules! setup_input_struct {
$(
/// Sets the durability for the field `$field_id`.
#[must_use]
pub fn $field_durability_id(mut self, durability: salsa::Durability) -> Self
pub fn $field_durability_id(mut self, durability: ::salsa::Durability) -> Self
{
self.durabilities[$field_index] = durability;
self
Expand Down
40 changes: 20 additions & 20 deletions components/salsa-macro-rules/src/setup_interned_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ macro_rules! setup_interned_struct {
#[allow(clippy::all)]
#[allow(dead_code)]
const _: () = {
use salsa::plumbing as $zalsa;
use ::salsa::plumbing as $zalsa;
use $zalsa::interned as $zalsa_struct;

type $Configuration = $StructWithStatic;
Expand All @@ -120,7 +120,7 @@ macro_rules! setup_interned_struct {
#[derive(Hash)]
struct StructKey<$db_lt, $($indexed_ty),*>(
$($indexed_ty,)*
std::marker::PhantomData<&$db_lt ()>,
::std::marker::PhantomData<&$db_lt ()>,
);

impl<$db_lt, $($indexed_ty,)*> $zalsa::interned::HashEqLike<StructKey<$db_lt, $($indexed_ty),*>>
Expand All @@ -129,7 +129,7 @@ macro_rules! setup_interned_struct {
$($field_ty: $zalsa::interned::HashEqLike<$indexed_ty>),*
{

fn hash<H: std::hash::Hasher>(&self, h: &mut H) {
fn hash<H: ::std::hash::Hasher>(&self, h: &mut H) {
$($zalsa::interned::HashEqLike::<$indexed_ty>::hash(&self.$field_index, &mut *h);)*
}

Expand All @@ -147,7 +147,7 @@ macro_rules! setup_interned_struct {
}
}

impl salsa::plumbing::interned::Configuration for $StructWithStatic {
impl $zalsa::interned::Configuration for $StructWithStatic {
const LOCATION: $zalsa::Location = $zalsa::Location {
file: file!(),
line: line!(),
Expand All @@ -171,7 +171,7 @@ macro_rules! setup_interned_struct {
fn serialize<S: $zalsa::serde::Serializer>(
fields: &Self::Fields<'_>,
serializer: S,
) -> Result<S::Ok, S::Error> {
) -> ::std::result::Result<S::Ok, S::Error> {
$zalsa::macro_if! {
if $persist {
$($serialize_fn(fields, serializer))?
Expand All @@ -183,7 +183,7 @@ macro_rules! setup_interned_struct {

fn deserialize<'de, D: $zalsa::serde::Deserializer<'de>>(
deserializer: D,
) -> Result<Self::Fields<'static>, D::Error> {
) -> ::std::result::Result<Self::Fields<'static>, D::Error> {
$zalsa::macro_if! {
if $persist {
$($deserialize_fn(deserializer))?
Expand All @@ -210,14 +210,14 @@ macro_rules! setup_interned_struct {
}

impl< $($db_lt_arg)? > $zalsa::AsId for $Struct< $($db_lt_arg)? > {
fn as_id(&self) -> salsa::Id {
fn as_id(&self) -> ::salsa::Id {
self.0.as_id()
}
}

impl< $($db_lt_arg)? > $zalsa::FromId for $Struct< $($db_lt_arg)? > {
fn from_id(id: salsa::Id) -> Self {
Self(<$Id>::from_id(id), std::marker::PhantomData)
fn from_id(id: ::salsa::Id) -> Self {
Self(<$Id>::from_id(id), ::std::marker::PhantomData)
}
}

Expand All @@ -226,8 +226,8 @@ macro_rules! setup_interned_struct {
unsafe impl< $($db_lt_arg)? > Sync for $Struct< $($db_lt_arg)? > {}

$zalsa::macro_if! { $generate_debug_impl =>
impl< $($db_lt_arg)? > std::fmt::Debug for $Struct< $($db_lt_arg)? > {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl< $($db_lt_arg)? > ::std::fmt::Debug for $Struct< $($db_lt_arg)? > {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
Self::default_debug_fmt(*self, f)
}
}
Expand Down Expand Up @@ -269,7 +269,7 @@ macro_rules! setup_interned_struct {

$zalsa::macro_if! { $persist =>
impl<$($db_lt_arg)?> $zalsa::serde::Serialize for $Struct<$($db_lt_arg)?> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
fn serialize<S>(&self, serializer: S) -> ::std::result::Result<S::Ok, S::Error>
where
S: $zalsa::serde::Serializer,
{
Expand All @@ -278,7 +278,7 @@ macro_rules! setup_interned_struct {
}

impl<'de, $($db_lt_arg)?> $zalsa::serde::Deserialize<'de> for $Struct<$($db_lt_arg)?> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
where
D: $zalsa::serde::Deserializer<'de>,
{
Expand All @@ -301,17 +301,17 @@ macro_rules! setup_interned_struct {
}

impl<$db_lt> $Struct< $($db_lt_arg)? > {
pub fn $new_fn<$Db, $($indexed_ty: $zalsa::interned::Lookup<$field_ty> + std::hash::Hash,)*>(db: &$db_lt $Db, $($field_id: $indexed_ty),*) -> Self
pub fn $new_fn<$Db, $($indexed_ty: $zalsa::interned::Lookup<$field_ty> + ::std::hash::Hash,)*>(db: &$db_lt $Db, $($field_id: $indexed_ty),*) -> Self
where
// FIXME(rust-lang/rust#65991): The `db` argument *should* have the type `dyn Database`
$Db: ?Sized + salsa::Database,
$Db: ?Sized + ::salsa::Database,
$(
$field_ty: $zalsa::interned::HashEqLike<$indexed_ty>,
)*
{
let (zalsa, zalsa_local) = db.zalsas();
$Configuration::ingredient(zalsa).intern(zalsa, zalsa_local,
StructKey::<$db_lt>($($field_id,)* std::marker::PhantomData::default()), |_, data| ($($zalsa::interned::Lookup::into_owned(data.$field_index),)*))
StructKey::<$db_lt>($($field_id,)* ::std::marker::PhantomData::default()), |_, data| ($($zalsa::interned::Lookup::into_owned(data.$field_index),)*))
}

$(
Expand All @@ -337,11 +337,11 @@ macro_rules! setup_interned_struct {
iftt ($($db_lt_arg)?) {
impl $Struct<'_> {
/// Default debug formatting for this struct (may be useful if you define your own `Debug` impl)
pub fn default_debug_fmt(this: Self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
pub fn default_debug_fmt(this: Self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result
where
// rustc rejects trivial bounds, but it cannot see through higher-ranked bounds
// with its check :^)
$(for<$db_lt> $field_ty: std::fmt::Debug),*
$(for<$db_lt> $field_ty: ::std::fmt::Debug),*
{
$zalsa::with_attached_database(|db| {
let zalsa = db.zalsa();
Expand All @@ -361,11 +361,11 @@ macro_rules! setup_interned_struct {
} else {
impl $Struct {
/// Default debug formatting for this struct (may be useful if you define your own `Debug` impl)
pub fn default_debug_fmt(this: Self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
pub fn default_debug_fmt(this: Self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result
where
// rustc rejects trivial bounds, but it cannot see through higher-ranked bounds
// with its check :^)
$(for<$db_lt> $field_ty: std::fmt::Debug),*
$(for<$db_lt> $field_ty: ::std::fmt::Debug),*
{
$zalsa::with_attached_database(|db| {
let zalsa = db.zalsa();
Expand Down
Loading
Loading