Skip to content

Ci improvements #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1908504
Fix type confusion in coercion
jdupak Oct 2, 2023
c7728c8
Removed unnecessary comments
rizan21 Oct 4, 2023
10fd060
Fix parser bug on tupplestruct pattern
jdupak Oct 5, 2023
007166c
Add test for parser bug
jdupak Oct 5, 2023
7292e71
gccrs: minor changes (typo and minor refactor)
dkm Oct 13, 2023
464cfa5
Adjust methods for TuplePatternItems to match TupleStructItems
powerboat9 Oct 3, 2023
288536f
Rename cloning methods in TupleStructItems and TuplePatternItems
powerboat9 Oct 7, 2023
b6a420f
gccrs: Initial implementation of v0 mangling
tamaroning Aug 8, 2023
08396ed
Change debug log call to as_string function
P-E-P Oct 9, 2023
a87e147
Fix type param bound parsing with opening scope
P-E-P Oct 9, 2023
522528b
Add a regression test for global path parsing
P-E-P Oct 10, 2023
e3fcc88
TyTy: TyTy improved subclass casting and checking
jdupak Oct 3, 2023
2b4eb39
TyTy: use new subclass API
jdupak Oct 5, 2023
1815409
Fix pub unit type parsing
P-E-P Oct 16, 2023
9d0a073
Add regression test
P-E-P Oct 16, 2023
abb2703
Add comma for expr delimiter to fix match arms
P-E-P Oct 11, 2023
9ddb362
Add regression test
P-E-P Oct 11, 2023
c82bbb0
Replace get_pattern_node_id with get_node_id
powerboat9 Oct 11, 2023
0ad1096
Fix path expr segment parsing with generic path
P-E-P Oct 10, 2023
ba0fb41
Add a new regression test
P-E-P Oct 10, 2023
948523a
Allow call to macro named "default" at item level
P-E-P Oct 10, 2023
6658219
Add a new regression test for macro call "default"
P-E-P Oct 10, 2023
66aa179
Fix RangeFromExpr parsing in for loops
P-E-P Oct 10, 2023
442008f
Add a new regression test
P-E-P Oct 10, 2023
0abe96a
Add new regression test
P-E-P Oct 16, 2023
3e3180a
Allow macro named macro_rules
P-E-P Oct 10, 2023
9762e09
Add new regression test
P-E-P Oct 10, 2023
c3b68b5
Add a new test for mbe named macro_rules
P-E-P Oct 17, 2023
94b1ff7
Add path to macro fragment follow restrictions
P-E-P Oct 16, 2023
813d0b9
Add new regression test for macro matcher behavior
P-E-P Oct 16, 2023
0af6a9f
Break OR tokens in closure parameter list context
P-E-P Oct 10, 2023
25eb53d
Add new test for closure in closure parsing
P-E-P Oct 10, 2023
b3f02d9
gccrs: Add tests for v0 mangling
tamaroning Sep 22, 2023
cdd548b
Create base class AssociatedItem
powerboat9 Oct 11, 2023
ee60ec5
ast: Parse labelled block
jdupak Oct 16, 2023
483cb84
hir: Lower labelled block
jdupak Oct 16, 2023
155458a
resolve: Resolve labelled block
jdupak Oct 16, 2023
8ad5830
typecheck: add loop ctx for labelled block
jdupak Oct 16, 2023
9a53cb5
compile: bail on labelled block
jdupak Oct 16, 2023
2ef9814
Make lowering of AssociatedItem instances polymorphic
powerboat9 Oct 11, 2023
4931eb8
Make resolution of AssociatedItem instances polymorphic
powerboat9 Oct 11, 2023
8c7bc53
hir: Refactor - avoid copy in getter
jdupak Oct 17, 2023
ef4d1a8
ast: Handle tuplestruct pattern with indices
jdupak Oct 17, 2023
a6c535d
hir: Add missing getter
jdupak Oct 17, 2023
ba10e40
hir: Rename get_pattern_mappings method
jdupak Oct 17, 2023
2e3e600
hir: Rename ComoundAssignment getters
jdupak Oct 17, 2023
af3071f
hir: Avoid copy in getter (PathPattern)
jdupak Oct 17, 2023
4f0da0e
Parse const with no value expression
P-E-P Oct 23, 2023
eb393ac
Add a new regression test for issue 2665
P-E-P Oct 23, 2023
9a8b3ea
Fix warning with overridden virtual methods
P-E-P Oct 23, 2023
199a402
CI: cancel run if a new version of PR was pushed
jdupak Oct 28, 2023
c3f2997
CI: use sccache for non-boostrap CI builds
jdupak Oct 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ on:
branches: [ master ]
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build-and-check-ubuntu-64bit:

env:
# Force locale, in particular for reproducible results re '.github/bors_log_expected_warnings' (see below).
LC_ALL: C.UTF-8
SCCACHE_GHA_ENABLED: "true"

runs-on: ubuntu-22.04

Expand All @@ -39,11 +44,14 @@ jobs:
g++-multilib \
dejagnu

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Configure
run: |
mkdir -p gccrs-build;
cd gccrs-build;
../configure \
../configure CC="sccache gcc" CXX="sccache g++" \
--enable-languages=rust \
--disable-bootstrap \
--enable-multilib
Expand All @@ -54,6 +62,10 @@ jobs:
cd gccrs-build; \
make -Otarget -j $(nproc) 2>&1 | tee log

- name: Show sccache stats
shell: bash
run: ${SCCACHE_PATH} --show-stats

- name: Check for new warnings
run: |
cd gccrs-build
Expand Down
5 changes: 3 additions & 2 deletions gcc/rust/ast/rust-ast-builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ std::unique_ptr<Expr>
AstBuilder::block (std::vector<std::unique_ptr<Stmt>> &&stmts,
std::unique_ptr<Expr> &&tail_expr)
{
return std::unique_ptr<Expr> (
new BlockExpr (std::move (stmts), std::move (tail_expr), {}, {}, loc, loc));
return std::unique_ptr<Expr> (new BlockExpr (std::move (stmts),
std::move (tail_expr), {}, {},
LoopLabel::error (), loc, loc));
}

std::unique_ptr<Stmt>
Expand Down
65 changes: 32 additions & 33 deletions gcc/rust/ast/rust-ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ class Pattern : public Visitable
virtual bool is_marked_for_strip () const { return false; }

virtual location_t get_locus () const = 0;
virtual NodeId get_pattern_node_id () const = 0;
virtual NodeId get_node_id () const = 0;

protected:
// Clone pattern implementation as pure virtual method
Expand Down Expand Up @@ -1446,82 +1446,81 @@ class LifetimeParam : public GenericParam
}
};

class AssociatedItem : public Visitable
{
protected:
// Clone function implementation as pure virtual method
virtual AssociatedItem *clone_associated_item_impl () const = 0;

public:
virtual ~AssociatedItem () {}

std::unique_ptr<AssociatedItem> clone_associated_item () const
{
return std::unique_ptr<AssociatedItem> (clone_associated_item_impl ());
}

virtual std::string as_string () const = 0;

virtual void mark_for_strip () = 0;
virtual bool is_marked_for_strip () const = 0;

virtual location_t get_locus () const = 0;
};

// Item used in trait declarations - abstract base class
class TraitItem : public Visitable
class TraitItem : virtual public AssociatedItem
{
protected:
TraitItem (location_t locus)
: node_id (Analysis::Mappings::get ()->get_next_node_id ()), locus (locus)
{}

// Clone function implementation as pure virtual method
virtual TraitItem *clone_trait_item_impl () const = 0;
virtual TraitItem *clone_associated_item_impl () const override = 0;

NodeId node_id;
location_t locus;

public:
virtual ~TraitItem () {}

// Unique pointer custom clone function
std::unique_ptr<TraitItem> clone_trait_item () const
{
return std::unique_ptr<TraitItem> (clone_trait_item_impl ());
return std::unique_ptr<TraitItem> (clone_associated_item_impl ());
}

virtual std::string as_string () const = 0;

virtual void mark_for_strip () = 0;
virtual bool is_marked_for_strip () const = 0;

NodeId get_node_id () const { return node_id; }
location_t get_locus () const { return locus; }
};

/* Abstract base class for items used within an inherent impl block (the impl
* name {} one) */
class InherentImplItem : public Visitable
class InherentImplItem : virtual public AssociatedItem
{
protected:
// Clone function implementation as pure virtual method
virtual InherentImplItem *clone_inherent_impl_item_impl () const = 0;
virtual InherentImplItem *clone_associated_item_impl () const override = 0;

public:
virtual ~InherentImplItem () {}

// Unique pointer custom clone function
std::unique_ptr<InherentImplItem> clone_inherent_impl_item () const
{
return std::unique_ptr<InherentImplItem> (clone_inherent_impl_item_impl ());
return std::unique_ptr<InherentImplItem> (clone_associated_item_impl ());
}

virtual std::string as_string () const = 0;

virtual void mark_for_strip () = 0;
virtual bool is_marked_for_strip () const = 0;

virtual location_t get_locus () const = 0;
};

// Abstract base class for items used in a trait impl
class TraitImplItem : public Visitable
class TraitImplItem : virtual public AssociatedItem
{
protected:
virtual TraitImplItem *clone_trait_impl_item_impl () const = 0;
virtual TraitImplItem *clone_associated_item_impl () const override = 0;

public:
virtual ~TraitImplItem (){};

// Unique pointer custom clone function
std::unique_ptr<TraitImplItem> clone_trait_impl_item () const
{
return std::unique_ptr<TraitImplItem> (clone_trait_impl_item_impl ());
return std::unique_ptr<TraitImplItem> (clone_associated_item_impl ());
}

virtual std::string as_string () const = 0;

virtual void mark_for_strip () = 0;
virtual bool is_marked_for_strip () const = 0;
};

// Abstract base class for an item used inside an extern block
Expand Down
76 changes: 41 additions & 35 deletions gcc/rust/ast/rust-expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,36 @@ namespace AST {
* "has_whatever" pairs with
* optional types (std::optional or boost::optional)? */

// Loop label expression AST node used with break and continue expressions
// TODO: inline?
class LoopLabel /*: public Node*/
{
Lifetime label; // or type LIFETIME_OR_LABEL
location_t locus;

NodeId node_id;

public:
std::string as_string () const;

LoopLabel (Lifetime loop_label, location_t locus = UNDEF_LOCATION)
: label (std::move (loop_label)), locus (locus),
node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}

// Returns whether the LoopLabel is in an error state.
bool is_error () const { return label.is_error (); }

// Creates an error state LoopLabel.
static LoopLabel error () { return LoopLabel (Lifetime::error ()); }

location_t get_locus () const { return locus; }

Lifetime &get_lifetime () { return label; }

NodeId get_node_id () const { return node_id; }
};

// AST node for an expression with an accompanying block - abstract
class ExprWithBlock : public Expr
{
Expand Down Expand Up @@ -2396,6 +2426,7 @@ class BlockExpr : public ExprWithBlock
std::vector<Attribute> inner_attrs;
std::vector<std::unique_ptr<Stmt> > statements;
std::unique_ptr<Expr> expr;
LoopLabel label;
location_t start_locus;
location_t end_locus;
bool marked_for_strip = false;
Expand All @@ -2412,19 +2443,21 @@ class BlockExpr : public ExprWithBlock
BlockExpr (std::vector<std::unique_ptr<Stmt> > block_statements,
std::unique_ptr<Expr> block_expr,
std::vector<Attribute> inner_attribs,
std::vector<Attribute> outer_attribs, location_t start_locus,
location_t end_locus)
std::vector<Attribute> outer_attribs, LoopLabel label,
location_t start_locus, location_t end_locus)
: outer_attrs (std::move (outer_attribs)),
inner_attrs (std::move (inner_attribs)),
statements (std::move (block_statements)), expr (std::move (block_expr)),
start_locus (start_locus), end_locus (end_locus)
label (std::move (label)), start_locus (start_locus),
end_locus (end_locus)
{}

// Copy constructor with clone
BlockExpr (BlockExpr const &other)
: ExprWithBlock (other), outer_attrs (other.outer_attrs),
inner_attrs (other.inner_attrs), start_locus (other.start_locus),
end_locus (other.end_locus), marked_for_strip (other.marked_for_strip)
inner_attrs (other.inner_attrs), label (other.label),
start_locus (other.start_locus), end_locus (other.end_locus),
marked_for_strip (other.marked_for_strip)
{
// guard to protect from null pointer dereference
if (other.expr != nullptr)
Expand Down Expand Up @@ -2524,6 +2557,9 @@ class BlockExpr : public ExprWithBlock
outer_attrs = std::move (new_attrs);
}

bool has_label () { return !label.is_error (); }
LoopLabel &get_label () { return label; }

protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
Expand Down Expand Up @@ -3352,36 +3388,6 @@ class UnsafeBlockExpr : public ExprWithBlock
}
};

// Loop label expression AST node used with break and continue expressions
// TODO: inline?
class LoopLabel /*: public Node*/
{
Lifetime label; // or type LIFETIME_OR_LABEL
location_t locus;

NodeId node_id;

public:
std::string as_string () const;

LoopLabel (Lifetime loop_label, location_t locus = UNDEF_LOCATION)
: label (std::move (loop_label)), locus (locus),
node_id (Analysis::Mappings::get ()->get_next_node_id ())
{}

// Returns whether the LoopLabel is in an error state.
bool is_error () const { return label.is_error (); }

// Creates an error state LoopLabel.
static LoopLabel error () { return LoopLabel (Lifetime::error ()); }

location_t get_locus () const { return locus; }

Lifetime &get_lifetime () { return label; }

NodeId get_node_id () const { return node_id; }
};

// Base loop expression AST node - aka LoopExpr
class BaseLoopExpr : public ExprWithBlock
{
Expand Down
Loading