Commit graph

151619 commits

Author SHA1 Message Date
Nikita Popov
4560efe46c Pass type when creating load
This makes load generation compatible with opaque pointers.

The generation of nontemporal copies still accesses the pointer
element type, as fixing this requires more movement.
2021-07-09 22:14:44 +02:00
Fabian Wolff
a7bfd35966 Enhance well-formedness checks for #[repr(...)] attributes 2021-07-09 22:03:48 +02:00
Nikita Popov
33e9a6b565 Pass type when creating atomic load
Instead of determining it from the pointer type, explicitly pass
the type to load.
2021-07-09 22:00:19 +02:00
Smitty
b86ed4a425 panic when trying to destructure union as enum 2021-07-09 15:22:12 -04:00
Aman Arora
5055569008 Apply suggestions from code review
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-07-09 15:12:24 -04:00
Richard Cobbe
a867dd4c7e Add support for raw-dylib with stdcall, fastcall functions on i686-pc-windows-msvc. 2021-07-09 12:04:54 -07:00
bors
3eff244fc7 Auto merge of #85832 - kornelski:raw_arg, r=yaahc
Unescaped command-line arguments for Windows

Some Windows commands, expecially `cmd.exe /c`, have unusual quoting requirements which are incompatible with default rules assumed for `.arg()`.

This adds `.unquoted_arg()` to `Command` via Windows `CommandExt` trait.

Fixes #29494
2021-07-09 18:15:20 +00:00
Smitty
df3e003378 Don't stub out part of test 2021-07-09 13:51:30 -04:00
Smitty
74d0d74dae Check for union field accesses in THIR unsafeck 2021-07-09 13:51:28 -04:00
Eric Huss
f698cacc33 Fix rust-analyzer install when not available. 2021-07-09 10:38:28 -07:00
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
Cameron Steffen
dce274024e clippy: allow default_hash_types on bootstrap 2021-07-09 09:10:45 -05:00
Cameron Steffen
17ebba70d0 clippy: allow default_hash_types on bootstrap 2021-07-09 09:10:45 -05:00
Cameron Steffen
d6b0d0bf97 Fix default_hash_types to use resolved path 2021-07-09 09:10:45 -05:00
bors
cb16543b3a Auto merge of #7449 - flip1995:remove-lints_enabled, r=camsteffen
Remove lints_enabled

r? `@camsteffen`

cc https://github.com/rust-lang/rust-clippy/pull/7448#issuecomment-876497862

I haven't added a variant with `last_node_with_lint_attrs` yet, since I didn't see a usecase for this. Also this field is not documented, so I'm wondering how it behaves with command line lints and so on.

changelog: none
2021-07-09 14:00:52 +00: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
flip1995
d2c8f50bbe
Rename is_allowed -> is_lint_allowed 2021-07-09 15:06:12 +02:00
flip1995
5add651223
Remove lints_enabled function
This function was redundant with the is_allowed function. Now is_allowed
is used everywhere lints_enabled was used before.
2021-07-09 15:00:24 +02: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
Yoshitomo Nakanishi
04aa3f7e9b default_numeric_fallback: Add more tests for floating literal 2021-07-09 18:24:23 +09: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
8da39e66ac Auto merge of #7448 - flip1995:run_lints-rename, r=llogiq
Rename run_lints -> lints_enabled

Just a quick rename of a utilities function. `run_lints` kinda suggested that the lints were run by this function. But the only thing this function does is to check if the lints are enabled in the context of the `hir_id`

changelog: none
2021-07-09 06:39:56 +00: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