diff options
| author | bors <bors@rust-lang.org> | 2022-03-18 00:35:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-03-18 00:35:19 +0000 |
| commit | cd119057160cedea245aa2679add56723f3dc784 (patch) | |
| tree | 21335c52669bb2665024cf37adf8d892925d9d31 /src/test | |
| parent | 4ca56d2b7bbe275bc6c9f3cd698c6e0719a07182 (diff) | |
| parent | 4493826d07bf38cca058b4d9e75bce14ceeeaab9 (diff) | |
| download | rust-cd119057160cedea245aa2679add56723f3dc784.tar.gz rust-cd119057160cedea245aa2679add56723f3dc784.zip | |
Auto merge of #95056 - Dylan-DPC:rollup-swtuw2n, r=Dylan-DPC
Rollup of 10 pull requests
Successful merges:
- #91133 (Improve `unsafe` diagnostic)
- #93222 (Make ErrorReported impossible to construct outside `rustc_errors`)
- #93745 (Stabilize ADX target feature)
- #94309 ([generator_interior] Be more precise with scopes of borrowed places)
- #94698 (Remove redundant code from copy-suggestions)
- #94731 (Suggest adding `{ .. }` around a const function call with arguments)
- #94960 (Fix many spelling mistakes)
- #94982 (Add deprecated_safe feature gate and attribute, cc #94978)
- #94997 (debuginfo: Fix ICE when generating name for type that produces a layout error.)
- #95000 (Fixed wrong type name in comment)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
20 files changed, 187 insertions, 13 deletions
diff --git a/src/test/codegen/catch-unwind.rs b/src/test/codegen/catch-unwind.rs index b89c590add0..3ea3a24bfae 100644 --- a/src/test/codegen/catch-unwind.rs +++ b/src/test/codegen/catch-unwind.rs @@ -1,6 +1,6 @@ // compile-flags: -O -// On x86 the closure is inlined in foo() producting something like +// On x86 the closure is inlined in foo() producing something like // define i32 @foo() [...] { // tail call void @bar() [...] // ret i32 0 diff --git a/src/test/codegen/debug-column.rs b/src/test/codegen/debug-column.rs index 5d3afef5289..e61642b8e1b 100644 --- a/src/test/codegen/debug-column.rs +++ b/src/test/codegen/debug-column.rs @@ -1,4 +1,4 @@ -// Verify that debuginfo column nubmers are 1-based byte offsets. +// Verify that debuginfo column numbers are 1-based byte offsets. // // ignore-windows // compile-flags: -C debuginfo=2 diff --git a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs index ee668501ae7..802b867a301 100644 --- a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs +++ b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs @@ -50,7 +50,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingAllowedAttrPass { let allowed = |attr| pprust::attribute_to_string(attr).contains("allowed_attr"); if !cx.tcx.hir().attrs(item.hir_id()).iter().any(allowed) { cx.lint(MISSING_ALLOWED_ATTR, |lint| { - lint.build("Missing 'allowed_attr' attribute").set_span(span).emit() + lint.build("Missing 'allowed_attr' attribute").set_span(span).emit(); }); } } diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs index e726f8402ef..bc153faa892 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs @@ -34,7 +34,7 @@ macro_rules! fake_lint_pass { if !cx.sess().contains_name(attrs, $attr) { cx.lint(CRATE_NOT_OKAY, |lint| { let msg = format!("crate is not marked with #![{}]", $attr); - lint.build(&msg).set_span(span).emit() + lint.build(&msg).set_span(span).emit(); }); } )* diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs index 4bbed502980..29d0abfbe53 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs @@ -30,7 +30,7 @@ impl<'tcx> LateLintPass<'tcx> for Pass { let span = cx.tcx.def_span(CRATE_DEF_ID); if !cx.sess().contains_name(attrs, Symbol::intern("crate_okay")) { cx.lint(CRATE_NOT_OKAY, |lint| { - lint.build("crate is not marked with #![crate_okay]").set_span(span).emit() + lint.build("crate is not marked with #![crate_okay]").set_span(span).emit(); }); } } diff --git a/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs index 98ba8b12256..691cfb97d92 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs @@ -23,10 +23,10 @@ impl<'tcx> LateLintPass<'tcx> for Pass { fn check_item(&mut self, cx: &LateContext, it: &rustc_hir::Item) { match it.ident.as_str() { "lintme" => cx.lint(TEST_LINT, |lint| { - lint.build("item is named 'lintme'").set_span(it.span).emit() + lint.build("item is named 'lintme'").set_span(it.span).emit(); }), "pleaselintme" => cx.lint(PLEASE_LINT, |lint| { - lint.build("item is named 'pleaselintme'").set_span(it.span).emit() + lint.build("item is named 'pleaselintme'").set_span(it.span).emit(); }), _ => {} } diff --git a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs index 42368ec36a0..285754928c2 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs @@ -22,7 +22,7 @@ impl EarlyLintPass for Pass { fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { if it.ident.name.as_str() == "lintme" { cx.lint(TEST_LINT, |lint| { - lint.build("item is named 'lintme'").set_span(it.span).emit() + lint.build("item is named 'lintme'").set_span(it.span).emit(); }); } } diff --git a/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs index 81feddf5713..3d5dba42b5f 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs @@ -32,12 +32,12 @@ impl EarlyLintPass for Pass { fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { if it.ident.name.as_str() == "lintme" { cx.lint(TEST_LINT, |lint| { - lint.build("item is named 'lintme'").set_span(it.span).emit() + lint.build("item is named 'lintme'").set_span(it.span).emit(); }); } if it.ident.name.as_str() == "lintmetoo" { cx.lint(TEST_GROUP, |lint| { - lint.build("item is named 'lintmetoo'").set_span(it.span).emit() + lint.build("item is named 'lintmetoo'").set_span(it.span).emit(); }); } } diff --git a/src/test/ui/const-generics/const-generic-function.rs b/src/test/ui/const-generics/const-generic-function.rs new file mode 100644 index 00000000000..c8d2683e53f --- /dev/null +++ b/src/test/ui/const-generics/const-generic-function.rs @@ -0,0 +1,21 @@ +fn foo<const N: i32>() -> i32 { + N +} + +const fn bar(n: i32, m: i32) -> i32 { + n +} + +const fn baz() -> i32 { + 1 +} + +const FOO: i32 = 3; + +fn main() { + foo::<baz()>(); //~ ERROR expected type, found function `baz` + //~| ERROR unresolved item provided when a constant was expected + foo::<bar(bar(1, 1), bar(1, 1))>(); //~ ERROR expected type, found `1` + foo::<bar(1, 1)>(); //~ ERROR expected type, found `1` + foo::<bar(FOO, 2)>(); //~ ERROR expected type, found `2` +} diff --git a/src/test/ui/const-generics/const-generic-function.stderr b/src/test/ui/const-generics/const-generic-function.stderr new file mode 100644 index 00000000000..5ad3f1006c1 --- /dev/null +++ b/src/test/ui/const-generics/const-generic-function.stderr @@ -0,0 +1,54 @@ +error: expected type, found `1` + --> $DIR/const-generic-function.rs:18:19 + | +LL | foo::<bar(bar(1, 1), bar(1, 1))>(); + | ^ expected type + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | foo::<{ bar(bar(1, 1), bar(1, 1)) }>(); + | + + + +error: expected type, found `1` + --> $DIR/const-generic-function.rs:19:15 + | +LL | foo::<bar(1, 1)>(); + | ^ expected type + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | foo::<{ bar(1, 1) }>(); + | + + + +error: expected type, found `2` + --> $DIR/const-generic-function.rs:20:20 + | +LL | foo::<bar(FOO, 2)>(); + | ^ expected type + | +help: expressions must be enclosed in braces to be used as const generic arguments + | +LL | foo::<{ bar(FOO, 2) }>(); + | + + + +error[E0573]: expected type, found function `baz` + --> $DIR/const-generic-function.rs:16:11 + | +LL | foo::<baz()>(); + | ^^^^^ not a type + +error[E0747]: unresolved item provided when a constant was expected + --> $DIR/const-generic-function.rs:16:11 + | +LL | foo::<baz()>(); + | ^^^^^ + | +help: if this generic argument was intended as a const parameter, surround it with braces + | +LL | foo::<{ baz() }>(); + | + + + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0573, E0747. +For more information about an error, try `rustc --explain E0573`. diff --git a/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs new file mode 100644 index 00000000000..78bda28485d --- /dev/null +++ b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.rs @@ -0,0 +1,16 @@ +// Make sure the compiler does not ICE when trying to generate the debuginfo name of a type that +// causes a layout error. See https://github.com/rust-lang/rust/issues/94961. + +// compile-flags:-C debuginfo=2 +// build-fail +// error-pattern: too big for the current architecture +// normalize-stderr-64bit "18446744073709551615" -> "SIZE" +// normalize-stderr-32bit "4294967295" -> "SIZE" + +#![crate_type = "rlib"] + +pub struct Foo<T>([T; usize::MAX]); + +pub fn foo() -> usize { + std::mem::size_of::<Foo<u8>>() +} diff --git a/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr new file mode 100644 index 00000000000..851dca84c3d --- /dev/null +++ b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-1.stderr @@ -0,0 +1,4 @@ +error: values of the type `[u8; SIZE]` are too big for the current architecture + +error: aborting due to previous error + diff --git a/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs new file mode 100644 index 00000000000..fdc088dc0f9 --- /dev/null +++ b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.rs @@ -0,0 +1,20 @@ +// Make sure the compiler does not ICE when trying to generate the debuginfo name of a type that +// causes a layout error. +// This version of the test already ICE'd before the commit that introduce the ICE described in +// https://github.com/rust-lang/rust/issues/94961. + +// compile-flags:-C debuginfo=2 +// build-fail +// error-pattern: too big for the current architecture +// normalize-stderr-64bit "18446744073709551615" -> "SIZE" +// normalize-stderr-32bit "4294967295" -> "SIZE" + +#![crate_type = "rlib"] + +pub enum Foo<T> { + Bar([T; usize::MAX]), +} + +pub fn foo() -> usize { + std::mem::size_of::<Foo<u8>>() +} diff --git a/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr new file mode 100644 index 00000000000..851dca84c3d --- /dev/null +++ b/src/test/ui/debuginfo/debuginfo-type-name-layout-ice-94961-2.stderr @@ -0,0 +1,4 @@ +error: values of the type `[u8; SIZE]` are too big for the current architecture + +error: aborting due to previous error + diff --git a/src/test/ui/extern/extern-static-size-overflow.rs b/src/test/ui/extern/extern-static-size-overflow.rs index 30a0c445466..a96ce0cf47e 100644 --- a/src/test/ui/extern/extern-static-size-overflow.rs +++ b/src/test/ui/extern/extern-static-size-overflow.rs @@ -4,7 +4,7 @@ struct ReallyBig { } // The limit for "too big for the current architecture" is dependent on the target pointer size -// however it's artifically limited on 64 bits +// however it's artificially limited on 64 bits // logic copied from rustc_target::abi::TargetDataLayout::obj_size_bound() const fn max_size() -> usize { #[cfg(target_pointer_width = "16")] diff --git a/src/test/ui/feature-gates/feature-gate-deprecated_safe.rs b/src/test/ui/feature-gates/feature-gate-deprecated_safe.rs new file mode 100644 index 00000000000..d5f4a4705b9 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-deprecated_safe.rs @@ -0,0 +1,7 @@ +#[deprecated_safe(since = "TBD", note = "...")] //~ ERROR: the `#[deprecated_safe]` attribute is an experimental feature +unsafe fn deprecated_safe_fn() {} + +#[deprecated_safe(since = "TBD", note = "...")] //~ ERROR: the `#[deprecated_safe]` attribute is an experimental feature +unsafe trait DeprecatedSafeTrait {} + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-deprecated_safe.stderr b/src/test/ui/feature-gates/feature-gate-deprecated_safe.stderr new file mode 100644 index 00000000000..5e98a1faaa3 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-deprecated_safe.stderr @@ -0,0 +1,21 @@ +error[E0658]: the `#[deprecated_safe]` attribute is an experimental feature + --> $DIR/feature-gate-deprecated_safe.rs:1:1 + | +LL | #[deprecated_safe(since = "TBD", note = "...")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #94978 <https://github.com/rust-lang/rust/issues/94978> for more information + = help: add `#![feature(deprecated_safe)]` to the crate attributes to enable + +error[E0658]: the `#[deprecated_safe]` attribute is an experimental feature + --> $DIR/feature-gate-deprecated_safe.rs:4:1 + | +LL | #[deprecated_safe(since = "TBD", note = "...")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #94978 <https://github.com/rust-lang/rust/issues/94978> for more information + = help: add `#![feature(deprecated_safe)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/generator/issue-57017.rs b/src/test/ui/generator/issue-57017.rs new file mode 100644 index 00000000000..1223a3037ab --- /dev/null +++ b/src/test/ui/generator/issue-57017.rs @@ -0,0 +1,22 @@ +// check-pass +// compile-flags: -Zdrop-tracking +#![feature(generators, negative_impls)] + +struct Client; + +impl !Sync for Client {} + +fn status(_client_status: &Client) -> i16 { + 200 +} + +fn assert_send<T: Send>(_thing: T) {} + +// This is the same bug as issue 57017, but using yield instead of await +fn main() { + let client = Client; + let g = move || match status(&client) { + _status => yield, + }; + assert_send(g); +} diff --git a/src/test/ui/impl-trait/multiple-lifetimes.rs b/src/test/ui/impl-trait/multiple-lifetimes.rs index 92e5ea2f49d..5407fb6dd28 100644 --- a/src/test/ui/impl-trait/multiple-lifetimes.rs +++ b/src/test/ui/impl-trait/multiple-lifetimes.rs @@ -1,4 +1,4 @@ -// Test that multiple liftimes are allowed in impl trait types. +// Test that multiple lifetimes are allowed in impl trait types. // build-pass (FIXME(62277): could be check-pass?) trait X<'x>: Sized {} diff --git a/src/test/ui/parser/issues/issue-19398.stderr b/src/test/ui/parser/issues/issue-19398.stderr index 1da00960adf..f9c3ca763f2 100644 --- a/src/test/ui/parser/issues/issue-19398.stderr +++ b/src/test/ui/parser/issues/issue-19398.stderr @@ -4,10 +4,15 @@ error: expected `{`, found keyword `unsafe` LL | trait T { | - while parsing this item list starting here LL | extern "Rust" unsafe fn foo(); - | ^^^^^^ expected `{` + | --------------^^^^^^ + | | | + | | expected `{` + | help: `unsafe` must come before `extern "Rust"`: `unsafe extern "Rust"` LL | LL | } | - the item list ends here + | + = note: keyword order for functions declaration is `default`, `pub`, `const`, `async`, `unsafe`, `extern` error: aborting due to previous error |
