about summary refs log tree commit diff
path: root/compiler/rustc_session/src
AgeCommit message (Collapse)AuthorLines
2020-11-10Rollup merge of #78875 - petrochenkov:cleantarg, r=Mark-SimulacrumJonas Schievink-40/+35
rustc_target: Further cleanup use of target options Follow up to https://github.com/rust-lang/rust/pull/77729. Implements items 2 and 4 from the list in https://github.com/rust-lang/rust/pull/77729#issue-500228243. The first commit collapses uses of `target.options.foo` into `target.foo`. The second commit renames some target options to avoid tautology: `target.target_endian` -> `target.endian` `target.target_c_int_width` -> `target.c_int_width` `target.target_os` -> `target.os` `target.target_env` -> `target.env` `target.target_vendor` -> `target.vendor` `target.target_family` -> `target.os_family` `target.target_mcount` -> `target.mcount` r? `@Mark-Simulacrum`
2020-11-10Add flags customizing behaviour of MIR inliningTomasz Miąsko-0/+4
* `-Zinline-mir-threshold` to change the default threshold. * `-Zinline-mir-hint-threshold` to change the threshold used by functions with inline hint.
2020-11-09Add `#[cfg(panic = "...")]`David Hewitt-0/+3
2020-11-08rustc_target: Rename some target options to avoid tautologyVadim Petrochenkov-5/+5
`target.target_endian` -> `target.endian` `target.target_c_int_width` -> `target.c_int_width` `target.target_os` -> `target.os` `target.target_env` -> `target.env` `target.target_vendor` -> `target.vendor` `target.target_family` -> `target.os_family` `target.target_mcount` -> `target.mcount`
2020-11-08Collapse all uses of `target.options.foo` into `target.foo`Vadim Petrochenkov-36/+31
with an eye on merging `TargetOptions` into `Target`. `TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls.
2020-11-07Allow making `RUSTC_BOOTSTRAP` conditional on the crate nameJoshua Nelson-9/+18
The main change is that `UnstableOptions::from_environment` now requires an (optional) crate name. If the crate name is unknown (`None`), then the new feature is not available and you still have to use `RUSTC_BOOTSTRAP=1`. In practice this means the feature is only available for `--crate-name`, not for `#![crate_name]`; I'm interested in supporting the second but I'm not sure how. Other major changes: - Added `Session::is_nightly_build()`, which uses the `crate_name` of the session - Added `nightly_options::match_is_nightly_build`, a convenience method for looking up `--crate-name` from CLI arguments. `Session::is_nightly_build()`should be preferred where possible, since it will take into account `#![crate_name]` (I think). - Added `unstable_features` to `rustdoc::RenderOptions` There is a user-facing change here: things like `RUSTC_BOOTSTRAP=0` no longer active nightly features. In practice this shouldn't be a big deal, since `RUSTC_BOOTSTRAP` is the opposite of stable and everyone uses `RUSTC_BOOTSTRAP=1` anyway. - Add tests Check against `Cheat`, not whether nightly features are allowed. Nightly features are always allowed on the nightly channel. - Only call `is_nightly_build()` once within a function - Use booleans consistently for rustc_incremental Sessions can't be passed through threads, so `read_file` couldn't take a session. To be consistent, also take a boolean in `write_file_header`.
2020-11-05Responded to all feedback as of 2020-10-30Rich Kadel-2/+5
2020-11-03Rollup merge of #77950 - arlosi:sha256, r=eddybMara Bos-1/+1
Add support for SHA256 source file hashing Adds support for `-Z src-hash-algorithm sha256`, which became available in LLVM 11. Using an older version of LLVM will cause an error `invalid checksum kind` if the hash algorithm is set to sha256. r? `@eddyb` cc #70401 `@est31`
2020-11-02Auto merge of #78592 - fpoli:nll-facts-dir, r=matthewjasperbors-0/+2
Add option to customize the nll-facts' folder location This PR adds a `nll-facts-dir` option to specify the location of the directory in which NLL facts are dumped into. It works the same way `dump-mir-dir` controls the location used by the `dump-mir` option.
2020-11-02Auto merge of #78605 - nox:relax-elf-relocations, r=nagisabors-0/+2
Implement -Z relax-elf-relocations=yes|no This lets rustc users tweak whether the linker should relax ELF relocations without recompiling a whole new target with its own libcore etc.
2020-10-31Implement -Z relax-elf-relocations=yes|noAnthony Ramine-0/+2
This lets rustc users tweak whether the linker should relax ELF relocations, namely whether it should emit R_X86_64_GOTPCRELX relocations instead of R_X86_64_GOTPCREL, as the former is allowed by the ABI to be further optimised. The default value is whatever the target defines.
2020-10-30Some workAaron Hill-3/+3
2020-10-30Implement rustc side of report-future-incompatAaron Hill-3301/+56
2020-10-30Add option to customize the nll-facts' folder locationFederico Poli-0/+2
2020-10-30Fix even more clippy warningsJoshua Nelson-8/+3
2020-10-29Rollup merge of #78244 - workingjubilee:dogfood-fancy-ranges, r=varkorJonas Schievink-2/+2
Dogfood {exclusive,half-open} ranges in compiler (nfc) In particular, this allows us to write more explicit matches that avoid the pitfalls of using a fully general fall-through case, yet remain fairly ergonomic. Less logic is in guard cases, more is in the actual exhaustive case analysis. No functional changes.
2020-10-28Dogfood {exclusive,half-open} ranges in compiler (nfc)Jubilee Young-2/+2
In particular, this allows us to write more explicit matches that avoid the pitfalls of using a fully general fall-through case, yet remain fairly ergonomic. Less logic is in guard cases, more is in the actual exhaustive case analysis. No functional changes.
2020-10-28Auto merge of #78414 - nox:function-sections, r=nagisa,bjorn3bors-3/+5
Implement -Z function-sections=yes|no This lets rustc users tweak whether all functions should be put in their own TEXT section, using whatever default value the target defines if the flag is missing. I'm having fun experimenting with musl libc and trying to implement the start symbol in Rust, that means avoiding code that requires relocations, and AFAIK putting everything in its own section makes the toolchain generate `GOTPCREL` relocations for symbols that could use plain old PC-relative addressing (at least on `x86_64`) if they were all in the same section.
2020-10-27Added suggestion to `function_item_references` lint and fixed warning messageAyrton-1/+1
Also updated tests accordingly and tweaked some wording in the lint declaration.
2020-10-27Added documentation for `function_item_references` lintAyrton-0/+24
Added documentation for `function_item_references` lint to the rustc book and fixed comments in the lint checker itself.
2020-10-27Changed lint to check for `std::fmt::Pointer` and `transmute`Ayrton-2/+3
The lint checks arguments in calls to `transmute` or functions that have `Pointer` as a trait bound and displays a warning if the argument is a function reference. Also checks for `std::fmt::Pointer::fmt` to handle formatting macros although it doesn't depend on the exact expansion of the macro or formatting internals. `std::fmt::Pointer` and `std::fmt::Pointer::fmt` were also added as diagnostic items and symbols.
2020-10-27modified lint to work with MIRAyrton-0/+6
Working with MIR let's us exclude expressions like `&fn_name as &dyn Something` and `(&fn_name)()`. Also added ABI, unsafety and whether a function is variadic in the lint suggestion, included the `&` in the span of the lint and updated the test.
2020-10-26Implement -Z function-sections=yes|noAnthony Ramine-0/+2
This lets rustc users tweak whether all functions should be put in their own TEXT section, using whatever default value the target defines if the flag is missing.
2020-10-26Fix some outdated commentsAnthony Ramine-3/+3
2020-10-26Fix typo in lint descriptionMichael Howell-1/+1
2020-10-24ensure that statics are inhabitedRalf Jung-0/+30
2020-10-15Remove rustc_session::config::Configest31-13/+6
The wrapper type led to tons of target.target across the compiler. Its ptr_width field isn't required any more, as target_pointer_width is already present in parsed form.
2020-10-15Replace target.target with target and target.ptr_width with target.pointer_widthest31-47/+38
Preparation for a subsequent change that replaces rustc_target::config::Config with its wrapped Target. On its own, this commit breaks the build. I don't like making build-breaking commits, but in this instance I believe that it makes review easier, as the "real" changes of this PR can be seen much more easily. Result of running: find compiler/ -type f -exec sed -i -e 's/target\.target\([)\.,; ]\)/target\1/g' {} \; find compiler/ -type f -exec sed -i -e 's/target\.target$/target/g' {} \; find compiler/ -type f -exec sed -i -e 's/target.ptr_width/target.pointer_width/g' {} \; ./x.py fmt
2020-10-15Rename target_pointer_width to pointer_width and turn it into an u32est31-11/+10
Rename target_pointer_width to pointer_width because it is already member of the Target struct. The compiler supports only three valid values for target_pointer_width: 16, 32, 64. Thus it can safely be turned into an int. This means less allocations and clones as well as easier handling of the type.
2020-10-14Add support for SHA256 source file hashing for LLVM 11+.Arlo Siemsen-1/+1
2020-10-14Remove unused code from remaining compiler cratesest31-2/+0
2020-10-13Auto merge of #76830 - Artoria2e5:tune, r=nagisabors-0/+2
Pass tune-cpu to LLVM I think this is how it should work... See https://internals.rust-lang.org/t/expose-tune-cpu-from-llvm/13088 for the background. Or the documentation diff.
2020-10-07Auto merge of #77119 - GuillaumeGomez:unclosed-html-tag-lint, r=jyn514bors-0/+11
Unclosed html tag lint Part of #67799. I think `@ollie27` will be interested (`@Manishearth` too since they opened the issue ;) ). r? `@jyn514`
2020-10-05Updates to experimental coverage counter injectionRich Kadel-9/+0
This is a combination of 18 commits. Commit #2: Additional examples and some small improvements. Commit #3: fixed mir-opt non-mir extensions and spanview title elements Corrected a fairly recent assumption in runtest.rs that all MIR dump files end in .mir. (It was appending .mir to the graphviz .dot and spanview .html file names when generating blessed output files. That also left outdated files in the baseline alongside the files with the incorrect names, which I've now removed.) Updated spanview HTML title elements to match their content, replacing a hardcoded and incorrect name that was left in accidentally when originally submitted. Commit #4: added more test examples also improved Makefiles with support for non-zero exit status and to force validation of tests unless a specific test overrides it with a specific comment. Commit #5: Fixed rare issues after testing on real-world crate Commit #6: Addressed PR feedback, and removed temporary -Zexperimental-coverage -Zinstrument-coverage once again supports the latest capabilities of LLVM instrprof coverage instrumentation. Also fixed a bug in spanview. Commit #7: Fix closure handling, add tests for closures and inner items And cleaned up other tests for consistency, and to make it more clear where spans start/end by breaking up lines. Commit #8: renamed "typical" test results "expected" Now that the `llvm-cov show` tests are improved to normally expect matching actuals, and to allow individual tests to override that expectation. Commit #9: test coverage of inline generic struct function Commit #10: Addressed review feedback * Removed unnecessary Unreachable filter. * Replaced a match wildcard with remining variants. * Added more comments to help clarify the role of successors() in the CFG traversal Commit #11: refactoring based on feedback * refactored `fn coverage_spans()`. * changed the way I expand an empty coverage span to improve performance * fixed a typo that I had accidently left in, in visit.rs Commit #12: Optimized use of SourceMap and SourceFile Commit #13: Fixed a regression, and synched with upstream Some generated test file names changed due to some new change upstream. Commit #14: Stripping out crate disambiguators from demangled names These can vary depending on the test platform. Commit #15: Ignore llvm-cov show diff on test with generics, expand IO error message Tests with generics produce llvm-cov show results with demangled names that can include an unstable "crate disambiguator" (hex value). The value changes when run in the Rust CI Windows environment. I added a sed filter to strip them out (in a prior commit), but sed also appears to fail in the same environment. Until I can figure out a workaround, I'm just going to ignore this specific test result. I added a FIXME to follow up later, but it's not that critical. I also saw an error with Windows GNU, but the IO error did not specify a path for the directory or file that triggered the error. I updated the error messages to provide more info for next, time but also noticed some other tests with similar steps did not fail. Looks spurious. Commit #16: Modify rust-demangler to strip disambiguators by default Commit #17: Remove std::process::exit from coverage tests Due to Issue #77553, programs that call std::process::exit() do not generate coverage results on Windows MSVC. Commit #18: fix: test file paths exceeding Windows max path len
2020-10-05Pass tune-cpu to LLVMMingye Wang-0/+2
I think this is how it should work...
2020-10-04Enforce crate level attributes checksGuillaume Gomez-1/+1
2020-10-03Make invalid_html_tags lint only run on nightly and being allowed by defaultGuillaume Gomez-1/+1
2020-10-03Add `unclosed_html_tags` lintGuillaume Gomez-0/+11
2020-10-01Add `-Zprecise-enum-drop-elaboration`Dylan MacKenzie-0/+4
Its purpose is to assist in debugging #77382 and #74551.
2020-09-27[mir-opt] Introduce a new flag to enable experimental/unsound mir optsWesley Wiser-0/+2
2020-09-27Rollup merge of #77262 - bugadani:redundant-comment, r=Dylan-DPCJonas Schievink-3/+0
Remove duplicate comment
2020-09-27Add documentation for `private_intra_doc_links`Joshua Nelson-1/+1
2020-09-27Separate `private_intra_doc_links` and `broken_intra_doc_links` into ↵Joshua Nelson-0/+11
separate lints This is not ideal because it means `deny(broken_intra_doc_links)` will no longer `deny(private_intra_doc_links)`. However, it can't be fixed with a new lint group, because `broken` is already in the `rustdoc` lint group; there would need to be a way to nest groups somehow. This also removes the early `return` so that the link will be generated even though it gives a warning.
2020-09-27Remove duplicate commentDániel Buga-3/+0
2020-09-26Rollup merge of #77211 - est31:remove_unused_allow, r=oli-obkRalf Jung-2/+0
Remove unused #[allow(...)] statements from compiler/
2020-09-26Auto merge of #70743 - oli-obk:eager_const_to_pat_conversion, r=eddybbors-18/+90
Fully destructure constants into patterns r? `@varkor` as discussed in https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/constants.20in.20patterns/near/192789924 we should probably crater it once reviewed
2020-09-26Remove unused #[allow(...)] statements from compiler/est31-2/+0
2020-09-24Don't talk about determinismOliver Scherer-2/+2
2020-09-23Update documentation testsOliver Scherer-16/+6
2020-09-21Don't unwrap but report a fatal error for TargetDataLayout::parse.Mara Bos-1/+3