diff options
| author | bors <bors@rust-lang.org> | 2021-07-01 21:45:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-01 21:45:19 +0000 |
| commit | 56dee7c49ecdec4c2c9eccc6ff966cf58847bda6 (patch) | |
| tree | 8b0ca08467f70bd8ecacca624c75303d5d3f7ad5 /src/test | |
| parent | 7100b311df0367c4d9067687573d1396b22411df (diff) | |
| parent | 76bf7c006959ccdf2d161f9113a86491b98e7eae (diff) | |
| download | rust-56dee7c49ecdec4c2c9eccc6ff966cf58847bda6.tar.gz rust-56dee7c49ecdec4c2c9eccc6ff966cf58847bda6.zip | |
Auto merge of #86791 - JohnTitor:rollup-96ltzpz, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #86148 (Check the number of generic lifetime and const parameters of intrinsics) - #86659 (fix(rustdoc): generics search) - #86768 (Add myself to mailmap) - #86775 (Test for const trait impls behind feature gates) - #86779 (Allow anyone to add or remove any label starting with perf-) - #86783 (Move Mutex::unlock to T: ?Sized) - #86785 (proc_macro/bridge: Remove dead code Slice type) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
15 files changed, 238 insertions, 22 deletions
diff --git a/src/test/rustdoc-js-std/alias-4.js b/src/test/rustdoc-js-std/alias-4.js new file mode 100644 index 00000000000..bf2bb4d2981 --- /dev/null +++ b/src/test/rustdoc-js-std/alias-4.js @@ -0,0 +1,7 @@ +const QUERY = '<'; + +const EXPECTED = { + 'others': [ + { 'name': 'Ord' }, + ], +}; diff --git a/src/test/rustdoc-js/generics-trait.js b/src/test/rustdoc-js/generics-trait.js new file mode 100644 index 00000000000..7876622435b --- /dev/null +++ b/src/test/rustdoc-js/generics-trait.js @@ -0,0 +1,23 @@ +const QUERY = [ + 'Result<SomeTrait>', + 'OtherThingxxxxxxxx', +]; + +const EXPECTED = [ + { + 'in_args': [ + { 'path': 'generics_trait', 'name': 'beta' }, + ], + 'returned': [ + { 'path': 'generics_trait', 'name': 'bet' }, + ], + }, + { + 'in_args': [ + { 'path': 'generics_trait', 'name': 'alpha' }, + ], + 'returned': [ + { 'path': 'generics_trait', 'name': 'alef' }, + ], + }, +]; diff --git a/src/test/rustdoc-js/generics-trait.rs b/src/test/rustdoc-js/generics-trait.rs new file mode 100644 index 00000000000..20db117ccd5 --- /dev/null +++ b/src/test/rustdoc-js/generics-trait.rs @@ -0,0 +1,8 @@ +pub trait SomeTrait {} +pub trait OtherThingxxxxxxxx {} + +pub fn alef<T: OtherThingxxxxxxxx>() -> Result<T, ()> { loop {} } +pub fn bet<T: SomeTrait>() -> Result<T, ()> { loop {} } + +pub fn alpha<T: OtherThingxxxxxxxx>(_param: Result<T, ()>) { loop {} } +pub fn beta<T: SomeTrait>(_param: Result<T, ()>) { loop {} } diff --git a/src/test/rustdoc-js/generics.js b/src/test/rustdoc-js/generics.js new file mode 100644 index 00000000000..49a80ae2360 --- /dev/null +++ b/src/test/rustdoc-js/generics.js @@ -0,0 +1,44 @@ +// exact-check + +const QUERY = [ + '"R<P>"', + '"P"', + 'P', + '"ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti>"', +]; + +const EXPECTED = [ + { + 'returned': [ + { 'path': 'generics', 'name': 'alef' }, + ], + 'in_args': [ + { 'path': 'generics', 'name': 'alpha' }, + ], + }, + { + 'others': [ + { 'path': 'generics', 'name': 'P' }, + ], + 'returned': [ + { 'path': 'generics', 'name': 'alef' }, + ], + 'in_args': [ + { 'path': 'generics', 'name': 'alpha' }, + ], + }, + { + 'returned': [ + { 'path': 'generics', 'name': 'alef' }, + ], + 'in_args': [ + { 'path': 'generics', 'name': 'alpha' }, + ], + }, + { + 'in_args': [ + { 'path': 'generics', 'name': 'extracreditlabhomework' }, + ], + 'returned': [], + }, +]; diff --git a/src/test/rustdoc-js/generics.rs b/src/test/rustdoc-js/generics.rs new file mode 100644 index 00000000000..a0dc086e9f9 --- /dev/null +++ b/src/test/rustdoc-js/generics.rs @@ -0,0 +1,21 @@ +pub struct P; +pub struct Q; +pub struct R<T>(T); + +// returns test +pub fn alef() -> R<P> { loop {} } +pub fn bet() -> R<Q> { loop {} } + +// in_args test +pub fn alpha(_x: R<P>) { loop {} } +pub fn beta(_x: R<Q>) { loop {} } + +// test case with multiple appearances of the same type +pub struct ExtraCreditStructMulti<T, U> { t: T, u: U } +pub struct ExtraCreditInnerMulti {} +pub fn extracreditlabhomework( + _param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ExtraCreditInnerMulti> +) { loop {} } +pub fn redherringmatchforextracredit( + _param: ExtraCreditStructMulti<ExtraCreditInnerMulti, ()> +) { loop {} } diff --git a/src/test/ui/rfc-2632-const-trait-impl/auxiliary/staged-api.rs b/src/test/ui/rfc-2632-const-trait-impl/auxiliary/staged-api.rs new file mode 100644 index 00000000000..734ce17001e --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/auxiliary/staged-api.rs @@ -0,0 +1,22 @@ +#![feature(const_trait_impl)] +#![allow(incomplete_features)] + +#![feature(staged_api)] +#![stable(feature = "rust1", since = "1.0.0")] + +#[stable(feature = "rust1", since = "1.0.0")] +pub trait MyTrait { + #[stable(feature = "rust1", since = "1.0.0")] + fn func(); +} + +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Unstable; + +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_const_unstable(feature = "staged", issue = "none")] +impl const MyTrait for Unstable { + fn func() { + + } +} diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate-feature-disabled.rs b/src/test/ui/rfc-2632-const-trait-impl/cross-crate-feature-disabled.rs deleted file mode 100644 index abd11d8b0e9..00000000000 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate-feature-disabled.rs +++ /dev/null @@ -1,18 +0,0 @@ -// aux-build: cross-crate.rs -extern crate cross_crate; - -use cross_crate::*; - -fn non_const_context() { - NonConst.func(); - Const.func(); -} - -const fn const_context() { - NonConst.func(); - //~^ ERROR: calls in constant functions are limited to constant functions, tuple structs and tuple variants - Const.func(); - //~^ ERROR: calls in constant functions are limited to constant functions, tuple structs and tuple variants -} - -fn main() {} diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate-feature-enabled.stderr b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gated.stderr index a544c0dd285..30baa385475 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate-feature-enabled.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.gated.stderr @@ -1,5 +1,5 @@ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/cross-crate-feature-enabled.rs:15:5 + --> $DIR/cross-crate.rs:16:5 | LL | NonConst.func(); | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate-feature-enabled.rs b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.rs index b79ccc7712f..c28ff638958 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate-feature-enabled.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.rs @@ -1,4 +1,5 @@ -#![feature(const_trait_impl)] +// revisions: stock gated +#![cfg_attr(gated, feature(const_trait_impl))] #![allow(incomplete_features)] // aux-build: cross-crate.rs @@ -15,6 +16,7 @@ const fn const_context() { NonConst.func(); //~^ ERROR: calls in constant functions are limited to constant functions, tuple structs and tuple variants Const.func(); + //[stock]~^ ERROR: calls in constant functions are limited to constant functions, tuple structs and tuple variants } fn main() {} diff --git a/src/test/ui/rfc-2632-const-trait-impl/cross-crate-feature-disabled.stderr b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stock.stderr index b86583b9e07..e6a86f251ca 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/cross-crate-feature-disabled.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/cross-crate.stock.stderr @@ -1,11 +1,11 @@ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/cross-crate-feature-disabled.rs:12:5 + --> $DIR/cross-crate.rs:16:5 | LL | NonConst.func(); | ^^^^^^^^^^^^^^^ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/cross-crate-feature-disabled.rs:14:5 + --> $DIR/cross-crate.rs:18:5 | LL | Const.func(); | ^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2632-const-trait-impl/staged-api.rs b/src/test/ui/rfc-2632-const-trait-impl/staged-api.rs new file mode 100644 index 00000000000..39a1b6066de --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/staged-api.rs @@ -0,0 +1,39 @@ +// revisions: stock staged +#![cfg_attr(staged, feature(staged))] + +#![feature(const_trait_impl)] +#![allow(incomplete_features)] + +#![feature(staged_api)] +#![stable(feature = "rust1", since = "1.0.0")] + +// aux-build: staged-api.rs +extern crate staged_api; + +use staged_api::*; + +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Stable; + +#[stable(feature = "rust1", since = "1.0.0")] +#[cfg_attr(staged, rustc_const_stable(feature = "rust1", since = "1.0.0"))] +// ^ should trigger error with or without the attribute +impl const MyTrait for Stable { + fn func() { //~ ERROR trait methods cannot be stable const fn + + } +} + +fn non_const_context() { + Unstable::func(); + Stable::func(); +} + +#[unstable(feature = "none", issue = "none")] +const fn const_context() { + Unstable::func(); + //[stock]~^ ERROR `<staged_api::Unstable as staged_api::MyTrait>::func` is not yet stable as a const fn + Stable::func(); +} + +fn main() {} diff --git a/src/test/ui/rfc-2632-const-trait-impl/staged-api.staged.stderr b/src/test/ui/rfc-2632-const-trait-impl/staged-api.staged.stderr new file mode 100644 index 00000000000..d2ff4ce2001 --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/staged-api.staged.stderr @@ -0,0 +1,10 @@ +error: trait methods cannot be stable const fn + --> $DIR/staged-api.rs:22:5 + | +LL | / fn func() { +LL | | +LL | | } + | |_____^ + +error: aborting due to previous error + diff --git a/src/test/ui/rfc-2632-const-trait-impl/staged-api.stock.stderr b/src/test/ui/rfc-2632-const-trait-impl/staged-api.stock.stderr new file mode 100644 index 00000000000..91c5469bd90 --- /dev/null +++ b/src/test/ui/rfc-2632-const-trait-impl/staged-api.stock.stderr @@ -0,0 +1,18 @@ +error: trait methods cannot be stable const fn + --> $DIR/staged-api.rs:22:5 + | +LL | / fn func() { +LL | | +LL | | } + | |_____^ + +error: `<staged_api::Unstable as staged_api::MyTrait>::func` is not yet stable as a const fn + --> $DIR/staged-api.rs:34:5 + | +LL | Unstable::func(); + | ^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(staged)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/simd-intrinsic/issue-85855.rs b/src/test/ui/simd-intrinsic/issue-85855.rs new file mode 100644 index 00000000000..f276fbd6694 --- /dev/null +++ b/src/test/ui/simd-intrinsic/issue-85855.rs @@ -0,0 +1,19 @@ +// Check that appropriate errors are reported if an intrinsic is defined +// with the wrong number of generic lifetime/type/const parameters, and +// that no ICE occurs in these cases. + +#![feature(platform_intrinsics)] +#![crate_type="lib"] + +extern "platform-intrinsic" { + fn simd_saturating_add<'a, T: 'a>(x: T, y: T); + //~^ ERROR: intrinsic has wrong number of lifetime parameters + + fn simd_add<'a, T>(x: T, y: T) -> T; + + fn simd_sub<T, U>(x: T, y: U); + //~^ ERROR: intrinsic has wrong number of type parameters + + fn simd_mul<T, const N: usize>(x: T, y: T); + //~^ ERROR: intrinsic has wrong number of const parameters +} diff --git a/src/test/ui/simd-intrinsic/issue-85855.stderr b/src/test/ui/simd-intrinsic/issue-85855.stderr new file mode 100644 index 00000000000..fb2f1fbc5b1 --- /dev/null +++ b/src/test/ui/simd-intrinsic/issue-85855.stderr @@ -0,0 +1,21 @@ +error[E0094]: intrinsic has wrong number of lifetime parameters: found 1, expected 0 + --> $DIR/issue-85855.rs:9:27 + | +LL | fn simd_saturating_add<'a, T: 'a>(x: T, y: T); + | ^^^^^^^^^^^ expected 0 lifetime parameters + +error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1 + --> $DIR/issue-85855.rs:14:16 + | +LL | fn simd_sub<T, U>(x: T, y: U); + | ^^^^^^ expected 1 type parameter + +error[E0094]: intrinsic has wrong number of const parameters: found 1, expected 0 + --> $DIR/issue-85855.rs:17:16 + | +LL | fn simd_mul<T, const N: usize>(x: T, y: T); + | ^^^^^^^^^^^^^^^^^^^ expected 0 const parameters + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0094`. |
