Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
0541b4e0
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0541b4e0
编写于
7月 04, 2022
作者:
T
Takayuki Maeda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use `named_span` in case of tuple variant
上级
3d1b679a
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
26 addition
and
31 deletion
+26
-31
compiler/rustc_middle/src/hir/map/mod.rs
compiler/rustc_middle/src/hir/map/mod.rs
+1
-6
compiler/rustc_trait_selection/src/traits/specialize/mod.rs
compiler/rustc_trait_selection/src/traits/specialize/mod.rs
+1
-1
src/test/ui/empty/empty-struct-braces-pat-3.stderr
src/test/ui/empty/empty-struct-braces-pat-3.stderr
+2
-2
src/test/ui/empty/empty-struct-tuple-pat.stderr
src/test/ui/empty/empty-struct-tuple-pat.stderr
+1
-1
src/test/ui/empty/empty-struct-unit-pat.stderr
src/test/ui/empty/empty-struct-unit-pat.stderr
+2
-2
src/test/ui/mismatched_types/issue-47706.stderr
src/test/ui/mismatched_types/issue-47706.stderr
+1
-1
src/test/ui/namespace/namespace-mix.stderr
src/test/ui/namespace/namespace-mix.stderr
+1
-1
src/test/ui/pattern/pat-tuple-field-count-cross.stderr
src/test/ui/pattern/pat-tuple-field-count-cross.stderr
+4
-4
src/test/ui/pattern/pat-tuple-overfield.stderr
src/test/ui/pattern/pat-tuple-overfield.stderr
+2
-2
src/test/ui/proc-macro/parent-source-spans.stderr
src/test/ui/proc-macro/parent-source-spans.stderr
+3
-3
src/test/ui/repr/repr-transparent.stderr
src/test/ui/repr/repr-transparent.stderr
+1
-1
src/test/ui/resolve/privacy-enum-ctor.stderr
src/test/ui/resolve/privacy-enum-ctor.stderr
+3
-3
src/test/ui/rfc-2008-non-exhaustive/variant.stderr
src/test/ui/rfc-2008-non-exhaustive/variant.stderr
+3
-3
src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr
...est/ui/suggestions/fn-or-tuple-struct-without-args.stderr
+1
-1
未找到文件。
compiler/rustc_middle/src/hir/map/mod.rs
浏览文件 @
0541b4e0
...
...
@@ -1012,12 +1012,7 @@ fn named_span(item_span: Span, ident: Ident, generics: Option<&Generics<'_>>) ->
ItemKind
::
Use
(
path
,
_
)
=>
path
.span
,
_
=>
named_span
(
item
.span
,
item
.ident
,
item
.kind
.generics
()),
},
Node
::
Variant
(
variant
)
=>
match
variant
.data
{
VariantData
::
Struct
(
..
)
|
VariantData
::
Unit
(
..
)
=>
{
named_span
(
variant
.span
,
variant
.ident
,
None
)
}
VariantData
::
Tuple
(
..
)
=>
variant
.span
,
},
Node
::
Variant
(
variant
)
=>
named_span
(
variant
.span
,
variant
.ident
,
None
),
Node
::
ImplItem
(
item
)
=>
named_span
(
item
.span
,
item
.ident
,
Some
(
item
.generics
)),
Node
::
ForeignItem
(
item
)
=>
match
item
.kind
{
ForeignItemKind
::
Fn
(
decl
,
_
,
_
)
=>
until_within
(
item
.span
,
decl
.output
.span
()),
...
...
compiler/rustc_trait_selection/src/traits/specialize/mod.rs
浏览文件 @
0541b4e0
...
...
@@ -341,7 +341,7 @@ fn report_negative_positive_conflict(
positive_impl_def_id
:
DefId
,
sg
:
&
mut
specialization_graph
::
Graph
,
)
{
let
impl_span
=
tcx
.
span_of_impl
(
local_impl_def_id
.to_def_id
())
.unwrap
(
);
let
impl_span
=
tcx
.
def_span
(
local_impl_def_id
);
let
mut
err
=
struct_span_err!
(
tcx
.sess
,
...
...
src/test/ui/empty/empty-struct-braces-pat-3.stderr
浏览文件 @
0541b4e0
...
...
@@ -19,7 +19,7 @@ LL | XEmpty3 {},
| ------- `XE::XEmpty3` defined here
LL | XEmpty4,
LL | XEmpty5(),
| -------
--
similarly named tuple variant `XEmpty5` defined here
| ------- similarly named tuple variant `XEmpty5` defined here
|
help: use struct pattern syntax instead
|
...
...
@@ -51,7 +51,7 @@ LL | XEmpty3 {},
| ------- `XE::XEmpty3` defined here
LL | XEmpty4,
LL | XEmpty5(),
| -------
--
similarly named tuple variant `XEmpty5` defined here
| ------- similarly named tuple variant `XEmpty5` defined here
|
help: use struct pattern syntax instead
|
...
...
src/test/ui/empty/empty-struct-tuple-pat.stderr
浏览文件 @
0541b4e0
...
...
@@ -36,7 +36,7 @@ LL | XE::XEmpty5 => (),
LL | XEmpty4,
| ------- similarly named unit variant `XEmpty4` defined here
LL | XEmpty5(),
| -------
--
`XE::XEmpty5` defined here
| ------- `XE::XEmpty5` defined here
|
help: use the tuple variant pattern syntax instead
|
...
...
src/test/ui/empty/empty-struct-unit-pat.stderr
浏览文件 @
0541b4e0
...
...
@@ -108,7 +108,7 @@ LL | XE::XEmpty4() => (),
LL | XEmpty4,
| ------- `XE::XEmpty4` defined here
LL | XEmpty5(),
| -------
--
similarly named tuple variant `XEmpty5` defined here
| ------- similarly named tuple variant `XEmpty5` defined here
|
help: use this syntax instead
|
...
...
@@ -139,7 +139,7 @@ LL | XE::XEmpty4(..) => (),
LL | XEmpty4,
| ------- `XE::XEmpty4` defined here
LL | XEmpty5(),
| -------
--
similarly named tuple variant `XEmpty5` defined here
| ------- similarly named tuple variant `XEmpty5` defined here
|
help: use this syntax instead
|
...
...
src/test/ui/mismatched_types/issue-47706.stderr
浏览文件 @
0541b4e0
...
...
@@ -19,7 +19,7 @@ error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
--> $DIR/issue-47706.rs:27:9
|
LL | Bar(i32),
| ---
-----
takes 1 argument
| --- takes 1 argument
...
LL | foo(Qux::Bar);
| --- ^^^^^^^^ expected function that takes 0 arguments
...
...
src/test/ui/namespace/namespace-mix.stderr
浏览文件 @
0541b4e0
...
...
@@ -94,7 +94,7 @@ LL | check(xm7::V);
LL | V {},
| - `xm7::V` defined here
LL | TV(),
| --
--
similarly named tuple variant `TV` defined here
| -- similarly named tuple variant `TV` defined here
|
help: use struct literal syntax instead
|
...
...
src/test/ui/pattern/pat-tuple-field-count-cross.stderr
浏览文件 @
0541b4e0
...
...
@@ -60,7 +60,7 @@ LL | E1::Z0() => {}
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:15
|
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
| -- --
--
similarly named tuple variant `Z1` defined here
| -- -- similarly named tuple variant `Z1` defined here
| |
| `E1::Z0` defined here
|
...
...
@@ -82,7 +82,7 @@ LL | E1::Z0(x) => {}
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:15
|
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
| -- --
--
similarly named tuple variant `Z1` defined here
| -- -- similarly named tuple variant `Z1` defined here
| |
| `E1::Z0` defined here
|
...
...
@@ -104,7 +104,7 @@ LL | E1::Z1 => {}
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:19
|
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
| -- --
--
`E1::Z1` defined here
| -- -- `E1::Z1` defined here
| |
| similarly named unit variant `Z0` defined here
|
...
...
@@ -295,7 +295,7 @@ LL | E1::Z1(x) => {}
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:19
|
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
| --
--
tuple variant has 0 fields
| -- tuple variant has 0 fields
error[E0023]: this pattern has 0 fields, but the corresponding tuple variant has 3 fields
--> $DIR/pat-tuple-field-count-cross.rs:39:9
...
...
src/test/ui/pattern/pat-tuple-overfield.stderr
浏览文件 @
0541b4e0
...
...
@@ -289,7 +289,7 @@ error[E0023]: this pattern has 1 field, but the corresponding tuple variant has
--> $DIR/pat-tuple-overfield.rs:71:16
|
LL | Z1(),
| --
--
tuple variant has 0 fields
| -- tuple variant has 0 fields
...
LL | E1::Z1(_) => {}
| ^ expected 0 fields, found 1
...
...
@@ -298,7 +298,7 @@ error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has
--> $DIR/pat-tuple-overfield.rs:72:16
|
LL | Z1(),
| --
--
tuple variant has 0 fields
| -- tuple variant has 0 fields
...
LL | E1::Z1(_, _) => {}
| ^ ^ expected 0 fields, found 2
...
...
src/test/ui/proc-macro/parent-source-spans.stderr
浏览文件 @
0541b4e0
...
...
@@ -148,7 +148,7 @@ LL | one!("hello", "world");
::: $SRC_DIR/core/src/result.rs:LL:COL
|
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
| --
-------------------------------------------------
similarly named tuple variant `Ok` defined here
| -- similarly named tuple variant `Ok` defined here
|
= note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
...
...
@@ -164,7 +164,7 @@ LL | two!("yay", "rust");
::: $SRC_DIR/core/src/result.rs:LL:COL
|
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
| --
-------------------------------------------------
similarly named tuple variant `Ok` defined here
| -- similarly named tuple variant `Ok` defined here
|
= note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
...
...
@@ -180,7 +180,7 @@ LL | three!("hip", "hop");
::: $SRC_DIR/core/src/result.rs:LL:COL
|
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
| --
-------------------------------------------------
similarly named tuple variant `Ok` defined here
| -- similarly named tuple variant `Ok` defined here
|
= note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
...
...
src/test/ui/repr/repr-transparent.stderr
浏览文件 @
0541b4e0
...
...
@@ -58,7 +58,7 @@ error[E0731]: transparent enum needs exactly one variant, but has 2
LL | enum MultipleVariants {
| ^^^^^^^^^^^^^^^^^^^^^ needs exactly one variant, but has 2
LL | Foo(String),
| ---
--------
| ---
LL | Bar,
| --- too many variants in `MultipleVariants`
...
...
src/test/ui/resolve/privacy-enum-ctor.stderr
浏览文件 @
0541b4e0
...
...
@@ -318,7 +318,7 @@ error[E0308]: mismatched types
--> $DIR/privacy-enum-ctor.rs:27:20
|
LL | Fn(u8),
| --
----
fn(u8) -> Z {Z::Fn} defined here
| -- fn(u8) -> Z {Z::Fn} defined here
...
LL | let _: Z = Z::Fn;
| - ^^^^^ expected enum `Z`, found fn item
...
...
@@ -353,7 +353,7 @@ error[E0308]: mismatched types
--> $DIR/privacy-enum-ctor.rs:43:16
|
LL | Fn(u8),
| --
----
fn(u8) -> E {E::Fn} defined here
| -- fn(u8) -> E {E::Fn} defined here
...
LL | let _: E = m::E::Fn;
| - ^^^^^^^^ expected enum `E`, found fn item
...
...
@@ -388,7 +388,7 @@ error[E0308]: mismatched types
--> $DIR/privacy-enum-ctor.rs:51:16
|
LL | Fn(u8),
| --
----
fn(u8) -> E {E::Fn} defined here
| -- fn(u8) -> E {E::Fn} defined here
...
LL | let _: E = E::Fn;
| - ^^^^^ expected enum `E`, found fn item
...
...
src/test/ui/rfc-2008-non-exhaustive/variant.stderr
浏览文件 @
0541b4e0
...
...
@@ -8,7 +8,7 @@ note: the tuple variant `Tuple` is defined here
--> $DIR/auxiliary/variants.rs:5:23
|
LL | #[non_exhaustive] Tuple(u32),
| ^^^^^
^^^^^
| ^^^^^
error[E0603]: unit variant `Unit` is private
--> $DIR/variant.rs:14:47
...
...
@@ -44,7 +44,7 @@ note: the tuple variant `Tuple` is defined here
--> $DIR/auxiliary/variants.rs:5:23
|
LL | #[non_exhaustive] Tuple(u32),
| ^^^^^
^^^^^
| ^^^^^
error[E0603]: tuple variant `Tuple` is private
--> $DIR/variant.rs:26:35
...
...
@@ -56,7 +56,7 @@ note: the tuple variant `Tuple` is defined here
--> $DIR/auxiliary/variants.rs:5:23
|
LL | #[non_exhaustive] Tuple(u32),
| ^^^^^
^^^^^
| ^^^^^
error[E0639]: cannot create non-exhaustive variant using struct expression
--> $DIR/variant.rs:8:26
...
...
src/test/ui/suggestions/fn-or-tuple-struct-without-args.stderr
浏览文件 @
0541b4e0
...
...
@@ -130,7 +130,7 @@ error[E0308]: mismatched types
--> $DIR/fn-or-tuple-struct-without-args.rs:35:16
|
LL | A(usize),
| -
-------
fn(usize) -> E {E::A} defined here
| - fn(usize) -> E {E::A} defined here
...
LL | let _: E = E::A;
| - ^^^^ expected enum `E`, found fn item
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录