Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
7ee817e4
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,发现更多精彩内容 >>
未验证
提交
7ee817e4
编写于
6月 03, 2021
作者:
Y
Yuki Okushi
提交者:
GitHub
6月 03, 2021
浏览文件
操作
浏览文件
下载
差异文件
Rollup merge of #85896 - BoxyUwU:remove-fixme-fwd-declared-const-default, r=petrochenkov
Add test for forward declared const param defaults
上级
0d4bbc5d
ba680aa5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
3 deletion
+45
-3
compiler/rustc_resolve/src/diagnostics.rs
compiler/rustc_resolve/src/diagnostics.rs
+1
-1
compiler/rustc_resolve/src/lib.rs
compiler/rustc_resolve/src/lib.rs
+2
-2
src/test/ui/const-generics/defaults/forward-declared.rs
src/test/ui/const-generics/defaults/forward-declared.rs
+15
-0
src/test/ui/const-generics/defaults/forward-declared.stderr
src/test/ui/const-generics/defaults/forward-declared.stderr
+27
-0
未找到文件。
compiler/rustc_resolve/src/diagnostics.rs
浏览文件 @
7ee817e4
...
...
@@ -450,7 +450,7 @@ impl<'a> Resolver<'a> {
err
.span_label
(
shadowed_binding_span
,
msg
);
err
}
ResolutionError
::
ForwardDeclared
Ty
Param
=>
{
ResolutionError
::
ForwardDeclared
Generic
Param
=>
{
let
mut
err
=
struct_span_err!
(
self
.session
,
span
,
...
...
compiler/rustc_resolve/src/lib.rs
浏览文件 @
7ee817e4
...
...
@@ -242,7 +242,7 @@ enum ResolutionError<'a> {
shadowed_binding_span
:
Span
,
},
/// Error E0128: generic parameters with a default cannot use forward-declared identifiers.
ForwardDeclared
TyParam
,
// FIXME(const_generics_defaults)
ForwardDeclared
GenericParam
,
/// ERROR E0770: the type of const parameters must not depend on other generic parameters.
ParamInTyOfConstParam
(
Symbol
),
/// generic parameters must not be used inside const evaluations.
...
...
@@ -2608,7 +2608,7 @@ fn validate_res_from_ribs(
let
res_error
=
if
rib_ident
.name
==
kw
::
SelfUpper
{
ResolutionError
::
SelfInTyParamDefault
}
else
{
ResolutionError
::
ForwardDeclared
Ty
Param
ResolutionError
::
ForwardDeclared
Generic
Param
};
self
.report_error
(
span
,
res_error
);
}
...
...
src/test/ui/const-generics/defaults/forward-declared.rs
0 → 100644
浏览文件 @
7ee817e4
#![feature(const_generics_defaults)]
struct
Foo
<
const
N
:
usize
=
M
,
const
M
:
usize
=
10
>
;
//~^ ERROR generic parameters with a default cannot use forward declared identifiers
enum
Bar
<
const
N
:
usize
=
M
,
const
M
:
usize
=
10
>
{}
//~^ ERROR generic parameters with a default cannot use forward declared identifiers
struct
Foo2
<
const
N
:
usize
=
N
>
;
//~^ ERROR generic parameters with a default cannot use forward declared identifiers
enum
Bar2
<
const
N
:
usize
=
N
>
{}
//~^ ERROR generic parameters with a default cannot use forward declared identifiers
fn
main
()
{}
src/test/ui/const-generics/defaults/forward-declared.stderr
0 → 100644
浏览文件 @
7ee817e4
error[E0128]: generic parameters with a default cannot use forward declared identifiers
--> $DIR/forward-declared.rs:3:29
|
LL | struct Foo<const N: usize = M, const M: usize = 10>;
| ^ defaulted generic parameters cannot be forward declared
error[E0128]: generic parameters with a default cannot use forward declared identifiers
--> $DIR/forward-declared.rs:6:27
|
LL | enum Bar<const N: usize = M, const M: usize = 10> {}
| ^ defaulted generic parameters cannot be forward declared
error[E0128]: generic parameters with a default cannot use forward declared identifiers
--> $DIR/forward-declared.rs:9:30
|
LL | struct Foo2<const N: usize = N>;
| ^ defaulted generic parameters cannot be forward declared
error[E0128]: generic parameters with a default cannot use forward declared identifiers
--> $DIR/forward-declared.rs:12:28
|
LL | enum Bar2<const N: usize = N> {}
| ^ defaulted generic parameters cannot be forward declared
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0128`.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录