about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2020-08-04Auto merge of #75161 - sunfishcode:wasm-no-threads, r=alexcrichtonbors-7/+0
Remove the `--no-threads` workaround for wasm targets. Remove `--no-threads` from the wasm-ld command-line, which was a workaround for [an old bug] which was fixed in LLVM 9.0, and is no longer needed. Also, the `--no-threads` option has been [removed upstream]. [an old bug]: https://bugs.llvm.org/show_bug.cgi?id=41508 [removed upstream]: https://reviews.llvm.org/D76885 r? @alexcrichton
2020-08-04Remove the `--no-threads` workaround for wasm targets.Dan Gohman-7/+0
Remove `--no-threads` from the wasm-ld command-line, which was a workaround for [an old bug] which was fixed in LLVM 9.0, and is no longer needed. Also, the `--no-threads` option has been [removed upstream]. [an old bug]: https://bugs.llvm.org/show_bug.cgi?id=41508 [removed upstream]: https://reviews.llvm.org/D76885
2020-08-04Auto merge of #75136 - JohnTitor:unsizing-casts-non-null, r=oli-obkbors-1/+31
Forbid non-derefable types explicitly in unsizing casts Fixes #75118 r? @oli-obk
2020-08-04Auto merge of #75133 - nnethercote:rm-SubstFolder-fields, r=matthewjasperbors-31/+6
Remove two fields from `SubstFolder`. They're only used in error messages printed if there's an internal compiler error, and the cost of maintaining them is high enough to show up in profiles. r? @matthewjasper
2020-08-04Auto merge of #74850 - TimDiekmann:remove-in-place-alloc, r=Amanieubors-17/+11
Remove in-place allocation and revert to separate methods for zeroed allocations closes rust-lang/wg-allocators#58
2020-08-04Auto merge of #75095 - pietroalbini:fallible-fast-fail, r=Mark-Simulacrumbors-0/+1
ci: disable fast-fail on auto-fallible The purpose of the auto-fallible job is to run builders that are likely to fail on CI without gating on them. Having fast-fail enabled there kinda defeats the purpose, as if one of them fails we can't monitor the outcome of the other ones. This was prompted by the aarch64-gnu builder consistently failing due to a broken test, preventing us from seeing if the macOS spurious failure is fixed. r? @Mark-Simulacrum
2020-08-04ci: disable fail-fast on auto-falliblePietro Albini-0/+1
The purpose of the auto-fallible job is to run builders that are likely to fail on CI without gating on them. Having fail-fast enabled there kinda defeats the purpose, as if one of them fails we can't monitor the outcome of the other ones. This was prompted by the aarch64-gnu builder consistently failing due to a broken test, preventing us from seeing if the macOS spurious failure is fixed.
2020-08-04Forbid non-derefable types explicitly in unsizing castsYuki Okushi-1/+31
2020-08-04Remove two fields from `SubstFolder`.Nicholas Nethercote-31/+6
They're only used in error messages printed if there's an internal compiler error, and the cost of maintaining them is high enough to show up in profiles.
2020-08-04Auto merge of #75111 - mati865:use-lld-option, r=Mark-Simulacrumbors-1/+6
Make rust.use-lld config option work with non MSVC targets Builds fine and passes tests on Linux. Not overriding `use-lld` by `linker` makes sense on those platforms since very old GCC versions don't understand `-fuse-ld=lld`. This allows pointing to newer GCC or Clang that will know how to call LLD.
2020-08-04Auto merge of #75126 - JohnTitor:rollup-aejluzx, r=JohnTitorbors-147/+269
Rollup of 8 pull requests Successful merges: - #74759 (add `unsigned_abs` to signed integers) - #75043 (rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`) - #75056 (Lint path statements to suggest using drop when the type needs drop) - #75081 (Fix logging for rustdoc) - #75083 (Do not trigger `unused_braces` for `while let`) - #75084 (Stabilize Ident::new_raw) - #75103 (Disable building rust-analyzer on riscv64) - #75106 (Enable docs on in the x86_64-unknown-linux-musl manifest) Failed merges: r? @ghost
2020-08-04Rollup merge of #75106 - etherealist:docs_manifest, r=Mark-SimulacrumYuki Okushi-0/+1
Enable docs on in the x86_64-unknown-linux-musl manifest Add the rust-docs component to toolchain x86_64-unknown-linux-musl, which allows people using rustup on their musl-based linux distribution to download the rust-docs. Generating and uploading the docs was enabled in b5d143b (#74871). In #75102 @Mark-Simulacrum found that we are uploading the docs, but the correct manifest is missing. * The relevant call to build-manifest seems to be [in bootstrap](https://github.com/rust-lang/rust/blob/c058a8b8dc5dea0ed9b33e14da9e317e2749fcd7/src/bootstrap/dist.rs#L2334) * The manifest is then used in [promote-release crontab](https://github.com/rust-lang/rust-central-station/blob/master/crontab)
2020-08-04Rollup merge of #75103 - Mark-Simulacrum:no-ra-for-riscv64, r=matkladYuki Okushi-27/+47
Disable building rust-analyzer on riscv64 riscv64 has an LLVM bug that makes rust-analyzer not build. Should permit future rust-analyzer ups (e.g., https://github.com/rust-lang/rust/pull/74813) to land.
2020-08-04Rollup merge of #75084 - Aaron1011:stabilize/ident-new-raw, r=petrochenkovYuki Okushi-0/+61
Stabilize Ident::new_raw Tracking issue: #54723 This is a continuation of PR #59002
2020-08-04Rollup merge of #75083 - JohnTitor:follow-up-unused-braces, r=lcnrYuki Okushi-25/+21
Do not trigger `unused_braces` for `while let` Follow-up for #75031 r? @lcnr
2020-08-04Rollup merge of #75081 - jyn514:fix-logging, r=Mark-SimulacrumYuki Okushi-1/+1
Fix logging for rustdoc https://github.com/rust-lang/rust/pull/74726#issuecomment-667765557
2020-08-04Rollup merge of #75056 - Veykril:path_statements_lint, r=oli-obkYuki Okushi-5/+44
Lint path statements to suggest using drop when the type needs drop Fixes #48852. With this change the current lint description doesn't really fit entirely anymore I think.
2020-08-04Rollup merge of #75043 - petrochenkov:hasname, r=nnethercoteYuki Okushi-89/+94
rustc_ast: `(Nested)MetaItem::check_name` -> `has_name` For consistency with `Attribute::has_name` which doesn't mark the attribute as used either. Replace all uses of `check_name` with `has_name` outside of rustc, only rustc needs to mark attributes as used. cc https://github.com/rust-lang/rust/pull/74932 r? @nnethercote
2020-08-03Auto merge of #74695 - alexcrichton:more-wasm-float-cast-fixes, r=nagisabors-112/+235
rustc: Improving safe wasm float->int casts This commit improves code generation for WebAssembly targets when translating floating to integer casts. This improvement is only relevant when the `nontrapping-fptoint` feature is not enabled, but the feature is not enabled by default right now. Additionally this improvement only affects safe casts since unchecked casts were improved in #74659. Some more background for this issue is present on #73591, but the general gist of the issue is that in LLVM the `fptosi` and `fptoui` instructions are defined to return an `undef` value if they execute on out-of-bounds values; they notably do not trap. To implement these instructions for WebAssembly the LLVM backend must therefore generate quite a few instructions before executing `i32.trunc_f32_s` (for example) because this WebAssembly instruction traps on out-of-bounds values. This codegen into wasm instructions happens very late in the code generator, so what ends up happening is that rustc inserts its own codegen to implement Rust's saturating semantics, and then LLVM also inserts its own codegen to make sure that the `fptosi` instruction doesn't trap. Overall this means that a function like this: #[no_mangle] pub unsafe extern "C" fn cast(x: f64) -> u32 { x as u32 } will generate this WebAssembly today: (func $cast (type 0) (param f64) (result i32) (local i32 i32) local.get 0 f64.const 0x1.fffffffep+31 (;=4.29497e+09;) f64.gt local.set 1 block ;; label = @1 block ;; label = @2 local.get 0 f64.const 0x0p+0 (;=0;) local.get 0 f64.const 0x0p+0 (;=0;) f64.gt select local.tee 0 f64.const 0x1p+32 (;=4.29497e+09;) f64.lt local.get 0 f64.const 0x0p+0 (;=0;) f64.ge i32.and i32.eqz br_if 0 (;@2;) local.get 0 i32.trunc_f64_u local.set 2 br 1 (;@1;) end i32.const 0 local.set 2 end i32.const -1 local.get 2 local.get 1 select) This PR improves the situation by updating the code generation for float-to-int conversions in rustc, specifically only for WebAssembly targets and only for some situations (float-to-u8 still has not great codegen). The fix here is to use basic blocks and control flow to avoid speculatively executing `fptosi`, and instead LLVM's raw intrinsic for the WebAssembly instruction is used instead. This effectively extends the support added in #74659 to checked casts. After this commit the codegen for the above Rust function looks like: (func $cast (type 0) (param f64) (result i32) (local i32) block ;; label = @1 local.get 0 f64.const 0x0p+0 (;=0;) f64.ge local.tee 1 i32.const 1 i32.xor br_if 0 (;@1;) local.get 0 f64.const 0x1.fffffffep+31 (;=4.29497e+09;) f64.le i32.eqz br_if 0 (;@1;) local.get 0 i32.trunc_f64_u return end i32.const -1 i32.const 0 local.get 1 select) For reference, in Rust 1.44, which did not have saturating float-to-integer casts, the codegen LLVM would emit is: (func $cast (type 0) (param f64) (result i32) block ;; label = @1 local.get 0 f64.const 0x1p+32 (;=4.29497e+09;) f64.lt local.get 0 f64.const 0x0p+0 (;=0;) f64.ge i32.and i32.eqz br_if 0 (;@1;) local.get 0 i32.trunc_f64_u return end i32.const 0) So we're relatively close to the original codegen, although it's slightly different because the semantics of the function changed where we're emulating the `i32.trunc_sat_f32_s` instruction rather than always replacing out-of-bounds values with zero. There is still work that could be done to improve casts such as `f32` to `u8`. That form of cast still uses the `fptosi` instruction which generates lots of branch-y code. This seems less important to tackle now though. In the meantime this should take care of most use cases of floating-point conversion and as a result I'm going to speculate that this... Closes #73591
2020-08-03Auto merge of #74526 - erikdesjardins:reftrack, r=Mark-Simulacrumbors-1/+8
Add track_caller to RefCell::{borrow, borrow_mut} So panic messages point at the offending borrow. Fixes #74472
2020-08-04rustc_ast: More detailed docs for `Attribute::check_name`Vadim Petrochenkov-1/+5
2020-08-04rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`Vadim Petrochenkov-89/+90
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either. Replace all uses of `check_name` with `has_name` outside of rustc
2020-08-03Stabilize Ident::new_rawAaron Hill-0/+61
Tracking issue: #54723 This is a continuation of PR #59002
2020-08-03Make rust.use-lld config option work with non MSVC targetsMateusz Mikuła-1/+6
2020-08-03Disable building rust-analyzer on riscv64Mark Rousskov-27/+47
riscv64 has an LLVM bug that makes rust-analyzer not build.
2020-08-03Enable docs on in the x86_64-unknown-linux-musl manifestDavid Sonder-0/+1
Add the rust-docs component to toolchain x86_64-unknown-linux-musl, which allows people using rustup on their musl-based linux distribution to download the rust-docs. Generating and uploading the docs was enabled in b5d143b.
2020-08-03Auto merge of #75076 - tmiasko:simplify-goto, r=oli-obkbors-3/+8
Fix change detection in CfgSimplifier::collapse_goto_chain Check that the old target is different from the new collapsed one, before concluding that anything changed. Fixes #75074 Fixes #75051
2020-08-03Auto merge of #75068 - petrochenkov:ignore-debinfo, r=Mark-Simulacrumbors-0/+1
tests: Ignore src/test/debuginfo/rc_arc.rs on Windows It requires loading pretty-printers (`src\etc\gdb_load_rust_pretty_printers.py`), but GDB doesn't load them on Windows. Not sure how this passes through CI, due to an old GDB version perhaps?
2020-08-03Auto merge of #75055 - cjgillot:clean-cache, r=oli-obkbors-367/+145
Introduce an abstraction for EvaluationCache and SelectionCache The small duplicated code has been moved to librustc_query_system. The remaining changes are some cleanups of structural impls.
2020-08-03Do not trigger `unused_braces` for `while let`Yuki Okushi-25/+21
2020-08-02Fix logging for rustdocJoshua Nelson-1/+1
2020-08-03Auto merge of #74969 - nnethercote:rm-GCX_PTR, r=Mark-Simulacrumbors-78/+36
Remove `GCX_PTR`. We store an `ImplicitCtxt` pointer in a thread-local value (TLV). This allows implicit access to a `GlobalCtxt` and some other things. We also store a `GlobalCtxt` pointer in `GCX_PTR`. This is always the same `GlobalCtxt` as the one within the `ImplicitCtxt` pointer in TLV. `GCX_PTR` is only used in the parallel compiler's `handle_deadlock()` function. This commit does the following. - It removes `GCX_PTR`. - It also adds `ImplicitCtxt::new()`, which constructs an `ImplicitCtxt` from a `GlobalCtxt`. `ImplicitCtxt::new()` + `tls::enter_context()` is now equivalent to the old `tls::enter_global()`. - Makes `tls::get_tlv()` public for the parallel compiler, because it's now used in `handle_deadlock()`. r? @petrochenkov
2020-08-03Merge branch 'master' into remove-in-place-allocTim Diekmann-5413/+7300
2020-08-02Auto merge of #74948 - lzutao:stalize-result-as-deref, r=dtolnaybors-46/+3
Stabilize `Result::as_deref` and `as_deref_mut` FCP completed in https://github.com/rust-lang/rust/issues/50264#issuecomment-645681400. This PR stabilizes two new APIs for `std::result::Result`: ```rust fn as_deref(&self) -> Result<&T::Target, &E> where T: Deref; fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> where T: DerefMut; ``` This PR also removes two rarely used unstable APIs from `Result`: ```rust fn as_deref_err(&self) -> Result<&T, &E::Target> where E: Deref; fn as_deref_mut_err(&mut self) -> Result<&mut T, &mut E::Target> where E: DerefMut; ``` Closes #50264
2020-08-03Use more appropriate `tls::with_*` methods in some places.Nicholas Nethercote-8/+7
2020-08-03Remove `GCX_PTR`.Nicholas Nethercote-74/+33
We store an `ImplicitCtxt` pointer in a thread-local value (TLV). This allows implicit access to a `GlobalCtxt` and some other things. We also store a `GlobalCtxt` pointer in `GCX_PTR`. This is always the same `GlobalCtxt` as the one within the `ImplicitCtxt` pointer in TLV. `GCX_PTR` is only used in the parallel compiler's `handle_deadlock()` function. This commit does the following. - It removes `GCX_PTR`. - It also adds `ImplicitCtxt::new()`, which constructs an `ImplicitCtxt` from a `GlobalCtxt`. `ImplicitCtxt::new()` + `tls::enter_context()` is now equivalent to the old `tls::enter_global()`. - Makes `tls::get_tlv()` public for the parallel compiler, because it's now used in `handle_deadlock()`.
2020-08-03Remove redundant assignment from CfgSimplifierTomasz Miąsko-2/+0
2020-08-03Fix change detection in CfgSimplifier::collapse_goto_chainTomasz Miąsko-1/+8
Check that the old target is different from the new collapsed one, before concluding that anything changed.
2020-08-02Auto merge of #75070 - Manishearth:rollup-2kgcaw5, r=Manishearthbors-48/+183
Rollup of 5 pull requests Successful merges: - #74980 (pprust: adjust mixed comment printing and add regression test for #74745) - #75009 (Document the discrepancy in the mask type for _mm_shuffle_ps) - #75031 (Do not trigger `unused_{braces,parens}` lints with `yield`) - #75059 (fix typos) - #75064 (compiletest: Support ignoring tests requiring missing LLVM components) Failed merges: r? @ghost
2020-08-02Rollup merge of #75064 - petrochenkov:llvmtarg, r=Mark-SimulacrumManish Goregaokar-17/+45
compiletest: Support ignoring tests requiring missing LLVM components This PR implements a more principled solution to the problem described in https://github.com/rust-lang/rust/pull/66084. Builds of LLVM backends take a lot of time and disk space. So it usually makes sense to build rustc with ```toml [llvm] targets = "X86" experimental-targets = "" ``` unless you are working on some target-specific tasks. A few tests, however, require non-x86 backends to be built. A new test directive `// needs-llvm-components: component1 component2 component3` makes such tests to be automatically ignored if one of the listed components is missing in the provided LLVM (this is determined through `llvm-config --components`). As a result, the test suite now fully passes with LLVM built only with the x86 backend. The component list in this case is ``` aggressiveinstcombine all all-targets analysis asmparser asmprinter binaryformat bitreader bitstreamreader bitwriter cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel instcombine instrumentation interpreter ipo irreader jitlink libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mirparser native nativecodegen objcarcopts object objectyaml option orcerror orcjit passes profiledata remarks runtimedyld scalaropts selectiondag support symbolize tablegen target textapi transformutils vectorize windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xray ``` (With the default target list it's much larger.) ``` aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcerror orcjit passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xray ``` https://github.com/rust-lang/rust/pull/66084 is also reverted now. r? @Mark-Simulacrum
2020-08-02Rollup merge of #75059 - shengsheng:typos, r=Dylan-DPCManish Goregaokar-18/+18
fix typos Fix common misspellings with https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
2020-08-02Rollup merge of #75031 - JohnTitor:unused-parens-braces-yield, r=lcnrManish Goregaokar-1/+96
Do not trigger `unused_{braces,parens}` lints with `yield` Fixes #74883 r? @lcnr
2020-08-02Rollup merge of #74980 - davidtwco:issue-74745-pprust-regression-test, ↵Manish Goregaokar-12/+24
r=petrochenkov pprust: adjust mixed comment printing and add regression test for #74745 Fixes #74745. This PR adds a regression test for #74745. While a `ignore-tidy-trailing-lines` header is required, this doesn't stop the test from reproducing, so long as there is no newline at the end of the file. However, adding the header comments made the test fail due to a bug in pprust - so this PR also adjusts the pretty printing of mixed comments so that the initial zero-break isn't emitted at the beginning of the line. Through this, the `block-comment-wchar` test can have the `pp-exact` file removed, as it no longer converges from pretty printing of the source.
2020-08-02Auto merge of #74826 - matklad:mbe-fragment, r=petrochenkovbors-339/+319
Introduce NonterminalKind for more type-safe mbe parsing It encapsulate the (part of) the interface between the parser and macro by example (macro_rules) parser. The second bit is somewhat more general `parse_ast_fragment`, which is the reason why we keep some `parse_xxx` functions as public.
2020-08-02tests: Ignore src/test/debuginfo/rc_arc.rs on WindowsVadim Petrochenkov-0/+1
It requires loading pretty-printers, but GDB doesn't load them on Windows
2020-08-02Lint path statements to use drop for drop typesLukas Wirth-5/+44
2020-08-02Auto merge of #74963 - JohnTitor:ptn-ice, r=petrochenkovbors-56/+146
Fix ICEs with `@ ..` binding This reverts #74557 and introduces an alternative fix while ensuring that #74954 is not broken. The diagnostics are verbose though, it fixes three related issues. cc #74954, #74539, and #74702
2020-08-02compiletest: Support ignoring tests requiring missing LLVM componentsVadim Petrochenkov-17/+45
2020-08-03Recover strictness for `yield`Yuki Okushi-9/+60
2020-08-03Rollup merge of #75057 - Mark-Simulacrum:avoid-long-print, r=alexcrichtonYuki Okushi-1/+3
Avoid dumping rustc invocations to stdout These are quite long, usually, and in most cases not interesting. On smaller terminals they can take up more than a full page of output, hiding the error diagnostics emitted.