summary refs log tree commit diff
path: root/src/librustc_metadata
AgeCommit message (Collapse)AuthorLines
2020-03-10Rollup merge of #69677 - petrochenkov:spancode, r=eddybMazdak Farrokhzad-107/+126
rustc_metadata: Give decoder access to whole crate store Pre-requisite for https://github.com/rust-lang/rust/pull/68941. r? @eddyb
2020-03-07Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkovMazdak Farrokhzad-2/+2
fix various typos
2020-03-06Don't redundantly repeat field names (clippy::redundant_field_names)Matthias Krüger-1/+1
2020-03-06fix various typosMatthias Krüger-2/+2
2020-03-05rustc_metadata: Move some code from `impl CrateMetadataRef` to `impl ↵Vadim Petrochenkov-89/+87
CrateMetadata`
2020-03-05rustc_metadata: Give decoder access to whole crate storeVadim Petrochenkov-22/+43
2020-03-02Auto merge of #69432 - petrochenkov:alldeps, r=eddybbors-15/+4
rustc_metadata: Load metadata for indirect macro-only dependencies Imagine this dependency chain between crates ``` Executable crate -> Library crate -> Macro crate ``` where "Library crate" uses the macros from "Macro crate" for some code generation, but doesn't reexport them any further. Currently, when compiling "Executable crate" we don't even load metadata for it, because why would we want to load any metadata from "Macro crate" if it already did all its code generation job when compiling "Library crate". Right? Wrong! Hygiene data and spans (https://github.com/rust-lang/rust/issues/68686, https://github.com/rust-lang/rust/pull/68941) from "Macro crate" still may need to be decoded from "Executable crate". So we'll have to load them properly. Questions: - How this will affect compile times for larger crate trees in practice? How to measure it? Hygiene/span encoding/decoding will necessarily slow down compilation because right now we just don't do some work that we should do, but this introduces a whole new way to slow down things. E.g. loading metadata for `syn` (and its dependencies) when compiling your executable if one of its library dependencies uses it. - We are currently detecting whether a crate reexports macros from "Macro crate" or not, could we similarly detect whether a crate "reexports spans" and keep it unloaded if it doesn't? Or at least "reexports important spans" affecting hygiene, we can probably lose spans that only affect diagnostics.
2020-03-01Rollup merge of #69580 - matthiaskrgr:map_clone, r=CentrilYuki Okushi-1/+1
use .copied() instead of .map(|x| *x) on iterators
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-13/+13
2020-02-29Make it build againVadim Petrochenkov-2/+2
2020-02-29use .copied() instead of .map(|x| *x) on iteratorsMatthias Krüger-1/+1
2020-02-29Rollup merge of #69551 - matthiaskrgr:len_zero, r=Mark-SimulacrumDylan DPC-1/+1
use is_empty() instead of len() == x to determine if structs are empty.
2020-02-28Rollup merge of #69541 - dotdash:format, r=Mark-SimulacrumMazdak Farrokhzad-4/+1
Remove unneeded calls to format!()
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-1/+1
2020-02-27Remove unneeded calls to format!()Björn Steinbrink-4/+1
2020-02-26Auto merge of #67742 - mark-i-m:describe-it, r=matthewjasperbors-22/+22
Generalized article_and_description r? @matthewjasper The logic of finding the right word and article to print seems to be repeated elsewhere... this is an experimental method to unify this logic...
2020-02-24rustc_metadata: Use binary search from standard libraryVadim Petrochenkov-13/+5
instead of a hand rolled one.
2020-02-24rustc_metadata: Load metadata for indirect macro-only dependenciesVadim Petrochenkov-15/+4
2020-02-22get rid of lazymark-3/+3
2020-02-22add generator_kind queryMark Mansi-21/+21
2020-02-15Record proc macro harness order for use during metadata deserializationAaron Hill-12/+1
Fixes #68690 When we generate the proc macro harness, we now explicitly recorder the order in which we generate entries. We then use this ordering data to deserialize the correct proc-macro-data from the crate metadata.
2020-02-11Rollup merge of #66498 - bjorn3:less_feature_flags, r=Dylan-DPCDylan DPC-4/+0
Remove unused feature gates I think many of the remaining unstable things can be easily be replaced with stable things. I have kept the `#![feature(nll)]` even though it is only necessary in `libstd`, to make regressions of it harder.
2020-02-07Remove unused feature gates from librustc_metadatabjorn3-4/+0
2020-02-06Add a Hir wrapper typeJohn Kåre Alsaker-2/+2
2020-02-04Auto merge of #68708 - Mark-Simulacrum:stage0-step, r=pietroalbinibors-1/+0
Step stage0 to bootstrap from 1.42 This also includes a commit which fixes the rustfmt downloading logic to redownload when the rustfmt channel changes, and bumps rustfmt to a more recent version.
2020-02-01syntax::print -> new crate rustc_ast_prettyMazdak Farrokhzad-1/+2
2020-02-01Move builtin attribute logic to new rustc_attr crate.Mazdak Farrokhzad-3/+5
For now, this is all the crate contains, but more attribute logic & types will be moved there over time.
2020-01-31Drop cfg(bootstrap) codeMark Rousskov-1/+0
2020-01-31Auto merge of #68080 - varkor:declared-here, r=petrochenkovbors-1/+1
Address inconsistency in using "is" with "declared here" "is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout. r? @Centril
2020-01-25Auto merge of #68448 - maurer:dyn-cdylib, r=alexcrichtonbors-9/+11
rustc: Allow cdylibs to link against dylibs Previously, rustc mandated that cdylibs could only link against rlibs as dependencies (not dylibs). This commit disables that restriction and tests that it works in a simple case. I don't have a windows rustc dev environment, so I guessed at the MSVC test code, I'm hoping the CI can run that for me. Additionally, we might want to consider emitting (through cargo or rustc) some metadata to help C users of a cdylib figure out where all the dylibs they need are. I don't think that should be needed to land this change, as it will still be usable by homogeneous build systems without it. My new test was templated off the `tests/run-make-fulldeps/cdylib` test. It seemed more appropriate to have it as a separate test, since both foo.rs and bar.rs would need to be replicated to make that test cover both cases, but I can do that if it would be preferred. If I'm doing anything out of order/process, please let me know; this is only my second change to rustc and the prior one was trivial. r? alexcrichton
2020-01-24Normalise diagnostics with respect to "the X is declared/defined here"varkor-1/+1
2020-01-23rustc: Allow cdylibs to link against dylibsMatthew Maurer-9/+11
Previously, rustc mandated that cdylibs could only link against rlibs as dependencies (not dylibs). This commit disables that restriction and tests that it works in a simple case.
2020-01-23Auto merge of #68298 - Mark-Simulacrum:binary-depdep-fix, r=petrochenkovbors-6/+38
Avoid declaring a fake dependency edge When we're producing an rlib, we do not need anything more than an rmeta file for each of our dependencies (this is indeed utilized by Cargo for pipelining). Previously, we were still storing the paths of possible rlib/dylib crates, which meant that they could still plausibly be accessed. With -Zbinary-dep-depinfo, that meant that Cargo thought that rustc was using both the rlib and an (earlier emitted) rmeta, and so needed a recompile, as the rlib may have finished writing *after* compilation started (for more detail, see issue 68149). This commit changes metadata loading to not store the filepaths of dylib/rlib if we're going to end up creating an rlib only. Fixes #68149.
2020-01-20Read metadata from rmeta exclusively, if possibleMark Rousskov-6/+38
When we're producing an rlib, we do not need anything more than an rmeta file for each of our dependencies (this is indeed utilized by Cargo for pipelining). Previously, we were still storing the paths of possible rlib/dylib crates, which meant that they could still plausibly be accessed. With -Zbinary-dep-depinfo, that meant that Cargo thought that rustc was using both the rlib and an (earlier emitted) rmeta, and so needed a recompile, as the rlib may have finished writing *after* compilation started (for more detail, see issue 68149). This commit changes metadata loading to not store the filepaths of dylib/rlib if we're going to end up creating an rlib only.
2020-01-20Rollup merge of #68353 - Centril:code-liberation, r=petrochenkovDylan DPC-5/+0
Remove `rustc_error_codes` deps except in `rustc_driver` Remove dependencies on `rustc_error_codes` in all crates except for `rustc_driver`. This has some benefits: 1. Adding a new error code when hacking on the compiler only requires rebuilding at most `rustc_error_codes`, `rustc_driver`, and the reflexive & transitive closure of the crate where the new error code is being added and its reverse dependencies. This improves time-to-UI-tests (TTUT). 2. Adding an error description to an error code only requires rebuilding `rustc_error_codes` and `rustc_driver`. This should substantially improve TTUT. r? @petrochenkov cc @rust-lang/wg-diagnostics
2020-01-18remove rustc_error_codes deps except in rustc_driverMazdak Farrokhzad-5/+0
2020-01-18slice_patterns: remove internal uses of gateMazdak Farrokhzad-1/+1
2020-01-17Use named fields for `hir::ItemKind::Impl`Dylan MacKenzie-7/+7
2020-01-16don't clone types that are copyMatthias Krüger-2/+2
found via clippy
2020-01-11use winapi for non-stdlib Windows bindingsAndy Russell-21/+15
2020-01-11Auto merge of #65912 - estebank:variants-orig, r=petrochenkovbors-0/+4
Point at the span for the definition of crate foreign ADTs Follow up to #65421. Partially addresses #65386. Blocked on #53081.
2020-01-11Rollup merge of #67806 - Centril:splitsynmore, r=petrochenkovMazdak Farrokhzad-1/+1
Extract `rustc_ast_passes`, move gating, & refactor linting Based on https://github.com/rust-lang/rust/pull/67770. This PR extracts a crate `rustc_ast_passes`: - `ast_validation.rs`, which is contributed by `rustc_passes` (now only has HIR based passes) -- the goal here is to improve recompilation of the parser, - `feature_gate.rs`, which is contributed by `syntax` and performs post-expansion-gating & final erroring for pre-expansion gating, - `show_span`, which is contributed by `syntax`. To facilitate this, we first have to also: - Move `{leveled_}feature_err{_err}` from `syntax::feature_gate::check` into `rustc_session::parse`. - Move `get_features` into `rustc_parse::config`, the only place it is used. - Move some some lint datatypes and traits, e.g. `LintBuffer`, `BufferedEarlyLint`, `BuiltinLintDiagnostics`, `LintPass`, and `LintArray` into `rustc_session::lint`. - Move all the hard-wired lint `static`s into `rustc_session::lint::builtin`.
2020-01-11simplify feature_err importsMazdak Farrokhzad-1/+1
2020-01-10Auto merge of #65241 - tmiasko:no-std-san, r=alexcrichtonbors-111/+1
build-std compatible sanitizer support ### Motivation When using `-Z sanitizer=*` feature it is essential that both user code and standard library is instrumented. Otherwise the utility of sanitizer will be limited, or its use will be impractical like in the case of memory sanitizer. The recently introduced cargo feature build-std makes it possible to rebuild standard library with arbitrary rustc flags. Unfortunately, those changes alone do not make it easy to rebuild standard library with sanitizers, since runtimes are dependencies of std that have to be build in specific environment, generally not available outside rustbuild process. Additionally rebuilding them requires presence of llvm-config and compiler-rt sources. The goal of changes proposed here is to make it possible to avoid rebuilding sanitizer runtimes when rebuilding the std, thus making it possible to instrument standard library for use with sanitizer with simple, although verbose command: ``` env CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS=-Zsanitizer=thread cargo test -Zbuild-std --target x86_64-unknown-linux-gnu ``` ### Implementation * Sanitizer runtimes are no long packed into crates. Instead, libraries build from compiler-rt are used as is, after renaming them into `librusc_rt.*`. * rustc obtains runtimes from target libdir for default sysroot, so that they are not required in custom build sysroots created with build-std. * The runtimes are only linked-in into executables to address issue #64629. (in previous design it was hard to avoid linking runtimes into static libraries produced by rustc as demonstrated by sanitizer-staticlib-link test, which still passes despite changes made in #64780). cc @kennytm, @japaric, @firstyear, @choller
2020-01-10Point at the span for the definition of crate foreign ADTsEsteban Küber-0/+4
2020-01-10nix syntax::errors & prefer rustc_errors over errorsMazdak Farrokhzad-13/+11
2020-01-09add CStore::item_generics_num_lifetimesMazdak Farrokhzad-6/+5
2020-01-09{rustc::util -> rustc_data_structures}::capturesMazdak Farrokhzad-1/+1
2020-01-09Link sanitizer runtimes instead of injecting crate dependenciesTomasz Miąsko-104/+1
2020-01-09Remove sanitizer_runtime attributeTomasz Miąsko-7/+0