Commit graph

151619 commits

Author SHA1 Message Date
Zach Lute
5302539c98 Change all 'optflag' arguments to 'optflagmulti'
Because specifying these flags multiple times will never be discernibly different in functionality from specifying them a single time, there is no reason to fail and report an error to the user.
2021-07-10 14:20:32 -07:00
Vadim Petrochenkov
de897f5205 rustc_expand: Remove redundant field from proc macro expander structures
This information is already available from `ExpnData`
2021-07-10 23:22:27 +03:00
Michael Howell
f6e3644c11 cleanup(rustdoc): remove unused function getObjectNameById
This function was used in an earlier version, when idx's were used
to serialize function inputs and outputs. That's not done any more,
so removed the JS-side support for it.
2021-07-10 13:16:16 -07:00
Vadim Petrochenkov
075a28996c rustc_span: Revert addition of proc_macro field to ExpnKind::Macro
The flag has a vague meaning and is used for a single diagnostic change that is low benefit and appears only under `-Z macro_backtrace`.
2021-07-10 23:03:35 +03:00
Vadim Petrochenkov
28f4dba438 rustc_span: Revert addition of proc_macro field to ExpnKind::Macro
The flag has a vague meaning and is used for a single diagnostic change that is low benefit and appears only under `-Z macro_backtrace`.
2021-07-10 23:03:35 +03:00
Aris Merchant
5999a5fbdc Make tests pass on old macos
On old macos systems, `fs::hard_link()` will follow symlinks.
This changes the test `symlink_hard_link` to exit early on
these systems, so that tests can pass.
2021-07-10 12:59:25 -07:00
Aris Merchant
fd0cb0cdc2 Change weak! and linkat! to macros 2.0
`weak!` is needed in a test in another module. With macros
1.0, importing `weak!` would require reordering module
declarations in `std/src/lib.rs`, which is a bit too
evil.
2021-07-10 12:55:09 -07:00
bors
432e145bd5 Auto merge of #86873 - nikic:opaque-ptrs, r=nagisa
Improve opaque pointers support

Opaque pointers are coming, and rustc is not ready.

This adds partial support by passing an explicit load type to LLVM. Two issues I've encountered:
 * The necessary type was not available at the point where non-temporal copies were generated. I've pushed the code for that upwards out of the memcpy implementation and moved the position of a cast to make do with the types we have available. (I'm not sure that cast is needed at all, but have retained it in the interest of conservativeness.)
 * The `PlaceRef::project_deref()` function used during debuginfo generation seems to be buggy in some way -- though I haven't figured out specifically what it does wrong. Replacing it with `load_operand().deref()` did the trick, but I don't really know what I'm doing here.
2021-07-10 19:01:41 +00:00
Manuel Drehwald
f84f377018
Update reference.md
Apparently the Rust reference has moved again, so the link gave a 404 error.
2021-07-10 19:51:36 +02:00
bors
a31431fce7 Auto merge of #87029 - JohnTitor:rollup-0yapv7z, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #87006 (Revert the revert of renaming traits::VTable to ImplSource)
 - #87011 (avoid reentrant lock acquire when ThreadIds run out)
 - #87013 (Fix several ICEs related to malformed `#[repr(...)]` attributes)
 - #87020 (remove const_raw_ptr_to_usize_cast feature)
 - #87028 (Fix type: `'satic` -> `'static`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-07-10 16:41:26 +00:00
Yuki Okushi
36b142f5c1
Rollup merge of #87028 - aDotInTheVoid:patch-1, r=petrochenkov
Fix type: `'satic` -> `'static`

Pointed out on discord: https://discord.com/channels/273534239310479360/490356824420122645/863434443170250793

~~The fact that this compiles is probably a bug.~~ Nope it's `#![feature(in_band_lifetimes)]` (Thanks to [floppy](https://discord.com/channels/273534239310479360/490356824420122645/863437381671059486)

~~[The docs](https://doc.rust-lang.org/stable/nightly-rustc/rustc_mir/transform/inline/struct.Inliner.html#method.check_codegen_attributes) seem to indicate rust thinks this function is generic over the lifetime `'satic`~~ This is because of `in_band_lifetimes`
2021-07-11 01:15:43 +09:00
Yuki Okushi
ad2a0fc93f
Rollup merge of #87020 - RalfJung:const_raw_ptr_to_usize_cast, r=oli-obk
remove const_raw_ptr_to_usize_cast feature

This feature currently has the strange status of "const-only `unsafe`", which was an experiment that we no longer think is a good idea. We need to find better ways to enable things like "messing with the low bits of a pointer" during CTFE.

r? `@oli-obk`
2021-07-11 01:15:42 +09:00
Yuki Okushi
945458d472
Rollup merge of #87013 - FabianWolff:issue-83921, r=estebank
Fix several ICEs related to malformed `#[repr(...)]` attributes

This PR fixes #83921. #83921 actually contains two related but distinct issues (one of them incorrectly reported as a duplicate in https://github.com/rust-lang/rust/issues/83921#issuecomment-814640734):

In the first, a call to `delay_span_bug` leads to an ICE when compiling with `-Zunpretty=everybody_loops` (and some other pretty-printing modes), because the corresponding error is emitted in a later pass, which does not run when only pretty-printing is requested.

The second issue is about parsing `#[repr(...)]` attributes. Currently, all of the following cause an ICE when applied to a struct/enum:
```rust
#[repr(packed())]
#[repr(align)]
#[repr(align(2, 4))]
#[repr(align())]
#[repr(i8())]
#[repr(u32(42))]
#[repr(i64 = 2)]
```
I have fixed this by expanding the well-formedness checks in `find_repr_attrs()`.
2021-07-11 01:15:41 +09:00
Yuki Okushi
0ca5fc2e33
Rollup merge of #87011 - RalfJung:thread-id-supply-shortage, r=nagisa
avoid reentrant lock acquire when ThreadIds run out

Discovered by `@bjorn3`
2021-07-11 01:15:40 +09:00
Yuki Okushi
632f84f4cb
Rollup merge of #87006 - ptrojahn:implsource_vtable, r=jonas-schievink
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-11 01:15:39 +09:00
Nikita Popov
54110fed41 Use nproc instead of hardcoded 10 for build parallelism 2021-07-10 18:15:09 +02:00
Nikita Popov
7f9467c13d Update binutils version
This is needed to handle R_X86_64_REX_GOTPCRELX relocations.
2021-07-10 18:12:01 +02:00
Amanieu d'Antras
d2a1d048d9 Add AArch64 z* registers as aliases for v* registers 2021-07-10 17:29:07 +02:00
Amanieu d'Antras
e1c3f5e017 Add clobber-only register classes for asm!
These are needed to properly express a function call ABI using a clobber
list, even though we don't support passing actual values into/out of
these registers.
2021-07-10 17:29:00 +02:00
Nixon Enraght-Moony
293fa8f39a Fix typo: satic -> static 2021-07-10 16:20:53 +01:00
Fabian Wolff
b0888614f1 Implement Mutation- and BorrowOfLayoutConstrainedField in thir-unsafeck 2021-07-10 16:33:00 +02:00
bors
3982eb35ca Auto merge of #81360 - Aaron1011:trait-caller-loc, r=nagisa
Support forwarding caller location through trait object method call

Since PR #69251, the `#[track_caller]` attribute has been supported on
traits. However, it only has an effect on direct (monomorphized) method
calls. Calling a `#[track_caller]` method on a trait object will *not*
propagate caller location information - instead, `Location::caller()` will
return the location of the method definition.

This PR forwards caller location information when `#[track_caller]` is
present on the method definition in the trait. This is possible because
`#[track_caller]` in this position is 'inherited' by any impls of that
trait, so all implementations will have the same ABI.

This PR does *not* change the behavior in the case where
`#[track_caller]` is present only on the impl of a trait.
While all implementations of the method might have an explicit
`#[track_caller]`, we cannot know this at codegen time, since other
crates may have impls of the trait. Therefore, we keep the current
behavior of not forwarding the caller location, ensuring that all
implementations of the trait will have the correct ABI.

See the modified test for examples of how this works
2021-07-10 14:11:39 +00:00
Deadbeef
7c9e214bc3
Update DepNode's size 2021-07-10 21:46:31 +08:00
Guillaume Gomez
8ccee61d38 Fix display for external trait implementors 2021-07-10 14:58:36 +02:00
Deadbeef
88b29f5fb2
Test for misusing attribute 2021-07-10 20:54:50 +08:00
Deadbeef
a79e08ca2a
Update tests 2021-07-10 20:54:50 +08:00
Deadbeef
5e695bbba1
Update CTFE to allow fns marked with the attr 2021-07-10 20:54:50 +08:00
Deadbeef
554fad7bda
Permit calls to default const fns of impl const 2021-07-10 20:54:50 +08:00
Deadbeef
27e863b3df
functions marked with attr are not const 2021-07-10 20:54:49 +08:00
Deadbeef
89d190f090
Add impl_constness query 2021-07-10 20:54:49 +08:00
Deadbeef
032cbe4cce
Check if the attribute is applied correctly 2021-07-10 20:54:48 +08:00
Deadbeef
56d79adf3b
Skip check for calling functions in same trait 2021-07-10 20:54:48 +08:00
Deadbeef
d8d4cc3b98
Treat trait fns marked with the attr as const 2021-07-10 20:54:48 +08:00
Deadbeef
3660a4e972
Applied suggestions 2021-07-10 20:54:47 +08:00
Deadbeef
2db927d8d8
Add #[default_method_body_is_const] 2021-07-10 20:54:44 +08:00
Ralf Jung
dbc2b55baf rename variable 2021-07-10 14:14:09 +02:00
Ralf Jung
f5094aa5d6 remove duplicate test 2021-07-10 13:48:53 +02:00
Ralf Jung
fb010c9004 bless missing tests 2021-07-10 13:03:35 +02:00
Nikita Popov
f29450a05d Use clang 12.0.1 on dist-x86_64/i686-linux
The LLD + ThinLTO __morestack bug has been fixed in 12.0.1, so
we can now update our clang version. This also means that we no
longer need to build Python 2.
2021-07-10 12:40:40 +02:00
Ralf Jung
5f0dd6db94 remove const_raw_ptr_to_usize_cast feature 2021-07-10 12:08:58 +02:00
Ralf Jung
2750d3ac6a avoid reentrant lock acquire when ThreadIds run out 2021-07-10 11:54:38 +02:00
Aris Merchant
5022c0638d Update docs for fs::hard_link 2021-07-09 23:24:36 -07:00
Aris Merchant
dc38d87505 Fix linker error
This makes `fs::hard_link` use weak! for some platforms,
thereby preventing a linker error.
2021-07-09 23:24:36 -07:00
bors
a84d1b21ae Auto merge of #86987 - lcnr:const-default-eval-bound, r=oli-obk
only check cg defaults wf once instantiated

the previous fixmes here didn't make too much sense as I didn't yet fully understand the code further below.
That code only runs if the predicates using our generic param default are fully concrete after substituting our default, which never happens if our default is generic.

r? `@oli-obk` `@BoxyUwU`
2021-07-10 06:01:04 +00:00
bors
8eae2eb1d3 Auto merge of #86968 - inquisitivecrystal:missing-docs-v2, r=oli-obk
Remove `missing_docs` lint on private 2.0 macros

798baebde1/compiler/rustc_lint/src/builtin.rs (L573-L584)

This code is the source of #57569. The problem is subtle, so let me point it out. This code makes the mistake of assuming that all of the macros in `krate.exported_macros` are exported.

...Yeah. For some historical reason, all `macro` macros are marked as exported, regardless of whether they actually are, which is dreadfully confusing. It would be more accurate to say that `exported_macros` currently contains only macros that have paths.

This PR renames `exported_macros` to `importable_macros`, since these macros can be imported with `use` while others cannot. It also fixes the code above to no longer lint on private `macro` macros, since the `missing_docs` lint should only appear on exported items.

Fixes #57569.
2021-07-10 03:32:42 +00:00
bors
8d9d4c87d6 Auto merge of #86419 - ricobbe:raw-dylib-stdcall, r=petrochenkov
Add support for raw-dylib with stdcall, fastcall functions

Next stage of work for #58713: allow `extern "stdcall"` and `extern "fastcall"` with `#[link(kind = "raw-dylib")]`.

I've deliberately omitted support for vectorcall, as that doesn't currently work, and I wanted to get this out for review.  (I haven't really investigated the vectorcall failure much yet, but at first (very cursory) glance it appears that the problem is elsewhere.)
2021-07-09 23:24:21 +00:00
Wesley Wiser
d1852e1054 Respond to review feedback 2021-07-09 18:29:08 -04:00
bors
240ff4c4a0 Auto merge of #85263 - Smittyvb:thir-unsafeck-union-field, r=oli-obk
Check for union field accesses in THIR unsafeck

see also #85259, #83129, https://github.com/rust-lang/project-thir-unsafeck/issues/7

r? `@LeSeulArtichaut`
2021-07-09 20:56:07 +00:00
Nikita Popov
2ce1addeba Don't access pointer element type for nontemporal store
Simply shift the bitcast from the store to the load, so that
we can use the destination type. I'm not sure the bitcast is
really necessary, but keeping it for now.
2021-07-09 22:15:05 +02:00
Nikita Popov
208173f8e9 Fix project_deref() implementation
I'm not really sure what is wrong here, but I was getting load
type mismatches in the debuginfo code (which is the only place
using this function).

Replacing the project_deref() implementation with a generic
load_operand + deref did the trick.
2021-07-09 22:14:44 +02:00