Commit Graph

2360 Commits

Author SHA1 Message Date
Bastien Orivel
5c7b7afe82 Update lazy_static to 1.0 2017-12-07 20:56:15 +01:00
bors-servo
51d0ef9e41 Auto merge of #1179 - fitzgen:add-regression-test-for-issue-816, r=emilio
Add a regression test for issue #816

r? @emilio
2017-12-07 11:16:27 -06:00
Nick Fitzgerald
109597d81a Add a regression test for issue #816 2017-12-07 09:14:12 -08:00
bors-servo
a59205e8cf Auto merge of #1177 - snewt:feat/quickcheck-as-bin, r=fitzgen
Quickchecking crate CLI

Prior to this commit the quickchecking crate used for generating proprty tests for bindgen was a [lib] target and had configurations that required commenting/uncommenting code to enable/disable. This meant it was inconvienent/prohibitive to configure the property tests on a per-run basis. This commit reorganizes the `quickchecking` crate to provide both [lib] and [[bin]] targets in order to expose those configurations through a CLI.

The configurations that are exposed through the [[bin]] target's CLI are:
* Count/number of tests to run.
* Directory to provide fuzzed headers
* Generation range corresponding to the range quickcheck uses to
* generate arbitrary.

__Usage from the__ `tests/quickchecking` __directory__
```bash
quickchecking 0.2.0
Bindgen property tests with quickcheck. Generate random valid C code and pass it to the csmith/predicate.py script

USAGE:
    quickchecking [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -c, --count <COUNT>    Count / number of tests to run. Running a fuzzed header through the predicate.py script can
                           take a long time, especially if the generation range is large. Increase this number if you're
                           willing to wait a while. [default: 2]
    -p, --path <PATH>      Optional. Preserve generated headers for inspection, provide directory path for header
                           output. [default: None]
    -r, --range <RANGE>    Sets the range quickcheck uses during generation. Corresponds to things like arbitrary usize
                           and arbitrary vector length. This number doesn't have to grow much for that execution time to
                           increase significantly. [default: 32]
```

Because the actual work of running the property tests moved to the [[bin]]
target, rather than duplicate that code in the `quickchecking` crate's tests
directory, some actual (very basic) tests for the `quickchecking` crate were
added.

*Note: I'm not attached to any of the option flags, if there are better characters/words for any of the options I've exposed I'll be happy to revise!

Also, I'm not sure how palatable the "global singleton" is for managing context (output path) across tests in the `lib.rs` file. Very open to suggestions on how to manage that if it's not an acceptable approach.

Thanks for taking a look, looking forward to feedback!

Closes #1168

r? @fitzgen
2017-12-05 20:55:25 -06:00
Shea Newton
2c776522ae quickchecking CI tests
The changes reflected in this PR include the logic to test the
`quickcheking` crate itself. Rather that just validate that the
`quickchecking` crate builds in CI with `cargo check`, we can run
now `cargo test`.
2017-12-05 18:31:56 -08:00
Shea Newton
b4ba0923fb Quickchecking crate CLI
Prior to this commit the quickchecking crate used for generating proprty
tests
for bindgen was a [lib] target and had configurations that required
commenting/uncommenting code to enable/disable. This meant it was
inconvienent/prohibitive to configure the property tests on a per-run
basis.
This commit reorganizes the `quickchecking` crate to provide both [lib]
and
[[bin]] targets in order to expose those configurations through a CLI.

The configurations that are exposed through the [[bin]] target's CLI
are:
* Count/number of tests to run.
* Directory to provide fuzzed headers
* Generation range corresponding to the range quickcheck uses to
* generate arbitrary.

__Usage from the__ `tests/quickchecking` __directory__
```bash
quickchecking 0.2.0
Bindgen property tests with quickcheck. Generate random valid C code and
pass it to the csmith/predicate.py script

USAGE:
    quickchecking [OPTIONS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -c, --count <COUNT>    Count / number of tests to run. Running a
fuzzed header through the predicate.py script can
                           take a long time, especially if the
generation range is large. Increase this number if you're
                           willing to wait a while. [default: 2]
    -p, --path <PATH>      Optional. Preserve generated headers for
inspection, provide directory path for header
                           output. [default: None]
    -r, --range <RANGE>    Sets the range quickcheck uses during
generation. Corresponds to things like arbitrary usize
                           and arbitrary vector length. This number
doesn't have to grow much for that execution time to
                           increase significantly. [default: 32]
```

Because the actual work of running the property tests moved to the
[[bin]]
target, rather than duplicate that code in the `quickchecking` crate's
tests
directory, some actual (very basic) tests for the `quickchecking` crate
were
added.

*Note: I'm not attached to any of the option flags, if there are better
characters/words for any of the options I've exposed I'll be happy to
revise!

Thanks for taking a look, looking forward to feedback!

Closes #1168

r? @fitzgen
2017-12-04 19:39:03 -08:00
bors-servo
a48ca25600 Auto merge of #1175 - nox:rustfmt, r=emilio
Remove unstable rustfmt-nightly features
2017-12-04 05:00:09 -06:00
Anthony Ramine
72c3012e6e Remove unstable rustfmt-nightly features 2017-12-04 11:59:18 +01:00
Emilio Cobos Álvarez
935a18e522
Merge pull request #1173 from nox/tokens
Move tokens method from TranslationUnit to Cursor
2017-12-03 20:11:56 +01:00
Anthony Ramine
d076b9d5eb Move tokens method from TranslationUnit to Cursor
This makes it easier to call it without passing around a TranslationUnit,
which will prove itself useful to parse `__attribute__` nodes.
2017-12-03 01:18:43 +01:00
bors-servo
cd920a3983 Auto merge of #1159 - snewt:feat/970-quickcheck-fuzzing, r=fitzgen
Property testing with quickcheck

This PR represents an attempt to address issue #970. It also represents a portion of the meta issue for fuzzing #972.

The code base reflected here uses quickcheck to generate C headers that
include a variety of types including basic types, structs, unions,
function prototypes and function pointers. The headers generated by quickcheck
are passed to the `csmith-fuzzing/predicate.py` script. Examples of headers
generated by this iteration of the tooling can be viewed
[here](https://gist.github.com/snewt/03ce934f35c5b085807d2d5cf11d1d5c).

At the top of each header are two simple struct definitions,
`whitelistable` and `blacklistable`. Those types are present in the vector that
represents otherwise primitive types used to generate. They represent a naive
approach to exposing custom types without having to intuit generated type names like
`struct_21_8` though _any actual whitelisting logic isn't implemented
here_.

Test success is measured by the success of the
`csmith-fuzzing/predicate.py`
script. This means that for a test to pass the following must be true:
- bindgen doesn't panic
- the resulting bindings compile
- the resulting bindings layout tests pass

#### Usage
```bash
cd tests/property_test
cargo test
```

Some things I'm unsure of:
#### Where should this feature live?
At the moment it lives in `tests/property_test` but isn't run when
`cargo test` is invoked from bindgen's cargo manifest directory.

#### What's an acceptable ammount of time for these tests to take?
At this point, the source is genereated in ~1 second but the files are
large enough that it takes the `predicate.py` script ~30 seconds to run
through each one. In order for the tests to run in under a minute only 2 are
generated by quickcheck by default. This can be changed in the `test_bindgen`
function of the `tests/property_test/tests/fuzzed-c-headers.rs` file.

#### How do we expose the generated code for easy inspection?
For now the `run_predicate_script` function in the
`tests/property_test/tests/fuzzed-c-headers.rs` file contains a
commented block that will copy generated source in the `tests/property_test/tests`
directory. Should it be easier?

#### Special casing
There is some logic in the fuzzer that disallows 0 sized arrays because
tests will regulary fail due to issues documented in #684 and #1153. Should
this be special casing?

#### Does the fuzzer warrant its own crate?
After any iterations the reviewers are interested in required to make
this a functional testing tool, should/could the fuzzing library be made into
its own crate? I didn't move in that direction yet because having it all in one
place seemed like the best way to figure out what works an doesn't but I'm
interested in whether it might be useful as a standalone library.

#### What does it look like to expose more useful functionality?
I'm looking forward to feedback on how to make this a more useful tool
and one that provides the right configurability.

Thanks!

r? @fitzgen
2017-11-30 12:09:46 -06:00
Shea Newton
2aa9b1d234 Address requested changes to quickchecking crate.
- Remove `whitelistable` and `blacklistable` types.
- Rename test crate directory from `property_test` to `quickchecking`.
- Add new CI job that checks that this crate continues to build.
- Revise matching logic to be more idomatic.
- Phase out modular arithmetic in favor of `gen_range`.
- Incorporate `unreachable!` into match statements.
- Revise logic for accessing random element of vector, favor `choose`
  over `nth`.
- Proper punctuation and capitalization in comments.
- Using actual structures rather than converting everything to strings
  in order to leverage type system.
- Add `#![deny(missing_docs)]` and filled in documentation required for
  the project to build again.
- Add special case logic so we don't generate structs with `long double`
  fields as it will cause tests to fail unitl issue \#550 is resolved

Note on making sure we don't lose test cases we're interested in
preserving:
We're copying the directories `TempDir` makes so we get things like
this:
```
├── bindgen_prop.1WYe3F5HZU1c
│   └── prop_test.h
├── bindgen_prop.H4SLI1JX0jd8
│   └── prop_test.h
```
I'm not sure that `TempDir` makes any claims about uniqueness, so
collisions
probably aren't impossible. I'm up for any suggestions on a more
bulletproof
solution.

_Tasks not addressed by this PR:_
* TODO: Add `cargo features` logic to allow generating problematic code.
* TODO: Make a [bin] target with CLI to manage test settings.
* TODO: Whitelisting and opaque types.
* TODO: Generate bitfields, C++, I-bogus-codegen cases.

Figured this would be a good point to update the PR but if any of the
above TODO
items should be incorporated before moving forward I'm up for it!

Thanks for taking another look!

r? @fitzgen
2017-11-29 19:59:35 -08:00
bors-servo
0af9c89793 Auto merge of #1163 - fitzgen:remove-unnecessary-ci-jobs, r=emilio
Remove unnecessary ci jobs

And then in the process I noticed that we weren't running the layout tests for any of the libclang version-specific expectation files, so I also fixed that.

r? @emilio or @pepyakin
2017-11-28 13:54:55 -06:00
Nick Fitzgerald
1c2172f751 Ensure that we run layout tests from libclang version-specific expectations
This adds a build.rs to generate

    #[path="$FILE"]
    mod $FILE_AS_IDENT;

for each $FILE in our libclang version-specific directories. We need to do this
to get those files' layout tests to run because cargo doesn't automatically pick
up tests in subdirectories.
2017-11-28 11:34:43 -08:00
Nick Fitzgerald
5011ddcf97 Don't run test expectations' layout tests with multiple libclang versions
Only generating bindings depends on which libclang version we are dealing
with. Running the test expectations' layout tests does not change between
libclang versions, so these were redundant tests.

Note that we have not been testing the expected bindings that differ across
libclang versions (the nested sub-directories aren't automatically picked up by
cargo) and this commit does not change that.
2017-11-28 10:56:41 -08:00
bors-servo
75f9e1c233 Auto merge of #1162 - tamird:enum-naming-consistency, r=emilio
Properly handle namespaces for enum configuration options

...by using canonical_path rather than canonical_name.

Fixes #1125.

r? @emilio
2017-11-28 05:48:42 -06:00
Tamir Duberstein
89efc23497
Properly handle namespaces for enum configuration options
...by using canonical_path rather than canonical_name.

Fixes #1125.
2017-11-27 14:22:00 -05:00
Adam Baxter
d4ffe9eca8 Squashed commit. 2017-11-27 13:43:17 -05:00
bors-servo
7c3584d7bc Auto merge of #1158 - glyn:large-bitfield-units, r=emilio
Support bitfield allocation units larger than 64 bits

Individual bitfields are still limited to at most 64 bits, but this restriction can be weakened when Rust supports `u128`.

This implements issue #816.

Usage notes:

* Since common code is added to each generated binding, a program which uses
  more than one binding may need to work around the duplication by including
  each binding in its own module.
* The values created by bitfield allocation unit constructors can be assigned
  directly to the corresponding struct fields with no need for transmutation.

Implementation notes:

`__BindgenBitfieldUnit` represents a bitfield allocation unit using a `Storage`
type accessible as a slice of `u8`. The alignment of the unit is inherited from
an `Align` type by virtue of the field:
```
align: [Align; 0],
```
The position of this field in the struct is irrelevant.

It is assumed that the alignment of the `Storage` type is no larger than the
alignment of the `Align` type, which will be true if the `Storage` type is, for
example, an array of `u8`. This assumption is checked in a debug assertion.

Although the double underscore (__) prefix is reserved for implementations of
C++, there are precedents for this convention elsewhere in bindgen and so the
convention is adopted here too.

Acknowledgement:

Thanks to @fitzgen for an initial implementation of `__BindgenBitfieldUnit` and
code to integrate it into bindgen.

r? @emilio
2017-11-23 04:31:10 -06:00
Shea Newton
c981808952 This PR represents an attempt to address issue #970. It also represents
a portion of the meta issue for fuzzing #972.

The code base reflected here uses quickcheck to generate C headers that
include a variety of types including basic types, structs, unions,
function
prototypes and function pointers. The headers generated by quickcheck
are
passed to the `csmith-fuzzing/predicate.py` script. Examples of headers
generated by this iteration of the tooling can be viewed
[here](https://gist.github.com/snewt/03ce934f35c5b085807d2d5cf11d1d5c).

At the top of each header are two simple struct definitions,
`whitelistable`
and `blacklistable`. Those types are present in the vector that
represents
otherwise primitive types used to generate. They represent a naive
approach to
exposing custom types without having to intuit generated type names like
`struct_21_8` though _any actual whitelisting logic isn't implemented
here_.

Test success is measured by the success of the
`csmith-fuzzing/predicate.py`
script. This means that for a test to pass the following must be true:
- bindgen doesn't panic
- the resulting bindings compile
- the resulting bindings layout tests pass

```bash
cd tests/property_test
cargo test
```

Some things I'm unsure of:
At the moment it lives in `tests/property_test` but isn't run when
`cargo test`
is invoked from bindgen's cargo manifest directory.

At this point, the source is genereated in ~1 second but the files are
large
enough that it takes the `predicate.py` script ~30 seconds to run
through each
one. In order for the tests to run in under a minute only 2 are
generated by
quickcheck by default. This can be changed in the `test_bindgen`
function of the
`tests/property_test/tests/fuzzed-c-headers.rs` file.

For now the `run_predicate_script` function in the
`tests/property_test/tests/fuzzed-c-headers.rs` file contains a
commented block
that will copy generated source in the `tests/property_test/tests`
directory.
Should it be easier?

There is some logic in the fuzzer that disallows 0 sized arrays because
tests
will regulary fail due to issues documented in #684 and #1153. Should
this be
special casing?

After any iterations the reviewers are interested in required to make
this
a functional testing tool, should/could the fuzzing library be made into
its own
crate? I didn't move in that direction yet because having it all in one
place
seemed like the best way to figure out what works an doesn't but I'm
interested
in whether it might be useful as a standalone library.

I'm looking forward to feedback on how to make this a more useful tool
and one
that provides the right configurability.

Thanks!

r? @fitzgen
2017-11-22 18:28:49 -08:00
Nick Fitzgerald
f0e05310b4 Support bitfield allocation units larger than 64 bits
Individual bitfields are still limited to at most 64 bits, but this
restriction can be weakened when Rust supports u128.

This implements issue #816.

Usage notes:

* Since common code is added to each generated binding, a program which uses
  more than one binding may need to work around the duplication by including
  each binding in its own module.
* The values created by bitfield allocation unit constructors can be assigned
  directly to the corresponding struct fields with no need for transmutation.

Implementation notes:

__BindgenBitfieldUnit represents a bitfield allocation unit using a Storage
type accessible as a slice of u8. The alignment of the unit is inherited from
an Align type by virtue of the field:

align: [Align; 0],

The position of this field in the struct is irrelevant.

The alignment of the Storage type is intended to be no larger than the
alignment of the Align type, which will be true if the Storage type is, for
example, an array of u8.

Although the double underscore (__) prefix is reserved for implementations of
C++, there are precedents for this convention elsewhere in bindgen and so the
convention is adopted here too.

Acknowledgement:

Thanks to @fitzgen for an initial implementation of __BindgenBitfieldUnit and
code to integrate it into bindgen.
2017-11-21 13:55:00 +00:00
bors-servo
e3e6c73039 Auto merge of #1157 - tamird:use-ptr-null, r=emilio
Generate ptr::null rather than zero literal
2017-11-20 01:38:24 -06:00
Tamir Duberstein
430fb0eb23
Generate ptr::null rather than zero literal 2017-11-18 23:13:09 -05:00
bors-servo
5e0cf9c356 Auto merge of #1152 - glyn:document-integration-tests, r=emilio
Improve documentation of the integration tests

Also note the need to rebuild bindgen when running a single test.

r? @emilio
2017-11-16 11:46:02 -06:00
Glyn Normington
6cdf3e26f0 Improve documentation of the integration tests
Also:
* disable rustfmt in the integration test, to avoid it causing problems, since
  it is not needed.
* note the need to rebuild bindgen when running a single test.
2017-11-16 16:55:22 +00:00
bors-servo
bf3f75bdcc Auto merge of #1149 - glyn:avoid-accesses-outside-self, r=emilio
Avoid bitfield getters and setters accessing memory beyond "self"

This fixes https://github.com/rust-lang-nursery/rust-bindgen/issues/954.

r? @emilio
2017-11-13 08:48:56 -06:00
Glyn Normington
e22d7dad24 Avoid bitfield getters and setters accessing memory beyond "self"
This fixes https://github.com/rust-lang-nursery/rust-bindgen/issues/954.
2017-11-13 14:41:09 +00:00
bors-servo
433e9c050b Auto merge of #1148 - roblabla:bugfix-unnecessaryWriteModeRustfmt, r=fitzgen
Remove unnecessary flag from rustfmt invocation

From rustfmt docs, the --write-mode flag is unecessary when passing the flag to stdin. If we leave it there, rustfmt-nightly complains that it cannot find the file named --write-mode, so let's remove the flag.

here's the logs when I leave the flag :

```
Error: file `--write-mode=display` does not exist
Error { repr: Custom(Custom { kind: Other, error: StringError("Internal rustfmt error") }) }
```

<details>
<summary>The build.rs : </summary>

```rust
extern crate bindgen;

use std::env;
use std::path::PathBuf;

fn main() {
    println!("cargo:rustc-link-lib=static=transistor.nro");
    println!("cargo:rustc-link-search=native=libtransistor/build/lib");

    let bindings = bindgen::Builder::default()
        .header("libtransistor/include/libtransistor/nx.h")
        // Don't use host headers, to make sure we're building against newlib
        .clang_arg("-nostdinc")
        // Include the newlib/transistor headers, and the clang builtin headers
        .clang_args(&["-isystem", "/usr/lib/clang/5.0.0/include"])
        .clang_args(&["-isystem", "libtransistor/newlib/newlib/libc/include"])
        .clang_args(&["-isystem", "libtransistor/newlib/newlib/libc/sys/switch/include"])
        .clang_arg("-Ilibtransistor/include")
        // We don't need to define those types, rust has them already anyways.
        // Blacklisting avoids a bug in bindgen where it creates cyclic references
        // (pub type u8 = u8)
        .blacklist_type("u(8|16|32|64)")
        .rustfmt_bindings(true)
        .rustfmt_configuration_file(None)
        .generate()
        .expect("Unable to generate bindings");

    let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
    bindings
        .write_to_file(out_path.join("bindings.rs"))
        .expect("Couldn't write bindings!");
}
```
</details>
2017-11-10 11:09:06 -06:00
roblabla
a6d45069ac Remove unnecessary flag from rustfmt invocation
From rustfmt docs, the --write-mode flag is unecessary when passing the
flag to stdin. If we leave it there, rustfmt-nightly complains that it
cannot find the file named --write-mode, so let's remove the flag.
2017-11-10 16:27:09 +01:00
bors-servo
c54e64c537 Auto merge of #1146 - seemyvest:fix-metadata, r=emilio
Don't unwrap header metadata

Fix for a comment in #1092.
r? @fitzgen
2017-11-10 04:22:22 -06:00
seemyvest
7f0aa6c6da Don't unwrap header metadata 2017-11-10 11:32:32 +11:00
bors-servo
eccc0bfa8e Auto merge of #1141 - fitzgen:bitfield-without-layout, r=emilio
Make bitfield unit allocation fallible

Instead of panicking when we see a bitfield that does not have a layout, return an error up the stack. If we get an error when allocating bitfields into units, then make the whole struct opaque.

Fixes #1140

r? @pepyakin or @emilio
2017-11-03 10:18:48 -05:00
Nick Fitzgerald
43b88c5e79 Make bitfield unit allocation fallible
Instead of panicking when we see a bitfield that does not have a layout, return
an error up the stack. If we get an error when allocating bitfields into units,
then make the whole struct opaque.

Fixes #1140
2017-11-03 08:17:09 -07:00
bors-servo
406b477580 Auto merge of #1138 - fitzgen:stop-using-deprecated-methods, r=emilio
Stop using deprecated methods

r? @pepyakin
2017-11-02 13:08:24 -05:00
Nick Fitzgerald
9db9b74805 The stylo sanity test should use blacklist_type
...instead of the deprecated `hide_type`.
2017-11-02 10:53:09 -07:00
Nick Fitzgerald
8e4b8b87da Blacklisting docs should reference blacklist_type method
...instead of the deprecated `hide_type` method.
2017-11-02 10:50:54 -07:00
bors-servo
761dffc91f Auto merge of #1136 - fitzgen:pragma-pack-bandaid, r=emilio
Detect `#pragma pack(...)` and make `pack(n)` where `n > 1` opaque

This is a bandaid for #537. It does *not* fix the underlying issue, which requires `#[repr(packed = "N")]` support in Rust. However, it does make sure that we don't generate type definitions with the wrong layout, or fail our generated layout tests.

r? @emilio or @pepyakin
2017-11-02 11:51:39 -05:00
Nick Fitzgerald
79dbe8b806 Detect #pragma pack(...) and make pack(n) where n > 1 opaque
This is a bandaid for #537. It does *not* fix the underlying issue, which
requires `#[repr(packed = "N")]` support in Rust. However, it does make sure
that we don't generate type definitions with the wrong layout, or fail our
generated layout tests.
2017-11-02 09:51:09 -07:00
bors-servo
f059edee4a Auto merge of #1137 - fitzgen:divide-by-zero-in-struct-layout, r=emilio
Divide by zero in struct layout

See commit messages for details.

r? @emilio or @pepyakin
2017-11-01 19:13:44 -05:00
Nick Fitzgerald
460aaa06b2 "Alignment of field" -> "Offset of field"
It isn't checking alignment at all; it's checking offsets.
2017-11-01 17:11:56 -07:00
Nick Fitzgerald
8592f3677b Avoid divide-by-zero when checking if a field will merge with bitfields 2017-11-01 16:17:01 -07:00
bors-servo
0e84605df2 Auto merge of #1135 - fitzgen:changelog, r=pepyakin
Add a changelog

It is initially populated with information from our release announcements.

It has an "unreleased" section for accumulating notable changes that haven't been released yet, and to make it easier to summarize releases when we do publish them.

Fixes #1131

r? @emilio or @pepyakin
2017-11-01 14:29:18 -05:00
Nick Fitzgerald
a4d5c7aed6 Add a changelog
It is initially populated with information from our release announcements.

It has an "unreleased" section for accumulating notable changes that haven't
been released yet, and to make it easier to summarize releases when we do
publish them.

Fixes #1131
2017-11-01 11:59:51 -07:00
bors-servo
c64c256ad7 Auto merge of #1134 - fitzgen:actually-cleanup-temp-files-in-predicate, r=pepyakin
Actually cleanup temp files in predicate

Embarrassingly, we were ignoring and swallowing a dumb reference error that prevented the temp files from ever getting cleaned up.

The good news: with ignoring bitfields and packed structs, I got to `driver.py` iteration 27145 without triggering any `bindgen` bugs, and then the disk got full! :-p

r? @pepyakin
2017-11-01 13:44:40 -05:00
Nick Fitzgerald
4b049fc80f predicate.py: warn about ignored exceptions during temp clean up 2017-11-01 11:14:48 -07:00
Nick Fitzgerald
0744cea891 predicate.py: Fix reference error that prevented temp file deletion 2017-11-01 11:14:48 -07:00
bors-servo
ddb680b27d Auto merge of #1130 - fitzgen:issue-1076, r=pepyakin
Unnamed bit-fields and alignment

r? @pepyakin or @emilio
2017-11-01 01:06:21 -05:00
Nick Fitzgerald
e17bd8df3f Unnamed bit-fields should not affect alignment
According to the x86[-64] ABI spec: "Unnamed bit-fields’ types do not affect the
alignment of a structure or union". This makes sense: such bit-fields are only
used for padding, and we can't perform an un-aligned read of something we can't
read because we can't even name it.

Fixes #1076
2017-10-31 15:34:56 -07:00
Nick Fitzgerald
7bc4f34ab6 Remove unused assignment 2017-10-31 15:23:56 -07:00
bors-servo
55cf63c08c Auto merge of #1128 - emilio:not-yet-type, r=fitzgen
ir: We can't guarantee the type to be in the item map while propagating AlreadyResolved

The item may come from a recursive check down the stack, and as we say there:

> Unchecked because we haven't finished this type yet.

Fixes #1127
2017-10-31 12:57:30 -05:00