From cf94bdc0742c13e2a0cac864c478b8626b266e1b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/pretty/issue-4264.pp | 8 ++--- src/test/pretty/issue-85089.pp | 20 +++++++++++ src/test/pretty/issue-85089.rs | 16 +++++++++ src/test/pretty/raw-str-nonexpr.rs | 1 + src/test/pretty/tests-are-sorted.pp | 69 +++++++++++++++++++++++++++++++++++++ src/test/pretty/tests-are-sorted.rs | 13 +++++++ 6 files changed, 123 insertions(+), 4 deletions(-) create mode 100644 src/test/pretty/issue-85089.pp create mode 100644 src/test/pretty/issue-85089.rs create mode 100644 src/test/pretty/tests-are-sorted.pp create mode 100644 src/test/pretty/tests-are-sorted.rs (limited to 'src/test/pretty') diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp index 752c36a0f..18e6d75b1 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -32,12 +32,12 @@ fn bar() ({ ({ let res = ((::alloc::fmt::format as - for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1 + for<'a> fn(Arguments<'a>) -> String {format})(((::core::fmt::Arguments::new_v1 as - fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test" + fn(&[&'static str], &[ArgumentV1<'_>]) -> Arguments<'_> {Arguments::<'_>::new_v1})((&([("test" as &str)] as [&str; 1]) as &[&str; 1]), - (&([] as [ArgumentV1; 0]) as &[ArgumentV1; 0])) as - Arguments)) as String); + (&([] as [ArgumentV1<'_>; 0]) as &[ArgumentV1<'_>; 0])) as + Arguments<'_>)) as String); (res as String) } as String); } as ()) diff --git a/src/test/pretty/issue-85089.pp b/src/test/pretty/issue-85089.pp new file mode 100644 index 000000000..f84e9df04 --- /dev/null +++ b/src/test/pretty/issue-85089.pp @@ -0,0 +1,20 @@ +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +// Test to print lifetimes on HIR pretty-printing. + +// pretty-compare-only +// pretty-mode:hir +// pp-exact:issue-85089.pp + +trait A<'x> { } +trait B<'x> { } + +struct Foo<'b> { + bar: &'b dyn for<'a> A<'a>, +} + +impl <'a> B<'a> for dyn for<'b> A<'b> { } + +impl <'a> A<'a> for Foo<'a> { } diff --git a/src/test/pretty/issue-85089.rs b/src/test/pretty/issue-85089.rs new file mode 100644 index 000000000..eb45d4731 --- /dev/null +++ b/src/test/pretty/issue-85089.rs @@ -0,0 +1,16 @@ +// Test to print lifetimes on HIR pretty-printing. + +// pretty-compare-only +// pretty-mode:hir +// pp-exact:issue-85089.pp + +trait A<'x> {} +trait B<'x> {} + +struct Foo<'b> { + pub bar: &'b dyn for<'a> A<'a>, +} + +impl<'a> B<'a> for dyn for<'b> A<'b> {} + +impl<'a> A<'a> for Foo<'a> {} diff --git a/src/test/pretty/raw-str-nonexpr.rs b/src/test/pretty/raw-str-nonexpr.rs index 7af80979b..12440b5ae 100644 --- a/src/test/pretty/raw-str-nonexpr.rs +++ b/src/test/pretty/raw-str-nonexpr.rs @@ -1,3 +1,4 @@ +// needs-asm-support // pp-exact #[cfg(foo = r#"just parse this"#)] diff --git a/src/test/pretty/tests-are-sorted.pp b/src/test/pretty/tests-are-sorted.pp new file mode 100644 index 000000000..15dcd4ed9 --- /dev/null +++ b/src/test/pretty/tests-are-sorted.pp @@ -0,0 +1,69 @@ +#![feature(prelude_import)] +#![no_std] +#[prelude_import] +use ::std::prelude::rust_2015::*; +#[macro_use] +extern crate std; +// compile-flags: --crate-type=lib --test +// pretty-compare-only +// pretty-mode:expanded +// pp-exact:tests-are-sorted.pp + +extern crate test; +#[cfg(test)] +#[rustc_test_marker = "m_test"] +pub const m_test: test::TestDescAndFn = + test::TestDescAndFn { + desc: test::TestDesc { + name: test::StaticTestName("m_test"), + ignore: false, + ignore_message: ::core::option::Option::None, + compile_fail: false, + no_run: false, + should_panic: test::ShouldPanic::No, + test_type: test::TestType::Unknown, + }, + testfn: test::StaticTestFn(|| test::assert_test_result(m_test())), + }; +fn m_test() {} + +extern crate test; +#[cfg(test)] +#[rustc_test_marker = "z_test"] +pub const z_test: test::TestDescAndFn = + test::TestDescAndFn { + desc: test::TestDesc { + name: test::StaticTestName("z_test"), + ignore: false, + ignore_message: ::core::option::Option::None, + compile_fail: false, + no_run: false, + should_panic: test::ShouldPanic::No, + test_type: test::TestType::Unknown, + }, + testfn: test::StaticTestFn(|| test::assert_test_result(z_test())), + }; +fn z_test() {} + +extern crate test; +#[cfg(test)] +#[rustc_test_marker = "a_test"] +pub const a_test: test::TestDescAndFn = + test::TestDescAndFn { + desc: test::TestDesc { + name: test::StaticTestName("a_test"), + ignore: false, + ignore_message: ::core::option::Option::None, + compile_fail: false, + no_run: false, + should_panic: test::ShouldPanic::No, + test_type: test::TestType::Unknown, + }, + testfn: test::StaticTestFn(|| test::assert_test_result(a_test())), + }; +fn a_test() {} +#[rustc_main] +pub fn main() -> () { + extern crate test; + test::test_main_static(&[&a_test, &m_test, &z_test]) +} diff --git a/src/test/pretty/tests-are-sorted.rs b/src/test/pretty/tests-are-sorted.rs new file mode 100644 index 000000000..1f737d547 --- /dev/null +++ b/src/test/pretty/tests-are-sorted.rs @@ -0,0 +1,13 @@ +// compile-flags: --crate-type=lib --test +// pretty-compare-only +// pretty-mode:expanded +// pp-exact:tests-are-sorted.pp + +#[test] +fn m_test() {} + +#[test] +fn z_test() {} + +#[test] +fn a_test() {} -- cgit v1.2.3