Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
8e88c347
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,发现更多精彩内容 >>
提交
8e88c347
编写于
11月 12, 2018
作者:
V
Vadim Petrochenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
resolve: Reintroduce feature gate for uniform paths in imports
上级
a38f9031
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
168 addition
and
80 deletion
+168
-80
src/doc/unstable-book/src/language-features/extern-in-paths.md
...oc/unstable-book/src/language-features/extern-in-paths.md
+2
-2
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+29
-25
src/librustc_resolve/macros.rs
src/librustc_resolve/macros.rs
+27
-1
src/test/ui/feature-gates/feature-gate-uniform-paths.rs
src/test/ui/feature-gates/feature-gate-uniform-paths.rs
+9
-2
src/test/ui/feature-gates/feature-gate-uniform-paths.stderr
src/test/ui/feature-gates/feature-gate-uniform-paths.stderr
+59
-6
src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs
...test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs
+2
-0
src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr
.../ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr
+2
-2
src/test/ui/rust-2018/local-path-suggestions-2018.rs
src/test/ui/rust-2018/local-path-suggestions-2018.rs
+2
-0
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-forward-compat/issue-54253.rs
.../ui/rust-2018/uniform-paths-forward-compat/issue-54253.rs
+1
-1
src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs
...est/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs
+0
-2
src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
...ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
+2
-2
src/test/ui/rust-2018/uniform-paths/ambiguity-macros.rs
src/test/ui/rust-2018/uniform-paths/ambiguity-macros.rs
+0
-2
src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
+2
-2
src/test/ui/rust-2018/uniform-paths/ambiguity-nested.rs
src/test/ui/rust-2018/uniform-paths/ambiguity-nested.rs
+0
-2
src/test/ui/rust-2018/uniform-paths/ambiguity-nested.stderr
src/test/ui/rust-2018/uniform-paths/ambiguity-nested.stderr
+2
-2
src/test/ui/rust-2018/uniform-paths/ambiguity.rs
src/test/ui/rust-2018/uniform-paths/ambiguity.rs
+0
-2
src/test/ui/rust-2018/uniform-paths/ambiguity.stderr
src/test/ui/rust-2018/uniform-paths/ambiguity.stderr
+2
-2
src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs
.../ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs
+2
-0
src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr
...rust-2018/uniform-paths/block-scoped-shadow-nested.stderr
+3
-3
src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.rs
src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.rs
+0
-2
src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr
...est/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr
+9
-9
src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs
src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs
+2
-0
src/test/ui/rust-2018/uniform-paths/issue-54253.rs
src/test/ui/rust-2018/uniform-paths/issue-54253.rs
+1
-3
src/test/ui/rust-2018/uniform-paths/issue-54253.stderr
src/test/ui/rust-2018/uniform-paths/issue-54253.stderr
+1
-1
src/test/ui/rust-2018/uniform-paths/macro-rules.rs
src/test/ui/rust-2018/uniform-paths/macro-rules.rs
+1
-1
src/test/ui/rust-2018/uniform-paths/prelude-fail.rs
src/test/ui/rust-2018/uniform-paths/prelude-fail.rs
+2
-0
src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr
src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr
+2
-2
src/test/ui/rust-2018/uniform-paths/prelude.rs
src/test/ui/rust-2018/uniform-paths/prelude.rs
+2
-0
src/test/ui/rust-2018/uniform-paths/redundant.rs
src/test/ui/rust-2018/uniform-paths/redundant.rs
+0
-2
未找到文件。
src/doc/unstable-book/src/language-features/extern-in-paths.md
浏览文件 @
8e88c347
...
...
@@ -11,8 +11,8 @@ introducing `extern crate` items, using keyword `extern`.
For example,
`extern::my_crat::a::b`
will resolve to path
`a::b`
in crate
`my_crate`
.
`feature(extern_absolute_paths)`
mode provides the same effect by resolving absolute paths like
`::my_crate::a::b`
to paths from extern crates by default
.
Absolute paths on 2018 edition (e.g.
`::my_crate::a::b`
) provide the same effect
and resolve to extern crates (built-in or passed with
`--extern`
)
.
```
rust,ignore
#![feature(extern_in_paths)]
...
...
src/librustc_resolve/lib.rs
浏览文件 @
8e88c347
...
...
@@ -4736,6 +4736,34 @@ fn disambiguate_legacy_vs_modern(
}
}
fn
binding_description
(
&
self
,
b
:
&
NameBinding
,
ident
:
Ident
,
from_prelude
:
bool
)
->
String
{
if
b
.span
.is_dummy
()
{
let
add_built_in
=
match
b
.def
()
{
// These already contain the "built-in" prefix or look bad with it.
Def
::
NonMacroAttr
(
..
)
|
Def
::
PrimTy
(
..
)
|
Def
::
ToolMod
=>
false
,
_
=>
true
,
};
let
(
built_in
,
from
)
=
if
from_prelude
{
(
""
,
" from prelude"
)
}
else
if
b
.is_extern_crate
()
&&
!
b
.is_import
()
&&
self
.session.opts.externs
.get
(
&
ident
.as_str
())
.is_some
()
{
(
""
,
" passed with `--extern`"
)
}
else
if
add_built_in
{
(
" built-in"
,
""
)
}
else
{
(
""
,
""
)
};
let
article
=
if
built_in
.is_empty
()
{
b
.article
()
}
else
{
"a"
};
format!
(
"{a}{built_in} {thing}{from}"
,
a
=
article
,
thing
=
b
.descr
(),
built_in
=
built_in
,
from
=
from
)
}
else
{
let
introduced
=
if
b
.is_import
()
{
"imported"
}
else
{
"defined"
};
format!
(
"the {thing} {introduced} here"
,
thing
=
b
.descr
(),
introduced
=
introduced
)
}
}
fn
report_ambiguity_error
(
&
self
,
ambiguity_error
:
&
AmbiguityError
)
{
let
AmbiguityError
{
kind
,
ident
,
b1
,
b2
,
misc1
,
misc2
}
=
*
ambiguity_error
;
let
(
b1
,
b2
,
misc1
,
misc2
,
swapped
)
=
if
b2
.span
.is_dummy
()
&&
!
b1
.span
.is_dummy
()
{
...
...
@@ -4751,31 +4779,7 @@ fn report_ambiguity_error(&self, ambiguity_error: &AmbiguityError) {
err
.span_label
(
ident
.span
,
"ambiguous name"
);
let
mut
could_refer_to
=
|
b
:
&
NameBinding
,
misc
:
AmbiguityErrorMisc
,
also
:
&
str
|
{
let
what
=
if
b
.span
.is_dummy
()
{
let
add_built_in
=
match
b
.def
()
{
// These already contain the "built-in" prefix or look bad with it.
Def
::
NonMacroAttr
(
..
)
|
Def
::
PrimTy
(
..
)
|
Def
::
ToolMod
=>
false
,
_
=>
true
,
};
let
(
built_in
,
from
)
=
if
misc
==
AmbiguityErrorMisc
::
FromPrelude
{
(
""
,
" from prelude"
)
}
else
if
b
.is_extern_crate
()
&&
!
b
.is_import
()
&&
self
.session.opts.externs
.get
(
&
ident
.as_str
())
.is_some
()
{
(
""
,
" passed with `--extern`"
)
}
else
if
add_built_in
{
(
" built-in"
,
""
)
}
else
{
(
""
,
""
)
};
let
article
=
if
built_in
.is_empty
()
{
b
.article
()
}
else
{
"a"
};
format!
(
"{a}{built_in} {thing}{from}"
,
a
=
article
,
thing
=
b
.descr
(),
built_in
=
built_in
,
from
=
from
)
}
else
{
let
participle
=
if
b
.is_import
()
{
"imported"
}
else
{
"defined"
};
format!
(
"the {thing} {introduced} here"
,
thing
=
b
.descr
(),
introduced
=
participle
)
};
let
what
=
self
.binding_description
(
b
,
ident
,
misc
==
AmbiguityErrorMisc
::
FromPrelude
);
let
note_msg
=
format!
(
"`{ident}` could{also} refer to {what}"
,
ident
=
ident
,
also
=
also
,
what
=
what
);
...
...
src/librustc_resolve/macros.rs
浏览文件 @
8e88c347
...
...
@@ -891,7 +891,33 @@ struct Flags: u8 {
}
// The first found solution was the only one, return it.
if
let
Some
((
binding
,
..
))
=
innermost_result
{
if
let
Some
((
binding
,
flags
))
=
innermost_result
{
if
is_import
&&
!
self
.session
.features_untracked
()
.uniform_paths
{
// We get to here only if there's no ambiguity, in ambiguous cases an error will
// be reported anyway, so there's no reason to report an additional feature error.
// The `binding` can actually be introduced by something other than `--extern`,
// but its `Def` should coincide with a crate passed with `--extern`
// (otherwise there would be ambiguity) and we can skip feature error in this case.
if
ns
!=
TypeNS
||
!
use_prelude
||
self
.extern_prelude_get
(
ident
,
true
,
false
)
.is_none
()
{
let
msg
=
"imports can only refer to extern crate names
\
passed with `--extern` on stable channel"
;
let
mut
err
=
feature_err
(
&
self
.session.parse_sess
,
"uniform_paths"
,
ident
.span
,
GateIssue
::
Language
,
msg
);
let
what
=
self
.binding_description
(
binding
,
ident
,
flags
.contains
(
Flags
::
MISC_FROM_PRELUDE
));
let
note_msg
=
format!
(
"this import refers to {what}"
,
what
=
what
);
if
binding
.span
.is_dummy
()
{
err
.note
(
&
note_msg
);
}
else
{
err
.span_note
(
binding
.span
,
&
note_msg
);
err
.span_label
(
binding
.span
,
"not an extern crate passed with `--extern`"
);
}
err
.emit
();
}
}
return
Ok
(
binding
);
}
...
...
src/test/ui/feature-gates/feature-gate-uniform-paths.rs
浏览文件 @
8e88c347
...
...
@@ -8,15 +8,22 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// edition:2018
pub
mod
foo
{
pub
use
bar
::
Bar
;
//~^ ERROR unresolved import `bar`
pub
use
bar
::
Bar
;
//~ ERROR imports can only refer to extern crate names
pub
mod
bar
{
pub
struct
Bar
;
}
}
use
inline
;
//~ ERROR imports can only refer to extern crate names
use
Vec
;
//~ ERROR imports can only refer to extern crate names
use
vec
;
//~ ERROR imports can only refer to extern crate names
fn
main
()
{
let
_
=
foo
::
Bar
;
}
src/test/ui/feature-gates/feature-gate-uniform-paths.stderr
浏览文件 @
8e88c347
error[E0
432]: unresolved import `bar`
--> $DIR/feature-gate-uniform-paths.rs:1
2
:13
error[E0
658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
--> $DIR/feature-gate-uniform-paths.rs:1
4
:13
|
LL | pub use bar::Bar;
| ^^^ Did you mean `self::bar`?
LL | pub use bar::Bar; //~ ERROR imports can only refer to extern crate names
| ^^^
LL |
LL | / pub mod bar {
LL | | pub struct Bar;
LL | | }
| |_____- not an extern crate passed with `--extern`
|
= help: add #![feature(uniform_paths)] to the crate attributes to enable
note: this import refers to the module defined here
--> $DIR/feature-gate-uniform-paths.rs:16:5
|
LL | / pub mod bar {
LL | | pub struct Bar;
LL | | }
| |_____^
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
--> $DIR/feature-gate-uniform-paths.rs:21:5
|
LL | use inline; //~ ERROR imports can only refer to extern crate names
| ^^^^^^ not an extern crate passed with `--extern`
|
= help: add #![feature(uniform_paths)] to the crate attributes to enable
note: this import refers to the built-in attribute imported here
--> $DIR/feature-gate-uniform-paths.rs:21:5
|
LL | use inline; //~ ERROR imports can only refer to extern crate names
| ^^^^^^
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
--> $DIR/feature-gate-uniform-paths.rs:23:5
|
LL | use Vec; //~ ERROR imports can only refer to extern crate names
| ^^^ not an extern crate passed with `--extern`
|
= help: add #![feature(uniform_paths)] to the crate attributes to enable
note: this import refers to the struct imported here
--> $DIR/feature-gate-uniform-paths.rs:23:5
|
LL | use Vec; //~ ERROR imports can only refer to extern crate names
| ^^^
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
--> $DIR/feature-gate-uniform-paths.rs:25:5
|
LL | use vec; //~ ERROR imports can only refer to extern crate names
| ^^^ not an extern crate passed with `--extern`
|
= help: add #![feature(uniform_paths)] to the crate attributes to enable
note: this import refers to the macro imported here
--> $DIR/feature-gate-uniform-paths.rs:25:5
|
LL | use vec; //~ ERROR imports can only refer to extern crate names
| ^^^
error: aborting due to
previous error
error: aborting due to
4 previous errors
For more information about this error, try `rustc --explain E0
432
`.
For more information about this error, try `rustc --explain E0
658
`.
src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs
浏览文件 @
8e88c347
...
...
@@ -10,6 +10,8 @@
// edition:2018
#![feature(uniform_paths)]
// Tests that arbitrary crates (other than `core`, `std` and `meta`)
// aren't allowed without `--extern`, even if they're in the sysroot.
use
alloc
;
//~ ERROR unresolved import `alloc`
...
...
src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr
浏览文件 @
8e88c347
error: cannot import a built-in macro
--> $DIR/not-whitelisted.rs:1
6
:5
--> $DIR/not-whitelisted.rs:1
8
:5
|
LL | use test; //~ ERROR cannot import a built-in macro
| ^^^^
error[E0432]: unresolved import `alloc`
--> $DIR/not-whitelisted.rs:1
5
:5
--> $DIR/not-whitelisted.rs:1
7
:5
|
LL | use alloc; //~ ERROR unresolved import `alloc`
| ^^^^^ no `alloc` external crate
...
...
src/test/ui/rust-2018/local-path-suggestions-2018.rs
浏览文件 @
8e88c347
...
...
@@ -12,6 +12,8 @@
// compile-flags:--extern baz
// edition:2018
#![feature(uniform_paths)]
mod
foo
{
pub
type
Bar
=
u32
;
}
...
...
src/test/ui/rust-2018/local-path-suggestions-2018.stderr
浏览文件 @
8e88c347
error[E0432]: unresolved import `foo`
--> $DIR/local-path-suggestions-2018.rs:2
0
:9
--> $DIR/local-path-suggestions-2018.rs:2
2
:9
|
LL | use foo::Bar;
| ^^^ Did you mean `crate::foo`?
...
...
@@ -7,7 +7,7 @@ LL | use foo::Bar;
= note: `use` statements changed in Rust 2018; read more at <https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html>
error[E0432]: unresolved import `foobar`
--> $DIR/local-path-suggestions-2018.rs:
29
:5
--> $DIR/local-path-suggestions-2018.rs:
31
:5
|
LL | use foobar::Baz;
| ^^^^^^ Did you mean `baz::foobar`?
...
...
src/test/ui/rust-2018/uniform-paths-forward-compat/issue-54253.rs
浏览文件 @
8e88c347
...
...
@@ -10,7 +10,7 @@
// edition:2018
// Dummy import t
o introduce `uniform_paths`
canaries.
// Dummy import t
hat previously introduced uniform path
canaries.
use
std
;
// fn version() -> &'static str {""}
...
...
src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs
浏览文件 @
8e88c347
...
...
@@ -10,8 +10,6 @@
// edition:2018
#![feature(uniform_paths)]
// This test is similar to `ambiguity-macros.rs`, but nested in a module.
mod
foo
{
...
...
src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
浏览文件 @
8e88c347
error[E0659]: `std` is ambiguous (name vs any other name during import resolution)
--> $DIR/ambiguity-macros-nested.rs:1
8
:13
--> $DIR/ambiguity-macros-nested.rs:1
6
:13
|
LL | pub use std::io;
| ^^^ ambiguous name
...
...
@@ -7,7 +7,7 @@ LL | pub use std::io;
= note: `std` could refer to a built-in extern crate
= help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity-macros-nested.rs:2
3
:13
--> $DIR/ambiguity-macros-nested.rs:2
1
:13
|
LL | / mod std {
LL | | pub struct io;
...
...
src/test/ui/rust-2018/uniform-paths/ambiguity-macros.rs
浏览文件 @
8e88c347
...
...
@@ -10,8 +10,6 @@
// edition:2018
#![feature(uniform_paths)]
// This test is similar to `ambiguity.rs`, but with macros defining local items.
use
std
::
io
;
...
...
src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
浏览文件 @
8e88c347
error[E0659]: `std` is ambiguous (name vs any other name during import resolution)
--> $DIR/ambiguity-macros.rs:1
7
:5
--> $DIR/ambiguity-macros.rs:1
5
:5
|
LL | use std::io;
| ^^^ ambiguous name
...
...
@@ -7,7 +7,7 @@ LL | use std::io;
= note: `std` could refer to a built-in extern crate
= help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity-macros.rs:2
2
:9
--> $DIR/ambiguity-macros.rs:2
0
:9
|
LL | / mod std {
LL | | pub struct io;
...
...
src/test/ui/rust-2018/uniform-paths/ambiguity-nested.rs
浏览文件 @
8e88c347
...
...
@@ -10,8 +10,6 @@
// edition:2018
#![feature(uniform_paths)]
// This test is similar to `ambiguity.rs`, but nested in a module.
mod
foo
{
...
...
src/test/ui/rust-2018/uniform-paths/ambiguity-nested.stderr
浏览文件 @
8e88c347
error[E0659]: `std` is ambiguous (name vs any other name during import resolution)
--> $DIR/ambiguity-nested.rs:1
8
:13
--> $DIR/ambiguity-nested.rs:1
6
:13
|
LL | pub use std::io;
| ^^^ ambiguous name
...
...
@@ -7,7 +7,7 @@ LL | pub use std::io;
= note: `std` could refer to a built-in extern crate
= help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity-nested.rs:
21
:5
--> $DIR/ambiguity-nested.rs:
19
:5
|
LL | / mod std {
LL | | pub struct io;
...
...
src/test/ui/rust-2018/uniform-paths/ambiguity.rs
浏览文件 @
8e88c347
...
...
@@ -10,8 +10,6 @@
// edition:2018
#![feature(uniform_paths)]
use
std
::
io
;
//~^ ERROR `std` is ambiguous
...
...
src/test/ui/rust-2018/uniform-paths/ambiguity.stderr
浏览文件 @
8e88c347
error[E0659]: `std` is ambiguous (name vs any other name during import resolution)
--> $DIR/ambiguity.rs:1
5
:5
--> $DIR/ambiguity.rs:1
3
:5
|
LL | use std::io;
| ^^^ ambiguous name
...
...
@@ -7,7 +7,7 @@ LL | use std::io;
= note: `std` could refer to a built-in extern crate
= help: use `::std` to refer to this extern crate unambiguously
note: `std` could also refer to the module defined here
--> $DIR/ambiguity.rs:1
8
:1
--> $DIR/ambiguity.rs:1
6
:1
|
LL | / mod std {
LL | | pub struct io;
...
...
src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs
浏览文件 @
8e88c347
// edition:2018
#![feature(uniform_paths)]
mod
my
{
pub
mod
sub
{
pub
fn
bar
()
{}
...
...
src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr
浏览文件 @
8e88c347
error[E0659]: `sub` is ambiguous (name vs any other name during import resolution)
--> $DIR/block-scoped-shadow-nested.rs:1
6
:13
--> $DIR/block-scoped-shadow-nested.rs:1
8
:13
|
LL | use sub::bar; //~ ERROR `sub` is ambiguous
| ^^^ ambiguous name
|
note: `sub` could refer to the module imported here
--> $DIR/block-scoped-shadow-nested.rs:1
4
:9
--> $DIR/block-scoped-shadow-nested.rs:1
6
:9
|
LL | use my::sub;
| ^^^^^^^
note: `sub` could also refer to the module defined here
--> $DIR/block-scoped-shadow-nested.rs:
9
:1
--> $DIR/block-scoped-shadow-nested.rs:
11
:1
|
LL | / mod sub {
LL | | pub fn bar() {}
...
...
src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.rs
浏览文件 @
8e88c347
...
...
@@ -10,8 +10,6 @@
// edition:2018
#![feature(uniform_paths)]
enum
Foo
{}
struct
std
;
...
...
src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr
浏览文件 @
8e88c347
error[E0659]: `Foo` is ambiguous (name vs any other name during import resolution)
--> $DIR/block-scoped-shadow.rs:
21
:9
--> $DIR/block-scoped-shadow.rs:
19
:9
|
LL | use Foo::*;
| ^^^ ambiguous name
|
note: `Foo` could refer to the enum defined here
--> $DIR/block-scoped-shadow.rs:
20
:5
--> $DIR/block-scoped-shadow.rs:
18
:5
|
LL | enum Foo { A, B }
| ^^^^^^^^^^^^^^^^^
note: `Foo` could also refer to the enum defined here
--> $DIR/block-scoped-shadow.rs:1
5
:1
--> $DIR/block-scoped-shadow.rs:1
3
:1
|
LL | enum Foo {}
| ^^^^^^^^^^^
= help: use `self::Foo` to refer to this enum unambiguously
error[E0659]: `std` is ambiguous (name vs any other name during import resolution)
--> $DIR/block-scoped-shadow.rs:2
8
:9
--> $DIR/block-scoped-shadow.rs:2
6
:9
|
LL | use std as foo;
| ^^^ ambiguous name
|
note: `std` could refer to the enum defined here
--> $DIR/block-scoped-shadow.rs:2
7
:5
--> $DIR/block-scoped-shadow.rs:2
5
:5
|
LL | enum std {}
| ^^^^^^^^^^^
note: `std` could also refer to the struct defined here
--> $DIR/block-scoped-shadow.rs:1
7
:1
--> $DIR/block-scoped-shadow.rs:1
5
:1
|
LL | struct std;
| ^^^^^^^^^^^
= help: use `self::std` to refer to this struct unambiguously
error[E0659]: `std` is ambiguous (name vs any other name during import resolution)
--> $DIR/block-scoped-shadow.rs:2
8
:9
--> $DIR/block-scoped-shadow.rs:2
6
:9
|
LL | use std as foo;
| ^^^ ambiguous name
|
note: `std` could refer to the function defined here
--> $DIR/block-scoped-shadow.rs:2
6
:5
--> $DIR/block-scoped-shadow.rs:2
4
:5
|
LL | fn std() {}
| ^^^^^^^^^^^
note: `std` could also refer to the unit struct defined here
--> $DIR/block-scoped-shadow.rs:1
7
:1
--> $DIR/block-scoped-shadow.rs:1
5
:1
|
LL | struct std;
| ^^^^^^^^^^^
...
...
src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs
浏览文件 @
8e88c347
// compile-pass
// edition:2018
#![feature(uniform_paths)]
fn
main
()
{
enum
E
{
A
,
B
,
C
}
...
...
src/test/ui/rust-2018/uniform-paths/issue-54253.rs
浏览文件 @
8e88c347
...
...
@@ -10,9 +10,7 @@
// edition:2018
#![feature(uniform_paths)]
// Dummy import to introduce `uniform_paths` canaries.
// Dummy import that previously introduced uniform path canaries.
use
std
;
// fn version() -> &'static str {""}
...
...
src/test/ui/rust-2018/uniform-paths/issue-54253.stderr
浏览文件 @
8e88c347
error[E0432]: unresolved import `crate::version`
--> $DIR/issue-54253.rs:2
2
:9
--> $DIR/issue-54253.rs:2
0
:9
|
LL | use crate::version; //~ ERROR unresolved import `crate::version`
| ^^^^^^^^^^^^^^ no `version` in the root
...
...
src/test/ui/rust-2018/uniform-paths/macro-rules.rs
浏览文件 @
8e88c347
...
...
@@ -2,7 +2,7 @@
// For the time being `macro_rules` items are treated as *very* private...
#![feature(underscore_imports,
decl_macro)]
#![feature(underscore_imports,
decl_macro
,
uniform_paths
)]
mod
m1
{
macro_rules!
legacy_macro
{
()
=>
()
}
...
...
src/test/ui/rust-2018/uniform-paths/prelude-fail.rs
浏览文件 @
8e88c347
// edition:2018
#![feature(uniform_paths)]
// Built-in macro
use
env
as
env_imported
;
//~ ERROR cannot import a built-in macro
...
...
src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr
浏览文件 @
8e88c347
error: cannot import a built-in macro
--> $DIR/prelude-fail.rs:
4
:5
--> $DIR/prelude-fail.rs:
6
:5
|
LL | use env as env_imported; //~ ERROR cannot import a built-in macro
| ^^^^^^^^^^^^^^^^^^^
error[E0432]: unresolved import `rustfmt`
--> $DIR/prelude-fail.rs:
7
:5
--> $DIR/prelude-fail.rs:
9
:5
|
LL | use rustfmt::skip as imported_rustfmt_skip; //~ ERROR unresolved import `rustfmt`
| ^^^^^^^ Not a module `rustfmt`
...
...
src/test/ui/rust-2018/uniform-paths/prelude.rs
浏览文件 @
8e88c347
// compile-pass
// edition:2018
#![feature(uniform_paths)]
// Macro imported with `#[macro_use] extern crate`
use
vec
as
imported_vec
;
...
...
src/test/ui/rust-2018/uniform-paths/redundant.rs
浏览文件 @
8e88c347
...
...
@@ -11,8 +11,6 @@
// run-pass
// edition:2018
#![feature(uniform_paths)]
use
std
;
use
std
::
io
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录