Skip to content

Compilation fix: Use as_str rather than as_ref - #5877

Open
hovinen wants to merge 1 commit into
DioxusLabs:mainfrom
hovinen:fix/use-as-str-not-as-ref
Open

hovinen wants to merge 1 commit into
DioxusLabs:mainfrom
hovinen:fix/use-as-str-not-as-ref

Conversation

@hovinen

@hovinen hovinen commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Previously, we got the following compilation error with rustc 1.99 and Blitz HEAD:

 1  error[E0283]: type annotations needed
    --> /home/hovinen/dev/dioxus/dioxus/packages/native-dom/src/mutation_writer.rs:435:35
     |
 435 |             if element_name.local.as_ref() == "object" {
     |                                   ^^^^^^
     |
     = note: multiple `impl`s satisfying `string_cache::atom::Atom<web_atoms::LocalNameStaticSet>: AsRef<_>` found in the `string_cache` crate:
             - impl<Static> AsRef<[u8]> for string_cache::atom::Atom<Static>
               where Static: string_cache::static_sets::StaticAtomSet;
             - impl<Static> AsRef<str> for string_cache::atom::Atom<Static>
               where Static: string_cache::static_sets::StaticAtomSet;
 help: try using a fully qualified path to specify the expected types
     |
 435 -             if element_name.local.as_ref() == "object" {
 435 +             if <string_cache::atom::Atom<web_atoms::LocalNameStaticSet> as AsRef<T>>::as_ref(&element_name.local) == "object" {
     |

 For more information about this error, try `rustc --explain E0283`.
 error: could not compile `dioxus-native-dom` (lib) due to 1 previous error

Previously, we got the following compilation error with rustc 1.99 and
Blitz HEAD:

```
 1  error[E0283]: type annotations needed
    --> /home/hovinen/dev/dioxus/dioxus/packages/native-dom/src/mutation_writer.rs:435:35
     |
 435 |             if element_name.local.as_ref() == "object" {
     |                                   ^^^^^^
     |
     = note: multiple `impl`s satisfying `string_cache::atom::Atom<web_atoms::LocalNameStaticSet>: AsRef<_>` found in the `string_cache` crate:
             - impl<Static> AsRef<[u8]> for string_cache::atom::Atom<Static>
               where Static: string_cache::static_sets::StaticAtomSet;
             - impl<Static> AsRef<str> for string_cache::atom::Atom<Static>
               where Static: string_cache::static_sets::StaticAtomSet;
 help: try using a fully qualified path to specify the expected types
     |
 435 -             if element_name.local.as_ref() == "object" {
 435 +             if <string_cache::atom::Atom<web_atoms::LocalNameStaticSet> as AsRef<T>>::as_ref(&element_name.local) == "object" {
     |

 For more information about this error, try `rustc --explain E0283`.
 error: could not compile `dioxus-native-dom` (lib) due to 1 previous error
```

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant