summaryrefslogtreecommitdiffstats
path: root/tests/incremental
diff options
context:
space:
mode:
Diffstat (limited to 'tests/incremental')
-rw-r--r--tests/incremental/const-generics/hash-tyvid-regression-1.rs14
-rw-r--r--tests/incremental/const-generics/hash-tyvid-regression-2.rs16
-rw-r--r--tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-3.rs13
-rw-r--r--tests/incremental/hashes/match_expressions.rs1
-rw-r--r--tests/incremental/issue-101518.rs13
-rw-r--r--tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs90
-rw-r--r--tests/incremental/issue-110457-same-span-closures/main.rs47
7 files changed, 180 insertions, 14 deletions
diff --git a/tests/incremental/const-generics/hash-tyvid-regression-1.rs b/tests/incremental/const-generics/hash-tyvid-regression-1.rs
index 5ff7b19d8..06d674234 100644
--- a/tests/incremental/const-generics/hash-tyvid-regression-1.rs
+++ b/tests/incremental/const-generics/hash-tyvid-regression-1.rs
@@ -1,8 +1,20 @@
// revisions: cfail
#![feature(generic_const_exprs, adt_const_params)]
#![allow(incomplete_features)]
+
+use std::marker::ConstParamTy;
+
+#[derive(PartialEq, Eq, ConstParamTy)]
+struct NonZeroUsize(usize);
+
+impl NonZeroUsize {
+ const fn get(self) -> usize {
+ self.0
+ }
+}
+
// regression test for #77650
-fn c<T, const N: std::num::NonZeroUsize>()
+fn c<T, const N: NonZeroUsize>()
where
[T; N.get()]: Sized,
{
diff --git a/tests/incremental/const-generics/hash-tyvid-regression-2.rs b/tests/incremental/const-generics/hash-tyvid-regression-2.rs
index 5cdd43cd7..33f226ff6 100644
--- a/tests/incremental/const-generics/hash-tyvid-regression-2.rs
+++ b/tests/incremental/const-generics/hash-tyvid-regression-2.rs
@@ -1,11 +1,23 @@
// revisions: cfail
#![feature(generic_const_exprs, adt_const_params)]
#![allow(incomplete_features)]
+
+use std::marker::ConstParamTy;
+
+#[derive(PartialEq, Eq, ConstParamTy)]
+struct NonZeroUsize(usize);
+
+impl NonZeroUsize {
+ const fn get(self) -> usize {
+ self.0
+ }
+}
+
// regression test for #77650
-struct C<T, const N: core::num::NonZeroUsize>([T; N.get()])
+struct C<T, const N: NonZeroUsize>([T; N.get()])
where
[T; N.get()]: Sized;
-impl<'a, const N: core::num::NonZeroUsize, A, B: PartialEq<A>> PartialEq<&'a [A]> for C<B, N>
+impl<'a, const N: NonZeroUsize, A, B: PartialEq<A>> PartialEq<&'a [A]> for C<B, N>
where
[B; N.get()]: Sized,
{
diff --git a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-3.rs b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-3.rs
index fc114f224..f1c108fed 100644
--- a/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-3.rs
+++ b/tests/incremental/const-generics/try_unify_abstract_const_regression_tests/issue-77708-3.rs
@@ -2,7 +2,18 @@
#![feature(generic_const_exprs, adt_const_params)]
#![allow(incomplete_features)]
-use std::{convert::TryFrom, num::NonZeroUsize};
+use std::{convert::TryFrom};
+
+use std::marker::ConstParamTy;
+
+#[derive(PartialEq, Eq, ConstParamTy)]
+struct NonZeroUsize(usize);
+
+impl NonZeroUsize {
+ const fn get(self) -> usize {
+ self.0
+ }
+}
struct A<const N: NonZeroUsize>([u8; N.get()])
where
diff --git a/tests/incremental/hashes/match_expressions.rs b/tests/incremental/hashes/match_expressions.rs
index 4429df683..4d1b3b683 100644
--- a/tests/incremental/hashes/match_expressions.rs
+++ b/tests/incremental/hashes/match_expressions.rs
@@ -225,6 +225,7 @@ pub fn change_mutability_of_binding_in_pattern(x: u32) -> u32 {
}
}
+// Ignore optimized_mir in cfail2, the only change to optimized MIR is a span.
#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2", except="hir_owner_nodes,optimized_mir,typeck")]
#[rustc_clean(cfg="cfail3")]
diff --git a/tests/incremental/issue-101518.rs b/tests/incremental/issue-101518.rs
index 501be175f..39373da6a 100644
--- a/tests/incremental/issue-101518.rs
+++ b/tests/incremental/issue-101518.rs
@@ -1,7 +1,4 @@
-// revisions: cfail1
-// should-ice
-// error-pattern: forcing query
-// known-bug: #101518
+// revisions: cpass
#[derive(PartialEq, Eq)]
struct Id<'a> {
@@ -9,9 +6,7 @@ struct Id<'a> {
}
fn visit_struct() {
let id = Id { ns: "random1" };
- const FLAG: Id<'static> = Id {
- ns: "needs_to_be_the_same",
- };
+ const FLAG: Id<'static> = Id { ns: "needs_to_be_the_same" };
match id {
FLAG => {}
_ => {}
@@ -19,9 +14,7 @@ fn visit_struct() {
}
fn visit_struct2() {
let id = Id { ns: "random2" };
- const FLAG: Id<'static> = Id {
- ns: "needs_to_be_the_same",
- };
+ const FLAG: Id<'static> = Id { ns: "needs_to_be_the_same" };
match id {
FLAG => {}
_ => {}
diff --git a/tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs b/tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs
new file mode 100644
index 000000000..e7d91235e
--- /dev/null
+++ b/tests/incremental/issue-110457-same-span-closures/auxiliary/egui_inspect_derive.rs
@@ -0,0 +1,90 @@
+// force-host
+// no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
+
+#[proc_macro]
+pub fn expand(_: TokenStream) -> TokenStream {
+ // Hand expansion/rewriting of
+ // ```
+ // quote! {
+ // output_mut(|o| o.copied_text = "".into());
+ // output_mut(|o| o.copied_text = format!("{:?}", self.tile_db));
+ // }.into()
+ // ```
+ stream([
+ ident("output_mut"),
+ group(
+ Delimiter::Parenthesis,
+ [
+ or(),
+ ident("o"),
+ or(),
+ ident("o"),
+ dot(),
+ ident("copied_text"),
+ eq(),
+ string(""),
+ dot(),
+ ident("into"),
+ group(Delimiter::Parenthesis, []),
+ ],
+ ),
+ semi(),
+ ident("output_mut"),
+ group(
+ Delimiter::Parenthesis,
+ [
+ or(),
+ ident("o"),
+ or(),
+ ident("o"),
+ dot(),
+ ident("copied_text"),
+ eq(),
+ ident("format"),
+ bang(),
+ group(
+ Delimiter::Parenthesis,
+ [string("{:?}"), comma(), ident("self"), dot(), ident("tile_db")],
+ ),
+ ],
+ ),
+ semi(),
+ ])
+}
+
+fn stream(s: impl IntoIterator<Item = TokenTree>) -> TokenStream {
+ s.into_iter().collect()
+}
+
+fn ident(i: &str) -> TokenTree {
+ TokenTree::Ident(Ident::new(i, Span::call_site()))
+}
+fn group(d: Delimiter, s: impl IntoIterator<Item = TokenTree>) -> TokenTree {
+ TokenTree::Group(Group::new(d, s.into_iter().collect()))
+}
+fn semi() -> TokenTree {
+ TokenTree::Punct(Punct::new(';', Spacing::Alone))
+}
+fn or() -> TokenTree {
+ TokenTree::Punct(Punct::new('|', Spacing::Alone))
+}
+fn dot() -> TokenTree {
+ TokenTree::Punct(Punct::new('.', Spacing::Alone))
+}
+fn eq() -> TokenTree {
+ TokenTree::Punct(Punct::new('=', Spacing::Alone))
+}
+fn bang() -> TokenTree {
+ TokenTree::Punct(Punct::new('!', Spacing::Alone))
+}
+fn comma() -> TokenTree {
+ TokenTree::Punct(Punct::new(',', Spacing::Alone))
+}
+fn string(s: &str) -> TokenTree {
+ TokenTree::Literal(Literal::string(s))
+}
diff --git a/tests/incremental/issue-110457-same-span-closures/main.rs b/tests/incremental/issue-110457-same-span-closures/main.rs
new file mode 100644
index 000000000..b44fda3d3
--- /dev/null
+++ b/tests/incremental/issue-110457-same-span-closures/main.rs
@@ -0,0 +1,47 @@
+// aux-build: egui_inspect_derive.rs
+// revisions: cpass1 cpass2
+
+extern crate egui_inspect_derive;
+
+pub struct TileDef {
+ pub layer: (),
+ #[cfg(cpass2)]
+ pub blend_graphic: String,
+}
+
+pub(crate) struct GameState {
+ pub(crate) tile_db: TileDb,
+}
+
+impl GameState {
+ fn inspect_mut(&mut self) {
+ egui_inspect_derive::expand! {}
+ }
+}
+
+fn new() -> GameState {
+ loop {}
+}
+
+fn main() {
+ let mut app = new();
+ app.inspect_mut();
+}
+// this is actually used
+pub struct TileDb {
+ unknown_bg: TileDef,
+}
+
+impl std::fmt::Debug for TileDb {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ loop {}
+ }
+}
+
+pub struct PlatformOutput {
+ pub copied_text: String,
+}
+
+pub fn output_mut<R>(writer: impl FnOnce(&mut PlatformOutput) -> R) -> R {
+ loop {}
+}