Age | Commit message (Collapse) | Author | Files | Lines |
|
When we construct a union, we were wrongly compiling the constructor
without taking into account the associated union index. This means we ended
up trying to coerce the wrong field which was always zero here which
resulted in a silent failure by returning error mark node.
The offending test case was: gcc/testsuite/execute/torture/slice1.rs
|
|
|
|
1217: Fix size used in unsized adjustments r=philberty a=philberty
When we coerce from an array to a slice we take the full capacity of the
array as the size to the FatPtr slice object but this was off by one. This
The TYPE_MAX_VALUE is not the correct method of accessing this but instead
it needs to take into account other values to get the correct HOST_WIDE_INT
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
|
|
This also fixes the missing kind in HIR::Visibility.
Having both `pub` and `pub restricted` as a single variant in the
HIR::Visibility::Kind enum was a mistake, as it cause the path resolver to
be triggered for `pub` visibilities which do not refer to any paths.
Finally, erroneous calls to Visibility::create_error() are removed.
This caused a lot of ICEs now that the Visibility lowering logic is
fixed
|
|
When we coerce from an array to a slice we take the full capacity of the
array as the size to the FatPtr slice object but this was off by one. This
The TYPE_MAX_VALUE is not the correct method of accessing this but instead
it needs to take into account other values to get the correct HOST_WIDE_INT
|
|
|
|
|
|
OBJ_TYPE_REF's are the gcc nodes that signify that this is a virtual call
which gives a hint to the optimizers for devirtualization.
Fixes #996
Fixes #854
|
|
1206: Use correct format specifiers for unisnged HOST_WIDE_INT r=philberty a=philberty
The code here was wrongly assuming the unsigned long interface which is not
correctly for all targets.
1209: Allow match on boolean expressions r=philberty a=dafaust
Enables compiling `match` expressions where the scrutinee is a boolean expression. Also enable compiling match arms with Literal patterns, since `true` and `false` literals are commonly used with matches on boolean expressions.
Fixes: #1207
1211: Preserve inside_loop context when type checking match r=philberty a=dafaust
Previously, we would lose the context of being inside a loop when compiling a `match`.
This would lead to incorrect error messages like "cannot 'break' outside of a loop" when
trying to break out of a loop from within a `match` expression.
Fixes: #1196
1212: intrinsic: add breakpoint intrinsic r=philberty a=liushuyu
- intrinsic: add breakpoint intrinsic
Addresses #658
1213: intrinsic: add rotate_left and rotate_right intrinsic r=philberty a=liushuyu
- intrinsic: add rotate_left and rotate_right intrinsic
Address #658
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Co-authored-by: David Faust <david.faust@oracle.com>
Co-authored-by: liushuyu <liushuyu011@gmail.com>
|
|
|
|
|
|
|
|
|
|
The code here was wrongly assuming the unsigned long interface which is not
correcty for all targets.
|
|
|
|
1197: Support recursive coercion sites r=philberty a=philberty
There are two changes are part of this PR one where we update the address_expression
helper to take a ptrtype tree. Since the default build_address_expr_loc was automatically
building a pointer type of the TREE_TYPE of the operand which is not correct since we
sometimes want REFERENCE_TYPES instead of POINTER_TYPES.
The 2nd commit enhances the coercion_site code to recursively walk the tree and their
types to handle coercions to dyn traits or do array bounds checking etc. This gets rid of
the get_root hack used and cleans up the code in general.
Fixes #1146
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
|
|
1199: Add new as_name interface for Dynamic types r=philberty a=philberty
The Gimple names of our dyn trait objects were looking like:
const struct dyn [HIR Trait: FnLike->[C: 0 Nid: 31 Hid: 38 Lid: 13] [(FN call ), ]<Self, &isize, &isize>] & const f
This is a horrible name but useful for debugging this patch fixes this so
we have a seperate naming for generating the type. So now it looks like:
const struct dyn [FnLike<Self, &isize, &isize>] & const f
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
|
|
1201: Generic functions should not be TREE_PUBLIC r=philberty a=philberty
Generic functions cannot be public since the symbols could overlap in
linking other crates reusing the same generic. The other benefit here is
that when optimizations are turned on we can eliminate more code since the
symbol does not _need_ to be public.
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
|
|
1191: Resolve simple paths in use items r=CohenArthur a=CohenArthur
In order to resolve `SimplePath`s, we have to expand all paths present
in a `UseDeclaration` and resolve them. For example, we want to resolve
two paths with the following statement `use foo::bar::{baz, bul}`:
`foo::bar::baz` and `foo::bar::bul`
This also removes the prelude inclusion (`use std::prelude::v1::*`)
since we cannot resolve it (yet!)
Needs #1172 to compile
Adresses #1159
Adresses #1187
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
|
|
Co-authored-by: CohenArthur <cohenarthur.dev@gmail.com>
|
|
Generic functions cannot be public since the symbols could overlap in
linking other crates reusing the same generic. The other benifit here is
that when optimizations are turned on we can eliminate more code since the
symbol does not _need_ to be public.
|
|
Follow-up for #1161
|
|
The Gimple names of our dyn trait objects were looking like:
const struct dyn [HIR Trait: FnLike->[C: 0 Nid: 31 Hid: 38 Lid: 13] [(FN call ), ]<Self, &isize, &isize>] & const f
This is a horrible name but useful for debugging this patch fixes this so
we have a seperate naming for generating the type. So now it looks like:
const struct dyn [FnLike<Self, &isize, &isize>] & const f
|
|
Our code for coercion sites are handled in two places once where we do the
type-checking portion and one where we do the code-generation. This makes
the code-generation piece recursive so that we apply the behaviours
consistantly when types need checked or converted.
Fixes #1146
|
|
|
|
1188: Support align and packed repr layout on structs r=dafaust a=dafaust
This is a start at handling the various layout options supported by Rust, beginning with `#[repr(align(N))]` and `#[repr(packed(N))]`, on structs and tuple structs.
There are several other layout options which remain to be supported such as `#[repr(C)]`, `#[repr(transparent)]`, combinations e.g. `#[repr(C, packed(2))]`, as well as layouts on union and enum types.
Fixes: #915
Co-authored-by: David Faust <david.faust@oracle.com>
|
|
|
|
In order to resolve `SimplePath`s, we have to expand all paths present
in a `UseDeclaration` and resolve them. For example, we want to resolve
two paths with the following statement `use foo::bar::{baz, bul}`:
`foo::bar::baz` and `foo::bar::bul`.
This also removes the prelude inclusion (`use std::prelude::v1::*`)
since we cannot resolve it (yet!)
|
|
This adds in the transmute intrisic by utilizing the convert_expression
framework we have in the backend class.
Fixes #1130
Addresses #658
|
|
|
|
1190: Fix ICE in reachability class and refactor associated types code r=philberty a=philberty
There are several fixes going on to solve these issues which overlap with one
another so it seemed best to pack them within the same PR.
The main issue for #1128 was that we did not resolve a trait when it was unused
leading to us hitting the ICE in the privacy pass. Since the type check context was
empty for the trait since it was not resolved. To fix this we needed to refactor the
trait resolver to resolve the trait as part of iterating the crate. This resulted in some
regressions in the testsuite so this is why we need the the other commits. Which
required us to finally perform the refactor specified in #1105 to fix these.
Fixes #1105 #1128 #1132
1192: Add an assertion to avoid peeking when the stack is empty r=philberty a=philberty
This will ensure we get a proper ICE instead of memory corruption/segv.
Addresses #1130
1193: Remove unused parameter caller from generating Call expressions r=philberty a=philberty
Within const context the fncontext maybe empty which in turn results in a
segv for generating const calls which will be evaluated by the const-expr
code anyway.
Addresses #1130
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
|
|
|
|
Within const context the fncontext maybe empty which in turn results in a
segv for generating const calls which will be evaluated by the const-expr
code anyway.
Addresses #1130
|
|
|
|
|
|
|
|
|
|
|
|
|
|
During type-resolution we resolve/type-check traits in a query based way.
So when we reference a trait we look it up as required but this left a case
for the privacy pass where the type-context information on the trait when
the trait was not used meant there was no type-checking performed on the
trait.
This patch adds an interface to directly resolve the trait when as we
iterate the crate so we do it as required. There is already code in the
trait resolver to check if we have already type-resolved this trait.
Fixes #1128
|
|
|
|
From PR #1086 I introduced a new setup_associated_types2 interface which
is used to ensure we handle the complex associated types in libcore slices
but this interface was inconsistant as well as the get_projected_type.
This path refactors the code base to get rid of the old
setup_associated_types interface in favour of this new one. It also removes
the get_projected_type interface which was not going to work either.
Fixes #1105
|
|
We missed a case to ensure the substitutions are equal in the is_equal
interface. This becomes important when dealing with generic associated
types since the projections could end up overlapping and we need to
differentiate them by the substitutions and monomorphization.
|
|
1189: Add missing `SimplePath`s location r=CohenArthur a=CohenArthur
Sorry to new contributors but I think I've taken all the good first issues we opened yesterday...
Closes #1179
Closes #1180
Closes #1181
Closes #1182
Necessary for #1172
Addresses #1159
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
|
|
1186: Refactor `ResolvePath` in its own file r=CohenArthur a=CohenArthur
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
|
|
|
|
|
|
|
|
|
|
|