Although types that don't implement Drop can't be Copyable, this can
still be useful when ManuallyDrop is used inside a generic type. This
doesn't derive from Copy as that would require T: Copy + Clone, instead
it provides an impl of Clone for T: Clone.
rustc: Flag {i,u}128 as unsafe for FFI
These don't appear to have a stable ABI as noted in #41799 and the work in
compiler-builtins definitely seems to be confirming it!
More general `on_unimplemented`, with uses in `Try`
Allow `on_unimplemented` directives to specify both the label and the primary message of the trait error, and allow them to be controlled by flags - currently only to be desugaring-sensitive.
e.g.
```Rust
#[rustc_on_unimplemented(
on(all(direct, from_desugaring="?"),
message="the `?` operator can only be used in a \
function that returns `Result` \
(or another type that implements `{Try}`)",
label="cannot use the `?` operator in a function that returns `{Self}`"),
)]
```
r? @nikomatsakis
Better StorageLive / StorageDead placement for constants.
Fixes problems in miri (see https://github.com/solson/miri/pull/324#issuecomment-326555552) caused by the new scope rules in #43932.
What I've tried to do here is always have a `StorageLive` but no `StorageDead` for `'static` slots.
It might not work perfectly in all cases, but it should unblock miri.
r? @nikomatsakis cc @oli-obk
rustc: Remove the `used_unsafe` field on TyCtxt
Now that lint levels are available for the entire compilation, this can be an
entirely local lint in `effect.rs`
cc #44137
Update rls
And expose the `CFG_VERSION` env var to tools so they can determine the version of Rust.
This gets the RLS back on master and so completes the PR dance for the generators PR.
r? @alexcrichton
powerpc64: improve extern struct ABI
These fixes all have to do with the 64-bit PowerPC ELF ABI for big-endian
targets. The ELF v2 ABI for powerpc64le already worked well.
- Return after marking return aggregates indirect. Fixes#42757.
- Pass one-member float aggregates as direct argument values.
- Aggregate arguments less than 64-bit must be written in the least-
significant bits of the parameter space.
- Larger aggregates are instead padded at the tail.
(i.e. filling MSBs, padding the remaining LSBs.)
New tests were also added for the single-float aggregate, and a 3-byte
aggregate to check that it's filled into LSBs. Overall, at least these
formerly-failing tests now pass on powerpc64:
- run-make/extern-fn-struct-passing-abi
- run-make/extern-fn-with-packed-struct
- run-pass/extern-pass-TwoU16s.rs
- run-pass/extern-pass-TwoU8s.rs
- run-pass/struct-return.rs
Add clippy as a submodule
~~This builds clippy as part of `./x.py build` (locally and in CI).~~
This allows building clippy with `./x.py build src/tools/clippy`
~~Needs https://github.com/nrc/dev-tools-team/issues/18#issuecomment-322456461 to be resolved before it can be merged.~~ Contributers can simply open a PR to clippy and point the submodule at the `pull/$pr_number/head` branch.
This does **not** build clippy or test the clippy test suite at all as per https://github.com/nrc/dev-tools-team/issues/18#issuecomment-321411418
r? @nrc
cc @Manishearth @llogiq @mcarton @alexcrichton
add a lowercase suggestion to unknown_lints
I recently wrote some tests for a clippy lint, copied the (uppercase) lint name into my test file and forgot to toggle the case. This PR adds a suggestion that would have saved me 10 minutes of debugging, so it's likely a net win 🙂 . Also it adds a UI test for the `unknown_lints` lint.
Following Clang's lead, and anecdotal evidence from the `float_one` part
of `run-make/extern-fn-struct-passing-abi`, use a floating point
register to return single-float aggregates, except on MSVC targets.
These fixes all have to do with the 64-bit PowerPC ELF ABI for big-endian
targets. The ELF v2 ABI for powerpc64le already worked well.
- Return after marking return aggregates indirect. Fixes#42757.
- Pass one-member float aggregates as direct argument values.
- Aggregate arguments less than 64-bit must be written in the least-
significant bits of the parameter space.
- Larger aggregates are instead padded at the tail.
(i.e. filling MSBs, padding the remaining LSBs.)
New tests were also added for the single-float aggregate, and a 3-byte
aggregate to check that it's filled into LSBs. Overall, at least these
formerly-failing tests now pass on powerpc64:
- run-make/extern-fn-struct-passing-abi
- run-make/extern-fn-with-packed-struct
- run-pass/extern-pass-TwoU16s.rs
- run-pass/extern-pass-TwoU8s.rs
- run-pass/struct-return.rs
Use hir::ItemLocalId instead of ast::NodeId in rustc::middle::region::CodeExtent.
This is an alternative to @michaelwoerister's #43887, changing `CodeExtent` instead of `ReScope`.
The benefit here is that the same `Region`s are used same-crate and cross-crate, while preserving the incremental recompilation properties of the stable `hir::ItemLocalId`.
Only places which needed to get back to the `ast::NodeId` from `CodeExtent` was its `span` method, used in error reporting - passing the `&RegionMaps` down allowed using `hir_to_node_id`.
`rustc::cfg` and `dataflow` also had to be converted to `hir::ItemLocalId` because of their interactions with `CodeExtent`, especially in `borrowck`, and from that we have 3 more `hir_to_node_id` calls: `cfg::graphviz` node labels, `borrowck` move reporting, and the `unconditional_recursion` lint.
Out of all of those, *only* the lint actually makes a decision (on whether code will compile) based on the result of the conversion, the others only use it to know how to print information to the user.
So I think we're safe to say that the bulk of the code working with a `CodeExtent` is fine with local IDs.
r? @nikomatsakis