浏览代码

accept impl display instead of From<String> (#2501)

Evan Almloff 1 年之前
父节点
当前提交
c0246c26e0
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      packages/core-macro/src/props/mod.rs

+ 2 - 0
packages/core-macro/src/props/mod.rs

@@ -213,6 +213,8 @@ mod field_info {
                     || field.ty == parse_quote!(String)
                 {
                     builder_attr.from_displayable = true;
+                    // ToString is both more general and provides a more useful error message than From<String>. If the user tries to use `#[into]`, use ToString instead.
+                    builder_attr.auto_into = false;
                 }
 
                 // extended field is automatically empty