Commit Graph

62 Commits

Author SHA1 Message Date
Ralf Jung
278e26eaf6
Rollup merge of #72669 - petrochenkov:smclean, r=Mark-Simulacrum
rustc_session: Cleanup session creation

Noticed while reviewing https://github.com/rust-lang/rust/pull/72618.
2020-05-30 23:08:55 +02:00
David Wood
a54ed872cb
standardize limit comparisons with Limit type
This commit introduces a `Limit` type which is used to ensure that all
comparisons against limits within the compiler are consistent (which can
result in ICEs if they aren't).

Signed-off-by: David Wood <david@davidtw.co>
2020-05-28 10:33:07 +01:00
Vadim Petrochenkov
5369f4aa57 rustc_session: Cleanup session creation 2020-05-27 22:32:24 +03:00
Dylan MacKenzie
c282c1c654 Use OnceCell instead of Once 2020-05-22 13:31:02 -07:00
Amanieu d'Antras
ec1ad61f88 Implement AST lowering for asm! 2020-05-18 14:41:29 +01:00
bors
5f472813df Auto merge of #72248 - petrochenkov:codemodel, r=Amanieu
Cleanup and document `-C code-model`

r? @Amanieu
2020-05-17 21:22:48 +00:00
Vadim Petrochenkov
55a94bdc38 rustc_target: Stop using "string typing" for code models
Introduce `enum CodeModel` instead.
2020-05-16 12:02:11 +03:00
Tomasz Miąsko
bbb63d4554 Consistently use LLVM lifetime markers during codegen
Ensure that inliner inserts lifetime markers if they have been emitted during
codegen. Otherwise if allocas from inlined functions are merged together,
lifetime markers from one function might invalidate load & stores performed
by the other one.
2020-05-14 15:23:24 +02:00
Dylan DPC
d9c3110ae8
Rollup merge of #72067 - jonas-schievink:fuel-warn, r=varkor
Emit a warning when optimization fuel runs out

`eprintln!` gets swallowed by Cargo too easily.
2020-05-11 22:21:01 +02:00
Jonas Schievink
62116c31cd Emit a warning when optimization fuel runs out
`eprintln!` gets swallowed by Cargo too easily.
2020-05-10 15:40:17 +02:00
bors
8d16eeb8c9 Auto merge of #71775 - petrochenkov:crtcfg, r=matthewjasper
Enable `cfg` predicate for `target_feature = "crt-static"` only if the target supports it

That's what all other `target_feature`s do.
2020-05-10 08:25:32 +00:00
Dylan DPC
12fc1e0fa5
Rollup merge of #69984 - lenary:lenary/force-uwtables, r=hanna-kruppe
Add Option to Force Unwind Tables

When panic != unwind, `nounwind` is added to all functions for a target.
This can cause issues when a panic happens with RUST_BACKTRACE=1, as
there needs to be a way to reconstruct the backtrace. There are three
possible sources of this information: forcing frame pointers (for which
an option exists already), debug info (for which an option exists), or
unwind tables.

Especially for embedded devices, forcing frame pointers can have code
size overheads (RISC-V sees ~10% overheads, ARM sees ~2-3% overheads).
In production code, it can be the case that debug info is not kept, so it is useful
to provide this third option, unwind tables, that users can use to
reconstruct the call stack. Reconstructing this stack is harder than
with frame pointers, but it is still possible.

---

This came up in discussion on #69890, and turned out to be a fairly simple addition.

r? @hanna-kruppe
2020-05-05 12:55:08 +02:00
Sam Elliott
cda994633e Add Option to Force Unwind Tables
When panic != unwind, `nounwind` is added to all functions for a target.
This can cause issues when a panic happens with RUST_BACKTRACE=1, as
there needs to be a way to reconstruct the backtrace. There are three
possible sources of this information: forcing frame pointers (for which
an option exists already), debug info (for which an option exists), or
unwind tables.

Especially for embedded devices, forcing frame pointers can have code
size overheads (RISC-V sees ~10% overheads, ARM sees ~2-3% overheads).
In code, it can be the case that debug info is not kept, so it is useful
to provide this third option, unwind tables, that users can use to
reconstruct the call stack. Reconstructing this stack is harder than
with frame pointers, but it is still possible.

This commit adds a compiler option which allows a user to force the
addition of unwind tables. Unwind tables cannot be disabled on targets
that require them for correctness, or when using `-C panic=unwind`.
2020-05-04 12:08:35 +01:00
bors
a0c61a9044 Auto merge of #71631 - RalfJung:miri-unleash-the-gates, r=oli-obk
Miri: unleash all feature gates

IMO it is silly to unleash features that do not even have a feature gate yet, but not unleash features that do. The only thing this achieves is making unleashed mode annoying to use as we have to figure out the feature flags to enable (and not always do the error messages say what that flag is).

Given that the point of `-Z unleash-the-miri-inside-of-you` is to debug the Miri internals, I see no good reason for this extra hurdle. I cannot imagine a situation where we'd use that flag, realize the program also requires some feature gate, and then be like "oh I guess if this feature is unstable I will do something else". Instead, we'll always just add that flag to the code as well, so requiring the flag achieves nothing.

r? @oli-obk @ecstatic-morse
Fixes https://github.com/rust-lang/rust/issues/71630
2020-05-03 22:54:55 +00:00
Ralf Jung
f7f606d9af fmt 2020-05-03 17:12:50 +02:00
Ralf Jung
99debecd4d warn about each skipped feature gate 2020-05-03 14:23:08 +02:00
Vadim Petrochenkov
33b6631d9b Enable cfg predicate for target_feature = "crt-static" only if the target supports it 2020-05-03 10:31:33 +03:00
Ralf Jung
89666ab6b4 fix miri-unleash delayed sanity checking 2020-05-02 14:39:19 +02:00
Ralf Jung
08ba0145c7 make sure the miri-unleash-flag is not used to circumvent feature gates 2020-05-02 13:32:58 +02:00
Vadim Petrochenkov
ff86a45820 cleanup: config::CrateType -> CrateType 2020-05-02 11:57:23 +03:00
Amanieu d'Antras
eb4725fc54 Remove Session::no_landing_pads() 2020-04-29 01:05:56 +01:00
Amanieu d'Antras
2f5bd9d0f1 Remove -Z no-landing-pads flag 2020-04-29 01:05:55 +01:00
Vadim Petrochenkov
feeb75e263 rustc_target: Stop using "string typing" for TLS models
Introduce `enum TlsModel` instead.
2020-04-26 23:36:00 +03:00
Vadim Petrochenkov
fb91e5ed2f rustc_target: Stop using "string typing" for relocation models
Introduce `enum RelocModel` instead.
2020-04-26 11:18:47 +03:00
Nicholas Nethercote
58217bc996 Replace uses of parse_opt_* with parse_* where possible.
This lets us specify the default at the options declaration point,
instead of using `.unwrap(default)` or `None | Some(default)` at some
use point far away. It also makes the code more concise.
2020-04-19 19:53:54 +10:00
bors
6050e523ba Auto merge of #69718 - arlosi:debughash, r=eddyb
Add hash of source files in debug info

LLVM supports placing the hash of source files inside the debug info.
This information can be used by a debugger to verify that the source code matches
the executable.

This change adds support for both hash algorithms supported by LLVM, MD5 and SHA1, controlled by a target option.

* DWARF only supports MD5
* LLVM IR supports MD5 and SHA1 (and SHA256 in LLVM 11).
* CodeView (.PDB) supports MD5, SHA1, and SHA256.

Fixes #68980.

Tracking issue: #70401

rustc dev guide PR with further details: https://github.com/rust-lang/rustc-dev-guide/pull/623
2020-04-04 03:00:47 +00:00
bors
9e55101bb6 Auto merge of #70156 - michaelwoerister:incr-cgus, r=nikomatsakis
Make the rustc respect the `-C codegen-units` flag in incremental mode.

This PR implements (the as of yet unapproved) major change proposal at https://github.com/rust-lang/compiler-team/issues/245. See the description there for background and rationale.

The changes are pretty straightforward and should be easy to rebase if the proposal gets accepted at some point.

r? @nikomatsakis cc @pnkfelix
2020-04-03 23:50:01 +00:00
Arlo Siemsen
f86b078e2d Add hash of source files in debug info
* Adds either an MD5 or SHA1 hash to the debug info.
* Adds new unstable option `-Z src-hash-algorithm` to control the hashing algorithm.
2020-04-02 14:13:19 -07:00
Eduard-Mihai Burtescu
f5892c00ac Translate the virtual /rustc/$hash prefix back to a real directory. 2020-04-02 11:39:41 +03:00
Michael Woerister
1e5b4594e1 Make the rustc respect the -C codegen-units flag in incremental mode.
Before this commit `-C codegen-units` would just get silently be
ignored if `-C incremental` was specified too. After this commit
one can control the number of codegen units generated during
incremental compilation. The default is rather high at 256, so most
crates won't see a difference unless explicitly opting into a lower
count.
2020-03-31 16:11:16 +02:00
Bastian Kauschke
d7ecc8c9bc query normalize_generic_arg_after_erasing_regions 2020-03-23 19:22:19 +01:00
Mazdak Farrokhzad
bb8785ea00 move CrateDisambiguator -> rustc_ast 2020-03-21 22:18:57 +01:00
bors
7ceebd98c6 Auto merge of #69519 - 12101111:remove-proc-macro-check, r=nagisa
Don't use static crt by default when build proc-macro

Don't check value of `crt-static` when build proc-macro crates, since they are always built dynamically.
For more information, see https://github.com/rust-lang/cargo/issues/7563#issuecomment-591965320
I hope this will fix issues about compiling `proc_macro` crates on musl host without bring more issues.
Fix https://github.com/rust-lang/cargo/issues/7563
2020-03-17 18:27:26 +00:00
Vadim Petrochenkov
01a0c6d441 rustc_metadata: Remove rmeta::MacroDef
Use `ast::MacroDef` instead.

Also remove `Session::imported_macro_spans`, external macros have spans now.
2020-03-14 00:27:13 +03:00
Wesley Wiser
5357f83ee8 [Miri] Use a session variable instead of checking for an env var always
In CTFE heavy code, checking the env var everytime is inefficient. We
can do a lot better by using a `Session` variable instead.
2020-03-10 18:18:04 -04:00
12101111
cfff1b4c12 When crate_type is None,check compiler options 2020-03-10 15:36:23 +08:00
12101111
dbed65afae Simplify checking of crt_static_feature() 2020-03-08 14:24:02 +08:00
Christoph Schmidler
288e142737 Add a new test to reach const_limit setting, although with wrong WARNINGs yet
rename feature to const_eval_limit
2020-03-05 08:09:52 +01:00
Christoph Schmidler
337af5ef7a Prepare const_limit feature gate and attribute 2020-03-05 08:09:52 +01:00
12101111
7996df992f Run format. 2020-03-03 16:29:44 +08:00
12101111
7ca1b2f504 Don't use static crt by default when build proc-macro. 2020-03-03 16:17:15 +08:00
John Kåre Alsaker
a8522256c5 Tune inlining 2020-02-19 16:03:21 +01:00
Matthias Prechtl
f35a7c38da Make issue references consistent 2020-02-09 20:43:49 +01:00
Eduard-Mihai Burtescu
f6fc80206e rustc: rename -Zexternal-macro-backtrace to -Zmacro-backtrace. 2020-02-06 21:32:07 +02:00
bors
58b834344f Auto merge of #67429 - mati865:mingw-ultimate-fix, r=alexcrichton
windows-gnu: prefer system crt libraries if they are available

The origin of the issue is the fact Rust ships mingw-w64 libraries but no headers and prefers own libraries over the system ones.
This leads to situation when headers aren't compatible with libraries (mingw-w64 doesn't provide any forward compatibility and AFAIK backwards compatibility is guaranteed only within major release series).

It's easier to understand how this PR works when looking at the linker invocation before and with this PR: https://www.diffchecker.com/GEuYFmzo
It adds system libraries path before Rust libraries so the linker will prefer them.
It has potential issue when system has files with the same names as Rust but that could be avoided by moving Rust shipped mingw-w64 libraries from `lib/rustlib/x86_64-pc-windows-gnu/lib` to say `lib/rustlib/x86_64-pc-windows-gnu/lib/mingw`. Then adding linker paths in this order: Rust libraries, system libraries, Rust shipped mingw-w64 libraries.

Fixes #47048
Fixes #49078
Fixes #53454
Fixes #60912
2020-02-05 19:11:04 +00:00
Mateusz Mikuła
1fad337f79 Prefer system MinGW libs when available 2020-02-04 23:20:24 +01:00
Matthias Krüger
697ef95c9f remove redundant imports (clippy::single_component_path_imports) 2020-02-04 01:05:45 +01:00
Aaron Green
192650a9aa Fix tidy warnings 2020-01-22 15:34:39 -08:00
Aaron Green
4210409f44 Enable ASan on Fuchsia
This change adds the x86_64-fuchsia and aarch64-fuchsia LLVM targets to
those allowed to invoke -Zsanitizer. Currently, the only overlap between
compiler_rt sanitizers supported by both rustc and Fuchsia is ASan.
2020-01-22 15:19:36 -08:00
Tomasz Miąsko
0c6b1a7e3c Link sanitizer runtimes instead of injecting crate dependencies 2020-01-09 07:54:02 +01:00