public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Merge #1162 #1167 #1168 #1170
@ 2022-06-08 12:38 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:38 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ab845217887468b500b624f0837023122002c534
commit ab845217887468b500b624f0837023122002c534
Merge: d7c5bbe6af7 461bf1369fa 1d19dd8a691 3e01b6b2a87 d780b204d84
Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Date: Tue Apr 26 09:13:40 2022 +0000
Merge #1162 #1167 #1168 #1170
1162: CI: catch malformed test cases r=philberty a=liushuyu
- catch malformed test cases and use GitHub Actions' annotation feature to mark the failures
1167: Fix nullptr when resolving the root of a path expression r=philberty a=philberty
When we resolve paths we don't have a _type_, in this scenario there is a
bug in our resolution of this generic function so this means the root_tyty
is nullptr but the offset is non zero so we return nullptr.
Addresses #1132
This test case no longer ICE's but still fails. I have a fix in progress for this
```rust
mod mem {
extern "rust-intrinsic" {
fn transmute<U, V>(_: U) -> V;
}
}
pub trait Hasher {
fn write(&mut self, bytes: &[u8]);
fn write_u16(&mut self, i: u16) {
self.write(&mem::transmute::<_, [u8; 2]>(i))
}
}
pub struct SipHasher;
impl Hasher for SipHasher {
#[inline]
fn write(&mut self, msg: &[u8]) {}
}
```
1168: ast: resolve: Move ResolveItem into its own source file r=CohenArthur a=CohenArthur
Since we need to add new functions to resolve visibilities, we might as well refactor this file before hand :)
1170: Implement macro expansion in `IfExpr`, `IfExprConseqElse`, `IfExprConseqIf`, `IfExprConseqIfLet`. r=CohenArthur a=antego
Addresses #1141. Following up on #1161.
This change adds support for the macros inside the `if` condition expressions.
Things to note:
1. Judging by my research, the `IfExprConseqIfLet` isn't used. The parser treats the syntax `let var = if ...` as a `let` expression followed by `if` expression:
![Screen Shot 2022-04-26 at 9 47 29 am](https://user-images.githubusercontent.com/1451467/165258060-6a42f918-2585-4aef-9da5-9d60d69ca248.png)
2. I didn't add the macro expansion to the `IfLetExpr...` family of expressions because I wasn't able to write a test case reproducing the missing macro expansion. I've tried the following code
```rust
fn main() -> i32 {
let mut res = 0;
enum E {
X(u8),
Y(u8),
Z(u8),
}
let v = E::Y(12);
if let E::Y(n) = v {
res = 1;
}
0
}
```
which caused the compiler error
```
FAIL: rust/compile/macro43.rs (internal compiler error: in append_reference_for_def, at rust/resolve/rust-name-resolver.h:227)
```
Co-authored-by: liushuyu <liushuyu011@gmail.com>
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Co-authored-by: antego <antego@users.noreply.github.com>
Diff:
.github/emit_test_errors.pl | 25 +
.github/workflows/ccpp.yml | 13 +-
gcc/rust/Make-lang.in | 1 +
gcc/rust/expand/rust-attribute-visitor.cc | 12 +
gcc/rust/resolve/rust-ast-resolve-item.cc | 952 +++++++++++++++++++++++++
gcc/rust/resolve/rust-ast-resolve-item.h | 923 +-----------------------
gcc/rust/typecheck/rust-hir-type-check-path.cc | 2 +-
gcc/testsuite/rust/compile/macro42.rs | 31 +
8 files changed, 1059 insertions(+), 900 deletions(-)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:38 [gcc/devel/rust/master] Merge #1162 #1167 #1168 #1170 Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).