- 13 1月, 2021 14 次提交
-
-
由 Dylan DPC 提交于
Update to LLVM 11.0.1 This updates to a new LLVM branch, rebased on the upstream `llvmorg-11.0.1`. All our patches applied cleanly except the fortanix unwind changes, which just needed a small adjustment in cmake files. r? `@nikic` Fixes https://github.com/rust-lang/rust/issues/73722
-
由 Dylan DPC 提交于
use Once instead of Mutex to manage capture resolution For #78299 This allows us to return borrows of the captured backtrace frames that are tied to a borrow of the Backtrace itself, instead of to some short-lived Mutex guard. We could alternatively share `&Mutex<Capture>`s and lock on-demand, but then we could potentially forget to call `resolve()` before working with the capture. It also makes it semantically clearer what synchronization is needed on the capture. cc `@seanchen1991` `@rust-lang/project-error-handling`
-
由 Dylan DPC 提交于
Added support for i386-unknown-linux-gnu and i486-unknown-linux-gnu Support for both can be useful when creating new firmware, boot loaders, or embedded operating systems.
-
由 Dylan DPC 提交于
Remove redundant def_id lookups Simplify `DefId -> LocalDefId -> HirId -> LocalDefId -> DefId` chains.
-
由 Dylan DPC 提交于
Provide more information for HRTB lifetime errors involving closures
-
由 Dylan DPC 提交于
diagnostics: Note capturing closures can't be coerced to fns Fixes #72457, fixes #71895 r? `@estebank`
-
由 bors 提交于
Turn type inhabitedness into a query to fix `exhaustive_patterns` perf We measured in https://github.com/rust-lang/rust/pull/79394 that enabling the [`exhaustive_patterns` feature](https://github.com/rust-lang/rust/issues/51085) causes significant perf degradation. It was conjectured that the culprit is type inhabitedness checking, and [I hypothesized](https://github.com/rust-lang/rust/pull/79394#issuecomment-733861149) that turning this computation into a query would solve most of the problem. This PR turns `tcx.is_ty_uninhabited_from` into a query, and I measured a 25% perf gain on the benchmark that stress-tests `exhaustiveness_patterns`. This more than compensates for the 30% perf hit I measured [when creating it](https://github.com/rust-lang/rustc-perf/pull/801). We'll have to measure enabling the feature again, but I suspect this fixes the perf regression entirely. I'd like a perf run on this PR obviously. I made small atomic commits to help reviewing. The first one is just me discovering the "revisions" feature of the testing framework. I believe there's a push to move things out of `rustc_middle` because it's huge. I guess `inhabitedness/mod.rs` could be moved out, but it's quite small. `DefIdForest` might be movable somewhere too. I don't know what the policy is for that. Ping `@camelid` since you were interested in following along `@rustbot` modify labels: +A-exhaustiveness-checking
-
由 Esteban Küber 提交于
-
由 Nadrieril 提交于
Since `DefIdForest` contains 0 or 1 elements the large majority of the time, by allocating only in the >1 case we avoid almost all allocations, compared to `Arc<SmallVec<[DefId;1]>>`. This shaves off 0.2% on the benchmark that stresses uninhabitedness checking.
-
由 bors 提交于
Use tcx.symbol_name when determining clashing extern declarations. Fixes #79581. r? `@alexcrichton`
-
由 Nadrieril 提交于
-
由 Nadrieril 提交于
-
由 Nadrieril 提交于
-
由 bors 提交于
Make CTFE able to check for UB... ... by not doing any optimizations on the `const fn` MIR used in CTFE. This means we duplicate all `const fn`'s MIR now, once for CTFE, once for runtime. This PR is for checking the perf effect, so we have some data when talking about https://github.com/rust-lang/const-eval/blob/master/rfcs/0000-const-ub.md To do this, we now have two queries for obtaining mir: `optimized_mir` and `mir_for_ctfe`. It is now illegal to invoke `optimized_mir` to obtain the MIR of a const/static item's initializer, an array length, an inline const expression or an enum discriminant initializer. For `const fn`, both `optimized_mir` and `mir_for_ctfe` work, the former returning the MIR that LLVM should use if the function is called at runtime. Similarly it is illegal to invoke `mir_for_ctfe` on regular functions. This is all checked via appropriate assertions and I don't think it is easy to get wrong, as there should be no `mir_for_ctfe` calls outside the const evaluator or metadata encoding. Almost all rustc devs should keep using `optimized_mir` (or `instance_mir` for that matter).
-
- 12 1月, 2021 26 次提交
-
-
由 oli 提交于
-
由 bors 提交于
Enhance type inference errors involving the `?` operator This patch adds a special-cased note on type inference errors when the error span points to a `?` return. It also makes the primary label for such errors "cannot infer type of `?` error" in cases where before we would have only said "cannot infer type". One beneficiary of this change is async blocks, where we can't explicitly annotate the return type and so may not generate any other help (#77880); this lets us at least print the error type we're converting from and anything we know about the type we can't fully infer. More generally, it signposts that an implicit conversion is happening that may have impeded type inference the user was expecting. We already do something similar for [mismatched type errors](https://github.com/rust-lang/rust/blob/2987785df3d46d5ff144a5c67fbb8f5cca798d78/src/test/ui/try-block/try-block-bad-type.stderr#L7). The check for a relevant `?` operator is built into the existing HIR traversal which looks for places that could be annotated to resolve the error. That means we could identify `?` uses anywhere in the function that output the type we can't infer, but this patch just sticks to adding the note if the primary span given for the error has the operator; if there are other expressions where the type occurs and one of them is selected for the error instead, it's more likely that the `?` operator's implicit conversion isn't the sole cause of the inference failure and that adding an additional diagnostic would just be noise. I added a ui test for one such case. The data about the `?` conversion is passed around in a `UseDiagnostic` enum that in theory could be used to add more of this kind of note in the future. It was also just easier to pass around than something with a more specific name. There are some follow-up refactoring commits for the code that generates the error label, which was already pretty involved and made a bit more complicated by this change.
-
由 bors 提交于
remove redundant closures (clippy::redundant_closure)
-
由 bors 提交于
Rollup of 8 pull requests Successful merges: - #79757 (Replace tabs earlier in diagnostics) - #80600 (Add `MaybeUninit` method `array_assume_init`) - #80880 (Move some tests to more reasonable directories) - #80897 (driver: Use `atty` instead of rolling our own) - #80898 (Add another test case for #79808) - #80917 (core/slice: remove doc comment about scoped borrow) - #80927 (Replace a simple `if let` with the `matches` macro) - #80930 (fix typo in trait method mutability mismatch help) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Yuki Okushi 提交于
fix typo in trait method mutability mismatch help
-
由 Yuki Okushi 提交于
Replace a simple `if let` with the `matches` macro `@rustbot` modify labels +C-cleanup +T-compiler
-
由 Yuki Okushi 提交于
core/slice: remove doc comment about scoped borrow There's no need to scope the borrow in the doc example due to NLL. [Playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=fn%20main()%20%7B%0A%20%20%20%20let%20mut%20v%20%3D%20%5B1%2C%200%2C%203%2C%200%2C%205%2C%206%5D%3B%0A%0A%20%20%20%20let%20(left%2C%20right)%20%3D%20v.split_at_mut(2)%3B%0A%20%20%20%20assert_eq!(left%2C%20%5B1%2C%200%5D)%3B%0A%20%20%20%20assert_eq!(right%2C%20%5B3%2C%200%2C%205%2C%206%5D)%3B%0A%20%20%20%20left%5B1%5D%20%3D%202%3B%0A%20%20%20%20right%5B1%5D%20%3D%204%3B%0A%0A%20%20%20%20assert_eq!(v%2C%20%5B1%2C%202%2C%203%2C%204%2C%205%2C%206%5D)%3B%0A%7D%0A) where changed code compiles
-
由 Yuki Okushi 提交于
Add another test case for #79808 Taken from #80293. Closes #80293 r? `@lcnr`
-
由 Yuki Okushi 提交于
driver: Use `atty` instead of rolling our own Fixes #80888. Rationale: - `atty` is widely used in the Rust ecosystem - We already use it (in `rustc_errors` and other places) - We shouldn't be rolling our own TTY detector when there's a widely-used, well-tested package that we can use
-
由 Yuki Okushi 提交于
Move some tests to more reasonable directories The idea is to move `issues`/`ui` tests in small batches r? `@petrochenkov`
-
由 Yuki Okushi 提交于
Add `MaybeUninit` method `array_assume_init` When initialising an array element-by-element, the conversion to the initialised array is done through `mem::transmute`, which is both ugly and does not work with const generics (see #61956). This PR proposes the associated method `array_assume_init`, matching the style of `slice_assume_init_*`: ```rust unsafe fn array_assume_init<T, const N: usize>(array: [MaybeUninit<T>; N]) -> [T; N]; ``` Example: ```rust let mut array: [MaybeUninit<i32>; 3] = MaybeUninit::uninit_array(); array[0].write(0); array[1].write(1); array[2].write(2); // SAFETY: Now safe as we initialised all elements let array: [i32; 3] = unsafe { MaybeUninit::array_assume_init(array) }; ``` Things I'm unsure about: * Should this be a method of array instead? * Should the function be const?
-
由 Yuki Okushi 提交于
Replace tabs earlier in diagnostics This replaces tabs earlier in the diagnostics emitting process, which allows various margin calculations to ignore the existence of tabs. It does add a string copy for the source lines that are emitted. Fixes https://github.com/rust-lang/rust/issues/78438 r? `@estebank`
-
由 bors 提交于
Serialize incr comp structures to file via fixed-size buffer Reduce a large memory spike that happens during serialization by writing the incr comp structures to file by way of a fixed-size buffer, rather than an unbounded vector. Effort was made to keep the instruction count close to that of the previous implementation. However, buffered writing to a file inherently has more overhead than writing to a vector, because each write may result in a handleable error. To reduce this overhead, arrangements are made so that each LEB128-encoded integer can be written to the buffer with only one capacity and error check. Higher-level optimizations in which entire composite structures can be written with one capacity and error check are possible, but would require much more work. The performance is mostly on par with the previous implementation, with small to moderate instruction count regressions. The memory reduction is significant, however, so it seems like a worth-while trade-off.
-
由 Camelid 提交于
Rationale: - `atty` is widely used in the Rust ecosystem - We already use it (in `rustc_errors` and other places) - We shouldn't be rolling our own TTY detector when there's a widely-used, well-tested package that we can use
-
由 bors 提交于
Suggest async {} for async || {} Fixes #76011 This adds support for adding help diagnostics to the feature gating checks and then uses it for the async_closure gate to add the extra bit of help information as described in the issue.
-
由 LingMan 提交于
-
由 CoffeeBlend 提交于
-
由 Andy Russell 提交于
-
由 bors 提交于
Rollup of 9 pull requests Successful merges: - #79997 (Emit a reactor for cdylib target on wasi) - #79998 (Use correct ABI for wasm32 by default) - #80042 (Split a func into cold/hot parts, reducing binary size) - #80324 (Explain method-call move errors in loops) - #80864 (std/core docs: fix wrong link in PartialEq) - #80870 (resolve: Simplify built-in macro table) - #80885 (rustdoc: Resolve `&str` as `str`) - #80904 (Fix small typo) - #80923 (Merge different function exits) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Josh Stone 提交于
-
由 Yuki Okushi 提交于
Merge different function exits `@rustbot` modify labels +C-cleanup +T-compiler
-
由 Yuki Okushi 提交于
Fix small typo transmutting -> transmuting
-
由 Yuki Okushi 提交于
rustdoc: Resolve `&str` as `str` People almost always are referring to `&str`, not `str`, so this will save a manual link resolve in many cases. Note that we already accept `&` (resolves to `reference`) in intra-doc links, so this shouldn't cause breakage. r? `@jyn514`
-
由 Yuki Okushi 提交于
resolve: Simplify built-in macro table We don't use full `SyntaxExtension`s from the table, only `SyntaxExtensionKind`s, and `Ident` in `register_builtin_macro` always had dummy span. This PR removes unnecessary data from the table and related function signatures. Noticed when reviewing #80850.
-
由 Yuki Okushi 提交于
std/core docs: fix wrong link in PartialEq PartialEq doc was attempting to link to ``[`Eq`]`` but instead we got a link to `` `eq` ``. Disambiguate with `trait@Eq`. You can see the bad link [here](https://doc.rust-lang.org/std/cmp/trait.PartialEq.html) (Second sentence, "floating point types implement PartialEq but not Eq").
-
由 Yuki Okushi 提交于
Explain method-call move errors in loops PR #73708 added a more detailed explanation of move errors that occur due to a call to a method that takes `self`. This PR extends that logic to work when a move error occurs due to a method call in the previous iteration of a loop.
-