about summary refs log tree commit diff
path: root/src/librustc_session
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-6970/+0
2020-08-25Auto merge of #74275 - wesleywiser:break_up_partitioning_rs, r=pnkfelixbors-0/+2
Refactor the partitioning module to make it easier to introduce new algorithms I've split the `librustc_mir::monomorphize::partitioning` module into a few files and introduced a `Partitioner` trait which allows us to decouple the partitioning algorithm from the code which integrates it into the query system. This should allow us to introduce new partitioning algorithms much more easily. I've also gone ahead and added a `-Z` flag to control which algorithm is used (currently there is only the `default`). I left a few comments in places where things might be improved further. r? @pnkfelix cc @rust-lang/wg-incr-comp
2020-08-22Lazy decoding of DefPathTable from crate metadata (non-incremental case)Aaron Hill-7/+0
2020-08-21Add partitioning -Z option to control which partitioning scheme is usedWesley Wiser-0/+2
2020-08-18Remove missing_fragment_specifier lintAleksey Kladov-11/+0
2020-08-18Promote missing_fragment_specifier to hard errorAleksey Kladov-2/+0
It has been deny_by_default since 2017 (and warned for some time before that), so it seems reasonable to promote it. The specific technical motivation to do this now is to remove a field from `ParseSess` -- it is a global state, and global state makes extracting libraries annoying. Closes #40107
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-2/+2
2020-08-16Rollup merge of #75223 - Aaron1011:feature/session-track-caller, r=eddybTyler Mandry-0/+1
Add #[track_caller] to `Session::delay_span_bug` This forwards the caller span to `Handler::delay_span_bug`
2020-08-15replaced log with tracingGurpreet Singh-4/+4
2020-08-15Auto merge of #74576 - myfreeweb:freebsd-sanitizers, r=oli-obkbors-3/+8
Add sanitizer support on FreeBSD Restarting #47337. Everything is better now, no more weird llvm problems, well not everything: Unfortunately, the sanitizers don't have proper support for versioned symbols (https://github.com/google/sanitizers/issues/628), so `libc`'s usage of `stat@FBSD_1.0` and so on explodes, e.g. in calling `std::fs::metadata`. Building std (now easy thanks to cargo `-Zbuild-std`) and libc with `freebsd12/13` config via the `LIBC_CI=1` env variable is a good workaround… ``` LIBC_CI=1 RUSTFLAGS="-Z sanitizer=address" cargo +san-test -Zbuild-std run --target x86_64-unknown-freebsd --verbose ``` …*except* std won't build because there's no `st_lspare` in the ino64 version of the struct, so an std patch is required: ```diff --- i/src/libstd/os/freebsd/fs.rs +++ w/src/libstd/os/freebsd/fs.rs @@ -66,8 +66,6 @@ pub trait MetadataExt { fn st_flags(&self) -> u32; #[stable(feature = "metadata_ext2", since = "1.8.0")] fn st_gen(&self) -> u32; - #[stable(feature = "metadata_ext2", since = "1.8.0")] - fn st_lspare(&self) -> u32; } #[stable(feature = "metadata_ext", since = "1.1.0")] @@ -136,7 +134,4 @@ impl MetadataExt for Metadata { fn st_flags(&self) -> u32 { self.as_inner().as_inner().st_flags as u32 } - fn st_lspare(&self) -> u32 { - self.as_inner().as_inner().st_lspare as u32 - } } ``` I guess std could like.. detect that `libc` isn't built for the old ABI, and replace the implementation of `st_lspare` with a panic?
2020-08-14Rework `rustc_serialize`Matthew Jasper-6/+11
- Move the type parameter from `encode` and `decode` methods to the trait. - Remove `UseSpecialized(En|De)codable` traits. - Remove blanket impls for references. - Add `RefDecodable` trait to allow deserializing to arena-allocated references safely. - Remove ability to (de)serialize HIR. - Create proc-macros `(Ty)?(En|De)codable` to help implement these new traits.
2020-08-10Fix symbol ordering for confusable idents detection.Nicholas Nethercote-2/+1
Confusable idents detection uses a type `BTreeMap<Symbol, Span>`. This is highly dubious given that `Symbol` doesn't guarantee a meaningful order. (In practice, it currently gives an order that mostly matches source code order.) As a result, changes in `Symbol` representation make the `lint-confusable-idents.rs` test fail, because this error message: > identifier pair considered confusable between `s` and `s` is changed to this: > identifier pair considered confusable between `s` and `s` and the corresponding span pointers get swapped erroneously, leading to an incorrect "previous identifier" label. This commit sorts the relevant symbols by span before doing the checking, which ensures that the ident that appears first in the code will be mentioned first in the message. The commit also extends the test slightly to be more thorough.
2020-08-09Add sanitizer support on FreeBSDGreg V-3/+8
2020-08-08Auto merge of #74932 - nnethercote:rm-ast-session-globals, r=petrochenkovbors-26/+98
Remove `librustc_ast` session globals By moving the data onto `Session`. r? @petrochenkov
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-4/+80
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-08Remove some unnecessary uses of `Option`.Nicholas Nethercote-22/+18
These arguments are never `None`.
2020-08-07fix clippy::redundant_clone: remove redundant clonesMatthias Krüger-1/+1
2020-08-06Add #[track_caller] to `Session::delay_span_bug`Aaron Hill-0/+1
This forwards the caller span to `Handler::delay_span_bug`
2020-08-02Rollup merge of #75059 - shengsheng:typos, r=Dylan-DPCManish Goregaokar-2/+2
fix typos Fix common misspellings with https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
2020-08-02fix typosliuzhenyu-2/+2
2020-08-02Auto merge of #74210 - estebank:type-ascriptomatic, r=petrochenkovbors-0/+3
Deduplicate `::` -> `:` typo errors Deduplicate errors caused by the same type ascription typo, including ones suggested during parsing that would get reported again during resolve. Fix #70382.
2020-07-31Move from `log` to `tracing`Oliver Scherer-1/+1
2020-07-31Reduce verbosity of some type ascription errorsEsteban Küber-0/+3
* Deduplicate type ascription LHS errors * Remove duplicated `:` -> `::` suggestion from parse error * Tweak wording to be more accurate * Modify `current_type_ascription` to reduce span wrangling * remove now unnecessary match arm * Add run-rustfix to appropriate tests
2020-07-31Auto merge of #74926 - Manishearth:rename-lint, r=jyn514bors-2/+2
Rename intra_doc_link_resolution_failure It should be plural to follow the conventions in https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints
2020-07-30Rollup merge of #74915 - alexcrichton:allow-failing-canonicalize, ↵Manish Goregaokar-19/+13
r=Mark-Simulacrum rustc: Ignore fs::canonicalize errors in metadata This commit updates the metadata location logic to ignore errors when calling `fs::canonicalize`. Canonicalization was added historically so multiple `-L` paths to the same directory don't print errors about multiple candidates (since rustc can deduplicate same-named paths), but canonicalization doesn't work on all filesystems. Cargo, for example, always uses this sort of fallback where it will opportunitistically try to canonicalize but fall back to using the input path if it otherwise doesn't work. If rustc is run on a filesystem that doesn't support canonicalization then the effect of this change will be that `-L` paths which logically point to the same directory will cause errors, but that's a rare enough occurrence it shouldn't cause much issue in practice. Otherwise rustc doesn't work at all today on those sorts of filesystem where canonicalization isn't supported!
2020-07-30Rename the lint againManish Goregaokar-2/+2
2020-07-30rustc: Ignore fs::canonicalize errors in metadataAlex Crichton-19/+13
This commit updates the metadata location logic to ignore errors when calling `fs::canonicalize`. Canonicalization was added historically so multiple `-L` paths to the same directory don't print errors about multiple candidates (since rustc can deduplicate same-named paths), but canonicalization doesn't work on all filesystems. Cargo, for example, always uses this sort of fallback where it will opportunitistically try to canonicalize but fall back to using the input path if it otherwise doesn't work. If rustc is run on a filesystem that doesn't support canonicalization then the effect of this change will be that `-L` paths which logically point to the same directory will cause errors, but that's a rare enough occurrence it shouldn't cause much issue in practice. Otherwise rustc doesn't work at all today on those sorts of filesystem where canonicalization isn't supported!
2020-07-30Rename to intra_doc_resolution_failuresManish Goregaokar-2/+2
2020-07-29Rename intra_doc_link_resolution_failure -> intra_doc_link_resolution_failuresManish Goregaokar-2/+2
2020-07-29Auto merge of #74733 - richkadel:llvm-coverage-map-gen-5, r=tmandrybors-1/+1
Fixed coverage map issues; better aligned with LLVM APIs Found some problems with the coverage map encoding when testing with more than one counter per function. While debugging, I realized some better ways to structure the Rust implementation of the coverage mapping generator. I refactored somewhat, resulting in less code overall, expanded coverage of LLVM Coverage Map capabilities, and much closer alignment with LLVM data structures, APIs, and naming. This should be easier to follow and easier to maintain. r? @tmandry Rust compiler MCP rust-lang/compiler-team#278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation
2020-07-29Auto merge of #72049 - mati865:mingw-lld, r=petrochenkovbors-5/+5
MinGW: enable dllexport/dllimport Fixes (only when using LLD) https://github.com/rust-lang/rust/issues/50176 Fixes https://github.com/rust-lang/rust/issues/72319 This makes `windows-gnu` on pair with `windows-msvc` when it comes to symbol exporting. For MinGW it means both good things like correctly working dllimport/dllexport, ability to link with LLD and bad things like https://github.com/rust-lang/rust/issues/27438. Not sure but maybe this should land behind unstable compiler option (`-Z`) or environment variable?
2020-07-29MinGW: emit dllexport/dllimport by rustcMateusz Mikuła-5/+5
This fixes various cases where LD could not guess dllexport correctly and greatly improves compatibility with LLD which is not going to support linker scripts anytime soon
2020-07-27mv std libs to library/mark-1/+1
2020-07-25Fixed coverage map issues; better aligned with LLVM APIsRich Kadel-1/+1
Found some problems with the coverage map encoding when testing with more than one counter per function. While debugging, I realized some better ways to structure the Rust implementation of the coverage mapping generator. I refactored somewhat, resulting in less code overall, expanded coverage of LLVM Coverage Map capabilities, and much closer alignment with LLVM data structures, APIs, and naming. This should be easier to follow and easier to maintain.
2020-07-22Rollup merge of #74643 - petrochenkov:noenvrerun, r=Mark-SimulacrumManish Goregaokar-1/+1
build: Remove unnecessary `cargo:rerun-if-env-changed` annotations ... and a couple of related cleanups. rustc and cargo now track the majority of env var dependencies automatically (https://github.com/rust-lang/cargo/pull/8421), so the annotations are no longer necessary.
2020-07-22Auto merge of #74633 - davidtwco:issue-74614-disable-polymorphisation, ↵bors-1/+1
r=wesleywiser Disable polymorphisation Fixes #74614. This PR disables polymorphisation to fix the regression in #74614 after investigation into the issue makes it clear that the fix won't be trivial. ~~I'll file an issue shortly to replace #74614 with the findings so far.~~ #74636 has been filed to track the fix of the underlying regression. r? @eddyb
2020-07-22Rollup merge of #73893 - ajpaverd:cfguard-stabilize, r=nikomatsakisManish Goregaokar-3/+3
Stabilize control-flow-guard codegen option This is the stabilization PR discussed in #68793. It converts the `-Z control-flow-guard` debugging option into a codegen option (`-C control-flow-guard`), and changes the associated tests.
2020-07-22build: Remove unnecessary `cargo:rerun-if-env-changed` annotationsVadim Petrochenkov-1/+1
2020-07-22sess: disable polymorphisationDavid Wood-1/+1
This commit disables polymorphisation to resolve regressions related to closures which inherit unused generic parameters and are then used in casts or reflection. Signed-off-by: David Wood <david@davidtw.co>
2020-07-20mir: use attribute over `-Z polymorphize-errors`David Wood-2/+0
This commit replaces the `-Z polymorphize-errors` debugging flag with a `#[rustc_polymorphize_error]` attribute for use on functions. Signed-off-by: David Wood <david@davidtw.co>
2020-07-20mir: `unused_generic_params` queryDavid Wood-0/+4
This commit implements the `unused_generic_params` query, an initial version of polymorphization which detects when an item does not use generic parameters and is being needlessly monomorphized as a result. Signed-off-by: David Wood <david@davidtw.co>
2020-07-17Generating the coverage mapRich Kadel-5/+46
rustc now generates the coverage map and can support (limited) coverage report generation, at the function level. Example: $ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu $ $BUILD/stage1/bin/rustc -Zinstrument-coverage \ $HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs $ LLVM_PROFILE_FILE="main.profraw" ./main called $ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata $ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main 1| 1|pub fn will_be_called() { 2| 1| println!("called"); 3| 1|} 4| | 5| 0|pub fn will_not_be_called() { 6| 0| println!("should not have been called"); 7| 0|} 8| | 9| 1|fn main() { 10| 1| let less = 1; 11| 1| let more = 100; 12| 1| 13| 1| if less < more { 14| 1| will_be_called(); 15| 1| } else { 16| 1| will_not_be_called(); 17| 1| } 18| 1|}
2020-07-15Remove lots of `Symbol::as_str()` calls.Nicholas Nethercote-2/+2
In various ways, such as changing functions to take a `Symbol` instead of a `&str`.
2020-07-15Add and use more static symbols.Nicholas Nethercote-10/+12
Note that the output of `unpretty-debug.stdout` has changed. In that test the hash values are normalized from a symbol numbers to small numbers like "0#0" and "0#1". The increase in the number of static symbols must have caused the original numbers to contain more digits, resulting in different pretty-printing prior to normalization.
2020-07-14Stabilize control-flow-guard codegen optionAndrew Paverd-3/+3
2020-07-09Auto merge of #74131 - ollie27:rustdoc_invalid_codeblock_attributes_name, ↵bors-2/+2
r=GuillaumeGomez rustdoc: Rename invalid_codeblock_attribute lint to be plural Lint names should be plural as per the lint naming conventions: https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints r? @GuillaumeGomez
2020-07-07rustdoc: Rename invalid_codeblock_attribute lint to be pluralOliver Middleton-2/+2
2020-07-02Auto merge of #73954 - Manishearth:rollup-8qvh170, r=Manishearthbors-2/+3
Rollup of 10 pull requests Successful merges: - #73414 (Implement `slice_strip` feature) - #73564 (linker: Create GNU_EH_FRAME header by default when producing ELFs) - #73622 (Deny unsafe ops in unsafe fns in libcore) - #73684 (add spans to injected coverage counters, extract with CoverageData query) - #73812 (ast_pretty: Pass some token streams and trees by reference) - #73853 (Add newline to rustc MultiSpan docs) - #73883 (Compile rustdoc less often.) - #73885 (Fix wasm32 being broken due to a NodeJS version bump) - #73903 (Changes required for rustc/cargo to build for iOS targets) - #73938 (Optimise fast path of checked_ops with `unlikely`) Failed merges: r? @ghost
2020-06-29add spans to injected coverage countersRich Kadel-2/+3
added regions with counter expressions and counters. Added codegen_llvm/coverageinfo mod for upcoming coverage map Move coverage region collection to CodegenCx finalization Moved from `query coverageinfo` (renamed from `query coverage_data`), as discussed in the PR at: https://github.com/rust-lang/rust/pull/73684#issuecomment-649882503 Address merge conflict in MIR instrument_coverage test The MIR test output format changed for int types. moved debug messages out of block.rs This makes the block.rs calls to add coverage mapping data to the CodegenCx much more concise and readable. move coverage intrinsic handling into llvm impl I realized that having half of the coverage intrinsic handling in `rustc_codegen_ssa` and half in `rustc_codegen_llvm` meant that any non-llvm backend would be bound to the same decisions about how the coverage-related MIR terminators should be handled. To fix this, I moved the non-codegen portion of coverage intrinsic handling into its own trait, and implemented it in `rustc_codegen_llvm` alongside `codegen_intrinsic_call`. I also added the (required?) stubs for the new intrinsics to `IntrepretCx::emulate_intrinsic()`, to ensure calls to this function do not fail if called with these new but known intrinsics. address PR Feedback on 28 June 2020 2:48pm PDT
2020-06-28Remove defunct `-Z print-region-graph`Tomasz Miąsko-3/+0