Commit Graph

120262 Commits

Author SHA1 Message Date
Amanieu d'Antras
ff97db1e54 Apply review feedback 2020-05-18 14:41:32 +01:00
Amanieu d'Antras
8ab0f2d3c5 Add tests for asm! 2020-05-18 14:41:32 +01:00
Amanieu d'Antras
abed45ff9f Implement asm! codegen 2020-05-18 14:41:32 +01:00
Amanieu d'Antras
342a64caef Check that asm const operands are actually constants 2020-05-18 14:41:31 +01:00
Amanieu d'Antras
1e7b246086 Add asm! to MIR 2020-05-18 14:41:31 +01:00
Amanieu d'Antras
10510b5820 HIR passes for asm! 2020-05-18 14:41:31 +01:00
Amanieu d'Antras
ec1ad61f88 Implement AST lowering for asm! 2020-05-18 14:41:29 +01:00
Amanieu d'Antras
d5b1501d8c Add asm! to HIR 2020-05-18 14:39:54 +01:00
Amanieu d'Antras
a0adf53bc9 Implement asm! in librustc_builtin_macros 2020-05-18 14:39:54 +01:00
Amanieu d'Antras
813a9fc4f1 Add asm! to AST 2020-05-18 14:39:54 +01:00
Amanieu d'Antras
989edf6dd9 Add inline asm register definitions to librustc_target 2020-05-18 14:39:53 +01:00
Amanieu d'Antras
62d5784a8f Add RISC-V target features 2020-05-18 14:39:53 +01:00
bors
d4bf05693c Auto merge of #72316 - RalfJung:rollup-70g6bln, r=RalfJung
Rollup of 2 pull requests

Successful merges:

 - #72143 (make offset must_use)
 - #72307 (use the new interface to initialize conditional variables)

Failed merges:

r? @ghost
2020-05-18 07:53:03 +00:00
Ralf Jung
2cff5d961a
Rollup merge of #72307 - hermitcore:condvar, r=Mark-Simulacrum
use the new interface to initialize conditional variables

HermitCore introduce a new interface to intialize conditional variables.
Consequently, minor changes are required to support this interface.
2020-05-18 08:48:45 +02:00
Ralf Jung
2a90664798
Rollup merge of #72143 - rust-lang:steveklabnik-must-use, r=sfackler
make offset must_use

https://djugei.github.io/bad-at-unsafe/ describes an error a user had when trying to use offset:

> At first I just assumed that the .add() and .offset() methods on pointers would mutate the pointer. They do not. Instead they return a new pointer, which gets dropped silently if you don't use it. Unlike for example Result, which is must_use annotated.

This PR only adds `offset`, because I wanted to float the idea; I'm imagining that there's more than just `add` and `offset` that could use this. I am also very open to re-wording the warning.

r? @rust-lang/libs
2020-05-18 08:48:43 +02:00
bors
1baf85c7e0 Auto merge of #72300 - flip1995:clippyup, r=Mark-Simulacrum
Sync Clippy

cc rust-lang/rust-clippy#5608

Included changes:

- renames/merges of some lints
- ICE fix
- Downgrade useless_let_if_seq to nursery
- FP fixes
- formatting

r? @oli-obk
2020-05-18 04:10:01 +00:00
bors
35d86693ac Auto merge of #72269 - RalfJung:unsafe-borrow-of-packed, r=Mark-Simulacrum
move borrow-of-packed-field unsafety check out of loop

Looks like during the place refactoring, this code somehow got into this loop even though it does not actually depend on the loop variables.
2020-05-18 00:54:42 +00:00
Stefan Lankes
3f47d9d2e6 minor changes to pass the format check 2020-05-18 00:06:32 +02:00
Stefan Lankes
06d692febd use new interface to initialize Condvar
HermitCore introduce a new interface to intialize conditional variables.
Consequently, minor changes are required to support this interface.
2020-05-17 23:49:18 +02:00
bors
5f472813df Auto merge of #72248 - petrochenkov:codemodel, r=Amanieu
Cleanup and document `-C code-model`

r? @Amanieu
2020-05-17 21:22:48 +00:00
bors
d79f1bd31a Auto merge of #72295 - RalfJung:rollup-icmhbs7, r=RalfJung
Rollup of 3 pull requests

Successful merges:

 - #72259 (Disallow forbidden usage of non-ascii identifiers.)
 - #72261 (Break out early on empty span when generate_fn_span)
 - #72291 (bootstrap: fix typo)

Failed merges:

r? @ghost
2020-05-17 16:20:19 +00:00
flip1995
4dc83a74fd
Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup 2020-05-17 17:36:26 +02:00
Steve Klabnik
aea0186fe5 make many ptr functions must_use
https://djugei.github.io/bad-at-unsafe/ describes an error a user had when trying to use offset:

> At first I just assumed that the .add() and .offset() methods on pointers would mutate the pointer. They do not. Instead they return a new pointer, which gets dropped silently if you don't use it. Unlike for example Result, which is must_use annotated.
2020-05-17 10:35:57 -05:00
Ralf Jung
2b3d99d31a
Rollup merge of #72291 - RalfJung:format-typo, r=jonas-schievink
bootstrap: fix typo
2020-05-17 16:24:29 +02:00
Ralf Jung
65833dcd3d
Rollup merge of #72261 - csmoe:issue-72095, r=estebank
Break out early on empty span when generate_fn_span

Closes #72095
r? @oli-obk
cc @estebank @tmandry
2020-05-17 16:24:27 +02:00
Ralf Jung
49b81cae86
Rollup merge of #72259 - crlf0710:ascii_only_check, r=petrochenkov
Disallow forbidden usage of non-ascii identifiers.

Part of RFC2457, this tightens allowed identifiers back to ascii only in two situations.

r? @petrochenkov
2020-05-17 16:24:26 +02:00
bors
34cce58d81 Auto merge of #72204 - RalfJung:abort, r=Mark-Simulacrum
make abort intrinsic safe, and correct its documentation

Turns out `std::process::abort` is not the same as the intrinsic, the comment was just wrong. Quoting from the unix implementation:
```
// On Unix-like platforms, libc::abort will unregister signal handlers
// including the SIGABRT handler, preventing the abort from being blocked, and
// fclose streams, with the side effect of flushing them so libc buffered
// output will be printed.  Additionally the shell will generally print a more
// understandable error message like "Abort trap" rather than "Illegal
// instruction" that intrinsics::abort would cause, as intrinsics::abort is
// implemented as an illegal instruction.
```
2020-05-17 12:49:01 +00:00
bors
e214ea82ad Auto merge of #5568 - ThibsG:RenameIdentityConversionLint, r=flip1995
Rename lint `identity_conversion` to `useless_conversion`

Lint name `identity_conversion` was misleading, so this PR renames it to `useless_conversion`.

As decision has not really came up in the issue comments, this PR will probably need discussion.

fixes #3106

changelog: Rename lint `identity_conversion` to `useless_conversion`
2020-05-17 11:29:04 +00:00
bors
6ae0643d1a Auto merge of #5529 - alex-700:improve-option-and-then-some-lint, r=phansch
Improve `option_and_then_some` lint

fixed #5492

changelog: Improve and generalize `option_and_then_some` and rename it to `bind_instead_of_map`.
2020-05-17 10:58:56 +00:00
Ralf Jung
4caddaeeea bootstrap: fix typo 2020-05-17 11:41:20 +02:00
Ralf Jung
5980d972d1 make abort intrinsic safe, and correct its documentation 2020-05-17 11:23:42 +02:00
bors
7faeae0d38 Auto merge of #72135 - oli-obk:const_prop_deaggregates, r=wesleywiser
Propagate locals, even if they have unpropagatable assignments somewhere

Second try for https://github.com/rust-lang/rust/pull/71946#discussion_r422967292

r? @wesleywiser

cc @rust-lang/wg-mir-opt @RalfJung
2020-05-17 09:18:12 +00:00
Aleksei Latyshev
07f1edf2d4
improve and generalize option_and_then_some lint
- rename it to bind_instead_of_map
2020-05-17 12:17:03 +03:00
bors
e7f230dfd2 Auto merge of #72208 - tmandry:fix-fuchsia-solink, r=Mark-Simulacrum
Don't pass --dynamic-linker for Fuchsia dylibs

This was causing a PT_INTERP header in Fuchsia dylibs (implying that
they're executable when they're not).

r? @Mark-Simulacrum
cc @frobtech @petrhosek
2020-05-17 05:58:54 +00:00
bors
440a46dd20 Auto merge of #5608 - flip1995:rustup, r=phansch
Rustup with git subtree

The commits from the last rustup #5587, are again included in this rustup, since I rebased the rustup. Lesson learned: never rebase, only merge when working with git subtree.

changelog: none
2020-05-17 05:41:39 +00:00
Wesley Wiser
27c818bc56 Bless mir-opt tests to account for #72220 2020-05-16 22:13:50 -04:00
bors
09739c22db Auto merge of #72286 - Dylan-DPC:rollup-n3rk6df, r=Dylan-DPC
Rollup of 4 pull requests

Successful merges:

 - #72233 (Fix {:#?} representation of proc_macro::Literal)
 - #72277 (emphasize that ManuallyDrop is safe-to-access and unsafe-to-drop)
 - #72281 (Fix whitespace in `?Sized` structured suggestion)
 - #72282 (Fix issue number typo in note)

Failed merges:

r? @ghost
2020-05-17 01:31:15 +00:00
Dylan DPC
1d09a7b693
Rollup merge of #72282 - jonas-schievink:issue-typo, r=Dylan-DPC
Fix issue number typo in note
2020-05-17 01:51:35 +02:00
Dylan DPC
770b1f35de
Rollup merge of #72281 - estebank:fix-ws-sugg, r=Dylan-DPC
Fix whitespace in `?Sized` structured suggestion
2020-05-17 01:51:33 +02:00
Dylan DPC
444f449d10
Rollup merge of #72277 - RalfJung:manually-drop-docs, r=Mark-Simulacrum
emphasize that ManuallyDrop is safe-to-access and unsafe-to-drop

This seems to sometimes confused people, and generally seems reasonable to state in the top-level summary of the type.
2020-05-17 01:51:31 +02:00
Dylan DPC
fc91043d24
Rollup merge of #72233 - dtolnay:literal, r=petrochenkov
Fix {:#?} representation of proc_macro::Literal

Before:

```rust
TokenStream [
    Ident {
        ident: "name",
        span: #0 bytes(37..41),
    },
    Punct {
        ch: '=',
        spacing: Alone,
        span: #0 bytes(42..43),
    },
    Literal { lit: Lit { kind: Str, symbol: "SNPP", suffix: None }, span: Span { lo: BytePos(44), hi: BytePos(50), ctxt: #0 } },
    Punct {
        ch: ',',
        spacing: Alone,
        span: #0 bytes(50..51),
    },
    Ident {
        ident: "owner",
        span: #0 bytes(56..61),
    },
    Punct {
        ch: '=',
        spacing: Alone,
        span: #0 bytes(62..63),
    },
    Literal { lit: Lit { kind: Str, symbol: "Canary M Burns", suffix: None }, span: Span { lo: BytePos(64), hi: BytePos(80), ctxt: #0 } },
]
```

After:

```rust
TokenStream [
    Ident {
        ident: "name",
        span: #0 bytes(37..41),
    },
    Punct {
        ch: '=',
        spacing: Alone,
        span: #0 bytes(42..43),
    },
    Literal {
        kind: Str,
        symbol: "SNPP",
        suffix: None,
        span: #0 bytes(44..50),
    },
    Punct {
        ch: ',',
        spacing: Alone,
        span: #0 bytes(50..51),
    },
    Ident {
        ident: "owner",
        span: #0 bytes(56..61),
    },
    Punct {
        ch: '=',
        spacing: Alone,
        span: #0 bytes(62..63),
    },
    Literal {
        kind: Str,
        symbol: "Canary M Burns",
        suffix: None,
        span: #0 bytes(64..80),
    },
]
```
2020-05-17 01:51:30 +02:00
flip1995
7f317b708f
Run fmt 2020-05-17 01:18:43 +02:00
flip1995
404ae5b211
Re-remove util/dev
Maybe someday, git subtree will do it right
2020-05-17 01:14:28 +02:00
flip1995
cb0d40a7ec
Merge remote-tracking branch 'upstream/master' into rustup 2020-05-17 01:13:02 +02:00
bors
0ec4b06524 Auto merge of #72178 - tmiasko:inliner-lifetimes, r=nikic
Consistently use LLVM lifetime markers during codegen

Ensure that inliner inserts lifetime markers if they have been emitted during
codegen. Otherwise if allocas from inlined functions are merged together,
lifetime markers from one function might invalidate load & stores performed
by the other one.

Fixes #72154.
2020-05-16 22:16:48 +00:00
Aleksei Latyshev
cb7f9679a6
simplify multispan_sugg interface
- add `multispan_sugg_with_applicability`
- not it gets `&str` instead of `String`, like in `diag.multispan_suggestion`
2020-05-17 00:09:37 +03:00
ThibsG
e55b920970 Rename lint identity_conversion to useless_conversion 2020-05-16 22:50:20 +02:00
bors
cfd720d506 Auto merge of #5563 - ThibsG:MergeLints, r=flip1995
Merge some lints together

This PR merges following lints:

- `block_in_if_condition_expr` and `block_in_if_condition_stmt` → `blocks_in_if_conditions`
- `option_map_unwrap_or`, `option_map_unwrap_or_else` and `result_map_unwrap_or_else` → `map_unwrap`
- `option_unwrap_used` and `result_unwrap_used` → `unwrap_used`
- `option_expect_used` and `result_expect_used` → `expect_used`
- `wrong_pub_self_convention` into `wrong_self_convention`
- `for_loop_over_option` and `for_loop_over_result` → `for_loops_over_fallibles`

Lints that have already been merged since the issue was created:
- [x] `new_without_default` and `new_without_default_derive` → `new_without_default`

Need more discussion:
- `string_add` and `string_add_assign`: do we agree to merge them or not? Is there something more to do? → **not merge finally**
- `identity_op` and `modulo_one` → `useless_arithmetic`: seems outdated, since `modulo_arithmetic` has been created.

fixes #1078

changelog: Merging some lints together:
- `block_in_if_condition_expr` and `block_in_if_condition_stmt` → `blocks_in_if_conditions`
- `option_map_unwrap_or`, `option_map_unwrap_or_else` and `result_map_unwrap_or_else` → `map_unwrap_or`
- `option_unwrap_used` and `result_unwrap_used` → `unwrap_used`
- `option_expect_used` and `result_expect_used` → `expect_used`
- `for_loop_over_option` and `for_loop_over_result` → `for_loops_over_fallibles`
2020-05-16 20:17:11 +00:00
Jonas Schievink
9271f998d1 Fix issue number typo in note 2020-05-16 22:15:37 +02:00
Esteban Küber
47034db851 Fix whitespace in ?Sized structured suggestion 2020-05-16 12:56:21 -07:00