Roxane
08c616741c
Ensure deterministic ordering for diagnostics
2021-07-09 13:32:30 -04:00
Paul Trojahn
5cf954f932
Revert the revert of renaming traits::VTable to ImplSource
...
As #72114 and #73055 were merged so closely together I think this
accidentally happened while rebasing
2021-07-09 18:26:28 +02:00
bors
619c27a539
Auto merge of #87003 - m-ou-se:rollup-x7mhv3v, r=m-ou-se
...
Rollup of 5 pull requests
Successful merges:
- #86855 (Fix comments about unique borrows)
- #86881 (Inline implementation of lookup_line)
- #86937 (Change linked tracking issue for more_qualified_paths)
- #86994 (Update the comment on `lower_expr_try`)
- #87000 (Use #[track_caller] in const panic diagnostics.)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-09 15:34:16 +00:00
Mara Bos
2152c145d3
Rollup merge of #87000 - m-ou-se:const-panic-track-caller, r=oli-obk
...
Use #[track_caller] in const panic diagnostics.
This change stops const panic diagnostics from reporting inside #[track_caller] functions by skipping over them.
2021-07-09 16:20:36 +02:00
Mara Bos
98f35589f7
Rollup merge of #86994 - scottmcm:fix_expr_try_comment, r=petrochenkov
...
Update the comment on `lower_expr_try`
I'd updated the ones inside the method, but not its doc comment.
2021-07-09 16:20:35 +02:00
Mara Bos
07b9dae6a2
Rollup merge of #86937 - rylev:tracking-more-qualified-paths, r=nagisa
...
Change linked tracking issue for more_qualified_paths
This updates the linked tracking issue for the `more_qualified_paths` feature from the implementation PR #80080 to an actual tracking issue #86935 .
2021-07-09 16:20:33 +02:00
Mara Bos
ad10107600
Rollup merge of #86881 - tmiasko:lookup-line, r=nagisa
...
Inline implementation of lookup_line
to avoid unnecessary conversions from `Option<usize>` to `isize` and back.
2021-07-09 16:20:32 +02:00
Mara Bos
e920ef8785
Rollup merge of #86855 - LeSeulArtichaut:patch-1, r=davidtwco
...
Fix comments about unique borrows
2021-07-09 16:20:32 +02:00
Roxane
8cbeaf7382
Address comments
2021-07-09 10:18:55 -04:00
Roxane
ca44372957
Handle multi diagnostics
2021-07-09 10:00:21 -04:00
Roxane
59f634bc2d
Update comments
2021-07-09 10:00:21 -04:00
Roxane
81b062ae88
Fix wording
2021-07-09 10:00:21 -04:00
Roxane
36eb5442bd
Add note clarifying why a closure no longer implements a trait
2021-07-09 10:00:21 -04:00
Roxane
2900c1a5e8
Add note pointing to where a closure and it's captured variables are dropped
2021-07-09 10:00:21 -04:00
Roxane
0e8e89daa6
Update error message
2021-07-09 10:00:20 -04:00
Roxane
0b7ff9660f
Add note on why the variable is not fully captured
2021-07-09 10:00:20 -04:00
Kornel
bc67f6bc95
Debug formatting of raw_arg()
2021-07-09 14:24:34 +01:00
Mara Bos
0a4b53f57d
Use #[track_caller] in const panic diagnostics.
...
It was already used for the message. This also uses it for the spans
used for the error and backtrace.
2021-07-09 15:23:27 +02:00
Kornel
8f9d0f12eb
Use AsRef in CommandExt for raw_arg
2021-07-09 14:09:48 +01:00
Kornel
d868da7796
Unescaped command-line arguments for Windows
...
Fixes #29494
2021-07-09 14:09:48 +01:00
Kornel
fcd5cecdcf
Test escaping of trialing slashes in Windows command-line args
2021-07-09 14:09:48 +01:00
bors
e916b7cb77
Auto merge of #86888 - FabianWolff:issue-86600, r=davidtwco
...
Fix double warning about illegal floating-point literal pattern
This PR fixes #86600 . The problem is that the `ConstToPat` struct contains a field `include_lint_checks`, which determines whether lints should be emitted or not, but this field is currently not obeyed at one point, leading to a warning being emitted more than once. I have fixed this behavior here.
2021-07-09 12:51:02 +00:00
bors
ee86f96ba1
Auto merge of #85828 - scottmcm:raw-eq, r=oli-obk
...
Stop generating `alloca`s & `memcmp` for simple short array equality
Example:
```rust
pub fn demo(x: [u16; 6], y: [u16; 6]) -> bool { x == y }
```
Before:
```llvm
define zeroext i1 `@_ZN10playground4demo17h48537f7eac23948fE(i96` %0, i96 %1) unnamed_addr #0 {
start:
%y = alloca [6 x i16], align 8
%x = alloca [6 x i16], align 8
%.0..sroa_cast = bitcast [6 x i16]* %x to i96*
store i96 %0, i96* %.0..sroa_cast, align 8
%.0..sroa_cast3 = bitcast [6 x i16]* %y to i96*
store i96 %1, i96* %.0..sroa_cast3, align 8
%_11.i.i.i = bitcast [6 x i16]* %x to i8*
%_14.i.i.i = bitcast [6 x i16]* %y to i8*
%bcmp.i.i.i = call i32 `@bcmp(i8*` nonnull dereferenceable(12) %_11.i.i.i, i8* nonnull dereferenceable(12) %_14.i.i.i, i64 12) #2 , !alias.scope !2
%2 = icmp eq i32 %bcmp.i.i.i, 0
ret i1 %2
}
```
```x86
playground::demo: # `@playground::demo`
sub rsp, 32
mov qword ptr [rsp], rdi
mov dword ptr [rsp + 8], esi
mov qword ptr [rsp + 16], rdx
mov dword ptr [rsp + 24], ecx
xor rdi, rdx
xor esi, ecx
or rsi, rdi
sete al
add rsp, 32
ret
```
After:
```llvm
define zeroext i1 `@_ZN4mini4demo17h7a8994aaa314c981E(i96` %0, i96 %1) unnamed_addr #0 {
start:
%2 = icmp eq i96 %0, %1
ret i1 %2
}
```
```x86
_ZN4mini4demo17h7a8994aaa314c981E:
xor rcx, r8
xor edx, r9d
or rdx, rcx
sete al
ret
```
2021-07-09 09:16:27 +00:00
Aman Arora
28921b4213
Add more tests
2021-07-09 04:34:11 -04:00
Aman Arora
6195d6dcac
Move optimization to the central processing function
2021-07-09 03:55:03 -04:00
Aman Arora
c55db232d8
Cleanup and code comments
2021-07-09 03:32:04 -04:00
Aman Arora
c4f28ca611
Rewrite closure capture analysis
2021-07-09 03:31:55 -04:00
Scott McMurray
099a357e5c
Update the comment on lower_expr_try
...
I'd updated the ones inside the method, but not its doc comment.
2021-07-09 00:13:44 -07:00
bors
95fb131521
Auto merge of #86904 - m-ou-se:prelude-collision-check-trait, r=nikomatsakis
...
Check FromIterator trait impl in prelude collision check.
Fixes #86902 .
2021-07-09 06:35:42 +00:00
inquisitivecrystal
b49936c0bf
Improve handing of missing_docs
for macros
2021-07-08 22:55:04 -07:00
inquisitivecrystal
88fd46e129
Add regression test
2021-07-08 22:54:05 -07:00
inquisitivecrystal
2bcbb25cb5
Remove missing_docs
lint on private 2.0 macros
2021-07-08 22:54:01 -07:00
bors
b090cd1ea6
Auto merge of #86869 - sexxi-goose:rfc2229-migration-capture-kind, r=nikomatsakis
...
Account for capture kind in auto traits migration
Modifies the current auto traits migration for RFC2229 so it takes into account capture kind
Closes https://github.com/rust-lang/project-rfc-2229/issues/51
r? `@nikomatsakis`
2021-07-09 03:54:41 +00:00
bors
fdfe819580
Auto merge of #86701 - sexxi-goose:optimization, r=nikomatsakis
...
2229: Reduce the size of closures with `capture_disjoint_fields`
One key observation while going over the closure size profile of rustc
was that we are disjointly capturing one or more fields starting at an
immutable reference.
Disjoint capture over immutable reference doesn't add too much value
because the fields can either be borrowed immutably or copied.
One possible edge case of the optimization is when a fields of a struct
have a longer lifetime than the structure, therefore we can't completely
get rid of all the accesses on top of sharef refs, only the rightmost
one. Here is a possible example:
```rust
struct MyStruct<'a> {
a: &'static A,
b: B,
c: C<'a>,
}
fn foo<'a, 'b>(m: &'a MyStruct<'b>) -> impl FnMut() + 'static {
let c = || drop(&*m.a.field_of_a);
// Here we really do want to capture `*m.a` because that outlives `'static`
// If we capture `m`, then the closure no longer outlives `'static'
// it is constrained to `'a`
}
```
r? `@nikomatsakis`
2021-07-09 01:13:49 +00:00
Scott McMurray
d0644947a3
Bless a UI test
2021-07-08 15:16:37 -07:00
Scott McMurray
07fb5ee78f
Adjust the threshold to look at the ABI, not just the size
2021-07-08 14:55:59 -07:00
Scott McMurray
6444f24a29
Use cranelift's Type::int
instead of doing the match myself
...
<https://docs.rs/cranelift-codegen/0.74.0/cranelift_codegen/ir/types/struct.Type.html#method.int >
2021-07-08 14:55:58 -07:00
Scott McMurray
3d2869c6ff
PR Feedback: Don't put SSA-only types in CValue
s
2021-07-08 14:55:58 -07:00
Scott McMurray
039a3bafec
Add another codegen test, array_eq_zero
...
Showing that this avoids an alloca and private constant.
2021-07-08 14:55:58 -07:00
Scott McMurray
12163534a9
Implement the raw_eq intrinsic in codegen_cranelift
2021-07-08 14:55:57 -07:00
Scott McMurray
b63b2f1e42
PR feedback
...
- Add `:Sized` assertion in interpreter impl
- Use `Scalar::from_bool` instead of `ScalarInt: From<bool>`
- Remove unneeded comparison in intrinsic typeck
- Make this UB to call with undef, not just return undef in that case
2021-07-08 14:55:57 -07:00
Scott McMurray
2456495a26
Stop generating alloca
s+memcmp
for simple array equality
2021-07-08 14:55:54 -07:00
Scott McMurray
d05eafae2f
Move the PartialEq
and Eq
impls for arrays to a separate file
2021-07-08 14:53:37 -07:00
Tomasz Miąsko
1719d45013
Inline implementation of lookup_line
...
to simplify the implementation and avoid unnecessary
conversions from `Option<usize>` to `isize` and back.
2021-07-08 23:30:53 +02:00
Roxane
7c15fc16f4
Consider capture kind for auto traits migration
2021-07-08 17:07:53 -04:00
Roxane
f5e8a7d398
Add new test case
2021-07-08 17:06:40 -04:00
lcnr
4a53b11518
only check cg defaults wf once instantiated
2021-07-08 22:57:10 +02:00
bors
8b87e85394
Auto merge of #86930 - tspiteri:int_log10, r=kennytm
...
special case for integer log10
Now that #80918 has been merged, this PR provides a faster version of `log10`.
The PR also adds some tests for values close to all powers of 10.
2021-07-08 20:19:00 +00:00
bors
aa65b08b1d
Auto merge of #86982 - GuillaumeGomez:rollup-7sbye3c, r=GuillaumeGomez
...
Rollup of 8 pull requests
Successful merges:
- #84961 (Rework SESSION_GLOBALS API)
- #86726 (Use diagnostic items instead of lang items for rfc2229 migrations)
- #86789 (Update BTreeSet::drain_filter documentation)
- #86838 (Checking that function is const if marked with rustc_const_unstable)
- #86903 (Fix small headers display)
- #86913 (Document rustdoc with `--document-private-items`)
- #86957 (Update .mailmap file)
- #86971 (mailmap: Add alternative addresses for myself)
Failed merges:
- #86869 (Account for capture kind in auto traits migration)
r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-08 17:51:10 +00:00
Niko Matsakis
2083207536
Update src/test/ui/rust-2021/future-prelude-collision-unneeded.rs
2021-07-08 12:31:56 -04:00