Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
fc0fb38b
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,发现更多精彩内容 >>
提交
fc0fb38b
编写于
8月 30, 2021
作者:
M
Mara Bos
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add macro test for prelude collision suggestions.
上级
a15dab9c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
115 addition
and
0 deletion
+115
-0
src/test/ui/rust-2021/future-prelude-collision-macros.fixed
src/test/ui/rust-2021/future-prelude-collision-macros.fixed
+45
-0
src/test/ui/rust-2021/future-prelude-collision-macros.rs
src/test/ui/rust-2021/future-prelude-collision-macros.rs
+45
-0
src/test/ui/rust-2021/future-prelude-collision-macros.stderr
src/test/ui/rust-2021/future-prelude-collision-macros.stderr
+25
-0
未找到文件。
src/test/ui/rust-2021/future-prelude-collision-macros.fixed
0 → 100644
浏览文件 @
fc0fb38b
// run-rustfix
// edition:2018
// check-pass
#![warn(rust_2021_prelude_collisions)]
#![allow(unreachable_code)]
macro_rules! foo {
() => {{
123;
S
}};
}
trait MyTry<T> {
fn try_into(self, _: u8);
}
struct S;
impl MyTry<i32> for S {
fn try_into(self, _: u8) {}
}
trait TryFromU8: Sized {
fn try_from(_: u8);
}
impl TryFromU8 for u32 {
fn try_from(_: u8) {}
}
macro_rules! bar {
() => {
u32
};
}
fn main() {
MyTry::try_into(foo!(), todo!());
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~| WARNING this is accepted in the current edition
<bar!() as TryFromU8>::try_from(0);
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
//~| WARNING this is accepted in the current edition
}
src/test/ui/rust-2021/future-prelude-collision-macros.rs
0 → 100644
浏览文件 @
fc0fb38b
// run-rustfix
// edition:2018
// check-pass
#![warn(rust_2021_prelude_collisions)]
#![allow(unreachable_code)]
macro_rules!
foo
{
()
=>
{{
123
;
S
}};
}
trait
MyTry
<
T
>
{
fn
try_into
(
self
,
_
:
u8
);
}
struct
S
;
impl
MyTry
<
i32
>
for
S
{
fn
try_into
(
self
,
_
:
u8
)
{}
}
trait
TryFromU8
:
Sized
{
fn
try_from
(
_
:
u8
);
}
impl
TryFromU8
for
u32
{
fn
try_from
(
_
:
u8
)
{}
}
macro_rules!
bar
{
()
=>
{
u32
};
}
fn
main
()
{
foo!
()
.try_into
(
todo!
());
//~^ WARNING trait method `try_into` will become ambiguous in Rust 2021
//~| WARNING this is accepted in the current edition
<
bar!
()
>
::
try_from
(
0
);
//~^ WARNING trait-associated function `try_from` will become ambiguous in Rust 2021
//~| WARNING this is accepted in the current edition
}
src/test/ui/rust-2021/future-prelude-collision-macros.stderr
0 → 100644
浏览文件 @
fc0fb38b
warning: trait method `try_into` will become ambiguous in Rust 2021
--> $DIR/future-prelude-collision-macros.rs:39:5
|
LL | foo!().try_into(todo!());
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `MyTry::try_into(foo!(), todo!())`
|
note: the lint level is defined here
--> $DIR/future-prelude-collision-macros.rs:4:9
|
LL | #![warn(rust_2021_prelude_collisions)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html>
warning: trait-associated function `try_from` will become ambiguous in Rust 2021
--> $DIR/future-prelude-collision-macros.rs:42:5
|
LL | <bar!()>::try_from(0);
| ^^^^^^^^^^^^^^^^^^ help: disambiguate the associated function: `<bar!() as TryFromU8>::try_from`
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/prelude.html>
warning: 2 warnings emitted
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录