From 9030b704214d4b63f56498ee2af4c190a5287ac6 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Wed, 11 Oct 2023 19:38:03 -0400 Subject: [PATCH 1/4] Update libgccjit --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 85675fc40c3..b8e2e5d8080 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -74,7 +74,7 @@ dependencies = [ [[package]] name = "gccjit" version = "1.0.0" -source = "git+https://github.com/antoyo/gccjit.rs#0b158c68bf7e46732869d90550a98e886dee8858" +source = "git+https://github.com/antoyo/gccjit.rs#c52a218f5529321285b4489e5562a00e5428e033" dependencies = [ "gccjit_sys", ] @@ -82,7 +82,7 @@ dependencies = [ [[package]] name = "gccjit_sys" version = "0.0.1" -source = "git+https://github.com/antoyo/gccjit.rs#0b158c68bf7e46732869d90550a98e886dee8858" +source = "git+https://github.com/antoyo/gccjit.rs#c52a218f5529321285b4489e5562a00e5428e033" dependencies = [ "libc", ] From 100dfced2067925df97cf203d696559be5c828b9 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Wed, 11 Oct 2023 20:55:32 -0400 Subject: [PATCH 2/4] Fix #[inline(always)] attribute --- src/attributes.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/attributes.rs b/src/attributes.rs index 971e019a4f6..6159971cfaa 100644 --- a/src/attributes.rs +++ b/src/attributes.rs @@ -53,6 +53,9 @@ pub fn from_fn_attrs<'gcc, 'tcx>( codegen_fn_attrs.inline }; if let Some(attr) = inline_attr(cx, inline) { + if let FnAttribute::AlwaysInline = attr { + func.add_attribute(FnAttribute::Inline); + } func.add_attribute(attr); } From e3998b2d4633705eb4da278dcf5127f273e388ea Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Thu, 12 Oct 2023 17:06:29 -0400 Subject: [PATCH 3/4] Handle unsigned comparison for signed integers --- src/int.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/int.rs b/src/int.rs index 58e0dd56f38..5719f6a8cf5 100644 --- a/src/int.rs +++ b/src/int.rs @@ -415,6 +415,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { IntPredicate::IntNE => { return self.context.new_comparison(None, ComparisonOp::NotEquals, cmp, self.context.new_rvalue_one(self.int_type)); }, + // TODO(antoyo): cast to u128 for unsigned comparison. See below. IntPredicate::IntUGT => (ComparisonOp::Equals, 2), IntPredicate::IntUGE => (ComparisonOp::GreaterThanEquals, 1), IntPredicate::IntULT => (ComparisonOp::Equals, 0), @@ -444,6 +445,18 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { rhs = self.context.new_cast(None, rhs, a_type); } } + match op { + IntPredicate::IntUGT | IntPredicate::IntUGE | IntPredicate::IntULT | IntPredicate::IntULE => { + if !a_type.is_vector() { + let unsigned_type = a_type.to_unsigned(&self.cx); + lhs = self.context.new_cast(None, lhs, unsigned_type); + rhs = self.context.new_cast(None, rhs, unsigned_type); + } + }, + // TODO(antoyo): we probably need to handle signed comparison for unsigned + // integers. + _ => (), + } self.context.new_comparison(None, op.to_gcc_comparison(), lhs, rhs) } } From e2f32c72a7a6ad3b1ba971416d86c6eca1096a36 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Tue, 17 Oct 2023 07:57:56 -0400 Subject: [PATCH 4/4] Ignore failing test This test only fails with non-native 128-bit integers, but it will also fail with native 128-bit integers if we copy/paste it so that it's executed twice. Interestingly, wrapping the test in a loop won't make it fail. So, it could be due to stack space or unwinding in release mode. Also, the test only fails with -O2: ../cargo.sh rustc --bin test-rust -- -O It doesn't fail with -O3. --- doc/tests.md | 5 +++++ failing-ui-tests.txt | 1 + 2 files changed, 6 insertions(+) create mode 100644 doc/tests.md diff --git a/doc/tests.md b/doc/tests.md new file mode 100644 index 00000000000..3ac993bc2fd --- /dev/null +++ b/doc/tests.md @@ -0,0 +1,5 @@ +# Tests + +## Show the rustc command for UI tests + +Add ` --test-args "--verbose"` to `./x.py test`. diff --git a/failing-ui-tests.txt b/failing-ui-tests.txt index ed56a11a170..771da581295 100644 --- a/failing-ui-tests.txt +++ b/failing-ui-tests.txt @@ -71,3 +71,4 @@ tests/ui/lto/all-crates.rs tests/ui/async-await/deep-futures-are-freeze.rs tests/ui/closures/capture-unsized-by-ref.rs tests/ui/generator/resume-after-return.rs +tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs