Commit Graph

169685 Commits

Author SHA1 Message Date
Ralf Jung
a6207ec975 interpret: do not claim UB until we looked more into variadic functions 2022-06-05 13:24:24 -04:00
Ralf Jung
e5dd503d61 restore a test 2022-06-05 12:00:43 -04:00
Ralf Jung
4a41c35742 use strict provenance APIs 2022-06-05 11:50:48 -04:00
Ralf Jung
d208f80039 reduce code duplication 2022-06-05 10:13:34 -04:00
Ralf Jung
47d11a8483 interpret: better control over whether we read data with provenance, and implicit provenance stripping where possible 2022-06-05 10:13:34 -04:00
ouz-a
8f1fff04a7 get_vtable returns opt instd of unwrpping 2022-06-05 16:35:02 +03:00
Maybe Waffle
f21c0a274e Suggest adding {} for 'label: non_block_expr 2022-06-05 16:45:29 +04:00
bors
fee3a459dd Auto merge of #97756 - pietroalbini:pa-remove-azure-pipelines, r=Mark-Simulacrum
Remove Azure Pipelines configuration

This PR removes the remaining Azure Pipelines configuration, now that we fully removed all the resources on the Azure side of things.
2022-06-05 12:31:26 +00:00
Pietro Albini
6523ef41da
update comment 2022-06-05 12:32:46 +02:00
Pietro Albini
6a6c39765f
remove azure pipelines-specific debug statement 2022-06-05 12:30:55 +02:00
Pietro Albini
b926519d32
remove clean-disk script
The script wasn't referenced anywhere, and it's not useful anymore:
/opt/ghc is not present in new images, while /usr/share/dotnet is only
2.3 GB rather than 16 GB.
2022-06-05 12:30:01 +02:00
Pietro Albini
94f2f00939
remove azure pipelines configuration 2022-06-05 12:29:20 +02:00
bors
4322a785cc Auto merge of #97697 - WaffleLapkin:no_ref_vec, r=WaffleLapkin
Replace `&Vec<_>`s with `&[_]`s

It's generally preferable to use `&[_]` since it's one less indirection and it can be created from types other that `Vec`.

I've left `&Vec` in some locals where it doesn't really matter, in cases where `TypeFoldable` is expected (`TypeFoldable: Clone` so slice can't implement it) and in cases where it's `&TypeAliasThatIsActiallyVec`. Nothing important, really, I was just a little annoyed by `visit_generic_param_vec` :D

r? `@compiler-errors`
2022-06-05 09:30:53 +00:00
Maybe Waffle
cae3c78664 Rename visit_generic_param{_slice => s} 2022-06-05 13:12:31 +04:00
Camille GILLOT
f71ad2f992 Suggest 'static when in static/const items. 2022-06-05 10:43:58 +02:00
bors
a2da4af33c Auto merge of #97577 - betrusted-io:add-xous-target, r=nagisa
riscv32imac-unknown-xous-elf: add target

This PR starts the process of upstreaming support for our operating system, thanks to a suggestion from `@yaahc` [on Twitter](https://twitter.com/yaahc_/status/1530558574706839567?s=20&t=Mgkn1LEYvGU6FEi5SpZRsA). We have maintained a fork of Rust and have made changes to improve support for our platform since Rust 1.51. Now we would like to upstream these changes.

Xous is a microkernel operating system designed to run on small systems. The kernel contains a wide range of userspace processes that provide common services such as console output, networking, and time access.

The kernel and its services are completely written in Rust using a custom build of libstd. This adds support for this target to upstream Rust so that we can drop support for our out-of-tree `target.json` file.

This first patch adds a Tier 3 target for Xous running on RISC-V. Future patches will add libstd support, but those patches require changes to `dlmalloc` and `compiler_builtins`.

> Tier 3 policy:
>
> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

I will be the target maintainer for this target on matters that pertain to the `xous` part of the triple. For matters pertaining to the `riscv32imac` part of the triple, there should be no difference from all other `riscv` targets. If there are issues, I will address issues regarding the target.

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

This is a new OS, so I have taken the `riscv32imac-unknown-none-elf` target and changed the `os` section of the triple. This follows convention on targets such as `riscv32gc-unknown-linux-gnu` and `mipsel-unknown-linux-uclibc`. An argument could be made for omitting the `-elf` section of the triple, such as `riscv32imc-esp-espidf`, however I'm not certain what benefit that has.

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.

I feel that the target name does not introduce any ambiguity.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

The only unusual requirement for building the `compiler-builtins` crate is a standard RISC-V C compiler supported by `cc-rs`, and using this target does not require any additional software beyond what is shipped by `rustup`.

> The target must not introduce license incompatibilities.

All of the additional code will use Apache-2.0.

> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

Agreed, and there is no problem here.

> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.

The only new dependency will be the `xous` crate, which is licensed `MIT OR Apache-2.0`

> Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.

Linking is performed by `rust-lld`

> "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.

There are no terms. Xous is completely open. It runs on open hardware. We even provide the source to the CPU.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

This paragraph makes sense, but I don't think it's directed at me.

> This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

This paragraph also does not appear to be directed at me.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

So far we have:

 * Thread
 * Mutexex
 * Condvar
 * TcpStream
 * TcpListener
 * UdpSocket
 * DateTime
 * alloc

These will be merged as part of libstd in a future patch once I submit support for Xous in `dlmalloc` and `compiler-builtins`.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

Testing is currently done on real hardware or in a Renode emulator. I can add documentation on how to do this in a future patch, and I would need instructions on where to add said documentation.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

Alright.

> Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

Sounds good.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

This shouldn't affect any other targets, so this is understood.

> In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

This shouldn't come up right away. `xous` is a new operating system, and most features are keyed off of `target(os = "xous")` rather than a given architecture.
2022-06-05 07:03:50 +00:00
bors
656eec8785 Auto merge of #97391 - Urgau:cfg_accessible, r=petrochenkov
Handle more cases in cfg_accessible

This PR tries to handle more cases in the cfg_accessible implementation by only emitting a "not sure" error only if we have partially resolved a path.

This PR also adds many tests for the "not sure" cases and for private items.

r? `@petrochenkov`
2022-06-05 04:16:03 +00:00
klensy
2d2577cdec typo: -Zcodegen-backend=llvm -Cpasses=list should work now 2022-06-05 07:02:32 +03:00
bors
6dadfc06fe Auto merge of #93717 - pietroalbini:pa-ci-profiler, r=Mark-Simulacrum
Add build metrics to rustbuild

This PR adds a new module of rustbuild, `ci_profiler`, whose job is to gather as much information as possible about the CI build as possible and store it in a JSON file uploaded to `ci-artifacts`. Right now for each step it collects:

* Type name and debug representation of the `Step` object.
* Duration of the step (excluding child steps).
* Systemwide CPU stats for the duration of the step (both single core and all cores).
* Which child steps were executed.

This is capable of replacing both the scripts to collect CPU stats and the `[TIMING]` lines in build logs (not yet removed, until we port our tooling to use the CI profiler). The format is also extensible to be able in the future to collect more information.

r? `@Mark-Simulacrum`
2022-06-05 01:35:03 +00:00
nzrq
fc4e8c7f0d
Update library/std/src/collections/hash/set.rs
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2022-06-04 20:03:55 -04:00
bors
43874a2ee7 Auto merge of #97742 - matthiaskrgr:rollup-fr3j0t8, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #97609 (Iterate over `maybe_unused_trait_imports` when checking dead trait imports)
 - #97688 (test const_copy to make sure bytewise pointer copies are working)
 - #97707 (Improve soundness of rustc_data_structures)
 - #97731 (Add regresion test for #87142)
 - #97735 (Don't generate "Impls on Foreign Types" for std)
 - #97737 (Fix pretty printing named bound regions under -Zverbose)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-04 23:14:09 +00:00
cole
f3d93b6c62 Allow unstable items to be re-exported unstably without requiring the feature be enabled 2022-06-04 17:05:33 -05:00
Matthias Krüger
1794309e0a
Rollup merge of #97737 - jackh726:verbose-pretty-printing-fix, r=compiler-errors
Fix pretty printing named bound regions under -Zverbose

Fixed regression introduced in #97023

r? `@compiler-errors`

cc `@cjgillot`
2022-06-04 23:42:04 +02:00
Matthias Krüger
8d0de3a8da
Rollup merge of #97735 - jsha:no-foreign-std, r=GuillaumeGomez
Don't generate "Impls on Foreign Types" for std

Hack: many traits and types in std are re-exported from core or alloc. In general, rustdoc is capable of recognizing these implementations as being on local types. However, in at least one case, rustdoc gets confused and labels an implementation as being on a foreign type. To make sure that confusion doesn't pass on to the reader, consider all implementations in std, core, and alloc to be on local types.

Demo: https://rustdoc.crud.net/jsha/no-foreign-std/std/clone/trait.Clone.html
2022-06-04 23:42:03 +02:00
Matthias Krüger
c857265b51
Rollup merge of #97731 - JohnTitor:issue-87142, r=compiler-errors
Add regresion test for #87142

Closes #87142
r? `@compiler-errors`
2022-06-04 23:42:03 +02:00
Matthias Krüger
01453219de
Rollup merge of #97707 - Nilstrieb:data-structures-ub, r=cjgillot
Improve soundness of rustc_data_structures

Make it runnable in miri by adding some ignores and changing N in miri. Also fix a stacked borrows issue in sip128.
2022-06-04 23:42:02 +02:00
Matthias Krüger
36a16be35a
Rollup merge of #97688 - RalfJung:test-const-cpy, r=Mark-Simulacrum
test const_copy to make sure bytewise pointer copies are working

This is non-trivial; for `swap_nonoverlapping`, this is [not working](https://github.com/rust-lang/rust/issues/83163#issuecomment-1145917372).
2022-06-04 23:42:01 +02:00
Matthias Krüger
326315bf54
Rollup merge of #97609 - Elliot-Roberts:unused-trait-refactor, r=cjgillot
Iterate over `maybe_unused_trait_imports` when checking dead trait imports

Closes #96873
r? `@cjgillot`

Some questions, if you have time:

- Is there a way to shorten the `rustc_data_structures::fx::FxIndexSet` path in the query declaration? I wasn't sure where to put a `use`.
- Was returning by reference from the query the right choice here?
- How would I go about evaluating the importance of the `is_dummy()` call in `check_crate`? I don't see failing tests when I comment it out. Should I just try to determine whether dummy spans can ever be put into `maybe_unused_trait_imports`?
- Am I doing anything silly with the various ID types?
- Is that `let-else` with `unreachable!()` bad? (i.e is there a better idiom? Would `panic!("<explanation>")` be better?)
- If I want to evaluate the perf of using a `Vec` as mentioned in #96873, is the best way to use the CI or is it feasible locally?

Thanks :)
2022-06-04 23:42:00 +02:00
Jack Huey
dd38fecb78 Fix pretty printing named bound regions under -Zverbose 2022-06-04 17:32:27 -04:00
bors
4e725bad73 Auto merge of #97191 - wesleywiser:main_thread_name, r=ChrisDenton
Call the OS function to set the main thread's name on program init

Normally, `Thread::spawn` takes care of setting the thread's name, if
one was provided, but since the main thread wasn't created by calling
`Thread::spawn`, we need to call that function in `std::rt::init`.

This is mainly useful for system tools like debuggers and profilers
which might show the thread name to a user. Prior to these changes, gdb
and WinDbg would show all thread names except the main thread's name to
a user. I've validated that this patch resolves the issue for both
debuggers.
2022-06-04 20:27:53 +00:00
Elliot Roberts
76c6845a85 Iterate over maybe_unused_trait_imports when checking dead trait imports 2022-06-04 12:38:55 -07:00
Chase Wilson
857453d36c
Added test for #97732 2022-06-04 14:18:43 -05:00
Jacob Hoffman-Andrews
784eebcc60 Don't generate "Impls on Foreign Types" for std
Hack: many traits and types in std are re-exported from core or alloc. In
general, rustdoc is capable of recognizing these implementations as being
on local types. However, in at least one case, rustdoc gets confused and
labels an implementation as being on a foreign type. To make sure that
confusion doesn't pass on to the reader, consider all implementations in
std, core, and alloc to be on local types.
2022-06-04 11:10:51 -07:00
bors
3a8e713859 Auto merge of #97529 - Urgau:bootstrap-check-cfg-features, r=Mark-Simulacrum
Use new cargo argument in bootstrap for cfg checking

This PR use new cargo argument in bootstrap for doing cfg checking.

Follow-up to https://github.com/rust-lang/rust/pull/97044 and https://github.com/rust-lang/rust/pull/97214.

r? `@Mark-Simulacrum`
2022-06-04 17:47:14 +00:00
Pietro Albini
8ea95988df
update tests 2022-06-04 19:38:51 +02:00
Chase Wilson
ba2f14e065
Fixed premature assertions that caused -Z randomize-layout to fail on alloc 2022-06-04 12:33:01 -05:00
Pietro Albini
e257f38160
address review comments 2022-06-04 19:24:41 +02:00
Pietro Albini
70cdd7efc3
bump sysinfo version 2022-06-04 18:59:07 +02:00
Nilstrieb
7e3bee6d8e Fix stacked borrows invalidation in rustc_data_structures sip128
It creates the src pointer first, which is then invalidated by a
unique borrow of the destination pointer. Swap the borrows around
to fix this. Found with miri.
2022-06-04 17:46:36 +02:00
Nilstrieb
fc8b13cb96 Adapt rustc_data_structures tests to run in strict miri
Some tests took too long and owning_ref is fundamentally flawed,
so don't run these tests or run them with a shorter N. This makes
miri with `-Zmiri-strict-provenance` usable to find UB.
2022-06-04 17:46:29 +02:00
bors
6364179540 Auto merge of #97137 - Kobzol:ci-llvm-pgo-pid, r=Mark-Simulacrum
Add PID to LLVM PGO profile path

This is a continuation of https://github.com/rust-lang/rust/pull/97110, which adds PID to the filename pattern of LLVM profiles. It also adds some metrics to the pgo.sh script, so that we can observe how many profiles there are and how large are they.

r? `@lqd`
2022-06-04 14:30:36 +00:00
Wesley Wiser
cb87ce2285 Update src/test/debuginfo/thread-names.rs
Co-authored-by: Chris Denton <ChrisDenton@users.noreply.github.com>
2022-06-04 09:57:10 -04:00
Camille GILLOT
af8739b96e Completely remove LifetimeScopeForPath. 2022-06-04 15:33:27 +02:00
Camille GILLOT
a07290047e Compute lifetimes in scope at diagnostic time. 2022-06-04 15:28:15 +02:00
Yuki Okushi
7026845706
Add regresion test for #87142 2022-06-04 21:19:15 +09:00
Philipp Krones
586cbd0229
Update Cargo.lock
This updates the Cargo.lock file for Clippy:

- parking_lot 0.11.2 -> 0.12 (now 2 versions in parking lot)
- rustfix 0.6.0 -> 0.6.1 (now only one version left)
- compiletest_rs 0.7.1 -> 0.8
- clap 2.34.0 -> 3.1.1
2022-06-04 14:07:44 +02:00
Philipp Krones
c22d4e6b34
Remove unnecessary clap_derive dependency added in 9ee211af
The fixed issue in this commit can be tested without depending on
clap/clap_derive. This updates the test case to do so.
2022-06-04 14:04:35 +02:00
Philipp Krones
d55c373ddd
Merge commit 'd9ddce8a223cb9916389c039777b6966ea448dc8' into clippyup 2022-06-04 13:34:07 +02:00
bors
c7b0452ece Auto merge of #97729 - Dylan-DPC:rollup-dv43xo9, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #96642 (Avoid zero-sized allocs in ThinBox if T and H are both ZSTs.)
 - #97647 (Lazily allocate and initialize pthread locks.)
 - #97715 (Support the `#[expect]` attribute on fn parameters (RFC-2383))
 - #97716 (Fix reachability analysis for const methods)
 - #97722 (Tighten spans for bad fields in struct deriving `Copy`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-04 11:29:29 +00:00
bors
d9ddce8a22 Auto merge of #8942 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2022-06-04 10:55:48 +00:00