- 15 1月, 2021 4 次提交
-
-
由 Igor Matuszewski 提交于
-
由 Igor Matuszewski 提交于
-
由 Igor Matuszewski 提交于
-
由 bors 提交于
Update tests of "unused_lifetimes" lint for async functions and corresponding source code Before this PR the following code would cause an error: ``` #![deny(unused_lifetimes)] async fn f<'a>(_: &'a i32) {} fn main() {} ``` It was happening because of the desugaring of return type in async functions. As a result of the desugaring, the return type contains all lifetimes involved in the function signature. And these lifetimes were interpreted separately from the same in the function scope => so they are unused. Now, all lifetimes from the return type are interpreted as used. It is also not perfect, but at least this lint doesn't cause wrong errors now. This PR connected to issues #78522, #77217
-
- 14 1月, 2021 12 次提交
-
-
由 bors 提交于
Reintroduce hir::ExprKind::If Basically copied and paste #59288/https://github.com/rust-lang/rust-clippy/pull/4080 with some modifications. The vast majority of tests were fixed and now there are only a few remaining. Since I am still unable to figure out the missing pieces, any help with the following list is welcome. - [ ] **Unnecessary `typeck` exception**: [Cheated on this one to make CI green.](https://github.com/rust-lang/rust/pull/79328/files#diff-3faee9ba23fc54a12b7c43364ba81f8c5660045c7e1d7989a02a0cee1c5b2051) - [x] **Incorrect span**: [Span should reference `then` and `else` separately.](https://github.com/rust-lang/rust/pull/79328/files#diff-cf2c46e82222ee4b1037a68fff8a1af3c4f1de7a6b3fd798aacbf3c0475abe3d) - [x] **New note regarding `assert!`**: [Modified but not "wrong". Maybe can be a good thing?](https://github.com/rust-lang/rust/pull/79328/files#diff-9e0d7c89ed0224e2b62060c957177c27db43c30dfe3c2974cb6b5091cda9cfb5) - [x] **Inverted report location**: [Modified but not "wrong". Locations were inverted.](https://github.com/rust-lang/rust/pull/79328/files#diff-f637ce7c1f68d523a165aa9651765df05e36c4d7d279194b1a6b28b48a323691) - [x] **`src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs` has weird errors**: [Not sure why this is happening.](https://github.com/rust-lang/rust/pull/79328/files#diff-c823c09660f5b112f95e97e8ff71f1797b6c7f37dbb3d16f8e98bbaea8072e95) - [x] **Missing diagnostic**: [???](https://github.com/rust-lang/rust/pull/79328/files#diff-6b8ab09360d725ba4513933827f9796b42ff9522b0690f80b76de067143af2fc)
-
由 bors 提交于
Encode optimized MIR of generators when emitting metadata
-
由 bors 提交于
Fix #49660 - Adds checks to ensure existence of arithmetic trait implementations The first 2 commits fix an issue with the existing `wrapping.rs` tests. It wasn't referred to from the module, so the file was being ignored. This is fixed in https://github.com/rust-lang/rust/pull/78259/commits/872dc60ed203d16d43140c1d1623474cf8a9aedc This surfaced a bug in its macro which is fixed in https://github.com/rust-lang/rust/pull/78259/commits/8ddad18283e304753e09ef651209b4a6b54148b0 Lastly, commit https://github.com/rust-lang/rust/pull/78259/commits/64d695b753bfe09797b5f95c7b9b72948da01710 is the actual tests for fixing #49660 The following checks are done: * `Add`, `Sub`, `Mul`, `Div`, `Rem` * `T op T`, `T op &T`, `&T op T` and `&T op &T` * for all integer and floating point types * `AddAssign`, `SubAssign`, `MulAssign`, `DivAssign`, `RemAssign` * `&mut T op T` and `&mut T op &T` * for all integer and floating point types * `Neg` * `op T` and `op &T` * for all signed integer and floating point types * `Not` * `op T` and `op &T` * for `bool` * `BitAnd`, `BitOr`, `BitXor` * `T op T`, `T op &T`, `&T op T` and `&T op &T` * for all integer types and bool * `BitAndAssign`, `BitOrAssign`, `BitXorAssign` * `&mut T op T` and `&mut T op &T` * for all integer types and bool * `Shl`, `Shr` * `L op R`, `L op &R`, `&L op R` and `&L op &R` * for all pairs of integer types * `ShlAssign`, `ShrAssign` * `&mut L op R`, `&mut L op &R` * for all pairs of integer types NOTE: I'd like some feedback on improving the macros. I'm not familiar with the idioms and patterns there and composing them has been a challenge for me. [EDIT]: updated links to commits after rebase.
-
由 Philippe Laflamme 提交于
These tests invoke the various op traits using all accepted types they are implemented for as well as for references to those types. This fixes #49660 and ensures the following implementations exist: * `Add`, `Sub`, `Mul`, `Div`, `Rem` * `T op T`, `T op &T`, `&T op T` and `&T op &T` * for all integer and floating point types * `AddAssign`, `SubAssign`, `MulAssign`, `DivAssign`, `RemAssign` * `&mut T op T` and `&mut T op &T` * for all integer and floating point types * `Neg` * `op T` and `op &T` * for all signed integer and floating point types * `Not` * `op T` and `op &T` * for `bool` * `BitAnd`, `BitOr`, `BitXor` * `T op T`, `T op &T`, `&T op T` and `&T op &T` * for all integer types and bool * `BitAndAssign`, `BitOrAssign`, `BitXorAssign` * `&mut T op T` and `&mut T op &T` * for all integer types and bool * `Shl`, `Shr` * `L op R`, `L op &R`, `&L op R` and `&L op &R` * for all pairs of integer types * `ShlAssign`, `ShrAssign` * `&mut L op R`, `&mut L op &R` * for all pairs of integer types
-
由 Philippe Laflamme 提交于
AFAIK it isn't currently possible to do this. It is also more in line with other tests in the surrounding modules.
-
由 Philippe Laflamme 提交于
-
由 bors 提交于
Box Item::Attributes This reduces the size of Item from 128 to 40 bytes. I think this is as small as it needs to get
🎉 Builds on https://github.com/rust-lang/rust/pull/80339 and should not be merged before. r? `@GuillaumeGomez` -
由 Tomasz Miąsko 提交于
-
由 bors 提交于
Properly handle `SyntaxContext` of dummy spans in incr comp Fixes #80336 Due to macro expansion, we may end up with spans with an invalid location and non-root `SyntaxContext`. This commits preserves the `SyntaxContext` of such spans in the incremental cache, and ensures that we always hash the `SyntaxContext` when computing the `Fingerprint` of a `Span` Previously, we would discard the `SyntaxContext` during serialization to the incremental cache, causing the span's `Fingerprint` to change across compilation sessions.
-
由 bors 提交于
Rework diagnostics for wrong number of generic args (fixes #66228 and #71924) This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.
-
由 Aaron Hill 提交于
Fixes #80336 Due to macro expansion, we may end up with spans with an invalid location and non-root `SyntaxContext`. This commits preserves the `SyntaxContext` of such spans in the incremental cache, and ensures that we always hash the `SyntaxContext` when computing the `Fingerprint` of a `Span` Previously, we would discard the `SyntaxContext` during serialization to the incremental cache, causing the span's `Fingerprint` to change across compilation sessions.
-
由 bors 提交于
Consistently avoid constructing optimized MIR when not doing codegen The optimized MIR for closures is being encoded unconditionally, while being unnecessary for cargo check. This turns out to be especially costly with MIR inlining enabled, since it triggers computation of optimized MIR for all callees that are being examined for inlining purposes https://github.com/rust-lang/rust/pull/77307#issuecomment-751915450. Skip encoding of optimized MIR for closures, enum constructors, struct constructors, and trait fns when not doing codegen, like it is already done for other items since 49433.
-
- 13 1月, 2021 24 次提交
-
-
由 bors 提交于
Add allow-by-default lint on implicit ABI in extern function pointers and items This adds a new lint, missing_abi, which lints on omitted ABIs on extern blocks, function declarations, and function pointers. It is currently not emitting the best possible diagnostics -- we need to track the span of "extern" at least or do some heuristic searching based on the available spans -- but seems good enough for an initial pass than can be expanded in future PRs. This is a pretty large PR, but mostly due to updating a large number of tests to include ABIs; I can split that into a separate PR if it would be helpful, but test updates are already in dedicated commits.
-
由 Mark Rousskov 提交于
-
由 Mark Rousskov 提交于
-
由 Mark Rousskov 提交于
-
由 Mark Rousskov 提交于
-
由 bors 提交于
Try to avoid locals when cloning into Box/Rc/Arc For generic `T: Clone`, we can allocate an uninitialized box beforehand, which gives the optimizer a chance to create the clone directly in the heap. For `T: Copy`, we can go further and do a simple memory copy, regardless of optimization level. The same applies to `Rc`/`Arc::make_mut` when they must clone the data.
-
由 bors 提交于
Stabilize split_inclusive ### Contents of this MR This stabilises: * `slice::split_inclusive` * `slice::split_inclusive_mut` * `str::split_inclusive` Closes #72360. ### A possible concern The proliferation of `split_*` methods is not particularly pretty. The existence of `split_inclusive` seems to invite the addition of `rsplit_inclusive`, `splitn_inclusive`, etc. We could instead have a more general API, along these kinds of lines maybe: ``` pub fn split_generic('a,P,H>(&'a self, pat: P, how: H) -> ... where P: Pattern where H: SplitHow; pub fn split_generic_mut('a,P,H>(&'a mut self, pat: P, how: H) -> ... where P: Pattern where H: SplitHow; trait SplitHow { fn reverse(&self) -> bool; fn inclusive -> bool; fn limit(&self) -> Option<usize>; } pub struct SplitFwd; ... pub struct SplitRevInclN(pub usize); ``` But maybe that is worse. ### Let us defer that? ### This seems like a can of worms. I think we can defer opening it now; if and when we have something more general, these two methods can become convenience aliases. But I thought I would mention it so the lang API team can consider it and have an opinion.
-
由 bors 提交于
Rollup of 10 pull requests Successful merges: - #78901 (diagnostics: Note capturing closures can't be coerced to fns) - #79588 (Provide more information for HRTB lifetime errors involving closures) - #80232 (Remove redundant def_id lookups) - #80662 (Added support for i386-unknown-linux-gnu and i486-unknown-linux-gnu) - #80736 (use Once instead of Mutex to manage capture resolution) - #80796 (Update to LLVM 11.0.1) - #80859 (Fix --pretty=expanded with --remap-path-prefix) - #80922 (Revert "Auto merge of #76896 - spastorino:codegen-inline-fns2) - #80924 (Fix rustdoc --test-builder argument parsing) - #80935 (Rename `rustc_middle::lint::LevelSource` to `LevelAndSource`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
-
由 Ashley Mannix 提交于
-
由 Ashley Mannix 提交于
-
由 Ashley Mannix 提交于
-
由 Ashley Mannix 提交于
-
由 Dylan DPC 提交于
Rename `rustc_middle::lint::LevelSource` to `LevelAndSource` This continues work in https://github.com/rust-lang/rust/pull/80274 to improve code readability. This naming follows a pattern seen elsewhere in the compiler (e.g. [`rustc_middle::ty::TypeAndMut`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeAndMut.html)).
-
由 Dylan DPC 提交于
Fix rustdoc --test-builder argument parsing My suggested fix to issue #80893. I can actually hook Miri in there now. I also fixed what I believe to be a typo in the option's help text.
-
由 Dylan DPC 提交于
Revert "Auto merge of #76896 - spastorino:codegen-inline-fns2 This reverts commit ddf2cc7f, reversing changes made to 937f6295. As `@alexcrichton` pointed out in https://github.com/rust-lang/rust/issues/80916 there's a problem with the taken approach.
-
由 Dylan DPC 提交于
Fix --pretty=expanded with --remap-path-prefix Per https://github.com/rust-lang/rust/issues/80832, using --pretty=expanded and --remap-path-prefix results in an ICE. This is becasue the session source files table is stored in remapped form, whereas --pretty-expanded looks up unremapped files. This remaps the path prefixes before lookup. ~~There don't appear to be any existing tests for --pretty=expanded; I'll look into adding some.~~ Never mind, found the pretty tests. Fixes #80832
-
由 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 提交于
Separate out a `hir::Impl` struct This makes it possible to pass the `Impl` directly to functions, instead of having to pass each of the many fields one at a time. It also simplifies matches in many cases. See `rustc_save_analysis::dump_visitor::process_impl` or `rustdoc::clean::clean_impl` for a good example of how this makes `impl`s easier to work with. r? `@petrochenkov` maybe?
-
由 Joshua Nelson 提交于
This makes it possible to pass the `Impl` directly to functions, instead of having to pass each of the many fields one at a time. It also simplifies matches in many cases.
-