Commit graph

153541 commits

Author SHA1 Message Date
Mara Bos
5dea5d7549 Say what things are, instead of what they are not. 2021-08-23 16:57:58 +02:00
Mara Bos
d834d2a742 Silence confusing 'unused import' warnings. 2021-08-23 16:57:58 +02:00
Mara Bos
ce95a57a72 Update tests. 2021-08-23 16:43:54 +02:00
Mara Bos
11c879d209 Add tests for macro-not-found diagnostics. 2021-08-23 16:43:54 +02:00
Mara Bos
7977cb43b0 Look for macro names in all namespaces for diagnostics. 2021-08-23 16:43:54 +02:00
Mara Bos
9051c056ed Add test for macro-not-found-but-name-imported-here note. 2021-08-23 16:43:54 +02:00
Mara Bos
fed6131c41 Add note to 'macro not found' to point to identically-named imports. 2021-08-23 16:43:54 +02:00
bors
52c881ff52 Auto merge of #87661 - FabianWolff:issue-87461, r=estebank
Improve error reporting for closure return type mismatches

Fixes #87461.
2021-08-23 14:41:14 +00:00
Esteban Kuber
955e913612 review comments 2021-08-23 14:31:48 +00:00
asquared31415
385a233f18 Detect incorrect number of lang item generics 2021-08-23 10:15:25 -04:00
Andreas Liljeqvist
d92810646e Simplify zero check 2021-08-23 15:52:47 +02:00
Andreas Liljeqvist
32d7e5b723 add with_start and with_end 2021-08-23 15:44:56 +02:00
Andreas Liljeqvist
d230b92ba7 implement debug in similar way to RangeInclusive 2021-08-23 15:05:40 +02:00
Léo Lanteri Thauvin
6a2b448f2a Do not mark -Z thir-unsafeck as unsound anymore 2021-08-23 14:52:42 +02:00
Andreas Liljeqvist
e8e6d9bd86 Rename to WrappingRange 2021-08-23 14:24:34 +02:00
Guillaume Gomez
b7fe005eef Greatly improve limitation handling on parallel rustdoc GUI test run 2021-08-23 14:23:59 +02:00
Andreas Liljeqvist
70433955f4 implement contains_zero method 2021-08-23 14:20:38 +02:00
Andreas Liljeqvist
d50abd0249 Use ref 2021-08-23 14:18:48 +02:00
Esteban Kuber
31d07edc94 remove unnecessary info!() logging 2021-08-23 11:58:19 +00:00
Esteban Kuber
5626346ac9 Fixes to span locations 2021-08-23 11:58:19 +00:00
Esteban Kuber
a29a624f86 wip 2021-08-23 11:58:19 +00:00
Esteban Kuber
75fd1bf1e6 Account for tabs when highlighting multiline code suggestions 2021-08-23 11:58:18 +00:00
Andreas Liljeqvist
225a4bf922 Removed fixed fixme 2021-08-23 13:56:28 +02:00
bors
5998c2e9ad Auto merge of #88249 - lnicola:rust-analyzer-2021-08-23, r=lnicola
⬆️ rust-analyzer
2021-08-23 10:46:31 +00:00
Andreas Liljeqvist
c3fdefe142 remove commented code 2021-08-23 11:21:27 +02:00
bors
33fdb797f5 Auto merge of #88220 - sunfishcode:sunfishcode/unix-listener-io-safety, r=joshtriplett
Implement `AsFd` etc. for `UnixListener`.

Implement `AsFd`, `From<OwnedFd>`, and `Into<OwnedFd>` for
`UnixListener`. This is a follow-up to #87329.

r? `@joshtriplett`
2021-08-23 07:36:49 +00:00
Laurențiu Nicola
0a3a457d54 ⬆️ rust-analyzer 2021-08-23 09:01:38 +03:00
bors
1c0485610e Auto merge of #87598 - ccqpein:master, r=yaahc
Add doctests for HashMap's into_values and into_keys methods

Fixes #87591
2021-08-23 05:06:29 +00:00
Jack O'Connor
9c44d80c83 add Cell::as_array_of_cells, similar to Cell::as_slice_of_cells
Previously, converting `&mut [T; N]` to `&[Cell<T>; N]` looks like this:

    let array = &mut [1, 2, 3];
    let cells: &[Cell<i32>; 3] = Cell::from_mut(&mut array[..])
        .as_slice_of_cells()
        .try_into()
        .unwrap();

With this new helper method, it looks like this:

    let array = &mut [1, 2, 3];
    let cells: &[Cell<i32>; 3] = Cell::from_mut(array).as_array_of_cells();
2021-08-23 01:00:34 -04:00
bors
49967357c5 Auto merge of #88210 - spastorino:diff-lifetimes-def-use-test, r=oli-obk
Test TAITs different lifetimes in defining uses fail

r? `@oli-obk`

Related to #86727
2021-08-23 02:25:36 +00:00
Dan Gohman
a0ce5f25fa Remove redundant conversions. 2021-08-22 16:51:30 -07:00
bors
558553272d Auto merge of #88200 - pcwalton:no-dso-local-on-mach-o, r=nagisa
Stop emitting the `dso_local` LLVM attribute for external symbols under the static relocation model on macOS.

This matches Clang's behavior:

973cb2c326/clang/lib/CodeGen/CodeGenModule.cpp (L1038-L1040)

Even if `dso_local` were properly supported in this way on macOS, it seems
incorrect to add this annotation as liberally as we did. The `dso_local`
annotation is for symbols that ultimately end up in the same linkage unit, but
we were adding this annotation even for `static` values inside `extern` blocks
marked with `#[link(type="framework")]`, which should be considered dynamically
linked.  Note that Clang likewise avoids emitting `dso_local` for `dllimport`
symbols:

973cb2c326/clang/lib/CodeGen/CodeGenModule.cpp (L1005-L1007)

This issue caused breakage in the `ring` crate, which links to a symbol defined
in `Security.framework` that ultimately resolves to address `0x0`:

b94d61e044/src/rand.rs (L390)

For this symbol, the use of `dso_local` causes LLVM to emit a relocation of
type `X86_64_RELOC_SIGNED`, which is a 32-bit signed PC-relative offset. If the
binary is large enough, `0x0` might be out of range, and the link will fail.
Avoiding `dso_local` causes LLVM to use the GOT instead, emitting a relocation
of type `X86_64_RELOC_GOT_LOAD`, which will properly handle the large offset
and cause the link to succeed.

As a side note, the static relocation model is effectively deprecated for
security reasons on macOS, as it prohibits PIE. It's also completely
unsupported on Apple Silicon, so I don't think it's worth going to the effort
of properly supporting this model on that platform.
2021-08-22 23:44:48 +00:00
Andreas Liljeqvist
1b4064f04a fix 32bit err 2021-08-22 22:45:51 +02:00
bors
af140757b4 Auto merge of #88240 - GuillaumeGomez:rollup-wdom91m, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #86747 (Improve wording of the `drop_bounds` lint)
 - #87166 (Show discriminant before overflow in diagnostic for duplicate values.)
 - #88077 (Generate an iOS LLVM target with a specific version)
 - #88164 (PassWrapper: adapt for LLVM 14 changes)
 - #88211 (cleanup: `Span::new` -> `Span::with_lo`)
 - #88229 (Suggest importing the right kind of macro.)
 - #88238 (Stop tracking namespace in used_imports.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-08-22 20:23:37 +00:00
Andreas Liljeqvist
5a501f73ff Use custom wrap-around type instead of Range 2021-08-22 21:46:03 +02:00
Guillaume Gomez
3e8e8d2dad
Rollup merge of #88238 - m-ou-se:used-imports-no-track-namespace, r=estebank
Stop tracking namespace in used_imports.

This changes `used_imports` from a `FxHashSet<(NodeId, Namespace)>` to a `FxHashSet<NodeId>`, as the Namespace information isn't used.

The only point that uses it did three lookups, `|=`'ing them together.

r? `@estebank`
2021-08-22 20:52:56 +02:00
Guillaume Gomez
518b27b57a
Rollup merge of #88229 - m-ou-se:macro-suggest-right-kind, r=estebank
Suggest importing the right kind of macro.

Fixes #88228.

r? `@estebank`
2021-08-22 20:52:55 +02:00
Guillaume Gomez
167ae26a88
Rollup merge of #88211 - petrochenkov:withhilo, r=jyn514
cleanup: `Span::new` -> `Span::with_lo`

Extracted from https://github.com/rust-lang/rust/pull/84373 as suggested in https://github.com/rust-lang/rust/pull/84373#issuecomment-857773867.
It turned out less useful then I expected, but anyway.
r? `@cjgillot`
`@bors` rollup
2021-08-22 20:52:54 +02:00
Guillaume Gomez
2638d27ba5
Rollup merge of #88164 - durin42:llvm-14-san-opts, r=nikic
PassWrapper: adapt for LLVM 14 changes

These API changes appear to have all taken place in
https://reviews.llvm.org/D105007, which moved HWAddressSanitizerPass and
AddressSanitizerPass to only accept their options type as a ctor
argument instead of the sequence of bools etc. This required a couple of
parameter additions, which I made match the default prior to the
mentioned upstream LLVM change.

This patch restores rustc to building (though not quite passing all
tests, I've mailed other patches for those issues) against LLVM HEAD.
2021-08-22 20:52:53 +02:00
Guillaume Gomez
c6da5b08e0
Rollup merge of #88077 - kit-981:feature/fix-minimum-os-version-in-header, r=petrochenkov
Generate an iOS LLVM target with a specific version

This commit adds the `LC_VERSION_MIN_IPHONEOS` load command to the Mach-O header generated for `aarch64-apple-ios` binaries. The operating system will look for this load command to determine the minimum supported operating system version and will not allow the binary to run if it's absent. This logic already exists for the simulator toolchain.

I've been using `otool` from a [cctools](https://github.com/tpoechtrager/cctools-port) toolchain to parse the header and validate that this change adds the required load command.

This change appears to be enough to build Rust binaries that can run on a jailbroken iPhone.
2021-08-22 20:52:52 +02:00
Guillaume Gomez
3b1e7b1fc9
Rollup merge of #87166 - de-vri-es:show-discriminant-before-overflow, r=jackh726
Show discriminant before overflow in diagnostic for duplicate values.

This PR adds the value before overflow for explicit discriminant values in the error for duplicate discriminant values.
I found it rather confusing to see only the overflowed value.

It only does this for literals, since overflows in const evaluated arithmetic are already a hard error.

This is my first PR to the compiler, so please let me know if the implementation can be improved :)

Before:
![image](https://user-images.githubusercontent.com/786213/125850097-bf5fb7e0-d800-4386-a738-c30f41822964.png)

After:
![image](https://user-images.githubusercontent.com/786213/125850120-e2bb765d-ad86-4888-a6cb-dec34fba3fea.png)
2021-08-22 20:52:51 +02:00
Guillaume Gomez
2627db6a3c
Rollup merge of #86747 - FabianWolff:issue-86653, r=GuillaumeGomez
Improve wording of the `drop_bounds` lint

This PR addresses #86653. The issue is sort of a false positive of the `drop_bounds` lint, but I would argue that the best solution for #86653 is simply a rewording of the warning message and lint description, because even if the lint is _technically_ wrong, it still forces the programmer to think about what they are doing, and they can always use `#[allow(drop_bounds)]` if they think that they really need the `Drop` bound.

There are two issues with the current warning message and lint description:
- First, it says that `Drop` bounds are "useless", which is technically incorrect because they actually do have the effect of allowing you e.g. to call methods that also have a `Drop` bound on their generic arguments for some reason. I have changed the wording to emphasize not that the bound is "useless", but that it is most likely not what was intended.
- Second, it claims that `std::mem::needs_drop` detects whether a type has a destructor. But I think this is also technically wrong: The `Drop` bound says whether the type has a destructor or not, whereas `std::mem::needs_drop` also takes nested types with destructors into account, even if the top-level type does not itself have one (although I'm not 100% sure about the exact terminology here, i.e. whether the "drop glue" of the top-level type counts as a destructor or not).

cc `@jonhoo,` does this solve the issue for you?

r? `@GuillaumeGomez`
2021-08-22 20:52:50 +02:00
bors
91f9806208 Auto merge of #88166 - BoxyUwU:const-equate-canon, r=lcnr
canonicalize consts before calling try_unify_abstract_consts query

Fixes #88022
Fixes #86953
Fixes #77708
Fixes #82034
Fixes #85031

these ICEs were all caused by calling the `try_unify_abstract_consts` query with inference vars in substs

r? `@lcnr`
2021-08-22 18:00:22 +00:00
Frank Steffahn
2f9ddf3bc7 Fix typos “an”→“a” and a few different ones that appeared in the same search 2021-08-22 18:15:49 +02:00
Frank Steffahn
2396fad095 Fix more “a”/“an” typos 2021-08-22 17:27:18 +02:00
Mara Bos
abab99e02b Stop tracking namespce in used_imports.
The information was tracked, but unused.
2021-08-22 16:50:59 +02:00
Santiago Pastorino
10b3325d26
Test TAITs different lifetimes in defining uses fail 2021-08-22 11:42:53 -03:00
Frank Steffahn
b08b92eb42 Revert a change of “an --extern” (can be read with “dash dash”) 2021-08-22 16:37:47 +02:00
Frank Steffahn
be9d2699ca Fix more “a”/“an” typos 2021-08-22 16:35:29 +02:00
Frank Steffahn
bf88b113ea Fix typos “a”→“an” 2021-08-22 15:35:11 +02:00