Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
39b8aaf2
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,发现更多精彩内容 >>
提交
39b8aaf2
编写于
7月 11, 2017
作者:
F
Felix S. Klock II
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Slew of feature gating tests for issue #43106.
上级
d84693b9
变更
13
展开全部
隐藏空白更改
内联
并排
Showing
13 changed file
with
1291 addition
and
0 deletion
+1291
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-bench.rs
.../compile-fail/feature-gate/issue-43106-gating-of-bench.rs
+25
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs
...-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs
+878
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-deprecated.rs
...ile-fail/feature-gate/issue-43106-gating-of-deprecated.rs
+31
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-derive-2.rs
...mpile-fail/feature-gate/issue-43106-gating-of-derive-2.rs
+47
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-derive.rs
...compile-fail/feature-gate/issue-43106-gating-of-derive.rs
+44
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-inline.rs
...compile-fail/feature-gate/issue-43106-gating-of-inline.rs
+37
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_escape.rs
...e-fail/feature-gate/issue-43106-gating-of-macro_escape.rs
+17
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_use.rs
...pile-fail/feature-gate/issue-43106-gating-of-macro_use.rs
+33
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-proc_macro_derive.rs
...l/feature-gate/issue-43106-gating-of-proc_macro_derive.rs
+42
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs
...il/feature-gate/issue-43106-gating-of-rustc_deprecated.rs
+39
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs
...compile-fail/feature-gate/issue-43106-gating-of-stable.rs
+38
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-test.rs
...t/compile-fail/feature-gate/issue-43106-gating-of-test.rs
+22
-0
src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs
...mpile-fail/feature-gate/issue-43106-gating-of-unstable.rs
+38
-0
未找到文件。
src/test/compile-fail/feature-gate/issue-43106-gating-of-bench.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: main function not found
// At time of authorship, a crate-level #![bench] with no `--test`
// will cause compilation to error unconditionally with "main function
// not found" (despite having one), similar to #[bench].
//
// (The non-crate level cases are in
// issue-43106-gating-of-builtin-attrs.rs.)
// See issue-12997-1.rs and issue-12997-2.rs to see how `#[bench]` is
// handled in "weird places" when `--test` is passed.
#![bench
=
"4100"
]
fn
main
()
{
}
src/test/compile-fail/feature-gate/issue-43106-gating-of-builtin-attrs.rs
0 → 100644
浏览文件 @
39b8aaf2
此差异已折叠。
点击以展开。
src/test/compile-fail/feature-gate/issue-43106-gating-of-deprecated.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This test just shows that a crate-level `#![deprecated]` does not
// signal a warning or error. (This file sits on its own because a
// crate-level `#![deprecated]` causes all that crate's item
// definitions to be deprecated, which is a pain to work with.)
//
// (For non-crate-level cases, see issue-43106-gating-of-builtin-attrs.rs)
#![feature(rustc_attrs)]
// For `rustc_error`; see note below.
#![allow(dead_code)]
#![deprecated
=
"1100"
]
// Since we expect for the mix of attributes used here to compile
// successfully, and we are just testing for the expected warnings of
// various (mis)uses of attributes, we use the `rustc_error` attribute
// on the `fn main()`.
#[rustc_error]
fn
main
()
{
//~ ERROR compilation successful
println!
(
"Hello World"
);
}
src/test/compile-fail/feature-gate/issue-43106-gating-of-derive-2.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// `#![derive]` is interpreted (and raises errors) when it occurs at
// contexts other than ADT definitions. This test checks cases where
// the derive-macro does not exist.
#![derive(x3300)]
//~^ ERROR cannot find derive macro `x3300` in this scope
#[derive(x3300)]
//~^ ERROR cannot find derive macro `x3300` in this scope
mod
derive
{
mod
inner
{
#![derive(x3300)]
}
//~^ ERROR cannot find derive macro `x3300` in this scope
#[derive(x3300)]
//~^ ERROR cannot find derive macro `x3300` in this scope
fn
derive
()
{
}
#[derive(x3300)]
//~^ ERROR cannot find derive macro `x3300` in this scope
union
U
{
f
:
i32
}
#[derive(x3300)]
//~^ ERROR cannot find derive macro `x3300` in this scope
enum
E
{
}
#[derive(x3300)]
//~^ ERROR cannot find derive macro `x3300` in this scope
struct
S
;
#[derive(x3300)]
//~^ ERROR cannot find derive macro `x3300` in this scope
type
T
=
S
;
#[derive(x3300)]
//~^ ERROR cannot find derive macro `x3300` in this scope
impl
S
{
}
}
src/test/compile-fail/feature-gate/issue-43106-gating-of-derive.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// `#![derive]` is interpreted (and raises errors) when it occurs at
// contexts other than ADT definitions. This test checks cases where
// the derive-macro exists.
#![derive(Debug)]
//~^ ERROR `derive` may only be applied to structs, enums and unions
#[derive(Debug)]
//~^ ERROR `derive` may only be applied to structs, enums and unions
mod
derive
{
mod
inner
{
#![derive(Debug)]
}
//~^ ERROR `derive` may only be applied to structs, enums and unions
#[derive(Debug)]
//~^ ERROR `derive` may only be applied to structs, enums and unions
fn
derive
()
{
}
#[derive(Copy,
Clone)]
// (can't derive Debug for unions)
union
U
{
f
:
i32
}
#[derive(Debug)]
struct
S
;
#[derive(Debug)]
enum
E
{
}
#[derive(Debug)]
//~^ ERROR `derive` may only be applied to structs, enums and unions
type
T
=
S
;
#[derive(Debug)]
//~^ ERROR `derive` may only be applied to structs, enums and unions
impl
S
{
}
}
src/test/compile-fail/feature-gate/issue-43106-gating-of-inline.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This is testing whether `#[inline]` signals an error or warning
// when put in "weird" places.
//
// (This file sits on its own because it actually signals an error,
// which would mess up the treatment of other cases in
// issue-43106-gating-of-builtin-attrs.rs)
// Crate-level is accepted, though it is almost certainly unused?
#![inline
=
"2100"
]
#[inline
=
"2100"
]
//~^ ERROR attribute should be applied to function
mod
inline
{
mod
inner
{
#![inline=
"2100"
]
}
//~^ ERROR attribute should be applied to function
#[inline
=
"2100"
]
fn
f
()
{
}
#[inline
=
"2100"
]
struct
S
;
//~^ ERROR attribute should be applied to function
#[inline
=
"2100"
]
type
T
=
S
;
//~^ ERROR attribute should be applied to function
#[inline
=
"2100"
]
impl
S
{
}
//~^ ERROR attribute should be applied to function
}
src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_escape.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Testing that crate-level `#![macro_escape]` is not gated beyond a
// depecation warning. This file sits on its own, because crate-level
// `#![macro_escape]` is incompatible with crate-level `#![macro_use]`
// already present in issue-43106-gating-of-builtin-attrs.
#![macro_escape]
//~^ WARN macro_escape is a deprecated synonym for macro_use
src/test/compile-fail/feature-gate/issue-43106-gating-of-macro_use.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// This is just a check-list of the cases where feeding arguments to
// `#[macro_use]` is rejected. (The cases where no error is emitted
// corresponds to cases where the attribute is currently unused, so we
// get that warning; see issue-43106-gating-of-builtin-attrs.rs
#![macro_use
=
"4900"
]
//~ ERROR arguments to macro_use are not allowed here
#[macro_use
=
"2700"
]
//~^ ERROR arguments to macro_use are not allowed here
mod
macro_escape
{
mod
inner
{
#![macro_use=
"2700"
]
}
//~^ ERROR arguments to macro_use are not allowed here
#[macro_use
=
"2700"
]
fn
f
()
{
}
#[macro_use
=
"2700"
]
struct
S
;
#[macro_use
=
"2700"
]
type
T
=
S
;
#[macro_use
=
"2700"
]
impl
S
{
}
}
fn
main
()
{
}
src/test/compile-fail/feature-gate/issue-43106-gating-of-proc_macro_derive.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// At time of authorship, #[proc_macro_derive = "2500"] will emit an
// error when it occurs on a mod (apart from crate-level), but will
// not descend further into the mod for other occurrences of the same
// error.
//
// This file sits on its own because the the "weird" occurrences here
// signal errors, making it incompatible with the "warnings only"
// nature of issue-43106-gating-of-builtin-attrs.rs
#[proc_macro_derive
=
"2500"
]
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
mod
proc_macro_derive1
{
mod
inner
{
#![proc_macro_derive=
"2500"
]
}
// (no error issued here if there was one on outer module)
}
mod
proc_macro_derive2
{
mod
inner
{
#![proc_macro_derive=
"2500"
]
}
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
#[proc_macro_derive
=
"2500"
]
fn
f
()
{
}
//~^ ERROR the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro`
#[proc_macro_derive
=
"2500"
]
struct
S
;
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
#[proc_macro_derive
=
"2500"
]
type
T
=
S
;
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
#[proc_macro_derive
=
"2500"
]
impl
S
{
}
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
}
src/test/compile-fail/feature-gate/issue-43106-gating-of-rustc_deprecated.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Testing gating of `#[rustc_deprecated]` in "weird" places.
//
// This file sits on its own because these signal errors, making
// this test incompatible with the "warnings only" nature of
// issue-43106-gating-of-builtin-attrs.rs
#![rustc_deprecated
=
"1500"
]
//~^ ERROR stability attributes may not be used outside of the standard library
#[rustc_deprecated
=
"1500"
]
//~^ ERROR stability attributes may not be used outside of the standard library
mod
rustc_deprecated
{
mod
inner
{
#![rustc_deprecated=
"1500"
]
}
//~^ ERROR stability attributes may not be used outside of the standard library
#[rustc_deprecated
=
"1500"
]
fn
f
()
{
}
//~^ ERROR stability attributes may not be used outside of the standard library
#[rustc_deprecated
=
"1500"
]
struct
S
;
//~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR stability attributes may not be used outside of the standard library
#[rustc_deprecated
=
"1500"
]
type
T
=
S
;
//~^ ERROR stability attributes may not be used outside of the standard library
#[rustc_deprecated
=
"1500"
]
impl
S
{
}
//~^ ERROR stability attributes may not be used outside of the standard library
}
src/test/compile-fail/feature-gate/issue-43106-gating-of-stable.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Testing gating of `#[stable]` in "weird" places.
//
// This file sits on its own because these signal errors, making
// this test incompatible with the "warnings only" nature of
// issue-43106-gating-of-builtin-attrs.rs
#![stable
=
"1300"
]
//~^ ERROR stability attributes may not be used outside of the standard library
#[stable
=
"1300"
]
//~^ ERROR stability attributes may not be used outside of the standard library
mod
stable
{
mod
inner
{
#![stable=
"1300"
]
}
//~^ ERROR stability attributes may not be used outside of the standard library
#[stable
=
"1300"
]
fn
f
()
{
}
//~^ ERROR stability attributes may not be used outside of the standard library
#[stable
=
"1300"
]
struct
S
;
//~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR stability attributes may not be used outside of the standard library
#[stable
=
"1300"
]
type
T
=
S
;
//~^ ERROR stability attributes may not be used outside of the standard library
#[stable
=
"1300"
]
impl
S
{
}
//~^ ERROR stability attributes may not be used outside of the standard library
}
src/test/compile-fail/feature-gate/issue-43106-gating-of-test.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: main function not found
// At time of authorship, crate-level #[test] attribute with no
// `--test` signals unconditional error complaining of missing main
// function (despite having one), similar to #[bench].
//
// (The non-crate level cases are in
// issue-43106-gating-of-builtin-attrs.rs.)
#![test
=
"4200"
]
fn
main
()
{
}
src/test/compile-fail/feature-gate/issue-43106-gating-of-unstable.rs
0 → 100644
浏览文件 @
39b8aaf2
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Testing gating of `#[unstable]` in "weird" places.
//
// This file sits on its own because these signal errors, making
// this test incompatible with the "warnings only" nature of
// issue-43106-gating-of-builtin-attrs.rs
#![unstable
=
"1200"
]
//~^ ERROR stability attributes may not be used outside of the standard library
#[unstable
=
"1200"
]
//~^ ERROR stability attributes may not be used outside of the standard library
mod
unstable
{
mod
inner
{
#![unstable=
"1200"
]
}
//~^ ERROR stability attributes may not be used outside of the standard library
#[unstable
=
"1200"
]
fn
f
()
{
}
//~^ ERROR stability attributes may not be used outside of the standard library
#[unstable
=
"1200"
]
struct
S
;
//~^ ERROR stability attributes may not be used outside of the standard library
//~| ERROR stability attributes may not be used outside of the standard library
#[unstable
=
"1200"
]
type
T
=
S
;
//~^ ERROR stability attributes may not be used outside of the standard library
#[unstable
=
"1200"
]
impl
S
{
}
//~^ ERROR stability attributes may not be used outside of the standard library
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录