about summary refs log tree commit diff
path: root/src/librustc_session
AgeCommit message (Collapse)AuthorLines
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
2020-06-26errors: use `-Z terminal-width` in JSON emitterDavid Wood-4/+12
This commit makes the JSON emitter use `-Z terminal-width` in the "rendered" field of the JSON output. Signed-off-by: David Wood <david@davidtw.co>
2020-06-26Auto merge of #73746 - Manishearth:rollup-80jnynm, r=Manishearthbors-4/+8
Rollup of 14 pull requests Successful merges: - #72617 (Add a fast path for `std::thread::panicking`.) - #72738 (Self contained linking option) - #72770 (Implement mixed script confusable lint.) - #73418 (Add unstable `core::mem::variant_count` intrinsic) - #73460 (Emit line info for generator variants) - #73534 (Provide suggestions for some moved value errors) - #73538 (make commented examples use valid syntax, and be more consistent ) - #73581 (Create 0766 error code) - #73619 (Document the mod keyword) - #73621 (Document the mut keyword) - #73648 (Document the return keyword) - #73673 (Fix ptr doc warnings.) - #73674 (Tweak binop errors) - #73687 (Clean up E0701 explanation) Failed merges: - #73708 (Explain move errors that occur due to method calls involving `self` (take two)) r? @ghost
2020-06-25Rollup merge of #72770 - crlf0710:mixed_script_confusable, r=ManishearthManish Goregaokar-1/+2
Implement mixed script confusable lint. This implements the mixed script confusable lint defined in RFC 2457. This is blocked on #72069 and https://github.com/unicode-rs/unicode-security/pull/13, and will need a Cargo.toml version bump after those are resolved. The lint message warning is sub-optimal for now. We'll need a mechanism to properly output `AugmentScriptSet` to screen, this is to be added in `unicode-security` crate. r? @Manishearth
2020-06-25Rollup merge of #72738 - mati865:self-contained-option, r=petrochenkovManish Goregaokar-3/+6
Self contained linking option With objects moved to self-contained directory by https://github.com/rust-lang/rust/pull/72999 we can now add option to control whether to use self-contained on native linkage mode.
2020-06-25Auto merge of #71858 - petrochenkov:env, r=Mark-Simulacrumbors-0/+3
Print environment variables accessed by rustc as special comments into depinfo files So cargo (and perhaps others tools) can use them for linting (at least) or for actually rebuilding crates on env var changes. --- I've recently observed one more forgotten environment variable in a build script https://github.com/rust-lang/rust/pull/71314/commits/8a77d1ca3fc2df789157f7986ddbaf2a377ff0fe and thought it would be nice to provide the list of accessed variables to cargo automatically as a part of depinfo. Unsurprisingly, I wasn't the first who had this idea - cc https://github.com/rust-lang/rust/issues/70517 https://github.com/rust-lang/rust/issues/40364 https://github.com/rust-lang/rust/issues/44074. Also, there are dozens of uses of `(option_)env!` in rustc repo and, like, half of them are not registered in build scripts. --- Description: - depinfo files are extended with special comments containing info about environment variables accessed during compilation. - Comment format for environment variables with successfully retrieved value: `# env-dep:KEY=VALUE`. - Comment format for environment variables without successfully retrieved value: `# env-dep:KEY` (can happen with `option_env!`). - `KEY` and `VALUE` are minimally escaped (`\n`, `\r`, `\\`) so they don't break makefile comments and can be unescaped by anything that can unescape standard `escape_default` and friends. FCP report: https://github.com/rust-lang/rust/pull/71858#issuecomment-633071488 Closes https://github.com/rust-lang/rust/issues/70517 Closes https://github.com/rust-lang/rust/issues/40364 Closes https://github.com/rust-lang/rust/issues/44074 A new issue in the cargo repo will be needed to track the cargo side of this feature. r? @ehuss
2020-06-25Rename get_self_contained_lib_pathMateusz Mikuła-1/+1
2020-06-25Add unstable rustc option to control self-contained linkage modeMateusz Mikuła-2/+5
2020-06-23Rollup merge of #73523 - jyn514:everybody_loops, r=ecstatic-morseManish Goregaokar-2/+5
Fix -Z unpretty=everybody_loops It turns out that this has not been working for who knows how long. Previously: ``` pub fn h() { 1 + 2; } ``` After this change: ``` pub fn h() { loop { } } ``` This only affected the pass when run with the command line pretty-printing option, so rustdoc was still replacing bodies with `loop {}`.
2020-06-23Rollup merge of #73488 - richkadel:llvm-coverage-map-gen, r=tmandryManish Goregaokar-2/+3
code coverage foundation for hash and num_counters This PR is the next iteration after PR #73011 (which is still waiting on bors to merge). @wesleywiser - PTAL r? @tmandry (FYI, I'm also working on injecting the coverage maps, in another branch, while waiting for these to merge.) Thanks!
2020-06-23Refactor non_ascii_idents lints, exclude ascii pair for confusable_idents lint.Charles Lew-1/+2
2020-06-20Rollup merge of #73404 - ajpaverd:cfguard_syntax, r=Mark-SimulacrumRalf Jung-9/+22
Update CFGuard syntax Update the naming and syntax of the control-flow-guard option, as discussed in #68793. r? @Mark-Simulacrum
2020-06-20Support sanitizers on aarch64-unknown-linux-gnuTomasz Miąsko-5/+13
2020-06-19Rollup merge of #73347 - tmiasko:incompatible-sanitizers, r=nikicManish Goregaokar-85/+96
Diagnose use of incompatible sanitizers Emit an error when incompatible sanitizer are configured through command line options. Previously the last one configured prevailed and others were silently ignored. Additionally use a set to represent configured sanitizers, making it possible to enable multiple sanitizers at once. At least in principle, since currently all of them are considered to be incompatible with others.
2020-06-19Fix -Z unpretty=everybody_loopsJoshua Nelson-2/+5
It turns out that this has not been working for who knows how long. Previously: ``` pub fn h() { 1 + 2; } ``` After this change: ``` pub fn h() { loop {} } ``` This only affected the pass when run with the command line pretty-printing option, so rustdoc was still replacing bodies with `loop {}`.
2020-06-19code coverage foundation for hash and num_countersRich Kadel-2/+3
Replaced dummy values for hash and num_counters with computed values, and refactored InstrumentCoverage pass to simplify injecting more counters per function in upcoming versions. Improved usage documentation and error messaging.
2020-06-19Rollup merge of #73300 - crlf0710:crate_level_only_check, r=petrochenkovManish Goregaokar-3/+12
Implement crate-level-only lints checking. This implements a crate_level_only flag on lints, and when it is true, it becomes an error when user tries to specify this flag upon nodes other than crate node. This also turns on this flag for all non_ascii_ident lints.
2020-06-19Rollup merge of #73011 - richkadel:llvm-count-from-mir-pass, r=tmandryRalf Jung-0/+3
first stage of implementing LLVM code coverage This PR replaces #70680 (WIP toward LLVM Code Coverage for Rust) since I am re-implementing the Rust LLVM code coverage feature in a different part of the compiler (in MIR pass(es) vs AST). This PR updates rustc with `-Zinstrument-coverage` option that injects the llvm intrinsic `instrprof.increment()` for code generation. This initial version only injects counters at the top of each function, and does not yet implement the required coverage map. Upcoming PRs will add the coverage map, and add more counters and/or counter expressions for each conditional code branch. Rust compiler MCP https://github.com/rust-lang/compiler-team/issues/278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation ***[I put together some development notes here, under a separate branch.](https://github.com/richkadel/rust/blob/cfa0b21d34ee64e4ebee226101bd2ef0c6757865/src/test/codegen/coverage-experiments/README-THIS-IS-TEMPORARY.md)***
2020-06-19Rollup merge of #72999 - mati865:separate-self-contained-dir, r=Mark-SimulacrumRalf Jung-1/+5
Create self-contained directory and move there some of external binaries/libs One of the steps to reach design described in https://github.com/rust-lang/rust/issues/68887#issuecomment-633048380 This PR moves things around and allows link code to handle the new directory structure.
2020-06-18Implement crate level only lints checking.Charles Lew-3/+12
2020-06-16Update CFGuard syntaxAndrew Paverd-9/+22