about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
AgeCommit message (Collapse)AuthorLines
2021-07-15Rollup merge of #86478 - ehuss:future-incompat-test, r=oli-obkYuki Okushi-0/+1
Add -Zfuture-incompat-test to assist with testing future-incompat reports. This adds a `-Zfuture-incompat-test` cli flag to assist with testing future-incompatible reports. This flag causes all lints to be treated as a future-incompatible lint, and will emit a report for them. This is being added so that Cargo's testsuite can reliably test the reporting infrastructure. Right now, Cargo relies on using array_into_iter as a test subject. Since the breaking "future incompatible" lints are never intended to last forever, this means Cargo's testsuite would always need to keep changing to choose different lints (for example, #86330 proposed dropping that moniker for array_into_iter). With this flag, Cargo's tests can trigger any lint and check for the report.
2021-07-14Make --cap-lints and related options leave crate hash aloneJeremy Fitzhardinge-4/+18
Closes: #87144
2021-07-14Add -Zfuture-incompat-test to assist with testing future-incompat reports.Eric Huss-0/+1
2021-07-14Shrink the CrateStore dynamic interface.Camille GILLOT-6/+2
2021-07-08Rework SESSION_GLOBALS API to prevent overwriting itGuillaume Gomez-13/+14
2021-07-06Add flag to configure `large_assignments` lintTomasz Miąsko-0/+1
The `large_assignments` lints detects moves over specified limit. The limit is configured through `move_size_limit = "N"` attribute placed at the root of a crate. When attribute is absent, the lint is disabled. Make it possible to enable the lint without making any changes to the source code, through a new flag `-Zmove-size-limit=N`. For example, to detect moves exceeding 1023 bytes in a cargo crate, including all dependencies one could use: ``` $ env RUSTFLAGS=-Zmove-size-limit=1024 cargo build -vv ```
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-40/+8
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-07-04Combine individual limit queries into single `limits` queryAaron Hill-7/+5
2021-07-04Query-ify global limit attribute handlingAaron Hill-5/+12
2021-07-02add track_path::path fn for proc-macro usageBernhard Schuster-3/+13
Ref #73921
2021-06-30Update comments.Camille GILLOT-12/+5
2021-06-30Fix AST pretty.Camille GILLOT-6/+6
2021-06-30Move AST crate.Camille GILLOT-17/+17
2021-06-30Arena-allocate Crate during lowering.Camille GILLOT-2/+1
2021-06-30Move lowering to create_global_ctxt.Camille GILLOT-24/+16
2021-06-30Inline lower_to_hir.Camille GILLOT-33/+19
2021-06-30Separate resolver creation from expansion.Camille GILLOT-57/+38
2021-06-30Simplify DepGraph creation.Camille GILLOT-25/+12
2021-06-28Introduce -Zprofile-closures to evaluate the impact of 2229Aman Arora-0/+1
This creates a CSV with name "closure_profile_XXXXX.csv", where the variable part is the process id of the compiler. To profile a cargo project you can run one of the following depending on if you're compiling a library or a binary: ``` cargo +stage1 rustc --lib -- -Zprofile-closures cargo +stage1 rustc --bin -- -Zprofile-closures ```
2021-06-26Auto merge of #86267 - ZuseZ4:master, r=nagisabors-0/+1
Allow loading of llvm plugins on nightly Based on a discussion in #82734 / with `@wsmoses.` Mainly moves [this](https://github.com/wsmoses/rust/commit/0149bc4e7e596005c665b132877abebe5258a0f6) behind a -Z flag, so it can only be used on nightly, as requested by `@nagisa` in https://github.com/rust-lang/rust/issues/82734#issuecomment-835863940 This change allows loading of llvm plugins like Enzyme. Right now it also requires a shared library LLVM build of rustc for symbol resolution. ```rust // test.rs extern { fn __enzyme_autodiff(_: usize, ...) -> f64; } fn square(x : f64) -> f64 { return x * x; } fn main() { unsafe { println!("Hello, world {} {}!", square(3.0), __enzyme_autodiff(square as usize, 3.0)); } } ``` ``` ./rustc test.rs -Z llvm-plugins="./LLVMEnzyme-12.so" -C passes="enzyme" ./test Hello, world 9 6! ``` I will try to figure out how to simplify the usage and get this into stable in a later iteration, but having this on nightly will already help testing further steps.
2021-06-23Use HTTPS links where possibleSmitty-1/+1
2021-06-21Only hash OutputTypes keys in non-crate-hash modeAaron Hill-3/+3
This effectively turns OutputTypes into a hybrid where keys (OutputType) are TRACKED and the values (optional paths) are TRACKED_NO_CRATE_HASH.
2021-06-21make -Zno-codegen TRACKED_NO_CRATE_HASHJeremy Fitzhardinge-1/+10
2021-06-21Implement assert_non_crate_hash_different for testsJeremy Fitzhardinge-0/+8
2021-06-21In --emit KIND=PATH options, only hash KINDJeremy Fitzhardinge-3/+3
The PATH has no material effect on the emitted artifact, and setting the patch via `-o` or `--out-dir` does not affect the hash. Closes https://github.com/rust-lang/rust/issues/86044
2021-06-18Auto merge of #85284 - eggyal:custom-profiler-runtime, r=jackh726bors-1/+1
Provide option for specifying the profiler runtime Currently, if `-Zinstrument-coverage` is enabled, the target is linked against the `library/profiler_builtins` crate (which pulls in LLVM's compiler-rt runtime). This option enables backends to specify an alternative runtime crate for handling injected instrumentation calls.
2021-06-13allow loading of llvm plugins on nightlyManuel Drehwald-0/+1
2021-06-11Auto merge of #85885 - bjorn3:remove_box_region, r=cjgillotbors-40/+87
Don't use a generator for BoxedResolver The generator is non-trivial and requires unsafe code anyway. Using regular unsafe code without a generator is much easier to follow. Based on #85810 as it touches rustc_interface too.
2021-06-10Remove unnecessary transmutebjorn3-2/+1
2021-06-09Add safety commentsbjorn3-0/+5
2021-06-09Use explicit drop implbjorn3-8/+13
2021-06-08Do not require the DefPathTable to construct the on-disk cache.Camille GILLOT-3/+1
2021-06-08Don't require LintStore to live for 'a in configure_and_expand_innerbjorn3-1/+1
2021-06-08Revert "Let several methods take &Resolver instead of a BoxedResolver wrapper"bjorn3-29/+25
This reverts commit 5343ec338f72a61e2f51f9d90117092c8e8a725a.
2021-06-08Use a submodule as safety boundary for BoxedResolverbjorn3-55/+60
2021-06-08Don't use a generator for BoxedResolverbjorn3-119/+48
The generator is non-trivial and requires unsafe code anyway. Using regular unsafe code without a generator is much easier to follow.
2021-06-08Don't return a BoxedResolver on errorsbjorn3-5/+4
2021-06-08Inline two more methodsbjorn3-24/+14
2021-06-08Let several methods take &Resolver instead of a BoxedResolver wrapperbjorn3-25/+29
2021-06-08Store boxed metadata loader in CrateLoaderbjorn3-2/+2
2021-06-08Replace Pin::new with .as_mut()bjorn3-3/+5
2021-06-08Use more accurate lifetimesbjorn3-8/+6
2021-06-08Inline PinnedGeneratorbjorn3-42/+29
2021-06-08Inline the rest of box_regionbjorn3-22/+79
2021-06-08Inline box_region macro callsbjorn3-5/+77
2021-06-08Simplify box_region macrosbjorn3-2/+1
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-8/+40
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-07Auto merge of #85810 - bjorn3:further_driver_cleanup, r=varkorbors-44/+38
Driver improvements This PR contains a couple of cleanups for the driver and a few small improvements for the custom codegen backend interface. It also implements `--version` and `-Cpasses=list` support for custom codegen backends.
2021-06-04Auto merge of #84449 - alexcrichton:metadata-in-object, r=nagisabors-1/+1
rustc: Store metadata-in-rlibs in object files This commit updates how rustc compiler metadata is stored in rlibs. Previously metadata was stored as a raw file that has the same format as `--emit metadata`. After this commit, however, the metadata is encoded into a small object file which has one section which is the contents of the metadata. The motivation for this commit is to fix a common case where #83730 arises. The problem is that when rustc crates a `dylib` crate type it needs to include entire rlib files into the dylib, so it passes `--whole-archive` (or the equivalent) to the linker. The problem with this, though, is that the linker will attempt to read all files in the archive. If the metadata file were left as-is (today) then the linker would generate an error saying it can't read the file. The previous solution was to alter the rlib just before linking, creating a new archive in a temporary directory which has the metadata file removed. This problem from before this commit is now removed if the metadata file is stored in an object file that the linker can read. The only caveat we have to take care of is to ensure that the linker never actually includes the contents of the object file into the final output. We apply similar tricks as the `.llvmbc` bytecode sections to do this. This involved changing the metadata loading code a bit, namely updating some of the LLVM C APIs used to use non-deprecated ones and fiddling with the lifetimes a bit to get everything to work out. Otherwise though this isn't intended to be a functional change really, only that metadata is stored differently in archives now. This should end up fixing #83730 because by default dylibs will no longer have their rlib dependencies "altered" meaning that split-debuginfo will continue to have valid paths pointing at the original rlibs. (note that we still "alter" rlibs if LTO is enabled to remove Rust object files and we also "alter" for the #[link(cfg)] feature, but that's rarely used). Closes #83730
2021-06-04rustc: Store metadata-in-rlibs in object filesAlex Crichton-1/+1
This commit updates how rustc compiler metadata is stored in rlibs. Previously metadata was stored as a raw file that has the same format as `--emit metadata`. After this commit, however, the metadata is encoded into a small object file which has one section which is the contents of the metadata. The motivation for this commit is to fix a common case where #83730 arises. The problem is that when rustc crates a `dylib` crate type it needs to include entire rlib files into the dylib, so it passes `--whole-archive` (or the equivalent) to the linker. The problem with this, though, is that the linker will attempt to read all files in the archive. If the metadata file were left as-is (today) then the linker would generate an error saying it can't read the file. The previous solution was to alter the rlib just before linking, creating a new archive in a temporary directory which has the metadata file removed. This problem from before this commit is now removed if the metadata file is stored in an object file that the linker can read. The only caveat we have to take care of is to ensure that the linker never actually includes the contents of the object file into the final output. We apply similar tricks as the `.llvmbc` bytecode sections to do this. This involved changing the metadata loading code a bit, namely updating some of the LLVM C APIs used to use non-deprecated ones and fiddling with the lifetimes a bit to get everything to work out. Otherwise though this isn't intended to be a functional change really, only that metadata is stored differently in archives now. This should end up fixing #83730 because by default dylibs will no longer have their rlib dependencies "altered" meaning that split-debuginfo will continue to have valid paths pointing at the original rlibs. (note that we still "alter" rlibs if LTO is enabled to remove Rust object files and we also "alter" for the #[link(cfg)] feature, but that's rarely used). Closes #83730