Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
28831861
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,发现更多精彩内容 >>
提交
28831861
编写于
1月 18, 2017
作者:
E
Esteban Küber
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use multiline Diagnostic for candidate in other module
上级
c8af93f0
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
38 addition
and
37 deletion
+38
-37
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+17
-16
src/test/ui/resolve/enums-are-namespaced-xc.stderr
src/test/ui/resolve/enums-are-namespaced-xc.stderr
+3
-3
src/test/ui/resolve/issue-16058.stderr
src/test/ui/resolve/issue-16058.stderr
+3
-3
src/test/ui/resolve/issue-17518.stderr
src/test/ui/resolve/issue-17518.stderr
+1
-1
src/test/ui/resolve/issue-21221-1.stderr
src/test/ui/resolve/issue-21221-1.stderr
+9
-9
src/test/ui/resolve/issue-21221-2.stderr
src/test/ui/resolve/issue-21221-2.stderr
+1
-1
src/test/ui/resolve/issue-21221-3.stderr
src/test/ui/resolve/issue-21221-3.stderr
+1
-1
src/test/ui/resolve/issue-21221-4.stderr
src/test/ui/resolve/issue-21221-4.stderr
+1
-1
src/test/ui/resolve/issue-3907.stderr
src/test/ui/resolve/issue-3907.stderr
+1
-1
src/test/ui/span/issue-35987.stderr
src/test/ui/span/issue-35987.stderr
+1
-1
未找到文件。
src/librustc_resolve/lib.rs
浏览文件 @
28831861
...
...
@@ -67,6 +67,7 @@
use
errors
::
DiagnosticBuilder
;
use
std
::
cell
::{
Cell
,
RefCell
};
use
std
::
cmp
;
use
std
::
fmt
;
use
std
::
mem
::
replace
;
use
std
::
rc
::
Rc
;
...
...
@@ -3224,7 +3225,7 @@ fn show_candidates(session: &mut DiagnosticBuilder,
better
:
bool
)
{
// don't show more than MAX_CANDIDATES results, so
// we're consistent with the trait suggestions
const
MAX_CANDIDATES
:
usize
=
5
;
const
MAX_CANDIDATES
:
usize
=
4
;
// we want consistent results across executions, but candidates are produced
// by iterating through a hash map, so make sure they are ordered:
...
...
@@ -3237,21 +3238,21 @@ fn show_candidates(session: &mut DiagnosticBuilder,
1
=>
" is found in another module, you can import it"
,
_
=>
"s are found in other modules, you can import them"
,
};
session
.help
(
&
format!
(
"possible {}candidate{} into scope:"
,
better
,
msg_diff
));
let
count
=
path_strings
.len
()
as
isize
-
MAX_CANDIDATES
as
isize
+
1
;
for
(
idx
,
path_string
)
in
path_strings
.iter
()
.enumerate
()
{
if
idx
==
MAX_CANDIDATES
-
1
&&
count
>
1
{
session
.help
(
&
format!
(
" and {} other candidates"
,
count
)
.to_string
(),
);
break
;
}
else
{
session
.help
(
&
format!
(
" `use {};`"
,
path_string
)
.to_string
(),
);
}
}
let
end
=
cmp
::
min
(
MAX_CANDIDATES
,
path_strings
.len
());
session
.help
(
&
format!
(
"possible {}candidate{} into scope:{}{}"
,
better
,
msg_diff
,
&
path_strings
[
0
..
end
]
.iter
()
.map
(|
candidate
|
{
format!
(
"
\n
`use {};`"
,
candidate
)
})
.collect
::
<
String
>
(),
if
path_strings
.len
()
>
MAX_CANDIDATES
{
format!
(
"
\n
and {} other candidates"
,
path_strings
.len
()
-
MAX_CANDIDATES
)
}
else
{
""
.to_owned
()
}
));
}
/// A somewhat inefficient routine to obtain the name of a module.
...
...
src/test/ui/resolve/enums-are-namespaced-xc.stderr
浏览文件 @
28831861
...
...
@@ -5,7 +5,7 @@ error[E0425]: cannot find value `A` in module `namespaced_enums`
| ^^^^^^^^^^^^^^^^^^^ not found in `namespaced_enums`
|
= help: possible candidate is found in another module, you can import it into scope:
= help:
`use namespaced_enums::Foo::A;`
`use namespaced_enums::Foo::A;`
error[E0425]: cannot find function `B` in module `namespaced_enums`
--> $DIR/enums-are-namespaced-xc.rs:18:13
...
...
@@ -14,7 +14,7 @@ error[E0425]: cannot find function `B` in module `namespaced_enums`
| ^^^^^^^^^^^^^^^^^^^ not found in `namespaced_enums`
|
= help: possible candidate is found in another module, you can import it into scope:
= help:
`use namespaced_enums::Foo::B;`
`use namespaced_enums::Foo::B;`
error[E0422]: cannot find struct, variant or union type `C` in module `namespaced_enums`
--> $DIR/enums-are-namespaced-xc.rs:21:13
...
...
@@ -23,7 +23,7 @@ error[E0422]: cannot find struct, variant or union type `C` in module `namespace
| ^^^^^^^^^^^^^^^^^^^ not found in `namespaced_enums`
|
= help: possible candidate is found in another module, you can import it into scope:
= help:
`use namespaced_enums::Foo::C;`
`use namespaced_enums::Foo::C;`
error: aborting due to 3 previous errors
src/test/ui/resolve/issue-16058.stderr
浏览文件 @
28831861
...
...
@@ -5,9 +5,9 @@ error[E0574]: expected struct, variant or union type, found enum `Result`
| ^^^^^^ not a struct, variant or union type
|
= help: possible better candidates are found in other modules, you can import them into scope:
= help:
`use std::fmt::Result;`
= help:
`use std::io::Result;`
= help:
`use std::thread::Result;`
`use std::fmt::Result;`
`use std::io::Result;`
`use std::thread::Result;`
error: aborting due to previous error
src/test/ui/resolve/issue-17518.stderr
浏览文件 @
28831861
...
...
@@ -5,7 +5,7 @@ error[E0422]: cannot find struct, variant or union type `E` in this scope
| ^ not found in this scope
|
= help: possible candidate is found in another module, you can import it into scope:
= help:
`use SomeEnum::E;`
`use SomeEnum::E;`
error: aborting due to previous error
src/test/ui/resolve/issue-21221-1.stderr
浏览文件 @
28831861
...
...
@@ -5,9 +5,9 @@ error[E0405]: cannot find trait `Mul` in this scope
| ^^^ not found in this scope
|
= help: possible candidates are found in other modules, you can import them into scope:
= help:
`use mul1::Mul;`
= help:
`use mul2::Mul;`
= help:
`use std::ops::Mul;`
`use mul1::Mul;`
`use mul2::Mul;`
`use std::ops::Mul;`
error[E0412]: cannot find type `Mul` in this scope
--> $DIR/issue-21221-1.rs:72:16
...
...
@@ -16,11 +16,11 @@ error[E0412]: cannot find type `Mul` in this scope
| ^^^ not found in this scope
|
= help: possible candidates are found in other modules, you can import them into scope:
= help:
`use mul1::Mul;`
= help:
`use mul2::Mul;`
= help:
`use mul3::Mul;`
= help:
`use mul4::Mul;`
= help:
and 2 other candidates
`use mul1::Mul;`
`use mul2::Mul;`
`use mul3::Mul;`
`use mul4::Mul;`
and 2 other candidates
error[E0405]: cannot find trait `ThisTraitReallyDoesntExistInAnyModuleReally` in this scope
--> $DIR/issue-21221-1.rs:83:6
...
...
@@ -35,7 +35,7 @@ error[E0405]: cannot find trait `Div` in this scope
| ^^^ not found in this scope
|
= help: possible candidate is found in another module, you can import it into scope:
= help:
`use std::ops::Div;`
`use std::ops::Div;`
error: cannot continue compilation due to previous error
src/test/ui/resolve/issue-21221-2.stderr
浏览文件 @
28831861
...
...
@@ -5,7 +5,7 @@ error[E0405]: cannot find trait `T` in this scope
| ^ not found in this scope
|
= help: possible candidate is found in another module, you can import it into scope:
= help:
`use foo::bar::T;`
`use foo::bar::T;`
error: main function not found
...
...
src/test/ui/resolve/issue-21221-3.stderr
浏览文件 @
28831861
...
...
@@ -5,7 +5,7 @@ error[E0405]: cannot find trait `OuterTrait` in this scope
| ^^^^^^^^^^ not found in this scope
|
= help: possible candidate is found in another module, you can import it into scope:
= help:
`use issue_21221_3::outer::OuterTrait;`
`use issue_21221_3::outer::OuterTrait;`
error: cannot continue compilation due to previous error
src/test/ui/resolve/issue-21221-4.stderr
浏览文件 @
28831861
...
...
@@ -5,7 +5,7 @@ error[E0405]: cannot find trait `T` in this scope
| ^ not found in this scope
|
= help: possible candidate is found in another module, you can import it into scope:
= help:
`use issue_21221_4::T;`
`use issue_21221_4::T;`
error: cannot continue compilation due to previous error
src/test/ui/resolve/issue-3907.stderr
浏览文件 @
28831861
...
...
@@ -5,7 +5,7 @@ error[E0404]: expected trait, found type alias `Foo`
| ^^^ type aliases cannot be used for traits
|
= help: possible better candidate is found in another module, you can import it into scope:
= help:
`use issue_3907::Foo;`
`use issue_3907::Foo;`
error: cannot continue compilation due to previous error
src/test/ui/span/issue-35987.stderr
浏览文件 @
28831861
...
...
@@ -5,7 +5,7 @@ error[E0404]: expected trait, found type parameter `Add`
| ^^^ not a trait
|
= help: possible better candidate is found in another module, you can import it into scope:
= help:
`use std::ops::Add;`
`use std::ops::Add;`
error: main function not found
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录