summary refs log tree commit diff
path: root/src/librustc_session
AgeCommit message (Collapse)AuthorLines
2019-12-12Rollup merge of #67215 - nnethercote:fix-Zprint-type-size-zero-sized-fields, ↵Yuki Okushi-3/+6
r=pnkfelix Fix `-Z print-type-sizes`'s handling of zero-sized fields. Currently, the type `struct S { x: u32, y: u32, tag: () }` is incorrectly described like this: ``` print-type-size type: `S`: 8 bytes, alignment: 4 bytes print-type-size field `.x`: 4 bytes print-type-size field `.tag`: 0 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size padding: 4 bytes print-type-size field `.y`: 4 bytes, alignment: 4 bytes ``` Specifically: - The `padding` line is wrong. (There is no padding.) - The `offset` and `alignment` on the `.tag` line shouldn't be printed. The problem is that multiple fields can end up with the same offset, and the printing code doesn't handle this correctly. This commit fixes it by adjusting the field sorting so that zero-sized fields are dealt with before non-zero-sized fields. With that in place, the printing code works correctly. The commit also corrects the "something is very wrong" comment. The new output looks like this: ``` print-type-size type: `S`: 8 bytes, alignment: 4 bytes print-type-size field `.tag`: 0 bytes print-type-size field `.x`: 4 bytes print-type-size field `.y`: 4 bytes ``` r? @pnkfelix
2019-12-11Rollup merge of #67074 - ehuss:extern-options, r=petrochenkovMazdak Farrokhzad-37/+132
Add options to --extern flag. This changes the `--extern` flag so that it can take a series of options that changes its behavior. The general syntax is `[opts ':'] name ['=' path]` where `opts` is a comma separated list of options. Two options are supported, `priv` which replaces `--extern-private` and `noprelude` which avoids adding the crate to the extern prelude. ```text --extern priv:mylib=/path/to/libmylib.rlib --extern noprelude:alloc=/path/to/liballoc.rlib ``` `noprelude` is to be used by Cargo's build-std feature in order to use `--extern` to reference standard library crates. This also includes a second commit which adds the `aux-crate` directive to compiletest. I can split this off into a separate PR if desired, but it helps with defining these kinds of tests. It is based on #54020, and can be used in the future to replace and simplify some of the Makefile tests.
2019-12-11Fix `-Z print-type-sizes`'s handling of zero-sized fields.Nicholas Nethercote-3/+6
Currently, the type `struct S { x: u32, y: u32, tag: () }` is incorrectly described like this: ``` print-type-size type: `S`: 8 bytes, alignment: 4 bytes print-type-size field `.x`: 4 bytes print-type-size field `.tag`: 0 bytes, offset: 0 bytes, alignment: 1 bytes print-type-size padding: 4 bytes print-type-size field `.y`: 4 bytes, alignment: 4 bytes ``` Specifically: - The `padding` line is wrong. (There is no padding.) - The `offset` and `alignment` on the `.tag` line shouldn't be printed. The problem is that multiple fields can end up with the same offset, and the printing code doesn't handle this correctly. This commit fixes it by adjusting the field sorting so that zero-sized fields are dealt with before non-zero-sized fields. With that in place, the printing code works correctly. The commit also corrects the "something is very wrong" comment. The new output looks like this: ``` print-type-size type: `S`: 8 bytes, alignment: 4 bytes print-type-size field `.tag`: 0 bytes print-type-size field `.x`: 4 bytes print-type-size field `.y`: 4 bytes ```
2019-12-09Add options to --extern flag.Eric Huss-37/+132
2019-12-06Use `as_ref().map()` rather than `is_some().to_option()`varkor-1/+1
2019-12-06Use `to_option_with` in several placesvarkor-1/+1
2019-12-06Use `to_option` in various placesvarkor-7/+4
2019-12-03Deduplicate CrateConfigMark Rousskov-5/+4
2019-12-03Move Session to librustc_sessionMark Rousskov-0/+4741
2019-12-03Move ParseSess to librustc_sessionMark Rousskov-0/+176
2019-12-03Move BufferedEarlyLint to librustc_sessionMark Rousskov-1/+58
2019-12-03Move NativeLibraryKind to rustc_sessionMark Rousskov-0/+16
2019-12-03Move early lint declarations to librustc_sessionMark Rousskov-0/+123
2019-12-03Move Lint to rustc_sessionMark Rousskov-0/+72
This commit breaks early-lint registration, which will be fixed in the next commit. This movement will allow essentially all crates in the compiler tree to declare lints (though not lint passes).
2019-12-03Move Level to rustc_sessionMark Rousskov-0/+45
2019-12-03Move duration_to_secs_str to rustc_sessionMark Rousskov-0/+10
2019-12-03Move cgu_reuse_tracker to librustc_sessionMark Rousskov-0/+136
2019-12-03Introduce rustc_session crateMark Rousskov-0/+16