about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2019-03-30Rollup merge of #59343 - eddyb:rm-def-symbol-name, r=michaelwoeristerMazdak Farrokhzad-48/+19
rustc(codegen): uncache `def_symbol_name` prefix from `symbol_name`. The `def_symbol_name` query was an optimization to avoid recomputing the common part of a symbol name, as only the hash needs to be added to it for each symbol. However, #57967 will add a new mangling scheme, which doesn't readily support this kind of reuse - while it's plausible, it requires a lot more effort, since you'd have to "symbolically evaluate" mangling, and keep it in a form where the backreference positions can be computed correctly in the final step. So I want to see how much time we're actually saving with this `def_symbol_name` optimization, nowadays. cc @michaelwoerister
2019-03-30Use CStringYuki OKUSHI-5/+3
2019-03-30update stdsimdRalf Jung-0/+0
2019-03-30Fix infinite recursionGuillaume Gomez-5/+9
2019-03-30Use target_mcountYuki OKUSHI-24/+4
2019-03-30Add target_mcount optionYuki OKUSHI-39/+127
2019-03-30Added an example that shows how the remainder function on floating point ↵Christian-1/+11
values is computed internally.
2019-03-30Rollup merge of #59537 - goffrie:patch-3, r=CentrilMazdak Farrokhzad-2/+2
Fix OnceWith docstring. This was incorrectly copypasta'd from RepeatWith.
2019-03-30Rollup merge of #59534 - laurmaedje:collapse-blanket-impls, r=GuillaumeGomezMazdak Farrokhzad-0/+8
rustdoc: collapse blanket impls in the same way as normal impls If the rustdoc setting _Auto-hide trait implementations documentation_ is activated (on by default), normal trait implementations are collapsed by default. Blanket impls on the other hand are not collapsed. I'm not sure whether this is intended, but considering that the blanket impls for `From`, `Into`, `TryFrom`, ... are on every type, it would reduce the documentation bloat if these would also be collapsed when the setting is active. (I'm not really familiar with the codebase and therefore just copied the code for the normal impl collapsing, but I could deduplicate it into a method, of course, too.)
2019-03-30Rollup merge of #59532 - mbrubeck:docs, r=CentrilMazdak Farrokhzad-6/+19
In doc examples, don't ignore read/write results Calling `Read::read` or `Write::write` without checking the returned `usize` value is almost always an error. Example code in the documentation should demonstrate how to use the return value correctly. Otherwise, people might copy the example code thinking that it is okay to "fire and forget" these methods.
2019-03-30Rollup merge of #59528 - DevQps:improve-dbg-macro-docs, r=CentrilMazdak Farrokhzad-1/+7
Improve the dbg! macro docs # Description As stated has been discussed in #58383 the docs do not clearly state why it is useful to have the option to use `dbg!` in release builds as well. This PR should change that. closes #58383
2019-03-30Rollup merge of #59525 - pnkfelix:whitelist-some-rustc-attrs, r=petrochenkovMazdak Farrokhzad-1/+61
Whitelist some rustc attrs These rustc attrs are used within libcore, and were causing failures when one mixed incremental compilation with bootstrapping (due to a default of `-D warnings` when bootstrapping). Fix #59523 Fix #59524 Cc #58633
2019-03-30Rollup merge of #59512 - euclio:stdio-locks, r=sfacklerMazdak Farrokhzad-0/+51
implement `AsRawFd` for stdio locks cc https://github.com/rust-lang/rfcs/issues/2074.
2019-03-30Rollup merge of #59499 - pietroalbini:fix-arm-broken-link, r=alexcrichtonMazdak Farrokhzad-1/+2
Fix broken download link in the armhf-gnu image Thanks to @johnterickson for pointing this out! r? @alexcrichton
2019-03-30Rollup merge of #59455 - estebank:borrow-sugg-shorthand-field, r=davidtwcoMazdak Farrokhzad-20/+125
Account for short-hand field syntax when suggesting borrow Fix #52965.
2019-03-30Rollup merge of #59453 - estebank:recover-tuple-parse, r=petrochenkovMazdak Farrokhzad-34/+228
Recover from parse error in tuple syntax
2019-03-30Rollup merge of #59376 - davidtwco:finally-rfc-2008-variants, ↵Mazdak Farrokhzad-216/+219
r=petrochenkov,QuietMisdreavus RFC 2008: Enum Variants Part of #44109. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion. r? @petrochenkov cc @nikomatsakis
2019-03-30Auto merge of #59464 - alexcrichton:wasi-pr, r=fitzgenbors-5/+2146
Add a new wasm32-unknown-wasi target This commit adds a new wasm32-based target distributed through rustup, supported in the standard library, and implemented in the compiler. The `wasm32-unknown-wasi` target is intended to be a WebAssembly target which matches the [WASI proposal recently announced][LINK]. In summary the WASI target is an effort to define a standard set of syscalls for WebAssembly modules, allowing WebAssembly modules to not only be portable across architectures but also be portable across environments implementing this standard set of system calls. The wasi target in libstd is still somewhat bare bones. This PR does not fill out the filesystem, networking, threads, etc. Instead it only provides the most basic of integration with the wasi syscalls, enabling features like: * `Instant::now` and `SystemTime::now` work * `env::args` is hooked up * `env::vars` will look up environment variables * `println!` will print to standard out * `process::{exit, abort}` should be hooked up appropriately None of these APIs can work natively on the `wasm32-unknown-unknown` target, but with the assumption of the WASI set of syscalls we're able to provide implementations of these syscalls that engines can implement. Currently the primary engine implementing wasi is [wasmtime], but more will surely emerge! In terms of future development of libstd, I think this is something we'll probably want to discuss. The purpose of the WASI target is to provide a standardized set of syscalls, but it's *also* to provide a standard C sysroot for compiling C/C++ programs. This means it's intended that functions like `read` and `write` are implemented for this target with a relatively standard definition and implementation. It's unclear, therefore, how we want to expose file descriptors and how we'll want to implement system primitives. For example should `std::fs::File` have a libc-based file descriptor underneath it? The raw wasi file descriptor? We'll see! Currently these details are all intentionally hidden and things we can change over time. A `WasiFd` sample struct was added to the standard library as part of this commit, but it's not currently used. It shows how all the wasi syscalls could be ergonomically bound in Rust, and they offer a possible implementation of primitives like `std::fs::File` if we bind wasi file descriptors exactly. Apart from the standard library, there's also the matter of how this target is integrated with respect to its C standard library. The reference sysroot, for example, provides managment of standard unix file descriptors and also standard APIs like `open` (as opposed to the relative `openat` inspiration for the wasi ssycalls). Currently the standard library relies on the C sysroot symbols for operations such as environment management, process exit, and `read`/`write` of stdio fds. We want these operations in Rust to be interoperable with C if they're used in the same process. Put another way, if Rust and C are linked into the same WebAssembly binary they should work together, but that requires that the same C standard library is used. We also, however, want the `wasm32-unknown-wasi` target to be usable-by-default with the Rust compiler without requiring a separate toolchain to get downloaded and configured. With that in mind, there's two modes of operation for the `wasm32-unknown-wasi` target: 1. By default the C standard library is statically provided inside of `liblibc.rlib` distributed as part of the sysroot. This means that you can `rustc foo.wasm --target wasm32-unknown-unknown` and you're good to go, a fully workable wasi binary pops out. This is incompatible with linking in C code, however, which may be compiled against a different sysroot than the Rust code was previously compiled against. In this mode the default of `rust-lld` is used to link binaries. 2. For linking with C code, the `-C target-feature=-crt-static` flag needs to be passed. This takes inspiration from the musl target for this flag, but the idea is that you're no longer using the provided static C runtime, but rather one will be provided externally. This flag is intended to also get coupled with an external `clang` compiler configured with its own sysroot. Therefore you'll typically use this flag with `-C linker=/path/to/clang-script-wrapper`. Using this mode the Rust code will continue to reference standard C symbols, but the definition will be pulled in by the linker configured. Alright so that's all the current state of this PR. I suspect we'll definitely want to discuss this before landing of course! This PR is coupled with libc changes as well which I'll be posting shortly. [LINK]: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ [wasmtime]: https://github.com/cranestation/wasmtime-wasi
2019-03-29manifest: only include miri on the nightly channelJosh Stone-1/+7
miri needs to build std with xargo, which doesn't allow stable/beta: <https://github.com/japaric/xargo/pull/204#issuecomment-374888868> Therefore, at this time there's no point in making miri available on any but the nightly channel. If we get a stable way to build `std`, like [RFC 2663], then we can re-evaluate whether to start including miri, perhaps still as `miri-preview`. [RFC 2663]: https://github.com/rust-lang/rfcs/pull/2663
2019-03-29Add a new wasm32-unknown-wasi targetAlex Crichton-5/+2146
This commit adds a new wasm32-based target distributed through rustup, supported in the standard library, and implemented in the compiler. The `wasm32-unknown-wasi` target is intended to be a WebAssembly target which matches the [WASI proposal recently announced.][LINK]. In summary the WASI target is an effort to define a standard set of syscalls for WebAssembly modules, allowing WebAssembly modules to not only be portable across architectures but also be portable across environments implementing this standard set of system calls. The wasi target in libstd is still somewhat bare bones. This PR does not fill out the filesystem, networking, threads, etc. Instead it only provides the most basic of integration with the wasi syscalls, enabling features like: * `Instant::now` and `SystemTime::now` work * `env::args` is hooked up * `env::vars` will look up environment variables * `println!` will print to standard out * `process::{exit, abort}` should be hooked up appropriately None of these APIs can work natively on the `wasm32-unknown-unknown` target, but with the assumption of the WASI set of syscalls we're able to provide implementations of these syscalls that engines can implement. Currently the primary engine implementing wasi is [wasmtime], but more will surely emerge! In terms of future development of libstd, I think this is something we'll probably want to discuss. The purpose of the WASI target is to provide a standardized set of syscalls, but it's *also* to provide a standard C sysroot for compiling C/C++ programs. This means it's intended that functions like `read` and `write` are implemented for this target with a relatively standard definition and implementation. It's unclear, therefore, how we want to expose file descriptors and how we'll want to implement system primitives. For example should `std::fs::File` have a libc-based file descriptor underneath it? The raw wasi file descriptor? We'll see! Currently these details are all intentionally hidden and things we can change over time. A `WasiFd` sample struct was added to the standard library as part of this commit, but it's not currently used. It shows how all the wasi syscalls could be ergonomically bound in Rust, and they offer a possible implementation of primitives like `std::fs::File` if we bind wasi file descriptors exactly. Apart from the standard library, there's also the matter of how this target is integrated with respect to its C standard library. The reference sysroot, for example, provides managment of standard unix file descriptors and also standard APIs like `open` (as opposed to the relative `openat` inspiration for the wasi ssycalls). Currently the standard library relies on the C sysroot symbols for operations such as environment management, process exit, and `read`/`write` of stdio fds. We want these operations in Rust to be interoperable with C if they're used in the same process. Put another way, if Rust and C are linked into the same WebAssembly binary they should work together, but that requires that the same C standard library is used. We also, however, want the `wasm32-unknown-wasi` target to be usable-by-default with the Rust compiler without requiring a separate toolchain to get downloaded and configured. With that in mind, there's two modes of operation for the `wasm32-unknown-wasi` target: 1. By default the C standard library is statically provided inside of `liblibc.rlib` distributed as part of the sysroot. This means that you can `rustc foo.wasm --target wasm32-unknown-unknown` and you're good to go, a fully workable wasi binary pops out. This is incompatible with linking in C code, however, which may be compiled against a different sysroot than the Rust code was previously compiled against. In this mode the default of `rust-lld` is used to link binaries. 2. For linking with C code, the `-C target-feature=-crt-static` flag needs to be passed. This takes inspiration from the musl target for this flag, but the idea is that you're no longer using the provided static C runtime, but rather one will be provided externally. This flag is intended to also get coupled with an external `clang` compiler configured with its own sysroot. Therefore you'll typically use this flag with `-C linker=/path/to/clang-script-wrapper`. Using this mode the Rust code will continue to reference standard C symbols, but the definition will be pulled in by the linker configured. Alright so that's all the current state of this PR. I suspect we'll definitely want to discuss this before landing of course! This PR is coupled with libc changes as well which I'll be posting shortly. [LINK]: [wasmtime]:
2019-03-29Fix OnceWith docstring.Geoffry Song-2/+2
This was incorrectly copypasta'd from RepeatWith.
2019-03-29Auto merge of #58846 - bjorn3:misc_cg_ssa_refactor, r=eddybbors-759/+693
Misc refactorings to rustc_codegen_ssa Unlike #56636 this doesn't split `BuilderMethods` into a lot of traits. That makes this PR twice as small and the split turned out to not be very useful anyway. r? @eddyb
2019-03-29Suggest using anonymous lifetime in `impl Trait` returnEsteban Küber-9/+45
2019-03-29In doc examples, don't ignore read/write resultsMatt Brubeck-6/+19
Calling `Read::read` or `Write::write` without checking the returned `usize` value is almost always an error. Example code in the documentation should demonstrate how to use the return value correctly. Otherwise, people might copy the example code thinking that it is okay to "fire and forget" these methods.
2019-03-29Collapse blanket impls in the same way as normal implsLaurenz-0/+8
2019-03-29Fix incorrect codeEsteban Küber-8/+10
2019-03-29Auto merge of #59522 - Centril:rollup, r=Centrilbors-156/+425
Rollup of 9 pull requests Successful merges: - #59366 (Update books) - #59436 (Update jemalloc-sys to version 0.3.0) - #59454 (Update rustfmt to 1.2.0) - #59462 (Fix error in Rust 2018 + no_core environment) - #59467 (Better diagnostic for binary operation on BoxedValues) - #59473 (Do not emit incorrect borrow suggestion involving macros and fix overlapping multiline spans) - #59480 (Update stdsimd) - #59486 (Visit `ImplItem` in `dead_code` lint) - #59510 (Rename `type_parameters` to `generics` and so on) Failed merges: - #59516 (Update cargo) r? @ghost
2019-03-29Use ExactSizeIterator + TrustedLen instead of num_cases arg for switchbjorn3-6/+7
2019-03-29Add a method for emiting a switch.bjorn3-20/+19
2019-03-29Remove inline_asm_call from cg_ssabjorn3-57/+47
`count_insn` is no longer called for inline asm, because it is private to builder.rs
2019-03-29Remove type_variadic_func and typ_array from cg_ssabjorn3-73/+80
2019-03-29Remove a lot of methods from *TypeMethodsbjorn3-114/+92
2019-03-29Remove scalar_lltypes from cg_ssabjorn3-9/+0
2019-03-29Move get_param and set_value_namebjorn3-38/+46
2019-03-29Remove a lot of methods from BuilderMethodsbjorn3-260/+213
2019-03-29[WIP] Make some debug info methods take &mut FunctionDebugContextbjorn3-13/+9
declare_local still takes &FunctionDebugContext, because of borrowck errors
2019-03-29Remove internal mutability from source_locations_enabledbjorn3-10/+9
2019-03-29Remove param_substs from FunctionCxbjorn3-9/+3
2019-03-29Remove const_{cstr,str_slice,get_elt,get_real} and is_const_real methods ↵bjorn3-108/+126
from cg_ssa This introduces the static_panic_msg trait method to StaticBuilderMethods.
2019-03-29Remove const_{fat_ptr,array,vector,bytes} from cg_ssabjorn3-30/+28
2019-03-29Miscbjorn3-4/+5
2019-03-29Add a commentbjorn3-0/+1
2019-03-29Use Builder instead of CodegenCx for OperandRef and LocalRefbjorn3-25/+28
2019-03-29`eval_mir_constant` doesn't need a builder parambjorn3-6/+5
2019-03-29Don't use c_uint in cg_ssabjorn3-11/+9
2019-03-29Update src/libstd/macros.rs Mazdak Farrokhzad-1/+0
Removed duplicate line. Co-Authored-By: DevQps <46896178+DevQps@users.noreply.github.com>
2019-03-29Update src/libstd/macros.rs Mazdak Farrokhzad-1/+2
Wrapped lines earlier such that it is more coherent with the rest of the text. Co-Authored-By: DevQps <46896178+DevQps@users.noreply.github.com>
2019-03-29Added documentation on the remainder (Rem) operator for floating points.Christian-0/+4
2019-03-29Adjusted the indentation.Christian-2/+3
2019-03-29Edited the dbg! docs stating that dbg! works the same way in release builds.Christian-1/+6