summary refs log tree commit diff
path: root/src/librustc/session
AgeCommit message (Collapse)AuthorLines
2018-11-15resolve: Filter away macro prelude in modules with `#[no_implicit_prelude]` ↵Vadim Petrochenkov-0/+4
on 2018 edition
2018-10-19Prefer `Default::default` over `FxHash*::default` in struct constructorsOliver Scherer-6/+4
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-3/+3
2018-10-18Rollup merge of #55031 - nikic:verify_llvm_ir, r=Mark-Simulacrumkennytm-0/+1
Improve verify_llvm_ir config option LLVM IR verification has been disabled by default in #51230. However, the implementation doesn't quite match what was discussed in the discussion. This patch implements two changes: * Make `verify_llvm_ir` influence the behavior of the compiled rustc binary, rather than just the rustc build system. That is, if `verify_llvm_ir=true`, even manual invocations of the built rustc will verify LLVM IR. * Enable verification of LLVM IR in CI, for non-deploy and deploy-alt builds. This is similar to how LLVM assertions are handled.
2018-10-17Auto merge of #54671 - petrochenkov:extpre2015, r=nikomatsakisbors-18/+0
resolve: Scale back hard-coded extern prelude additions on 2015 edition https://github.com/rust-lang/rust/pull/54404 stabilized `feature(extern_prelude)` on 2015 edition, including the hard-coded parts not passed with `--extern`. First of all, I'd want to confirm that this is intended stabilization, rather than a part of the "extended beta" scheme that's going to be reverted before releasing stable. (EDIT: to clarify - this is a question, I'm \*asking\* for confirmation, rather than give it.) Second, on 2015 edition extern prelude is not so fundamentally tied to imports and is a mere convenience, so this PR scales them back to the uncontroversial subset. The "uncontroversial subset" means that if libcore is injected it brings `core` into prelude, if libstd is injected it brings `std` and `core` into prelude. On 2015 edition this can be implemented through the library prelude (rather than hard-coding in the compiler) right now, I'll do it in a follow-up PR. UPDATE: The change is done for both 2015 and 2018 editions now as discussed below. Closes https://github.com/rust-lang/rust/issues/53166
2018-10-15rustc/session: move consts up to improve readabilityljedrz-9/+9
2018-10-15rustc/session: use to_owned when no string conversion is neededljedrz-2/+2
2018-10-15rustc/session: improve common patternsljedrz-58/+35
2018-10-15rustc/session: improve allocationsljedrz-5/+6
2018-10-15rustc/session: whitespace & formatting improvementsljedrz-85/+79
2018-10-13Revert "rustc_resolve: move extern_prelude from Resolver to Session."Vadim Petrochenkov-18/+0
This reverts commit e90985acdec9928da9f6d157cfeb64f0ee98bffe.
2018-10-13Improve verify_llvm_ir config optionNikita Popov-0/+1
* Make it influence the behavior of the compiled rustc, rather than just the rustc build system. That is, if verify_llvm_ir=true, even manual invocations of the built rustc will verify LLVM IR. * Enable verification of LLVM IR in CI, for non-deploy and deploy-alt builds. This is similar to how LLVM assertions are handled.
2018-10-11Support for disabling the PLT on ELF targetsGabriel Majeri-2/+26
Disable the PLT where possible to improve performance for indirect calls into shared libraries. This optimization is enabled by default where possible. - Add the `NonLazyBind` attribute to `rustllvm`: This attribute informs LLVM to skip PLT calls in codegen. - Disable PLT unconditionally: Apply the `NonLazyBind` attribute on every function. - Only enable no-plt when full relro is enabled: Ensures we only enable it when we have linker support. - Add `-Z plt` as a compiler option
2018-10-02Move prelude crate names into `Session`.David Wood-7/+6
Avoid hardcoding and special-casing the `std` crate name in the item path logic by moving the prelude crate name logic into the `Session` type so it can be reused in the item path logic and resolve module.
2018-10-01Rollup merge of #54676 - ↵kennytm-2/+0
pnkfelix:issue-15287-kill-zflag-disabling-ast-check, r=alexcrichton Remove `-Z disable_ast_check_for_mutation_in_guard` One should use `#![feature(bind_by_move_pattern_guards)]` over `-Z disable_ast_check_for_mutation_in_guard` cc #15287
2018-10-01Auto merge of #54675 - alexcrichton:defaultlibs, r=varkorbors-0/+2
rust: Add a `-C default-linker-libraries` option This commit adds a new codegen option for the compiler which disables rustc's passing of `-nodefaultlibs` by default on relevant platforms. Sometimes Rust is linked with C code which fails to link with `-nodefaultlibs` and is unnecessarily onerous to get linking correctly with `-nodefaultlibs`. An example of this is that when you compile C code with sanitizers and then pass `-fsanitize=address` to the linker, it's incompatible with `-nodefaultlibs` also being passed to the linker. In these situations it's easiest to turn off Rust's default passing of `-nodefaultlibs`, which was more ideological to start with than anything! Preserving the default is somewhat important but having this be opt-in shouldn't cause any breakage. Closes #54237
2018-09-30Auto merge of #54650 - eddyb:no-extern's-land, r=alexcrichtonbors-1/+18
Don't lint non-extern-prelude extern crate's in Rust 2018. Fixes #54381 by silencing the lint telling users to remove `extern crate` when `use` doesn't work. r? @alexcrichton cc @petrochenkov @nikomatsakis @Centril
2018-09-29don't elide lifetimes in paths in librustc/Zack M. Davis-7/+7
This seemed like a good way to kick the tires on the elided-lifetimes-in-paths lint (#52069)—seems to work! This was also pretty tedious—it sure would be nice if `cargo fix` worked on this codebase (#53896)!
2018-09-29rust: Add a `-C default-linker-libraries` optionAlex Crichton-0/+2
This commit adds a new codegen option for the compiler which disables rustc's passing of `-nodefaultlibs` by default on relevant platforms. Sometimes Rust is linked with C code which fails to link with `-nodefaultlibs` and is unnecessarily onerous to get linking correctly with `-nodefaultlibs`. An example of this is that when you compile C code with sanitizers and then pass `-fsanitize=address` to the linker, it's incompatible with `-nodefaultlibs` also being passed to the linker. In these situations it's easiest to turn off Rust's default passing of `-nodefaultlibs`, which was more ideological to start with than anything! Preserving the default is somewhat important but having this be opt-in shouldn't cause any breakage. Closes #54237
2018-09-28rustc_resolve: move extern_prelude from Resolver to Session.Eduard-Mihai Burtescu-1/+18
2018-09-28Prefer `#![feature(bind_by_move_pattern_guards)]` over `-Z ↵Felix S. Klock II-2/+0
disable_ast_check_for_mutation_in_guard`
2018-09-26add -Z emit-stack-sizesJorge Aparicio-0/+2
2018-09-25incr.comp.: Don't automatically enable -Zshare-generics for incr.comp. builds.Michael Woerister-1/+0
2018-09-23Auto merge of #54325 - michaelwoerister:incr-thinlto-tests, r=alexcrichtonbors-0/+11
incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to test incremental ThinLTO. This adds some tests specifically targeted at incremental ThinLTO, plus the infrastructure for tracking the kind of cache hit/miss we had for a given CGU. @alexcrichton, let me know if you can think of any more tests to add. ThinLTO works rather reliably for small functions, so we should be able to test it in a robust way. I think after this lands it might time for a "Help us test incremental ThinLTO" post on irlo. r? @alexcrichton
2018-09-22Auto merge of #54188 - lqd:fallout-53695, r=nikomatsakisbors-1/+1
NLL: disallow creation of immediately unusable variables Fix #53695 Original description follows ---- This WIP PR is for discussing the impact of fixing #53695 by injecting a fake read in let patterns. (Travis will fail, at least the `mir-opt` suite is failing in its current state)
2018-09-20Auto merge of #54241 - vi:suggest_with_applicability, r=estebankbors-3/+8
Remove usages of span_suggestion without Applicability Use `Applicability::Unspecified` for all of them instead. Shall deprecations for the non-`_with_applicability` functions be added? Shall clippy be addressed somehow? r? @estebank
2018-09-18incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to ↵Michael Woerister-0/+11
test incremental ThinLTO.
2018-09-18Refactor 'ReadForMatch' into 'FakeRead' and add the cause of the fake readRemy Rakic-1/+1
2018-09-18Rollup merge of #54232 - pnkfelix:add-way-to-disable-diagnostic-buffering, ↵Guillaume Gomez-0/+4
r=nikomatsakis add `-Z dont-buffer-diagnostics` Add `-Z dont-buffer-diagnostics`, a way to force NLL to immediately its diagnostics. This is mainly intended for developers who want to see the error in its original context in the control flow. Two uses cases for that are: 1. `-Z treat-err-as-bug` (which then allows extraction of a stack-trace to the origin of the error) 2. RUST_LOG=... rustc, in which case it is often useful to see the logging statements that occurred immediately prior to the point where the diagnostic was signalled.
2018-09-17Whitespace fix again.Vitaly _Vi Shukela-5/+5
2018-09-17Add -Z dont-buffer-diagnostics, a way to force NLL to immediately emit its ↵Felix S. Klock II-0/+4
diagnostics. This is mainly intended for `rustc` developers who want to see a diagnostic in its original context in the control flow. Two uses cases for that are: * `-Z treat-err-as-bug` which then allows extraction of a stack-trace to the origin of the error (a case that is so important that we make that flag imply this one, effectively). * `RUST_LOG=... rustc`, in which case it is often useful to see the logging statements that occurred immediately prior to the point where the diagnostic was signalled. Drive-by: Added some documentation pointing future devs at HandlerFlags, and documented the fields of `HandlerFlags` itself.
2018-09-17Fix style according to review comments.Vitaly _Vi Shukela-2/+6
2018-09-16Remove usages of span_suggestion without ApplicabilityVitaly _Vi Shukela-3/+4
Use Applicability::Unspecified for all of them instead.
2018-09-15rustc: add unstable support for --extern crate_name without a path.Eduard-Mihai Burtescu-21/+22
2018-09-14Rollup merge of #53950 - michaelwoerister:more-lto-cli, r=alexcrichtonkennytm-20/+65
Allow for opting out of ThinLTO and clean up LTO related cli flag handling. It turns out that there currently is no way to explicitly disable ThinLTO (except for the nightly-only `-Zthinlto` flag). This PR extends `-C lto` to take `yes` and `no` in addition to `thin` and `fat`. It should be backwards compatible. It also cleans up how LTO mode selection is handled. Note that merging the PR in the current state would make the new values for `-C lto` available on the stable channel. I think that would be fine but maybe some team should vote on it.
2018-09-08Rollup merge of #54007 - japaric:gh53964, r=cramertjkennytm-0/+4
crates that provide a `panic_handler` are exempt from the `unused_extern_crates` lint fixes the *first* false positive reported in #53964
2018-09-06crates that provide a `panic_handler` are exempt from `unused_extern_crates`Jorge Aparicio-0/+4
fixes the *first* false positive reported in #53964
2018-09-06Validate syntax of `--cfg` command line argumentsVadim Petrochenkov-14/+25
2018-09-05Allow for opting out of ThinLTO and clean up LTO related cli flag handling.Michael Woerister-20/+65
2018-08-31Support local ThinLTO with incremental compilation.Michael Woerister-8/+13
2018-08-30Rollup merge of #53472 - eddyb:fx-pls, r=pnkfelixPietro Albini-7/+6
Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc. Most of the compiler uses the `Fx` hasher but some places ended up with the default one.
2018-08-28Fix warnings about the `native` target-cpuAlex Crichton-7/+0
This fixes a regression from #53031 where specifying `-C target-cpu=native` is printing a lot of warnings from LLVM about `native` being an unknown CPU. It turns out that `native` is indeed an unknown CPU and we have to perform a mapping to an actual CPU name, but this mapping is only performed in one location rather than all locations we inform LLVM about the target CPU. This commit centralizes the mapping of `native` to LLVM's value of the native CPU, ensuring that all locations we inform LLVM about the `target-cpu` it's never `native`. Closes #53322
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-7/+6
2018-08-23use String::new() instead of String::from(""), "".to_string(), "".to_owned() ↵Matthias Krüger-3/+3
or "".into()
2018-08-20Auto merge of #52101 - japaric:linker-flavor, r=alexcrichtonbors-8/+1
try to infer linker flavor from linker name and vice versa This is a second take on PR #50359 that implements the logic proposed in https://github.com/rust-lang/rust/pull/50359#pullrequestreview-116663121 With this change it would become possible to link `thumb*` binaries using GNU's LD on stable as `-C linker=arm-none-eabi-ld` would be enough to change both the linker and the linker flavor from their default values of `arm-none-eabi-gcc` and `gcc`. To link `thumb*` binaries using rustc's LLD on stable `-Z linker-flavor` would need to be stabilized as `-C linker=rust-lld -Z linker-flavor=ld.lld` are both required to change the linker and the linker flavor, but this PR doesn't propose that. We would probably need some sort of stability guarantee around `rust-lld`'s name and availability to make linking with rustc's LLD truly stable. With this change it would also be possible to link `thumb*` binaries using a system installed LLD on stable using the `-C linker=ld.lld` flag (provided that `ld.lld` is a symlink to the system installed LLD). r? @alexcrichton
2018-08-19mv codemap source_mapDonato Sciarra-12/+12
2018-08-19mv codemap() source_map()Donato Sciarra-2/+2
2018-08-19mv (mod) codemap source_mapDonato Sciarra-6/+6
2018-08-19mv CodeMap SourceMapDonato Sciarra-4/+4
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-2/+2