Commit Graph

221 Commits

Author SHA1 Message Date
Victor Ding ae51d2ba32 Split join_codegen_and_link() into two steps
`join_codegen_and_link()` is split to `join_codegen()` and `link()`.
2020-02-04 11:09:50 +11:00
Yuki Okushi cbaecee87c Rollup merge of #68111 - varkor:const-generics-type_name, r=oli-obk
Print constants in `type_name` for const generics

Fixes https://github.com/rust-lang/rust/issues/65372.

r? @oli-obk as there may have been a deliberate decision not to in https://github.com/rust-lang/rust/commit/5b9848912a85e28d000602fc2e81bad9c2f2a981#diff-4ed1a72c0bfdf17be769ed520932cd02R80.
2020-01-25 07:45:10 +09:00
varkor 50dd8eaeb9 Print constants in type_name for const generics 2020-01-24 16:23:32 +00:00
Michael Woerister 197cc1e43a Add projection query for upstream drop-glue instances.
This reduces the amount of invalidated data when new types are
add to upstream crates.
2020-01-23 16:56:59 +01:00
Michael Woerister 31095d7e37 Make sure that all upstream generics get re-exported from Rust dylibs. 2020-01-20 12:00:43 +01:00
Mazdak Farrokhzad ebfd8673a7 Remove rustc_hir reexports in rustc::hir. 2020-01-05 12:49:22 +01:00
Mazdak Farrokhzad 66f5bf1b8b extract rustc::middle::codegen_fn_attrs 2020-01-04 18:43:06 +01:00
Mazdak Farrokhzad 4ff12ce4c1 Normalize syntax::symbol imports. 2020-01-02 13:57:04 +01:00
Vadim Petrochenkov 70f1d57048 Rename syntax_pos to rustc_span in source code 2020-01-01 09:15:18 +03:00
Vadim Petrochenkov b9a9c5b4fd Make things build again 2019-12-30 19:18:16 +03:00
Mark Rousskov 6891388e66 x.py fmt after previous deignore 2019-12-24 17:38:22 -05:00
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Camille GILLOT 5fec1ca0ff Use Arena inside hir::ImplItem. 2019-12-21 23:31:47 +01:00
Camille GILLOT 0f7d77363b Use Arena inside hir::TraitItem. 2019-12-21 23:30:52 +01:00
Camille GILLOT 084e6722f9 Use Arena inside hir::Item. 2019-12-21 23:17:29 +01:00
Mazdak Farrokhzad a7aec3f207 1. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.
2. mir::Mutability -> ast::Mutability.
2019-12-20 22:22:44 +01:00
Mazdak Farrokhzad 43d1532cd7 Rollup merge of #67363 - alexcrichton:wasm-import-modules, r=eddyb
Fix handling of wasm import modules and names

The WebAssembly targets of rustc have weird issues around name mangling
and import the same name from different modules. This all largely stems
from the fact that we're using literal symbol names in LLVM IR to
represent what a function is called when it's imported, and we're not
using the wasm-specific `wasm-import-name` attribute. This in turn leads
to two issues:

* If, in the same codegen unit, the same FFI symbol is referenced twice
  then rustc, when translating to LLVM IR, will only reference one
  symbol from the first wasm module referenced.

* There's also a bug in LLD [1] where even if two codegen units
  reference different modules, having the same symbol names means that
  LLD coalesces the symbols and only refers to one wasm module.

Put another way, all our imported wasm symbols from the environment are
keyed off their LLVM IR symbol name, which has lots of collisions today.
This commit fixes the issue by implementing two changes:

1. All wasm symbols with `#[link(wasm_import_module = "...")]` are
   mangled by default in LLVM IR. This means they're all given unique names.

2. Symbols then use the `wasm-import-name` attribute to ensure that the
   WebAssembly file uses the correct import name.

When put together this should ensure we don't trip over the LLD bug [1]
and we also codegen IR correctly always referencing the right symbols
with the right import module/name pairs.

Closes #50021
Closes #56309
Closes #63562

[1]: https://bugs.llvm.org/show_bug.cgi?id=44316
2019-12-20 17:22:22 +01:00
Alex Crichton aa0ef5a01f Fix handling of wasm import modules and names
The WebAssembly targets of rustc have weird issues around name mangling
and import the same name from different modules. This all largely stems
from the fact that we're using literal symbol names in LLVM IR to
represent what a function is called when it's imported, and we're not
using the wasm-specific `wasm-import-name` attribute. This in turn leads
to two issues:

* If, in the same codegen unit, the same FFI symbol is referenced twice
  then rustc, when translating to LLVM IR, will only reference one
  symbol from the first wasm module referenced.

* There's also a bug in LLD [1] where even if two codegen units
  reference different modules, having the same symbol names means that
  LLD coalesces the symbols and only refers to one wasm module.

Put another way, all our imported wasm symbols from the environment are
keyed off their LLVM IR symbol name, which has lots of collisions today.
This commit fixes the issue by implementing two changes:

1. All wasm symbols with `#[link(wasm_import_module = "...")]` are
   mangled by default in LLVM IR. This means they're all given unique names.

2. Symbols then use the `wasm-import-name` attribute to ensure that the
   WebAssembly file uses the correct import name.

When put together this should ensure we don't trip over the LLD bug [1]
and we also codegen IR correctly always referencing the right symbols
with the right import module/name pairs.

Closes #50021
Closes #56309
Closes #63562

[1]: https://bugs.llvm.org/show_bug.cgi?id=44316
2019-12-16 14:43:46 -08:00
Niko Matsakis d286113024 Revert "Stabilize the never_type, written !."
This reverts commit 15c30ddd69.
2019-12-14 09:01:09 -05:00
Mazdak Farrokhzad 15c30ddd69 Stabilize the never_type, written !. 2019-11-21 14:55:32 +01:00
Mazdak Farrokhzad e32397a754 Rollup merge of #66060 - traxys:test_65401, r=michaelwoerister
Making ICEs and test them in incremental

This adds:
 - A way to make the compiler ICE
 - A way to check for ICE in `cfail` tests with `should-ice`
 - A regression test for issue #65401

I am not sure the attribute added `should-ice` is the best for this job
2019-11-20 18:32:04 +01:00
Camille GILLOT c67125260b Rename in librustc_codegen_utils. 2019-11-12 20:50:46 +01:00
Camille GILLOT ed640c6a27 Merge hir::Mutability into ast::Mutability. 2019-11-10 12:21:05 +01:00
Mazdak Farrokhzad a0b4b4dafa Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, r=estebank
Rename `LocalInternedString` and more

This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses.

r? @estebank
2019-11-06 07:03:01 +01:00
Quentin Boyer f0d206147e rewrote error messages for #[rustc_error] 2019-11-05 22:42:23 +01:00
Eduard-Mihai Burtescu 25953321c0 rustc: remove "GlobalMetaData" dead code from hir::map::definitions. 2019-11-05 21:00:38 +02:00
Quentin Boyer 32f3fe7a6d add rustc_error(delay_span_bug_from_inside_query) attribute 2019-11-03 16:44:19 +01:00
Nicholas Nethercote b9cef6984b Simplify various Symbol use points.
Including removing a bunch of unnecessary `.as_str()` calls, and a bunch
of unnecessary sigils.
2019-11-02 09:01:02 +11:00
Vadim Petrochenkov 222503a354 rustc: Add a convenience alias for dyn MetadataLoader + Sync 2019-10-24 20:51:33 +03:00
Nicholas Nethercote dddacf1eb3 Change SymbolName::name from InternedString to Symbol.
This requires changing the `PartialOrd`/`Ord` implementations to look at
the chars rather than the symbol index.
2019-10-21 18:30:32 +11:00
Nicholas Nethercote b8214e9b44 Convert fields within DefPathData from InternedString to Symbol.
It's a full conversion, except in `DefKey::compute_stable_hash()` where
a `Symbol` now is converted to an `InternedString` before being hashed.
This was necessary to avoid test failures.
2019-10-21 17:17:36 +11:00
bjorn3 ea60335c28 Add top level provide/provide_extern to cg_ssa and cg_utils 2019-10-13 14:43:58 +02:00
bjorn3 41d329c10d Remove unused method CodegenBackend::diagnostics 2019-10-13 14:35:14 +02:00
csmoe afc0bb9794 clean up GeneratorSubsts 2019-10-04 20:47:43 +08:00
csmoe 1f8e1d8aea remove ClosureSubsts with SubstsRef 2019-09-29 16:17:46 +00:00
Mark Rousskov 14a5aefb01 Switch over all StableHash impls to new format 2019-09-28 11:47:36 -04:00
bors 0b1521ffb7 Auto merge of #64816 - Centril:rollup-gbeqot4, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #64221 ( Rust 2015: No longer downgrade NLL errors)
 - #64772 (Remove tx_to_llvm_workers from TyCtxt)
 - #64783 (Fix issue #64732)
 - #64787 (Fix ExitStatus on Fuchsia)
 - #64812 (Add test for E0543)

Failed merges:

r? @ghost
2019-09-26 20:29:40 +00:00
Mazdak Farrokhzad 01303936f3 Rollup merge of #64772 - Mark-Simulacrum:no-tyctxt-tx, r=eddyb
Remove tx_to_llvm_workers from TyCtxt

This can be kept within the codegen backend crates entirely -- there's no reason for us to create it outside and attempt to hold it in the (global) context.

Changes here aren't really too easily reviewable I suspect -- not sure if they can be cleaned up by splitting into more commits though, it's just hard to reason about `Box<Any>` in general. If there are thoughts though I'd be happy to hear them.

The primary goal of this PR is to get rid of the field on `rustc_interface::Queries`.
2019-09-26 17:55:13 +02:00
varkor bea3d67c77 Rename subst::Kind to subst::GenericArg 2019-09-26 11:48:05 +01:00
Mark Rousskov b8a040fc5f Remove tx_to_llvm_workers from TyCtxt
This can be kept within the codegen backend crates entirely
2019-09-25 16:57:27 -04:00
varkor e2e0f9af85 Rename sty to kind 2019-09-25 15:50:04 +01:00
Shotaro Yamada 0423c2a7a3 Remove unused dependencies 2019-09-23 15:25:00 +09:00
Mark Rousskov 41b39fce98 Remove rustc_diagnostic_macros feature 2019-09-05 12:35:18 -04:00
Nicholas Nethercote 0ad111f8bb Remove LocalInternedString uses from librustc/ty/.
This is not a compelling change in isolation, but it is a necessary
step.
2019-09-04 14:23:30 +10:00
Mazdak Farrokhzad a053baefeb Rollup merge of #63559 - eddyb:v0-mangling-off-by-1, r=estebank
rustc_codegen_utils: account for 1-indexed anonymous lifetimes in v0 mangling.

I don't really understand why `anonymize_late_bound_regions` starts with `BrAnon(1)` instead of `BrAnon(0)`, but it does (maybe @nikomatsakis knows?): https://github.com/rust-lang/rust/blob/c43d03a19f326f4a323569328cc501e86eb6d22e/src/librustc/ty/fold.rs#L696-L712

Thankfully, the mangling format and demangler implementations are fine, and I just needed to offset the anonymized lifetime indices by `1` to get the correct mangling.

cc @alexcrichton @michaelwoerister
2019-08-17 11:13:45 +02:00
Eduard-Mihai Burtescu c1758d5918 rustc_codegen_utils: account for 1-indexed anonymous lifetimes in v0 mangling. 2019-08-14 18:53:22 +03:00
Eduard-Mihai Burtescu 1ab9e523f3 Update rustc-demangle to 0.1.16. 2019-08-14 10:35:24 +03:00
Oliver Scherer f4f957d00b Clear the ParamEnv where its information is irrelevant 2019-08-05 17:48:05 +02:00
Oliver Scherer 7710820d18 Fiddle param env through to try_eval_bits in most places 2019-08-05 17:48:05 +02:00
Oliver Scherer 9b87d22ea8 Don't abort on unevaluated constants without at least tryting to eval them 2019-08-05 17:48:04 +02:00