- 27 6月, 2018 13 次提交
-
-
由 Michael Woerister 提交于
-
由 Michael Woerister 提交于
-
由 bors 提交于
Stabilize to_bytes and from_bytes for integers. Fixes #49792
-
由 bors 提交于
Lowering cleanups [2/N] Double indirections are unnecessary
-
由 Thayne McCombs 提交于
Fixes #49792
-
由 bors 提交于
Optimize sum of Durations by using custom function The current `impl Sum for Duration` uses `fold` to perform several `add`s (or really `checked_add`s) of durations. In doing so, it has to guarantee the number of nanoseconds is valid after every addition. If you squeese the current implementation into a single function it looks kind of like this: ````rust fn sum<I: Iterator<Item = Duration>>(iter: I) -> Duration { let mut sum = Duration::new(0, 0); for rhs in iter { if let Some(mut secs) = sum.secs.checked_add(rhs.secs) { let mut nanos = sum.nanos + rhs.nanos; if nanos >= NANOS_PER_SEC { nanos -= NANOS_PER_SEC; if let Some(new_secs) = secs.checked_add(1) { secs = new_secs; } else { panic!("overflow when adding durations"); } } sum = Duration { secs, nanos } } else { panic!("overflow when adding durations"); } } sum } ```` We only need to check if `nanos` is in the correct range when giving our final answer so we can have a more optimized version like so: ````rust fn sum<I: Iterator<Item = Duration>>(iter: I) -> Duration { let mut total_secs: u64 = 0; let mut total_nanos: u64 = 0; for entry in iter { total_secs = total_secs .checked_add(entry.secs) .expect("overflow in iter::sum over durations"); total_nanos = match total_nanos.checked_add(entry.nanos as u64) { Some(n) => n, None => { total_secs = total_secs .checked_add(total_nanos / NANOS_PER_SEC as u64) .expect("overflow in iter::sum over durations"); (total_nanos % NANOS_PER_SEC as u64) + entry.nanos as u64 } }; } total_secs = total_secs .checked_add(total_nanos / NANOS_PER_SEC as u64) .expect("overflow in iter::sum over durations"); total_nanos = total_nanos % NANOS_PER_SEC as u64; Duration { secs: total_secs, nanos: total_nanos as u32, } } ```` We now only convert `total_nanos` to `total_secs` (1) if `total_nanos` overflows and (2) at the end of the function when we have to output a valid `Duration`. This gave a 5-22% performance improvement when I benchmarked it, depending on how big the `nano` value of the `Duration`s in `iter` were.
-
由 bors 提交于
Don't inspect the generated existential type items r? @nikomatsakis My debugging led me to the `hir::ItemExistential(..)` checks, which are entirely unnecessary because we never use the items directly. The issue was that items were iterated over in a random order (due to hashmaps), so if you checked the `ItemExistential` before the function that has the actual return `impl Trait`, you'd run into those ICEs you encountered.
-
由 bors 提交于
lint to favor `..=` over `...` range patterns; migrate to `..=` throughout codebase We probably need an RFC to actually deprecate the `...` syntax, but here's a candidate implementation for the lint considered in #51043. (My local build is super flaky, but hopefully I got all of the test revisions.)
-
由 bors 提交于
Add `LocalTaskObj` to `core::task` - Splits `libcore/task.rs` into submodules - Adds `LocalTaskObj` and `SpawnLocalObjError` (-> [Commit for this](https://github.com/rust-lang/rust/commit/433e6b31a75eea5ce45493acc63eae462d740338)) Note: To make reviewing easy, both actions have their own commit r? @cramertj
-
由 Josef Reinhard Brandl 提交于
-
由 Josef Reinhard Brandl 提交于
-
由 bors 提交于
Haiku: set stack size to 16 MB on Haiku, use 32 MB on other platforms The maximum stack size on Haiku is set to 16 MB (see [the Haiku source](https://git.haiku-os.org/haiku/tree/headers/private/system/thread_defs.h#n17)). With this change rustdoc will also work on Haiku.
-
由 bors 提交于
Do not build LLVM tools for any of the tools None of the tools in the list should need LLVM tools themselves as far as I can tell; if this is incorrect, we can re-enable the tool building later. The primary reason for doing this is that rust-central-station uses the BuildManifest tool and building LLVM there is not cached: it takes ~1.5 hours on the 2 core machine. This commit should make nightlies and stable releases much faster. Followup to https://github.com/rust-lang/rust/pull/51459, r? @kennytm I'm mostly relying on CI to test this so probably don't roll it up; I'm not sure how to (and not particularly inclined to) wait for multiple hours to test this locally. I imagine that the failures should be fairly obvious when/if encountered.
-
- 26 6月, 2018 27 次提交
-
-
由 Oliver Schneider 提交于
-
由 Oliver Schneider 提交于
-
由 Josef Reinhard Brandl 提交于
-
由 Zack M. Davis 提交于
-
由 Zack M. Davis 提交于
Our implementation ends up changing the `PatKind::Range` variant in the AST to take a `Spanned<RangeEnd>` instead of just a `RangeEnd`, because the alternative would be to try to infer the span of the range operator from the spans of the start and end subexpressions, which is both hideous and nontrivial to get right (whereas getting the change to the AST right was a simple game of type tennis). This is concerning #51043.
-
由 Zack M. Davis 提交于
These were stabilized in March 2018's #47813, and are the Preferred Way to Do It going forward (q.v. #51043).
-
由 Josef Reinhard Brandl 提交于
-
由 Oliver Schneider 提交于
-
由 bors 提交于
Combine all builtin late lints
-
由 bors 提交于
Rollup of 11 pull requests Successful merges: - #51104 (add `dyn ` to display of dynamic (trait) types) - #51153 (Link panic and compile_error docs) - #51642 (Fix unknown windows build) - #51730 (New safe associated functions for PinMut) - #51731 (Fix ICEs when using continue as an array length inside closures (inside loop conditions)) - #51747 (Add error for using null characters in #[export_name]) - #51769 (Update broken rustc-guide links) - #51786 (Remove unnecessary stat64 pointer casts) - #51788 (Fix typo) - #51789 (Don't ICE when performing `lower_pattern_unadjusted` on a `TyError`) - #51791 (Minify css) Failed merges: r? @ghost
-
由 Pietro Albini 提交于
Minify css Sizes changes: ``` dark.css: 8821 => 7804 (~11%) light.css: 8587 => 7565 (~11%) rustdoc.css: 22364 => 17818 (~20%) settings.css: 1384 => 1236 (~10%) ``` So obviously, the bigger the file, the bigger minification. r? @QuietMisdreavus
-
由 Pietro Albini 提交于
Don't ICE when performing `lower_pattern_unadjusted` on a `TyError` Fix #50577. CC #51696. r? @oli-obk
-
由 Pietro Albini 提交于
Fix typo
-
由 Pietro Albini 提交于
Remove unnecessary stat64 pointer casts In effect, these just casted `&mut stat64` to `*mut stat64`, twice. That's harmless, but it masked a problem when this was copied to new code calling `fstatat`, which takes a pointer to `struct stat`. That will be fixed by #51785, but let's remove the unnecessary casts here too.
-
由 Pietro Albini 提交于
Update broken rustc-guide links Recently, there has been some rearrangement of the content in the Rustc Guide, and this commit changes the urls the match the updated guide.
-
由 Pietro Albini 提交于
Add error for using null characters in #[export_name] Fixes #51741.
-
由 Pietro Albini 提交于
Fix ICEs when using continue as an array length inside closures (inside loop conditions) Fixes #51707. Fixes #51708. r? @estebank
-
由 Pietro Albini 提交于
New safe associated functions for PinMut - Add safe `get_mut` and `map` - Rename unsafe equivalents to `get_mut_unchecked` and `map_unchecked` The discussion about this starts [in this comment](https://github.com/rust-lang/rust/issues/49150#issuecomment-399604573) on the tracking issue.
-
由 Pietro Albini 提交于
Fix unknown windows build Fixes #51618.
-
由 Pietro Albini 提交于
Link panic and compile_error docs This adds documentation links between `panic!()` and `compile_error!()` as per #47275, which points out that they’re similar. It also adds a sentence to the `compile_error()` docs I thought could be added.
-
由 Pietro Albini 提交于
add `dyn ` to display of dynamic (trait) types ~~I'm not sure we want the `dyn` in the E0277 "trait bound [...] is not satisfied" messages ("bound" sounds like a different thing in contrast to the names of specific trait-object types like `Box<dyn Trait>`), but I'm finding the code I would need to change that hard to follow—the [display object seems to](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/traits/error_reporting.rs#L600) be a [`Predicate::Trait`](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/ty/mod.rs#L962) variant, whose [`Display` implementation](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/util/ppaux.rs#L1309) calls `.print` on its `PolyTraitPredicate` member, [which is a type alias](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/ty/mod.rs#L1112) for `ty::Binder<TraitPredicate<'tcx>>`, whose [`Display` implementation](https://github.com/rust-lang/rust/blob/f0805a4421449bd6fe3096d63820fbebe2bfcd1d/src/librustc/util/ppaux.rs#L975-L985) ... _&c._— so maybe it's time to pull-request this and see what reviewers think.~~ Resolves #49277 (?). r? @nikomatsakis
-
由 bors 提交于
Implementation of RFC 2086 - Allow Irrefutable Let patterns This is the set of changes for RFC2086. Tracking issue #44495. Rendered [here](https://github.com/rust-lang/rfcs/pull/2086)
-
由 bors 提交于
Obligation forest cleanup While looking at this code I was scratching my head about whether a node could appear in both `parent` and `dependents`. Turns out it can, but it's not useful to do so, so this PR cleans things up so it's no longer possible.
-
由 bors 提交于
Fix possibly endless loop in ReadDir iterator Certain directories in `/proc` can cause the `ReadDir` iterator to loop indefinitely. We get an error code (22) when calling libc's `readdir_r` on these directories, but `entry_ptr` is `NULL` at the same time, signalling the end of the directory stream. This change introduces an internal state to the iterator such that the `Some(Err(..))` value will only be returned once when calling `next`. Subsequent calls will return `None`. fixes #50619
-
由 bors 提交于
`Self` in where clauses may not be object safe Needs crater, virtually certain to cause regressions. In #50781 it was discovered that our object safety rules are not sound because we allow `Self` in where clauses without restrain. This PR is a direct fix to the rules so that we disallow methods with unsound where clauses. This currently uses hard error to measure impact, but we will want to downgrade it to a future compat error. Part of #50781. r? @nikomatsakis
-
由 Niko Matsakis 提交于
-
由 Guillaume Gomez 提交于
-