Commit graph

149924 commits

Author SHA1 Message Date
bors
3740ba2a7d Auto merge of #84863 - ABouttefeux:libtest, r=m-ou-se
Show test type during prints

Test output can sometimes be confusing. For example doctest with the no_run argument are displayed the same way than test that are run.

During #83857 I got the feedback that test output can be confusing.

For the moment test output is
```
test $DIR/test-type.rs - f (line 12) ... ignored
test $DIR/test-type.rs - f (line 15) ... ok
test $DIR/test-type.rs - f (line 21) ... ok
test $DIR/test-type.rs - f (line 6) ... ok
```

I propose to change output by indicating the test type as
```
test $DIR/test-type.rs - f (line 12) ... ignored
test $DIR/test-type.rs - f (line 15) - compile ... ok
test $DIR/test-type.rs - f (line 21) - compile fail ... ok
test $DIR/test-type.rs - f (line 6) ... ok
```
by indicating the test type after the test name (and in the case of doctest after the function name and line) and before the "...".

------------

Note: this is a proof of concept, the implementation is probably not optimal as the properties added in `TestDesc` are only use in the display and does not represent actual change of behavior, maybe `TestType::DocTest` could have fields
2021-06-06 09:13:59 +00:00
Luqman Aden
a26f00357f Unify duplicate linker_and_flavor methods in rustc_codegen_{cranelift,ssa}. 2021-06-05 21:59:41 -07:00
Joshua Nelson
1cdc81bdc1 Don't pass -Z unstable-options by default for UI tests
- Pass it explicitly where appropriate
- Update stderr files and warnings; it turns that unstable-options has
  far-reaching effects on diagnostics.
2021-06-06 00:44:54 -04:00
bors
9a576175cc Auto merge of #84171 - ricobbe:raw-dylib-via-llvm, r=petrochenkov
Partial support for raw-dylib linkage

First cut of functionality for issue #58713: add support for `#[link(kind = "raw-dylib")]` on `extern` blocks in lib crates compiled to .rlib files.  Does not yet support `#[link_name]` attributes on functions, or the `#[link_ordinal]` attribute, or `#[link(kind = "raw-dylib")]` on `extern` blocks in bin crates; I intend to publish subsequent PRs to fill those gaps.  It's also not yet clear whether this works for functions in `extern "stdcall"` blocks; I also intend to investigate that shortly and make any necessary changes as a follow-on PR.

This implementation calls out to an LLVM function to construct the actual `.idata` sections as temporary `.lib` files on disk and then links those into the generated .rlib.
2021-06-06 03:59:17 +00:00
erer1243
67f4f3baec Updated code examples and wording 2021-06-05 23:44:21 -04:00
Joshua Nelson
b8ebf4431e Don't fire invalid_doc_attributes on extern crate items 2021-06-05 21:18:20 -04:00
bors
f434217aab Auto merge of #79608 - alessandrod:bpf, r=nagisa
BPF target support

This adds `bpfel-unknown-none` and `bpfeb-unknown-none`, two new no_std targets that generate little and big endian BPF. The approach taken is very similar to the cuda target, where `TargetOptions::obj_is_bitcode` is enabled and code generation is done by the linker.

I added the targets to `dist-various-2`. There are [some tests](https://github.com/alessandrod/bpf-linker/tree/main/tests/assembly) in bpf-linker and I'm planning to add more. Those are currently not ran as part of rust CI.
2021-06-06 01:02:32 +00:00
Guillaume Gomez
e078e56112 Fix invalid ID value in all.html file 2021-06-05 23:14:12 +02:00
Guillaume Gomez
8c9200d045 Add missing backslash in HTML layout string 2021-06-05 23:14:10 +02:00
Guillaume Gomez
e1180f521f Escape <meta> content attribute value 2021-06-05 23:13:11 +02:00
bors
6c2dd251bb Auto merge of #86002 - cjgillot:expn_that_defined, r=petrochenkov
Always go through the expn_that_defined query.
2021-06-05 21:10:01 +00:00
Guillaume Gomez
c01bd560e2 Fix display for search results 2021-06-05 23:03:54 +02:00
bors
ac3e680193 Auto merge of #86032 - GuillaumeGomez:rollup-y3ij27b, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #83646 (Add a map method to Bound)
 - #85501 (Fix `deny(invalid_doc_attributes)`)
 - #85503 (rustdoc: add tooltips to some buttons)
 - #85710 (Document `From` impls in path.rs)
 - #85760 (Possible errors when accessing file metadata are platform specific)
 - #85974 (td align attribute)
 - #86014 (msp430 linker does not accept -znoexecstack. Set linker_is_gnu to fal…)

Failed merges:

 - #85972 (Rustdoc html fixes)

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-05 18:41:36 +00:00
Camille Gillot
3f32738628
Update compiler/rustc_middle/src/query/mod.rs 2021-06-05 20:40:58 +02:00
Guillaume Gomez
16504f6253
Rollup merge of #86014 - cr1901:msp430-link, r=jonas-schievink
msp430 linker does not accept -znoexecstack. Set linker_is_gnu to fal…

…se as workaround for now.

Tested locally and works. Closes #85948.
2021-06-05 19:41:45 +02:00
Guillaume Gomez
9c7ebc15a6
Rollup merge of #85974 - GuillaumeGomez:td-align, r=jsha
td align attribute

This is a follow-up of #85972. I have put this one on its own because it changes the display:

![Screenshot from 2021-06-03 21-49-11](https://user-images.githubusercontent.com/3050060/120703622-d533d280-c4b5-11eb-9519-ea1131a40bee.png)

Without align:

![Screenshot from 2021-06-03 21-49-15](https://user-images.githubusercontent.com/3050060/120703623-d5cc6900-c4b5-11eb-95f9-878d3915c7fb.png)

I also opened an issue about it: raphlinus/pulldown-cmark#533. However, I'm not sure if this is the right course of action... Should we instead ignore the warning?

r? ``@jsha``
2021-06-05 19:41:44 +02:00
Guillaume Gomez
114aff58fd
Rollup merge of #85760 - ChrisDenton:path-doc-platform-specific, r=m-ou-se
Possible errors when accessing file metadata are platform specific

In particular the `is_dir`, `is_file` and `exists` functions suggests that querying a file requires querying the directory. On Windows this is not normally true.

r? `@m-ou-se`
2021-06-05 19:41:43 +02:00
Guillaume Gomez
6dfde9a857
Rollup merge of #85710 - fee1-dead:document-path, r=m-ou-se
Document `From` impls in path.rs
2021-06-05 19:41:42 +02:00
Guillaume Gomez
eef4e2a0e8
Rollup merge of #85503 - liigo:tooltips, r=GuillaumeGomez
rustdoc: add tooltips to some buttons
2021-06-05 19:41:41 +02:00
Guillaume Gomez
515c5afe2c
Rollup merge of #85501 - jyn514:invalid-doc-attrs, r=varkor
Fix `deny(invalid_doc_attributes)`

Fixes https://github.com/rust-lang/rust/issues/85497.
2021-06-05 19:41:40 +02:00
Guillaume Gomez
1594076748
Rollup merge of #83646 - glittershark:bound-map, r=m-ou-se
Add a map method to Bound

Add a map method to std::ops::range::Bound, patterned off of the method
of the same name on Option.

Have left off creating a tracking issue initially, but as soon as I get the go-ahead from a reviewer I'll make that right away 😄
2021-06-05 19:41:34 +02:00
Tomasz Miąsko
07a03b0a58 Explain that ensure_monomorphic_enough omission is intentional 2021-06-05 18:28:25 +02:00
Tomasz Miąsko
894b42c861 Disallow non-monomorphic calls to needs_drop in interpreter
otherwise evaluation could change after further substitutions.
2021-06-05 18:28:25 +02:00
LingMan
f4080fca62 Drop an if let that will always succeed
We've already checked that `proj_base == []` in the line above and renaming
`place_local` to `local` doesn't gain us anything.
2021-06-05 18:12:47 +02:00
Griffin Smith
223c0d2a85 Add a map method to Bound
Add a map method to std::ops::range::Bound, patterned off of the method
of the same name on Option
2021-06-05 17:22:30 +02:00
bjorn3
6b45d59caa Remove get_install_prefix_lib_path completely
It was broken anyway for rustup installs and nobody seems to have noticed.
2021-06-05 16:42:03 +02:00
bjorn3
a3205a6698 Use sysroot instead of CFG_PREFIX for the rpath
CFG_PREFIX is incorrect for rustup installed rustc versions. It also
causes unnecessary recompilation when changing the install prefix.
2021-06-05 16:42:03 +02:00
bors
9104c898eb Auto merge of #85869 - tmiasko:box-free, r=nagisa
Remove special handling of `box_free` from `LocalAnalyzer`

The special casing of `box_free` predates the use of dominators in
analyzer. It is no longer necessary now that analyzer verifies that
the first assignment dominates all uses.
2021-06-05 14:08:38 +00:00
Deadbeef
d9630848d7
Remove _ from E0121 diagnostic suggestions 2021-06-05 21:10:08 +08:00
Simonas Kazlauskas
c63a1c0a1b Disable the machine outliner by default
This addresses a codegen-issue that needs to be fixed upstream in LLVM.
While we wait for the fix, we can disable it.

Verified manually that the outliner is no longer run when
`-Copt-level=z` is specified, and also that you can override this with
`-Cllvm-args=-enable-machine-outliner` if you need it anyway.

A regression test is not really feasible in this instance, given that we
do not have any minimal reproducers.

Fixes #85351
2021-06-05 14:57:28 +03:00
bors
5ea19239d9 Auto merge of #86001 - richkadel:revert-85617-rustin-patch-fix, r=Mark-Simulacrum
Revert "shrinking the deprecated method span"

Reverts rust-lang/rust#85617

Fixes: #86000

r? `@Mark-Simulacrum`
2021-06-05 11:12:57 +00:00
bors
34b9932f5c Auto merge of #85990 - jyn514:channel-replace-rustdoc, r=Manishearth
rustdoc: link consistently to stable/beta in diagnostic messages

Builds on https://github.com/rust-lang/rust/pull/84942. This makes the diagnostics consistent with the links.
2021-06-05 08:42:05 +00:00
bors
4e20754629 Auto merge of #85919 - workingjubilee:simd-ptrs-are-valid, r=petrochenkov
Allow raw pointers in SIMD types

Closes #85915 by loosening the strictness in typechecking and adding a test to guarantee it passes.

This still might be too strict, as references currently do pass monomorphization, but my understanding is that they are not guaranteed to be "scalar" in the same way.
2021-06-05 06:17:17 +00:00
bors
2c106885d5 Auto merge of #85457 - jyn514:remove-doc-include, r=GuillaumeGomez
Remove `doc(include)`

This nightly feature is redundant now that `extended_key_value_attributes` is stable (https://github.com/rust-lang/rust/pull/83366). `@rust-lang/rustdoc` not sure if you think this needs FCP; there was already an FCP in #82539, but technically it was for deprecating, not removing the feature altogether.

This should not be merged before #83366.

cc `@petrochenkov`
2021-06-05 03:36:26 +00:00
Joshua Nelson
dc302587e2 Pass --cfg=bootstrap for proc_macros or build scripts built by stage0
Cargo ignores RUSTFLAGS when building proc macro crates. However,
sometimes rustc_macro needs to have conditional compilation when there
are breaking changes to the `libproc_macro` API (see for example
tell the difference between stage 0 and stage 1.

Another alternative is to unconditionally build rustc_macros with the
master libstd instead of the beta one (i.e. use `--sysroot
stage0-sysroot`), but that led to strange and maddening errors:

```
error[E0460]: found possibly newer version of crate `std` which `proc_macro2` depends on
  --> /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/tracing-attributes-0.1.13/src/lib.rs:90:5
   |
90 | use proc_macro2::TokenStream;
   |     ^^^^^^^^^^^
   |
   = note: perhaps that crate needs to be recompiled?
   = note: the following crate versions were found:
           crate `std`: /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0-sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-b3602c301b71cc3d.rmeta
           crate `proc_macro2`: /home/joshua/rustc2/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps/libproc_macro2-a83c1f01610c129e.rlib
```
2021-06-04 22:01:40 -04:00
bors
9e6f0e878d Auto merge of #84234 - jyn514:blanket-hash, r=Aaron1011
Implement DepTrackingHash for `Option` through blanket impls instead of macros

This avoids having to add a new macro call for both the `Option` and the type itself.

Noticed this while working on https://github.com/rust-lang/rust/pull/84233.
r? `@Aaron1011`
2021-06-05 01:08:51 +00:00
Richard Cobbe
6aa45b71b1 Add first cut of functionality for #58713: support for #[link(kind = "raw-dylib")].
This does not yet support #[link_name] attributes on functions, the #[link_ordinal]
attribute, #[link(kind = "raw-dylib")] on extern blocks in bin crates, or
stdcall functions on 32-bit x86.
2021-06-04 18:01:35 -07:00
William D. Jones
cd11cdb88c msp430 linker does not accept -znoexecstack. Set linker_is_gnu to false as workaround for now. 2021-06-04 20:37:53 -04:00
Fabian Wolff
6a6a605a61 Fix handling of unmatched angle brackets in parser 2021-06-05 00:31:28 +02:00
bors
704934d080 Auto merge of #86006 - JohnTitor:rollup-97iuoi3, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #83653 (Remove unused code from `rustc_data_structures::sync`)
 - #84466 (rustdoc: Remove `PrimitiveType::{to_url_str, as_str}`)
 - #84880 (Make match in `register_res` easier to read)
 - #84942 (rustdoc: link to stable/beta docs consistently in documentation)
 - #85853 (Warn against boxed DST in `improper_ctypes_definitions` lint)
 - #85939 (Fix suggestion for removing &mut from &mut macro!().)
 - #85966 (wasm: Make simd types passed via indirection again)
 - #85979 (don't suggest unsized indirection in where-clauses)
 - #85983 (Update to semver 1.0.3)
 - #85988 (Note that `ninja = false` goes under `[llvm]`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-04 22:18:16 +00:00
Rich Kadel
1384200b1c Added a new test demonstrating the issue requiring revert
Note, the `Debug` impl is required.
2021-06-04 15:14:32 -07:00
Yuki Okushi
062e789a73
Rollup merge of #85988 - jyn514:ninja-error, r=joshtriplett
Note that `ninja = false` goes under `[llvm]`

Addresses https://github.com/rust-lang/rust/issues/84938#issuecomment-852448332 - `@kornelski` does this look good?

r? `@Mark-Simulacrum` cc `@joshtriplett`
2021-06-05 06:13:47 +09:00
Yuki Okushi
d5c9894109
Rollup merge of #85983 - dtolnay:semverx, r=ehuss
Update to semver 1.0.3

Fixes https://github.com/rust-lang/cargo/pull/9508#issuecomment-854326213 by pulling in https://github.com/dtolnay/semver/pull/247.

Fixes https://github.com/rust-lang/cargo/issues/9543
2021-06-05 06:13:46 +09:00
Yuki Okushi
2da4295028
Rollup merge of #85979 - tlyu:where-no-unsized-indirection, r=estebank
don't suggest unsized indirection in where-clauses

Skip where-clauses when suggesting using indirection in combination with
`?Sized` bounds on type parameters.

Fixes #85943.

`@estebank` I think this doesn't conflict with your work in #85947; please let me know if you'd like me to cherry pick it to a new branch based on yours instead.
2021-06-05 06:13:45 +09:00
Yuki Okushi
5d30ab85b2
Rollup merge of #85966 - alexcrichton:wasm-simd-indirect, r=workingjubilee
wasm: Make simd types passed via indirection again

This commit updates wasm target specs to use `simd_types_indirect: true`
again. Long ago this was added since wasm simd types were always
translated to `v128` under-the-hood in LLVM, meaning that it didn't
matter whether that target feature was enabled or not. Now, however,
`v128` is conditionally used in codegen depending on target features
enabled, meaning that it's possible to get linker errors about different
signatures in code that correctly uses simd types. The fix is the same
as for all other platforms, which is to pass the type indirectly.
2021-06-05 06:13:43 +09:00
Yuki Okushi
5ebc4d3697
Rollup merge of #85939 - m-ou-se:fix-remove-ref-macro-invocation, r=estebank
Fix suggestion for removing &mut from &mut macro!().

Fixes #85933

Before: (Note the suggestions.)
```
error[E0308]: mismatched types
 --> src/main.rs:2:21
  |
2 |     let _: String = &mut format!("");
  |            ------   ^^^^^^^^^^^^^^^^
  |            |        |
  |            |        expected struct `String`, found `&mut String`
  |            |        help: consider removing the borrow: `mut format!("")`
  |            expected due to this

error[E0308]: mismatched types
 --> src/main.rs:3:21
  |
3 |     let _: String = &mut (format!(""));
  |            ------   ^^^^^^^^^^^^^^^^^^
  |            |        |
  |            |        expected struct `String`, found `&mut String`
  |            |        help: consider removing the borrow: `mut (format!(""))`
  |            expected due to this
```

After:
```
error[E0308]: mismatched types
 --> src/main.rs:2:21
  |
2 |     let _: String = &mut format!("");
  |            ------   ^^^^^^^^^^^^^^^^
  |            |        |
  |            |        expected struct `String`, found `&mut String`
  |            |        help: consider removing the borrow: `format!("")`
  |            expected due to this

error[E0308]: mismatched types
 --> src/main.rs:3:21
  |
3 |     let _: String = &mut (format!(""));
  |            ------   ^^^^^^^^^^^^^^^^^^
  |            |        |
  |            |        expected struct `String`, found `&mut String`
  |            |        help: consider removing the borrow: `format!("")`
  |            expected due to this
```
2021-06-05 06:13:39 +09:00
Yuki Okushi
ec9e7d5df1
Rollup merge of #85853 - marmeladema:improper-ctypes-definitions-boxed-dst, r=petrochenkov
Warn against boxed DST in `improper_ctypes_definitions` lint

Fixes #85714
2021-06-05 06:13:38 +09:00
Yuki Okushi
01b0e6e645
Rollup merge of #84942 - jyn514:channel-replace, r=Manishearth
rustdoc: link to stable/beta docs consistently in documentation

This is an alternative to https://github.com/rust-lang/rust/pull/84941 which fixes the problem consistently by linking to stable/beta for *all* items, not just for primitives.

 ## User-facing changes

- Intra-doc links to primitives that currently go to rust-lang.org/nightly/std/primitive.x.html will start going to channel that rustdoc was built with. Nightly will continue going to /nightly; Beta will link to /beta; stable compilers will link to /1.52.1 (or whatever version they were built as).
- Cross-crate links from std to core currently go to /nightly unconditionally. They will start going to /1.52.0 on stable channels (but remain the same on nightly channels).
- Intra-crate links from std to std (or core to core) currently go to the same URL they are hosted at; they will continue to do so. Notably, this is different from everything else because it can preserve the distinction between /stable and /1.52.0 by using relative links.

Note that "links" includes both intra-doc links and rustdoc's own
automatically generated hyperlinks.

 ## Implementation changes

- Update the testsuite to allow linking to /beta and /1.52.1 in docs
- Use an html_root_url for the standard library that's dependent on the channel

  This avoids linking to nightly docs on stable.

- Update rustdoc to use channel-dependent links for primitives from an
  unknown crate

- Set DOC_RUST_LANG_ORG_CHANNEL from bootstrap to ensure it's in sync
- Include doc.rust-lang.org in the channel

cc Mark-Simulacrum - I know [you were dubious about this in the past](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Rustdoc.20unconditionally.20links.20to.20nightly.20libstd.20docs/near/231223124), but I'm not quite sure why? I see this as "just a bugfix", I don't know why rustdoc should unconditionally link to nightly.
cc dtolnay who commented in https://github.com/rust-lang/rust/issues/30693:

>  I would welcome a PR to solve this permanently if anyone has ideas for how. I don't believe we need an RFC.

Fixes https://github.com/rust-lang/rust/issues/30693 (note that issue is marked as feature-accepted, although I don't see where it was discussed).
2021-06-05 06:13:37 +09:00
Yuki Okushi
3a8bb38164
Rollup merge of #84880 - jyn514:cleanup-itemkind, r=GuillaumeGomez
Make match in `register_res` easier to read

- Don't duplicate DefKind -> ItemType handling; that's a good way to get bugs
- Use exhaustive match
- Add comments

This found that register_res is very wrong in at least one way: if it
registers a Res for `Variant`, it should also register one for `Field`.
But I don't know whether the one for Variant should be removed or Field
added. Maybe someone has ideas?

Found while reviewing https://github.com/rust-lang/rust/pull/84176.
2021-06-05 06:13:32 +09:00
Yuki Okushi
74c744e54a
Rollup merge of #84466 - jyn514:prim-str, r=GuillaumeGomez
rustdoc: Remove `PrimitiveType::{to_url_str, as_str}`

These can easily be rewritten in terms of `as_sym`, and this avoids bugs where the two get out of sync.

I don't expect this to have a perf impact, but I'll start a perf run just in case.
2021-06-05 06:13:30 +09:00