Commit graph

164115 commits

Author SHA1 Message Date
Eric Holk 7723506d13 Stabilize const_fn_fn_ptr_basics and const_fn_trait_bound 2022-03-07 08:47:15 -08:00
bors d137c3a7bd Auto merge of #94695 - matthiaskrgr:rollup-5pi3acz, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #94553 (add tests for #94502)
 - #94614 (Remove ordering traits from `rustc_span::hygiene::LocalExpnId`)
 - #94685 (interpret: move saturating_add/sub into (pub) helper method)
 - #94688 (Erase regions when checking for missing Copy predicates)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-07 13:02:31 +00:00
Matthias Krüger c0c452ba9b
Rollup merge of #94688 - compiler-errors:free-regions-in-copy-predicate-check, r=oli-obk
Erase regions when checking for missing Copy predicates

Fixes #94662
2022-03-07 11:35:58 +01:00
Matthias Krüger a795f0f536
Rollup merge of #94685 - RalfJung:saturating, r=oli-obk
interpret: move saturating_add/sub into (pub) helper method

I plan to use them for `simd_saturating_add/sub`.

The first commit just moves code, the 2nd simplifies it a bit with some helper methods that did not exist yet when the code was originally written.
2022-03-07 11:35:57 +01:00
Matthias Krüger 87df3f663d
Rollup merge of #94614 - pierwill:localexpnid-noord, r=lcnr
Remove ordering traits from `rustc_span::hygiene::LocalExpnId`

Part of work on #90317.

Also adds a negative impl block as a form of documentation and a roadblock to regression.
2022-03-07 11:35:56 +01:00
Matthias Krüger 2c98edaaa7
Rollup merge of #94553 - lcnr:add-tests, r=Dylan-DPC
add tests for #94502

cc #94552
2022-03-07 11:35:55 +01:00
bors 297273c45b Auto merge of #94692 - matthiaskrgr:rollup-64p7ya7, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #94636 (Check extra function arg exprs even if the fn is not C-variadic)
 - #94676 (Remove unnecessary `..` patterns)
 - #94681 (CTFE engine: expose misc_cast to Miri)
 - #94684 (Fix rustdoc for GATs with with anonymous bound regions)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-07 07:29:08 +00:00
lcnr dad81b65db add tests for #94502 2022-03-07 07:35:20 +01:00
Matthias Krüger a1119fd699
Rollup merge of #94684 - compiler-errors:gat-anon-late-bound, r=notriddle
Fix rustdoc for GATs with with anonymous bound regions

Just use the logic that already worked for cleaning trait refs.

Fixes #94683
2022-03-07 06:44:05 +01:00
Matthias Krüger f7eb3830df
Rollup merge of #94681 - RalfJung:miri-cast, r=oli-obk
CTFE engine: expose misc_cast to Miri

We need that to implement `simd_cast`/`simd_as` in Miri.

While at it, also change other code outside `cast.rs` to use `misc_cast` instead of lower-level methods.

r? `@oli-obk`
2022-03-07 06:44:04 +01:00
Matthias Krüger 02539e1612
Rollup merge of #94676 - TaKO8Ki:remove-unnecessary-pattens-for-ignoring-remaining-parts, r=Dylan-DPC
Remove unnecessary `..` patterns

This patch removes unnecessary `..` patterns.
2022-03-07 06:44:03 +01:00
Matthias Krüger 9c7ff1add7
Rollup merge of #94636 - compiler-errors:issue-94599, r=davidtwco
Check extra function arg exprs even if the fn is not C-variadic

We should still call check_expr on the args that exceed the formal input ty count, so that we have expr types to emit during writeback.

Not sure where this regressed, but it wasn't due to the same root cause as #94334 I think. I thought this might've regressed in #92360, but I think that is in stable, ad the test I provided (which minimizes #94599) passes on stable in playground. Maybe it regressed in #93118.

Anywho, fixes #94599.
2022-03-07 06:44:02 +01:00
bors 2631aeef82 Auto merge of #94272 - tavianator:readdir-reclen-for-real, r=cuviper
fs: Don't dereference a pointer to a too-small allocation

ptr::addr_of!((*ptr).field) still requires ptr to point to an
appropriate allocation for its type.  Since the pointer returned by
readdir() can be smaller than sizeof(struct dirent), we need to entirely
avoid dereferencing it as that type.

Link: https://github.com/rust-lang/miri/pull/1981#issuecomment-1048278492
Link: https://github.com/rust-lang/rust/pull/93459#discussion_r795089971
2022-03-07 04:48:23 +00:00
bors 3d1eaf4b62 Auto merge of #94638 - erikdesjardins:noextranull, r=nagisa
cleanup: remove unused ability to have LLVM null-terminate const strings

(and the copied function in rustc_codegen_gcc)

Noticed this while writing https://github.com/rust-lang/rust/pull/94450#issuecomment-1059687348.

r? `@nagisa`
2022-03-07 02:07:36 +00:00
Michael Goulet 5ddaa2d5e5 Erase regions when checking for missing Copy predicates 2022-03-06 17:21:39 -08:00
Ralf Jung ac844986d8 use singed_int_max/min helper methods 2022-03-06 19:11:31 -05:00
Ralf Jung 956659e5ce move saturating_add/sub into (pub) helper method 2022-03-06 19:09:22 -05:00
Michael Goulet 890a44f66b Fix rustdoc for GATs with with anonymous bound regions 2022-03-06 15:58:35 -08:00
bors 8876ca3dd4 Auto merge of #94597 - nnethercote:ConstAllocation, r=fee1-dead
Introduce `ConstAllocation`.

Currently some `Allocation`s are interned, some are not, and it's very
hard to tell at a use point which is which.

This commit introduces `ConstAllocation` for the known-interned ones,
which makes the division much clearer. `ConstAllocation::inner()` is
used to get the underlying `Allocation`.

In some places it's natural to use an `Allocation`, in some it's natural
to use a `ConstAllocation`, and in some places there's no clear choice.
I've tried to make things look as nice as possible, while generally
favouring `ConstAllocation`, which is the type that embodies more
information. This does require quite a few calls to `inner()`.

The commit also tweaks how `PartialOrd` works for `Interned`. The
previous code was too clever by half, building on `T: Ord` to make the
code shorter. That caused problems with deriving `PartialOrd` and `Ord`
for `ConstAllocation`, so I changed it to build on `T: PartialOrd`,
which is slightly more verbose but much more standard and avoided the
problems.

r? `@fee1-dead`
2022-03-06 22:37:54 +00:00
Nicholas Nethercote 4852291417 Introduce ConstAllocation.
Currently some `Allocation`s are interned, some are not, and it's very
hard to tell at a use point which is which.

This commit introduces `ConstAllocation` for the known-interned ones,
which makes the division much clearer. `ConstAllocation::inner()` is
used to get the underlying `Allocation`.

In some places it's natural to use an `Allocation`, in some it's natural
to use a `ConstAllocation`, and in some places there's no clear choice.
I've tried to make things look as nice as possible, while generally
favouring `ConstAllocation`, which is the type that embodies more
information. This does require quite a few calls to `inner()`.

The commit also tweaks how `PartialOrd` works for `Interned`. The
previous code was too clever by half, building on `T: Ord` to make the
code shorter. That caused problems with deriving `PartialOrd` and `Ord`
for `ConstAllocation`, so I changed it to build on `T: PartialOrd`,
which is slightly more verbose but much more standard and avoided the
problems.
2022-03-07 08:25:50 +11:00
bors 38a0b81b1c Auto merge of #94679 - matthiaskrgr:rollup-9vd7w6a, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #94659 (explain why shift with signed offset works the way it does)
 - #94671 (fix pin doc typo)
 - #94672 (Improved error message for failed bitcode load)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-06 20:21:35 +00:00
Ralf Jung d29d2307b9 CTFE engine: expose misc_cast to Miri 2022-03-06 14:01:01 -05:00
Matthias Krüger 0480a3254a
Rollup merge of #94672 - joedeandev:master, r=Dylan-DPC
Improved error message for failed bitcode load

"bc" is an unnecessary shorthand that obfuscates the compilation error
2022-03-06 19:08:39 +01:00
Matthias Krüger e8f38a03b5
Rollup merge of #94671 - csmoe:pin-typo, r=m-ou-se
fix pin doc typo

r? `@m-ou-se`
2022-03-06 19:08:38 +01:00
Matthias Krüger c2d2f6fd14
Rollup merge of #94659 - RalfJung:signed-shift, r=oli-obk
explain why shift with signed offset works the way it does

I was worried for a bit here that Miri/CTFE would be inconsistent with codegen, but I *think* everything is all right, actually.

Cc `@oli-obk` `@eddyb`
2022-03-06 19:08:37 +01:00
bors c38b8a8c62 Auto merge of #94579 - tmiasko:target-features, r=nagisa
Always include global target features in function attributes

This ensures that information about target features configured with
`-C target-feature=...` or detected with `-C target-cpu=native` is
retained for subsequent consumers of LLVM bitcode.

This is crucial for linker plugin LTO, since this information is not
conveyed to the plugin otherwise.

<details><summary>Additional test case demonstrating the issue</summary>

```rust
extern crate core;

#[inline]
#[target_feature(enable = "aes")]
unsafe fn f(a: u128, b: u128) -> u128 {
    use core::arch::x86_64::*;
    use core::mem::transmute;
    transmute(_mm_aesenc_si128(transmute(a), transmute(b)))
}

pub fn g(a: u128, b: u128) -> u128 {
    unsafe { f(a, b) }
}

fn main() {
    let mut args = std::env::args();
    let _ = args.next().unwrap();
    let a: u128 = args.next().unwrap().parse().unwrap();
    let b: u128 = args.next().unwrap().parse().unwrap();
    println!("{}", g(a, b));
}
```

```console
$ rustc --edition=2021 a.rs -Clinker-plugin-lto -Clink-arg=-fuse-ld=lld  -Ctarget-feature=+aes -O
...
  = note: LLVM ERROR: Cannot select: intrinsic %llvm.x86.aesni.aesenc
```

</details>

r? `@nagisa`
2022-03-06 18:07:11 +00:00
Erik Desjardins e1a4bf6492 cleanup: remove unused ability to have LLVM null-terminate const strings 2022-03-06 12:28:46 -05:00
Takayuki Maeda 51a53bf4df remove unnecessary .. patterns 2022-03-07 02:18:36 +09:00
Ralf Jung dfc43df937 explain why shift with signed offset works the way it does 2022-03-06 11:29:24 -05:00
bors a64180f67f Auto merge of #94673 - matthiaskrgr:rollup-2tnifg9, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #93412 (Improve rustdoc const bounds)
 - #94617 (Update `itertools`)
 - #94669 (Update -Z unpretty error message)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-06 15:26:21 +00:00
Joe 0e604a7864
Updated corresponding stderr 2022-03-06 16:14:07 +01:00
Matthias Krüger b7ccab4d40
Rollup merge of #94669 - Alexendoo:unpretty-help, r=tmiasko
Update -Z unpretty error message

Adds `thir-tree`, removes `everybody_loops` (removed in #93913)
2022-03-06 15:41:27 +01:00
Matthias Krüger 5f08cb9f2f
Rollup merge of #94617 - pierwill:update-itertools, r=Mark-Simulacrum
Update `itertools`

Update to 0.10.1
2022-03-06 15:41:26 +01:00
Matthias Krüger faf1a7ffc8
Rollup merge of #93412 - fee1-dead:improve-rustdoc-const-bounds, r=GuillaumeGomez
Improve rustdoc const bounds

 - Rustdoc no longer displays `~const` in trait bounds, because it currently means nothing for stable users, and because we still haven't decided on the final syntax yet.
 - Rustdoc will hide trait bounds where the trait is `Drop` AND it is `~const`, i.e. `~const Drop` bounds because it has no effect on stable users as well.
 - Because of additional logic that hides the whole `where` statement where it consists of `~const Drop` bounds (so it doesn't display `struct Foo<T>() where ;` like that), bounds that have no trait e.g. `where [T; N+1]: ;` are also hidden.

Cherry-picked from #92433.
2022-03-06 15:41:26 +01:00
Joe 65ec4dd904
Improved error message for failed bitcode load
"bc" is an unnecessary shorthand that obfuscates the compilation error
2022-03-06 15:25:05 +01:00
csmoe bf089331b4 fix pin doc typo 2022-03-06 21:40:30 +08:00
bors d53e19540e Auto merge of #94668 - fee1-dead:rollup-8e92bht, r=fee1-dead
Rollup of 3 pull requests

Successful merges:

 - #92509 (doc: `Iterator::partition` use partial type hints)
 - #94621 (rustbuild: support RelWithDebInfo for lld)
 - #94649 (Unix path::absolute: Fix leading "." component)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-06 12:57:32 +00:00
Alex Macleod 1d64b8587f Update -Z unpretty error message
Adds `thir-tree`, removes `everybody_loops`
2022-03-06 12:45:37 +00:00
fee1-dead 8ea3f236dc
Rollup merge of #94649 - ChrisDenton:unix-absolute-fix, r=Dylan-DPC
Unix path::absolute: Fix leading "." component

Testing leading `.` and `..` components were missing from the unix tests.

This PR adds them and fixes the leading `.` case. It also fixes the test cases so that they do an exact comparison.

This problem reported by ``@axetroy``
2022-03-06 22:35:31 +11:00
fee1-dead 02e8839cbd
Rollup merge of #94621 - ridwanabdillahi:lld-rel-dbg, r=Mark-Simulacrum
rustbuild: support RelWithDebInfo for lld

r? ``@alexcrichton``

LLVM has flags that control the level of debuginfo generated when building via rustbuild. Since LLD is built separately, it currently has no way of generating any debuginfo. This change re-uses the same flags as LLVM for LLD to ensure it has the same level of debuginfo generated as LLVM.
2022-03-06 22:35:30 +11:00
fee1-dead d85e4b1e35
Rollup merge of #92509 - Gentoli:partition-ex, r=camelid
doc: `Iterator::partition` use partial type hints

Switch to partial type hints to indicate only the collection type is needed.
2022-03-06 22:35:29 +11:00
bors ad0d1d71d3 Auto merge of #90076 - jackh726:wherethewhere, r=nikomatsakis
Change location of where clause on GATs

Closes #89122

~Blocked on lang FCP~

r? `@nikomatsakis`
2022-03-06 07:22:09 +00:00
bors 5d9d1e8891 Auto merge of #94658 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/94562
r? `@ghost`
2022-03-06 04:41:25 +00:00
Ralf Jung 0de698197f update Miri 2022-03-05 22:44:34 -05:00
Jack Huey d16ec7b9d1 Ignore 2022-03-05 21:20:12 -05:00
bors 1661e4c7e0 Auto merge of #93805 - petrochenkov:doclinkself, r=camelid,GuillaumeGomez
rustdoc: Stop textually replacing `Self` in doc links before resolving them

Resolve it directly to a type / def-id instead.

Also never pass `Self` to `Resolver`, it is useless because it's guaranteed that no resolution will be found.

This is a pre-requisite for https://github.com/rust-lang/rust/issues/83761.
2022-03-06 02:14:49 +00:00
Gentoli 62a65945b7
doc: Iterator::partition use partial type hints 2022-03-05 19:40:40 -05:00
bors 0cbef1c6a7 Auto merge of #94601 - csmoe:android-asan, r=nagisa
add address sanitizer fo android

We have been being using asan to debug the rust/cpp/c mixed android application in production for months: recompile the rust library with a patched rustc, everything just works fine. The patch is really small thanks to `@nagisa` 's refactoring in https://github.com/rust-lang/rust/pull/81866

r? `@nagisa`
2022-03-05 22:52:08 +00:00
bors c274e4969f Auto merge of #94648 - RalfJung:rollup-4iorcrd, r=RalfJung
Rollup of 4 pull requests

Successful merges:

 - #94630 (Update note about tier 2 docs.)
 - #94633 (Suggest removing a semicolon after derive attributes)
 - #94642 (Fix source code pages scroll)
 - #94645 (do not attempt to open cgroup files under Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-05 19:53:45 +00:00
Jack Huey 9dc05f3832 Add commment covering the case with no where clause 2022-03-05 13:15:00 -05:00