about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2019-10-12compress the function, remove the assert check.Guanqun Lu-11/+2
2019-10-12replace the hand-written binary search with the library oneGuanqun Lu-13/+5
2019-10-12Auto merge of #65020 - ↵bors-13/+187
pnkfelix:targetted-fix-for-always-marking-rust-abi-unwind-issue-64655, r=alexcrichton Always mark rust and rust-call abi's as unwind PR #63909 identified a bug that had been injected by PR #55982. As discussed on https://github.com/rust-lang/rust/issues/64655#issuecomment-537517428 , we started marking extern items as nounwind, *even* extern items that said they were using "Rust" or "rust-call" ABI. This is a more targeted variant of PR #63909 that fixes the above bug. Fix #64655 ---- I personally suspect we will want PR #63909 to land in the long-term But: * it is not certain that PR #63909 *will* land, * more importantly, PR #63909 almost certainly will not be backported to beta/stable. The identified bug was more severe than I think anyone realized (apart from perhaps @gnzlbg, as noted [here](https://github.com/rust-lang/rust/pull/63909#issuecomment-524818838)). Thus, I was motivated to write this PR, which fixes *just* the issue with extern rust/rust-call functions, and deliberately avoids injecting further deviation from current behavior (you can see further notes on this in the comments of the code added here).
2019-10-11Auto merge of #64877 - lzutao:stabilize-repeat_generic_slice, r=SimonSapinbors-6/+1
Stabilize `slice::repeat` (feature `repeat_generic_slice`) Closes #48784 r? @SimonSapin
2019-10-11emcscripten: ignore another thread-using testRalf Jung-0/+1
2019-10-11Auto merge of #64716 - jonhoo:stabilize-mem-take, r=SimonSapinbors-18/+1
Stabilize mem::take (mem_take) Tracking issue: https://github.com/rust-lang/rust/issues/61129 r? @matklad
2019-10-11ignore-emcscripten as it does not support threadsRalf Jung-0/+1
2019-10-10Auto merge of #64823 - cuviper:min-std, r=Mark-Simulacrumbors-33/+127
minimize the rust-std component This changes the `rust-std` dist component to only include the artifacts of compiling the `libstd` step, as listed in `.libstd.stamp`. This does include `test` and `proc-macro` as well. The remaining _unstable_ libraries that are built as part of `rustc` are packaged into a new `rustc-dev` component, intended for use in the development of closely related tools (clippy, miri, rls). Here are the component sizes from the [try build](https://dev-static.rust-lang.org/dist/2019-10-07/index.html): | Name | Size | --- | --- | rust-std-nightly-x86_64-unknown-linux-gnu.tar.gz | 23.94 MiB | rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz | 17.4 MiB | rustc-dev-nightly-x86_64-unknown-linux-gnu.tar.gz | 182.03 MiB | rustc-dev-nightly-x86_64-unknown-linux-gnu.tar.xz | 157.91 MiB Fixes #61978 Fixes #62486
2019-10-10Auto merge of #65153 - da-x:issue-58017, r=petrochenkovbors-120/+222
Improve message when attempting to instantiate tuple structs with private fields Fixes #58017, fixes #39703. ``` error[E0603]: tuple struct `Error` is private --> main.rs:22:16 | 2 | pub struct Error(usize, pub usize, usize); | ----- ----- field is private | | | field is private ... 22 | let x = a::Error(3, 1, 2); | ^^^^^ | = note: a tuple struct constructor is private if any of its fields is private ```
2019-10-10Auto merge of #59546 - sfanxiang:interminable-ub, r=nagisabors-1/+107
Add llvm.sideeffect to potential infinite loops and recursions LLVM assumes that a thread will eventually cause side effect. This is not true in Rust if a loop or recursion does nothing in its body, causing undefined behavior even in common cases like `loop {}`. Inserting llvm.sideeffect fixes the undefined behavior. As a micro-optimization, only insert llvm.sideeffect when jumping back in blocks or calling a function. A patch for LLVM is expected to allow empty non-terminate code by default and fix this issue from LLVM side. https://github.com/rust-lang/rust/issues/28728 **UPDATE:** [Mentoring instructions here](https://github.com/rust-lang/rust/pull/59546#issuecomment-515072429) to unstall this PR
2019-10-10Auto merge of #65140 - petrochenkov:disapp, r=nikomatsakisbors-1/+37
resolve: Remove an incorrect assert Fixes https://github.com/rust-lang/rust/issues/64803.
2019-10-10Auto merge of #65129 - andjo403:cargo_args, r=alexcrichtonbors-0/+10
make it possible to add args to cargo in x.py eg. make it easier to test -Ztimings for rustc cc https://github.com/rust-lang/rust/issues/65088
2019-10-10Auto merge of #65077 - estebank:mut-trait-expected, r=nikomatsakisbors-57/+297
Note when a mutable trait object is needed Fix https://github.com/rust-lang/rust/issues/63619, fix https://github.com/rust-lang/rust/issues/37914. CC https://github.com/rust-lang/rust/issues/64068.
2019-10-10Auto merge of #64939 - nnethercote:snapshot-cleanups, r=nikomatsakisbors-37/+28
Snapshot clean-ups Two minor clean-ups involving snapshots.
2019-10-09Auto merge of #65249 - matthewjasper:revert-into-drop, r=nnethercotebors-466/+247
Revert "Make `into` schedule drop for the destination" This was a *very* large perf regression in some cases. I'll undo the revert once I have time to avoid the regression.
2019-10-09Revert "Make `into` schedule drop for the destination"Matthew Jasper-466/+247
This reverts commit 37026837a3f23486d3cf1009d9136927168ddb33.
2019-10-09Only suggest change mut if vars are resolvedEsteban Küber-1/+6
2019-10-09review commentsEsteban Küber-3/+3
2019-10-09review commentsEsteban Küber-18/+27
2019-10-09Obligation must apply modulo regionsEsteban Küber-4/+4
2019-10-09Tweak wordingEsteban Küber-11/+12
2019-10-09Note when a mutable trait object is neededEsteban Küber-46/+271
2019-10-09Auto merge of #65228 - Wind-River:real_master, r=dtolnaybors-1/+1
vxworks: add checking (r == 0)
2019-10-09make it possible to add args to cargo in x.pyAndreas Jonson-0/+10
eg. make it easier to test -Ztimings for rustc
2019-10-09resolve: Use field spans for reporting the private constructor errorVadim Petrochenkov-107/+204
2019-10-09resolve: Keep field spans for diagnosticsVadim Petrochenkov-13/+18
2019-10-09Auto merge of #65208 - michaelwoerister:sp-events-review-2, r=wesleywiserbors-4/+39
self-profiling: Add events for everything except trait selection. This is the followup PR to https://github.com/rust-lang/rust/pull/64840. Trait selection events are still missing (at least those not covered by regular queries). r? @wesleywiser (or @Mark-Simulacrum if @wesleywiser is not available at the moment)
2019-10-09self-profiling: Add events for everything except trait selection.Michael Woerister-4/+39
2019-10-09Auto merge of #65198 - nnethercote:fix-65080, r=Mark-Simulacrumbors-61/+80
Speed up `TokenStream` concatenation This PR fixes the quadratic behaviour identified in #65080. r? @Mark-Simulacrum
2019-10-09Rollup merge of #65175 - andjo403:partitioning, r=zackmdavisMazdak Farrokhzad-3/+7
add more info in debug traces for gcu merging to help in investigation of CGU partitioning problems e.g https://github.com/rust-lang/rust/issues/64913
2019-10-09Rollup merge of #65166 - csmoe:async-move, r=estebankMazdak Farrokhzad-1/+74
Suggest to add `move` keyword for generator capture Closes #64382 r? @estebank
2019-10-09Rollup merge of #65037 - anp:track-caller, r=oli-obkMazdak Farrokhzad-2/+395
`#[track_caller]` feature gate (RFC 2091 1/N) RFC text: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md Tracking issue: https://github.com/rust-lang/rust/issues/47809 I started with @ayosec's commit to add the feature gate with tests and rebased it onto current master. I fixed up some tidy lints and added a test.
2019-10-09Rollup merge of #64656 - passcod:map-entry-insert, r=AmanieuMazdak Farrokhzad-1/+48
Implement (HashMap) Entry::insert as per #60142 Implementation of `Entry::insert` as per @SimonSapin's comment on #60142. This requires a patch to hashbrown: ```diff diff --git a/src/rustc_entry.rs b/src/rustc_entry.rs index fefa5c3..7de8300 100644 --- a/src/rustc_entry.rs +++ b/src/rustc_entry.rs @@ -546,6 +546,32 @@ impl<'a, K, V> RustcVacantEntry<'a, K, V> { let bucket = self.table.insert_no_grow(self.hash, (self.key, value)); unsafe { &mut bucket.as_mut().1 } } + + /// Sets the value of the entry with the RustcVacantEntry's key, + /// and returns a RustcOccupiedEntry. + /// + /// # Examples + /// + /// ``` + /// use hashbrown::HashMap; + /// use hashbrown::hash_map::RustcEntry; + /// + /// let mut map: HashMap<&str, u32> = HashMap::new(); + /// + /// if let RustcEntry::Vacant(v) = map.rustc_entry("poneyland") { + /// let o = v.insert_and_return(37); + /// assert_eq!(o.get(), &37); + /// } + /// ``` + #[inline] + pub fn insert_and_return(self, value: V) -> RustcOccupiedEntry<'a, K, V> { + let bucket = self.table.insert_no_grow(self.hash, (self.key, value)); + RustcOccupiedEntry { + key: None, + elem: bucket, + table: self.table + } + } } impl<K, V> IterMut<'_, K, V> { ``` This is also only an implementation for HashMap. I tried implementing for BTreeMap, but I don't really understand BTreeMap's internals and require more guidance on implementing the equivalent `VacantEntry::insert_and_return` such that it returns an `OccupiedEntry`. Notably, following the original PR's modifications I end up needing a `Handle<NodeRef<marker::Mut<'_>, _, _, marker::LeafOrInternal>, _>` while I only have a `Handle<NodeRef<marker::Mut<'_>, _, _, marker::Internal>, _>` and don't know how to proceed. (To be clear, I'm not asking for guidance right now; I'd be happy getting only the HashMap implementation — the subject of this PR — reviewed and ready, and leave the BTreeMap implementation for a latter PR.)
2019-10-08add checking (r == 0)Baoshan Pang-1/+1
2019-10-08Stabilize mem::take (mem_take)Jon Gjengset-18/+1
Tracking issue: https://github.com/rust-lang/rust/issues/61129
2019-10-09Implement (HashMap) Entry::insert as per #60142Félix Saparelli-1/+48
2019-10-08Rollup merge of #65213 - estebank:peel-drop-temps, r=CentrilMazdak Farrokhzad-15/+29
Ignore `ExprKind::DropTemps` for some ref suggestions Introduce `Expr::peel_drop_temps()` to ignore `ExprKind::DropTemps` for suggestions that depend on the `ExprKind` for accuracy.
2019-10-08Rollup merge of #65194 - estebank:remove_str, r=petrochenkovMazdak Farrokhzad-10/+23
Use structured suggestion for removal of `as_str()` call Follow up to #64739.
2019-10-08Rollup merge of #65135 - GuillaumeGomez:add-error-code-check, r=Mark-SimulacrumMazdak Farrokhzad-36/+205
Add check for missing tests for error codes Fixes #64811. r? @Mark-Simulacrum
2019-10-08Rollup merge of #65133 - ↵Mazdak Farrokhzad-181/+266
davidtwco:issue-65035-static-with-generic-in-foreign-mod, r=petrochenkov typeck: prohibit foreign statics w/ generics Fixes #65035 and fixes #65025. This PR modifies resolve to disallow foreign statics that have generics. `improper_ctypes` is not written to support type parameters, as these are normally disallowed before the lint is run. Thus, type parameters in foreign statics must be prohibited before the lint. The only other case where this *could* have occured is in functions, but typeck prohibits this with a "foreign items may not have type parameters" error - a similar error did not exist for statics, because statics cannot have type parameters, but they can use any type parameters that are in scope (which isn't the case for functions).
2019-10-08Rollup merge of #65081 - Mark-Simulacrum:remove-profile-queries, ↵Mazdak Farrokhzad-771/+11
r=michaelwoerister Remove -Zprofile-queries r? @michaelwoerister Per [zulip thread](https://zulip-archive.rust-lang.org/131828tcompiler/57361RemoveZprofilequeries.html).
2019-10-08Rollup merge of #64284 - Mark-Simulacrum:include-warn, r=petrochenkovMazdak Farrokhzad-2/+47
Warn if include macro fails to include entire file This currently introduces an error, mainly because that was just simpler, and I'm not entirely certain if we can introduce a lint without an RFC and such. This is primarily to get feedback on the approach and overall aim -- in particular, do we think this is helpful? If so, we probably will need lang-team sign off and decide if it should be an error (as currently introduced by this PR), a lint, or a warning. r? @petrochenkov cc https://github.com/rust-lang/rust/issues/35560
2019-10-08resolve: prohibit foreign statics w/ genericsDavid Wood-181/+266
This commit modifies resolve to disallow foreign statics that use parent generics. `improper_ctypes` is not written to support type parameters, as these are normally disallowed before the lint is run. Thus, type parameters in foreign statics must be prohibited before the lint. The only other case where this *could* have occured is in functions, but typeck prohibits this with a "foreign items may not have type parameters" error - a similar error did not exist for statics, because statics cannot have type parameters, but they can use any type parameters that are in scope (which isn't the case for functions). Signed-off-by: David Wood <david@davidtw.co>
2019-10-08Auto merge of #65209 - Centril:rollup-tzc0j87, r=Centrilbors-91/+266
Rollup of 8 pull requests Successful merges: - #64404 (Add long error explanation for E0495) - #64918 (Add long error explanation for E0551) - #65102 (Disable stack probe when thread sanitizer is enabled) - #65120 (Correctly estimate the required space for string in `StyledBuffer::prepend`) - #65145 (When suggesting assoc function with type params, include turbofish) - #65162 (Remove loaded_from_cache map from DepGraph) - #65176 (Remove query-related macros) - #65179 (Add long error explanation for E0567) Failed merges: r? @ghost
2019-10-08review commentsEsteban Küber-9/+5
2019-10-08Call `Expr::peel_drop_temps()` from more places for more accurate suggestionsEsteban Küber-13/+23
2019-10-08Ignore `ExprKind::DropTemps` for some ref suggestionsEsteban Küber-22/+30
2019-10-08Rollup merge of #65179 - GuillaumeGomez:long-err-explanation-E0567, r=davidtwcoMazdak Farrokhzad-2/+30
Add long error explanation for E0567 Part of #61137.
2019-10-08Rollup merge of #65176 - nnethercote:rm-query-macros, r=michaelwoeristerMazdak Farrokhzad-33/+18
Remove query-related macros The query system has a few macros that only have one or two call sites, and I find they hurt readability. This PR removes them. r? @michaelwoerister
2019-10-08Rollup merge of #65162 - Mark-Simulacrum:no-cache-loading-map, ↵Mazdak Farrokhzad-31/+0
r=michaelwoerister Remove loaded_from_cache map from DepGraph It's now unused, even with -Zquery-dep-graph From https://github.com/rust-lang/rust/pull/63756/files#r316039379 -- it'll simplify that PR to get this landed separately so we can just remove some of the code that it touches. r? @Zoxc or @michaelwoerister