Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
139d1092
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,发现更多精彩内容 >>
提交
139d1092
编写于
11月 17, 2018
作者:
V
Vadim Petrochenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a couple more tests + address review comments
上级
59464709
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
161 addition
and
5 deletion
+161
-5
src/librustc_resolve/resolve_imports.rs
src/librustc_resolve/resolve_imports.rs
+7
-1
src/test/ui/imports/auxiliary/glob-conflict.rs
src/test/ui/imports/auxiliary/glob-conflict.rs
+9
-0
src/test/ui/imports/glob-conflict-cross-crate.rs
src/test/ui/imports/glob-conflict-cross-crate.rs
+7
-0
src/test/ui/imports/glob-conflict-cross-crate.stderr
src/test/ui/imports/glob-conflict-cross-crate.stderr
+9
-0
src/test/ui/imports/issue-55884-1.rs
src/test/ui/imports/issue-55884-1.rs
+21
-0
src/test/ui/imports/issue-55884-1.stderr
src/test/ui/imports/issue-55884-1.stderr
+22
-0
src/test/ui/imports/issue-55884-2.rs
src/test/ui/imports/issue-55884-2.rs
+14
-0
src/test/ui/imports/issue-55884-2.stderr
src/test/ui/imports/issue-55884-2.stderr
+9
-0
src/test/ui/rust-2018/local-path-suggestions-2018.rs
src/test/ui/rust-2018/local-path-suggestions-2018.rs
+2
-2
src/test/ui/rust-2018/local-path-suggestions-2018.stderr
src/test/ui/rust-2018/local-path-suggestions-2018.stderr
+2
-2
src/test/ui/rust-2018/uniform-paths/deadlock.rs
src/test/ui/rust-2018/uniform-paths/deadlock.rs
+7
-0
src/test/ui/rust-2018/uniform-paths/deadlock.stderr
src/test/ui/rust-2018/uniform-paths/deadlock.stderr
+9
-0
src/test/ui/rust-2018/uniform-paths/issue-54390.rs
src/test/ui/rust-2018/uniform-paths/issue-54390.rs
+11
-0
src/test/ui/rust-2018/uniform-paths/issue-54390.stderr
src/test/ui/rust-2018/uniform-paths/issue-54390.stderr
+32
-0
未找到文件。
src/librustc_resolve/resolve_imports.rs
浏览文件 @
139d1092
...
...
@@ -192,6 +192,7 @@ fn resolution(&self, module: Module<'a>, ident: Ident, ns: Namespace)
ident
.name
==
keywords
::
SelfValue
.name
()
{
// FIXME: Implement these with renaming requirements so that e.g.
// `use super;` doesn't work, but `use super as name;` does.
// Fall through here to get an error from `early_resolve_...`.
}
}
...
...
@@ -940,7 +941,12 @@ fn finalize_import(
}
}
Err
(
..
)
=>
{
assert
!
(
result
[
ns
]
.get
()
.is_err
());
// FIXME: This assert may fire if public glob is later shadowed by a private
// single import (see test `issue-55884-2.rs`). In theory single imports should
// always block globs, even if they are not yet resolved, so that this kind of
// self-inconsistent resolution never happens.
// Reenable the assert when the issue is fixed.
// assert!(result[ns].get().is_err());
}
}
});
...
...
src/test/ui/imports/auxiliary/glob-conflict.rs
0 → 100644
浏览文件 @
139d1092
mod
m1
{
pub
fn
f
()
{}
}
mod
m2
{
pub
fn
f
(
_
:
u8
)
{}
}
pub
use
m1
::
*
;
pub
use
m2
::
*
;
src/test/ui/imports/glob-conflict-cross-crate.rs
0 → 100644
浏览文件 @
139d1092
// aux-build:glob-conflict.rs
extern
crate
glob_conflict
;
fn
main
()
{
glob_conflict
::
f
();
//~ ERROR cannot find function `f` in module `glob_conflict`
}
src/test/ui/imports/glob-conflict-cross-crate.stderr
0 → 100644
浏览文件 @
139d1092
error[E0425]: cannot find function `f` in module `glob_conflict`
--> $DIR/glob-conflict-cross-crate.rs:6:20
|
LL | glob_conflict::f(); //~ ERROR cannot find function `f` in module `glob_conflict`
| ^ not found in `glob_conflict`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.
src/test/ui/imports/issue-55884-1.rs
0 → 100644
浏览文件 @
139d1092
mod
m
{
mod
m1
{
pub
struct
S
{}
}
mod
m2
{
// Note this derive, it makes this struct macro-expanded,
// so it doesn't appear in time to participate in the initial resolution of `use m::S`,
// only in the later validation pass.
#[derive(Default)]
pub
struct
S
{}
}
// Create a glob vs glob ambiguity
pub
use
self
::
m1
::
*
;
pub
use
self
::
m2
::
*
;
}
fn
main
()
{
use
m
::
S
;
//~ ERROR `S` is ambiguous
let
s
=
S
{};
}
src/test/ui/imports/issue-55884-1.stderr
0 → 100644
浏览文件 @
139d1092
error[E0659]: `S` is ambiguous (glob import vs glob import in the same module)
--> $DIR/issue-55884-1.rs:19:12
|
LL | use m::S; //~ ERROR `S` is ambiguous
| ^ ambiguous name
|
note: `S` could refer to the struct imported here
--> $DIR/issue-55884-1.rs:14:13
|
LL | pub use self::m1::*;
| ^^^^^^^^^^^
= help: consider adding an explicit import of `S` to disambiguate
note: `S` could also refer to the struct imported here
--> $DIR/issue-55884-1.rs:15:13
|
LL | pub use self::m2::*;
| ^^^^^^^^^^^
= help: consider adding an explicit import of `S` to disambiguate
error: aborting due to previous error
For more information about this error, try `rustc --explain E0659`.
src/test/ui/imports/issue-55884-2.rs
0 → 100644
浏览文件 @
139d1092
mod
options
{
pub
struct
ParseOptions
{}
}
mod
parser
{
pub
use
options
::
*
;
// Private single import shadows public glob import, but arrives too late for initial
// resolution of `use parser::ParseOptions` because it depends on that resolution itself.
use
ParseOptions
;
}
pub
use
parser
::
ParseOptions
;
//~ ERROR struct `ParseOptions` is private
fn
main
()
{}
src/test/ui/imports/issue-55884-2.stderr
0 → 100644
浏览文件 @
139d1092
error[E0603]: struct `ParseOptions` is private
--> $DIR/issue-55884-2.rs:12:17
|
LL | pub use parser::ParseOptions; //~ ERROR struct `ParseOptions` is private
| ^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0603`.
src/test/ui/rust-2018/local-path-suggestions-2018.rs
浏览文件 @
139d1092
...
...
@@ -19,7 +19,7 @@ mod foo {
}
mod
bazz
{
use
foo
::
Bar
;
use
foo
::
Bar
;
//~ ERROR unresolved import `foo`
fn
baz
()
{
let
x
:
Bar
=
22
;
...
...
@@ -28,6 +28,6 @@ fn baz() {
use
foo
::
Bar
;
use
foobar
::
Baz
;
use
foobar
::
Baz
;
//~ ERROR unresolved import `foobar`
fn
main
()
{
}
src/test/ui/rust-2018/local-path-suggestions-2018.stderr
浏览文件 @
139d1092
error[E0432]: unresolved import `foo`
--> $DIR/local-path-suggestions-2018.rs:22:9
|
LL | use foo::Bar;
LL | use foo::Bar;
//~ ERROR unresolved import `foo`
| ^^^ did you mean `crate::foo`?
|
= note: `use` statements changed in Rust 2018; read more at <https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html>
...
...
@@ -9,7 +9,7 @@ LL | use foo::Bar;
error[E0432]: unresolved import `foobar`
--> $DIR/local-path-suggestions-2018.rs:31:5
|
LL | use foobar::Baz;
LL | use foobar::Baz;
//~ ERROR unresolved import `foobar`
| ^^^^^^ did you mean `baz::foobar`?
error: aborting due to 2 previous errors
...
...
src/test/ui/rust-2018/uniform-paths/deadlock.rs
0 → 100644
浏览文件 @
139d1092
// edition:2018
// compile-flags:--extern foo --extern bar
use
foo
::
bar
;
//~ ERROR unresolved import
use
bar
::
foo
;
fn
main
()
{}
src/test/ui/rust-2018/uniform-paths/deadlock.stderr
0 → 100644
浏览文件 @
139d1092
error[E0432]: unresolved import
--> $DIR/deadlock.rs:4:5
|
LL | use foo::bar; //~ ERROR unresolved import
| ^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0432`.
src/test/ui/rust-2018/uniform-paths/issue-54390.rs
0 → 100644
浏览文件 @
139d1092
// edition:2018
#![deny(unused)]
use
std
::
fmt
;
// No "unresolved import" + "unused import" combination here.
use
fmt
::
Write
;
//~ ERROR imports can only refer to extern crate names
//~| ERROR unused import: `fmt::Write`
fn
main
()
{}
src/test/ui/rust-2018/uniform-paths/issue-54390.stderr
0 → 100644
浏览文件 @
139d1092
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
--> $DIR/issue-54390.rs:8:5
|
LL | use std::fmt;
| -------- not an extern crate passed with `--extern`
...
LL | use fmt::Write; //~ ERROR imports can only refer to extern crate names
| ^^^
|
= help: add #![feature(uniform_paths)] to the crate attributes to enable
note: this import refers to the module imported here
--> $DIR/issue-54390.rs:5:5
|
LL | use std::fmt;
| ^^^^^^^^
error: unused import: `fmt::Write`
--> $DIR/issue-54390.rs:8:5
|
LL | use fmt::Write; //~ ERROR imports can only refer to extern crate names
| ^^^^^^^^^^
|
note: lint level defined here
--> $DIR/issue-54390.rs:3:9
|
LL | #![deny(unused)]
| ^^^^^^
= note: #[deny(unused_imports)] implied by #[deny(unused)]
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录