about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-11-15Fix `non-constant value` ICE (#90878)Nilstrieb-1/+100
This also fixes the same suggestion, which was kind of broken, because it just searched for the last occurence of `const` to replace with a `let`. This works great in some cases, but when there is no const and a leading space to the file, it doesn't work and panic with overflow because it thought that it had found a const. I also changed the suggestion to only trigger if the `const` and the non-constant value are on the same line, because if they aren't, the suggestion is very likely to be wrong. Also don't trigger the suggestion if the found `const` is on line 0, because that triggers the ICE.
2021-11-15Auto merge of #90717 - kit-981:fix-ld64-flags, r=petrochenkovbors-42/+50
Fix ld64 flags - The `-exported_symbols_list` argument appears to be malformed for `ld64` (if you are not going through `clang`). - The `-dynamiclib` argument isn't support for `ld64`. It should be guarded behind a compiler flag. These problems are fixed by these changes. I have also refactored the way linker arguments are generated to be ld/compiler agnostic and therefore less error prone. These changes are necessary to support cross-compilation to darwin targets.
2021-11-15Auto merge of #90645 - terrarier2111:master, r=estebankbors-36/+85
Implement diagnostic for String conversion This is my first real contribution to rustc, any feedback is highly appreciated. This should fix https://github.com/rust-lang/rust/issues/89856 Thanks to `@estebank` for guiding me.
2021-11-15Auto merge of #90684 - jyn514:dist-aliases, r=Mark-Simulacrumbors-12/+13
Change paths for `dist` command to match the components they generate Before, you could have the confusing situation where the command to generate a component had no relation to the name of that component (e.g. the `rustc` component was generated with `src/librustc`). This changes the name to make them match up.
2021-11-14Auto merge of #88282 - Neutron3529:patch-4, r=Mark-Simulacrumbors-0/+8
Optimize BinaryHeap::extend from Vec This improves the performance of extending `BinaryHeap`s from vectors directly. Future work may involve extending this optimization to other, similar, cases where the length of the added elements is well-known, but this is not yet done in this PR.
2021-11-14Auto merge of #90596 - the8472:path-hash-opt, r=Mark-Simulacrumbors-11/+140
Optimize Eq and Hash for Path/PathBuf ``` # new test path::tests::bench_hash_path_long ... bench: 86 ns/iter (+/- 1) test path::tests::bench_hash_path_short ... bench: 13 ns/iter (+/- 1) test path::tests::bench_path_hashset ... bench: 197 ns/iter (+/- 6) test path::tests::bench_path_hashset_miss ... bench: 94 ns/iter (+/- 4) # old test path::tests::bench_hash_path_long ... bench: 192 ns/iter (+/- 2) test path::tests::bench_hash_path_short ... bench: 33 ns/iter (+/- 1) test path::tests::bench_path_hashset ... bench: 1,121 ns/iter (+/- 24) test path::tests::bench_path_hashset_miss ... bench: 273 ns/iter (+/- 6) ```
2021-11-14Auto merge of #90839 - pierwill:docs-rustc-newtype-index, r=jackh726bors-1/+23
Generate documentation in rustc `rustc_index::newtype_index` macro The macro now documents all generated items. Documentation notes possible panics and unsafety.
2021-11-14Auto merge of #90757 - GuillaumeGomez:search-index-performance, r=camelidbors-4/+0
Remove unneeded FIXMEs comments in search index generation Original comment: > Instead of recreating a new `vec` for each arguments, we re-use the same. The impact on performance should be minor but worth a try. After testing it, we reached the conclusion that the code readability drop wasn't worth the almost unnoticeable performance improvement. r? `@camelid`
2021-11-14Only use the -dynamiclib flag when the linker is not ldkit-1/+4
This is not a valid flag for ld64. When the ld64 linker is explicitly provided through `config.toml`, rustc will not successfully compile.
2021-11-14Refactor linker argument generationkit-30/+18
This commit refactors linker argument generation to leverage a helper function that abstracts away details governing how these arguments are transformed and provided to the linker. This fixes the misuse of the `-exported_symbols_list` when an ld-like linker is used rather than a compiler. A compiler would expect `-Wl,-exported_symbols_list,path` but ld would expect `-exported_symbols_list` and `path` as two seperate arguments. Prior to this change, an ld-like linker was given `-exported_symbols_list,path`.
2021-11-14Add a helper method for linker argumentskit-11/+28
Linker arguments must transformed when Rust is interacting with the linker through a compiler. This commit introduces a helper function that abstracts away details of this transformation.
2021-11-14Auto merge of #90867 - hi-rustin:rustin-patch-rustdoc, r=CraftSpiderbors-31/+26
Delete rustdoc::doctree close https://github.com/rust-lang/rust/issues/90864
2021-11-14Auto merge of #90883 - matthiaskrgr:rollup-iu9k5pe, r=matthiaskrgrbors-18/+46
Rollup of 3 pull requests Successful merges: - #90771 (Fix trait object error code) - #90840 (relate lifetime in `TypeOutlives` bounds on drop impls) - #90853 (rustdoc: Use an empty Vec instead of Option<Vec>) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-11-13Generate documentation in rustc `rustc_index::newtype_index` macropierwill-1/+23
The macro now documents all generated items. Documentation notes possible panics and unsafety.
2021-11-13Rollup merge of #90853 - notriddle:notriddle/option-vec, r=GuillaumeGomezMatthias Krüger-13/+7
rustdoc: Use an empty Vec instead of Option<Vec>
2021-11-13Rollup merge of #90840 - BoxyUwU:lolripme, r=jackh726Matthias Krüger-2/+36
relate lifetime in `TypeOutlives` bounds on drop impls Fixes #90838
2021-11-13Rollup merge of #90771 - asterycs:fix/trait-object-error-code, ↵Matthias Krüger-3/+3
r=michaelwoerister Fix trait object error code closes #90768 I `grep`:d and changed the occurrences that seemed relevant. Please let me know what you think and if anything is missing!
2021-11-13Auto merge of #90385 - mfrw:mfrw/librustdoc, r=GuillaumeGomezbors-17/+29
rustdoc: use Type::def_id() instead of Type::def_id_no_primitives() For: #90187 r? `@jyn514`
2021-11-13Auto merge of #89551 - jhpratt:stabilize-const_raw_ptr_deref, r=oli-obkbors-193/+114
Stabilize `const_raw_ptr_deref` for `*const T` This stabilizes dereferencing immutable raw pointers in const contexts. It does not stabilize `*mut T` dereferencing. This is behind the same feature gate as mutable references. closes https://github.com/rust-lang/rust/issues/51911
2021-11-13Implement diagnostic for String conversionthreadexception-36/+85
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-11-13Auto merge of #90542 - the8472:privatize-the-means-of-rawvec-production, ↵bors-58/+6
r=joshtriplett Make RawVec private to alloc RawVec was previously exposed for compiler-internal use (libarena specifically) in 1acbb0a9350560d951359cc359361b87992a6f2b Since it is unstable, doc-hidden and has no associated tracking issue it was never meant for public use. And since it is no longer used outside alloc itself it can be made private again. Also remove some functions that are dead due to lack of internal users.
2021-11-13Delete rustdoc::doctreehi-rustin-31/+26
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-11-13Change paths for `dist` command to match the components they generateJoshua Nelson-12/+13
Before, you could have the confusing situation where the command to generate a component had no relation to the name of that component (e.g. the `rustc` component was generated with `src/librustc`). This changes the name to make them match up.
2021-11-13Auto merge of #87264 - mystor:expand_literal, r=petrochenkovbors-75/+421
proc_macro: Add an expand_expr method to TokenStream This feature is aimed at giving proc macros access to powers similar to those used by builtin macros such as `format_args!` or `concat!`. These macros are able to accept macros in place of string literal parameters, such as the format string, as they perform recursive macro expansion while being expanded. This can be especially useful in many cases thanks to helper macros like `concat!`, `stringify!` and `include_str!` which are often used to construct string literals at compile-time in user code. For now, this method only allows expanding macros which produce literals, although more expressions will be supported before the method is stabilized. In earlier versions of this PR, this method exclusively returned `Literal`, and spans on returned literals were stripped of expansion context before being returned to be as conservative as possible about permission leakage. The method's naming has been generalized to eventually support arbitrary expressions, and the context stripping has been removed (https://github.com/rust-lang/rust/pull/87264#discussion_r674863279), which should allow for more general APIs like "format_args_implicits" (https://github.com/rust-lang/rust/issues/67984) to be supported as well. ## API Surface ```rust impl TokenStream { pub fn expand_expr(&self) -> Result<TokenStream, ExpandError>; } #[non_exhaustive] pub struct ExpandError; impl Debug for ExpandError { ... } impl Display for ExpandError { ... } impl Error for ExpandError {} impl !Send for ExpandError {} impl !Sync for ExpandError {} ```
2021-11-12Use an empty Vec instead of Option<Vec>Michael Howell-13/+7
2021-11-13Auto merge of #90041 - jfrimmel:rt_copy_checks, r=Mark-Simulacrumbors-15/+47
Re-enable `copy[_nonoverlapping]()` debug-checks This commit re-enables the debug checks for valid usages of the two functions `copy()` and `copy_nonoverlapping()`. Those checks were commented out in #79684 in order to make the functions const. All that's been left was a FIXME, that could not be resolved until there is was way to only do the checks at runtime. Since #89247 there is such a way: `const_eval_select()`. This commit uses that new intrinsic in order to either do nothing (at compile time) or to do the old checks (at runtime). The change itself is rather small: in order to make the checks usable with `const_eval_select`, they are moved into a local function (one for `copy` and one for `copy_nonoverlapping` to keep symmetry). The change does not break referential transparency, as there is nothing you can do at compile time, which you cannot do on runtime without getting undefined behavior. The CTFE-engine won't allow missuses. The other way round is also fine. I've refactored the code to use `#[cfg(debug_assertions)]` on the new items. If that is not desired, the second commit can be dropped. I haven't added any checks, as I currently don't know, how to test this properly. Closes #90012. cc `@rust-lang/lang,` `@rust-lang/libs` and `@rust-lang/wg-const-eval` (as those teams are linked in the issue above).
2021-11-13Auto merge of #89167 - workingjubilee:use-simd, r=MarkSimulacrumbors-0/+7631
pub use core::simd; A portable abstraction over SIMD has been a major pursuit in recent years for several programming languages. In Rust, `std::arch` offers explicit SIMD acceleration via compiler intrinsics, but it does so at the cost of having to individually maintain each and every single such API, and is almost completely `unsafe` to use. `core::simd` offers safe abstractions that are resolved to the appropriate SIMD instructions by LLVM during compilation, including scalar instructions if that is all that is available. `core::simd` is enabled by the `#![portable_simd]` nightly feature tracked in https://github.com/rust-lang/rust/issues/86656 and is introduced here by pulling in the https://github.com/rust-lang/portable-simd repository as a subtree. We built the repository out-of-tree to allow faster compilation and a stochastic test suite backed by the proptest crate to verify that different targets, features, and optimizations produce the same result, so that using this library does not introduce any surprises. As these tests are technically non-deterministic, and thus can introduce overly interesting Heisenbugs if included in the rustc CI, they are visible in the commit history of the subtree but do nothing here. Some tests **are** introduced via the documentation, but these use deterministic asserts. There are multiple unsolved problems with the library at the current moment, including a want for better documentation, technical issues with LLVM scalarizing and lowering to libm, room for improvement for the APIs, and so far I have not added the necessary plumbing for allowing the more experimental or libm-dependent APIs to be used. However, I thought it would be prudent to open this for review in its current condition, as it is both usable and it is likely I am going to learn something else needs to be fixed when bors tries this out. The major types are - `core::simd::Simd<T, N>` - `core::simd::Mask<T, N>` There is also the `LaneCount` struct, which, together with the SimdElement and SupportedLaneCount traits, limit the implementation's maximum support to vectors we know will actually compile and provide supporting logic for bitmasks. I'm hoping to simplify at least some of these out of the way as the compiler and library evolve.
2021-11-12Test core::simd worksJubilee Young-0/+99
These tests just verify some basic APIs of core::simd function, and guarantees that attempting to access the wrong things doesn't work. The majority of tests are stochastic, and so remain upstream, but a few deterministic tests arrive in the subtree as doc tests.
2021-11-12Expose portable-simd as core::simdJubilee Young-0/+30
This enables programmers to use a safe alternative to the current `extern "platform-intrinsics"` API for writing portable SIMD code. This is `#![feature(portable_simd)]` as tracked in #86656
2021-11-12Add 'library/portable-simd/' from commit ↵Jubilee Young-0/+7502
'1ce1c645cf27c4acdefe6ec8a11d1f0491954a99' git-subtree-dir: library/portable-simd git-subtree-mainline: efd0483949496b067cd5f7569d1b28cd3d5d3c72 git-subtree-split: 1ce1c645cf27c4acdefe6ec8a11d1f0491954a99
2021-11-12Rewrite Arm transmutes, reading std::arch closerJubilee Young-38/+59
2021-11-12oops...Ellen-2/+36
2021-11-12proc_macro: Add an expand_expr method to TokenStreamNika Layzell-75/+421
This feature is aimed at giving proc macros access to powers similar to those used by builtin macros such as `format_args!` or `concat!`. These macros are able to accept macros in place of string literal parameters, such as the format string, as they perform recursive macro expansion while being expanded. This can be especially useful in many cases thanks to helper macros like `concat!`, `stringify!` and `include_str!` which are often used to construct string literals at compile-time in user code. For now, this method only allows expanding macros which produce literals, although more expresisons will be supported before the method is stabilized.
2021-11-12Auto merge of #90836 - matthiaskrgr:rollup-ou6yrlw, r=matthiaskrgrbors-121/+145
Rollup of 7 pull requests Successful merges: - #90589 (rustc_llvm: update PassWrapper for recent LLVM) - #90644 (Extend the const swap feature) - #90704 (Unix ExitStatus comments and a tiny docs fix) - #90761 (Shorten Span of unused macro lints) - #90795 (Add more comments to explain the code to generate the search index) - #90798 (Document `unreachable!` custom panic message) - #90826 (rustc_feature: Convert `BuiltinAttribute` from tuple to a struct) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-11-12Rollup merge of #90826 - petrochenkov:binattr, r=cjgillotMatthias Krüger-44/+62
rustc_feature: Convert `BuiltinAttribute` from tuple to a struct The tuple starts having too many fields. Noticed while reviewing https://github.com/rust-lang/rust/pull/88681.
2021-11-12Rollup merge of #90798 - edmorley:doc-unreachable-custom-message, r=dtolnayMatthias Krüger-2/+5
Document `unreachable!` custom panic message The `unreachable!` docs previously did not mention that there was a second form, `unreachable!("message")` that could be used to specify a custom panic message, The docs now mention this feature in the same wording as currently used for `unimplemented!`: https://doc.rust-lang.org/core/macro.unimplemented.html#panics
2021-11-12Rollup merge of #90795 - GuillaumeGomez:more-search-index-comments, r=notriddleMatthias Krüger-2/+13
Add more comments to explain the code to generate the search index Fixes #90766. I tried to put comments when the code wasn't easy to understand at first sight and added more documentation on the recursive function. Please tell me if I misused the terminology or if comments can be improved or added into other places. r? `@notriddle`
2021-11-12Rollup merge of #90761 - hellow554:macro_span, r=estebankMatthias Krüger-62/+41
Shorten Span of unused macro lints The span has been reduced to the actual ident of the macro, instead of linting the *whole* macro. Closes #90745 r? ``@estebank``
2021-11-12Rollup merge of #90704 - ijackson:exitstatus-comments, r=joshtriplettMatthias Krüger-1/+9
Unix ExitStatus comments and a tiny docs fix Some nits left over from #88300
2021-11-12Rollup merge of #90644 - est31:const_swap, r=Mark-SimulacrumMatthias Krüger-3/+6
Extend the const swap feature Adds the `const_swap` feature gate to three more swap functions. cc tracking issue #83163 ```Rust impl<T> [T] { pub const fn swap(&mut self, a: usize, b: usize); pub const unsafe fn swap_unchecked(&mut self, a: usize, b: usize); } impl<T: ?Sized> *mut T { pub const unsafe fn swap(self, with: *mut T); }
2021-11-12Rollup merge of #90589 - durin42:llvm-14-ASO-now-struct, r=nikicMatthias Krüger-7/+9
rustc_llvm: update PassWrapper for recent LLVM Now AddressSanitizerOptions is a struct, but at least the change was tiny. r? `@nikic`
2021-11-12Auto merge of #89316 - asquared31415:multiple-clobber-abi, r=Amanieubors-163/+377
Add support for specifying multiple clobber_abi in `asm!` r? `@Amanieu` cc #72016 `@rustbot` label: +A-inline-assembly +F-asm
2021-11-12fix aarch test error annotationsasquared31415-4/+4
2021-11-12Add more comments to explain the code to generate the search indexGuillaume Gomez-2/+13
2021-11-12Remove unneeded FIXME: after testing the suggested changes, we reached the ↵Guillaume Gomez-4/+0
conclusion that the code readibility wasn't worth the almost unnoticeable perf improvement
2021-11-12rustc_feature: Convert `BuiltinAttribute` from tuple to a structVadim Petrochenkov-44/+62
2021-11-12Auto merge of #90813 - notriddle:notriddle/vec-extend, r=GuillaumeGomezbors-26/+27
Use Vec extend and collect instead of repeatedly calling push
2021-11-12provide a `SpecExtend` trait for `Vec<T>`Neutron3529-0/+8
The discussion is [here](https://internals.rust-lang.org/t/append-vec-to-binaryheap/15209/3)
2021-11-12Auto merge of #90731 - pierwill:fix-90658, r=michaelwoeristerbors-4/+1
Remove `rustc_incremental::persist::fs::dep_graph_path_from` Closes https://github.com/rust-lang/rust/issues/90658. r? `@michaelwoerister`
2021-11-11Use `Iterator::collect` instead of calling `Vec::push` in a loopMichael Howell-23/+26