Yuki Okushi
4f8e0ebcc5
Use AttrVec
for Arm
, FieldDef
, and Variant
2021-06-17 08:04:54 +09:00
bors
444a85ac38
Auto merge of #86379 - JohnTitor:rollup-mkz9x36, r=JohnTitor
...
Rollup of 10 pull requests
Successful merges:
- #85870 (Allow whitespace in dump_mir filter)
- #86104 (Fix span calculation in format strings)
- #86140 (Mention the `Borrow` guarantee on the `Hash` implementations for Arrays and `Vec`)
- #86141 (Link reference in `dyn` keyword documentation)
- #86260 (Open trait implementations' toggles by default.)
- #86339 (Mention #79078 on compatibility notes of 1.52)
- #86341 (Stop returning a value from `report_assert_as_lint`)
- #86353 (Remove `projection_ty_from_predicates`)
- #86361 (Add missing backslashes to prevent unwanted newlines in rustdoc HTML)
- #86372 (Typo correction: s/is/its)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-16 22:48:31 +00:00
Smitty
044b3620e7
Move some hard error logic to InterpError
2021-06-16 18:23:34 -04:00
Yuki Okushi
05ba958fe8
Rollup merge of #86353 - JohnTitor:remove-projection_ty_from_predicates, r=oli-obk
...
Remove `projection_ty_from_predicates`
Fixes #86350
r? ``@oli-obk``
2021-06-17 05:54:59 +09:00
Yuki Okushi
36bf808aa1
Rollup merge of #86341 - LingMan:ret_val, r=davidtwco
...
Stop returning a value from `report_assert_as_lint`
This function only ever returns `None`. Make that explicity by not returning a value at all.
`@rustbot` modify labels +C-cleanup +T-compiler
2021-06-17 05:54:58 +09:00
Yuki Okushi
4ff55ecf04
Rollup merge of #86104 - FabianWolff:issue-86085, r=davidtwco
...
Fix span calculation in format strings
This pull request fixes #86085 . The ICE described there is due to an error in the span calculation inside format strings, if the format string is the result of a macro invocation:
```rust
fn main() {
format!(concat!("abc}"));
}
```
currently produces:
```
error: invalid format string: unmatched `}` found
--> test.rs:2:17
|
2 | format!(concat!("abc}"));
| ^ unmatched `}` in format string
```
which is obviously incorrect. This happens because the span of the entire `concat!()` is combined with the _relative_ location of the unmatched `` `}` `` in the _result_ of the macro invocation (i.e. 4).
In #86085 , this has led to a span that starts or ends in the middle of a multibyte character, but the root cause was the same. This pull request fixes the problem.
2021-06-17 05:54:52 +09:00
Yuki Okushi
7030efbb77
Rollup merge of #85870 - ptrojahn:mir_dump_whitespace, r=davidtwco
...
Allow whitespace in dump_mir filter
At least on my system this is necessary to get more complex filters with spaces like in https://rustc-dev-guide.rust-lang.org/mir/debugging.html working.
2021-06-17 05:54:46 +09:00
Smitty
210e46bf24
Add pattern walking support to THIR walker
2021-06-16 16:36:43 -04:00
bors
a85f584aeb
Auto merge of #86266 - LeSeulArtichaut:box-thir-adt, r=davidtwco
...
Box `thir::ExprKind::Adt` for performance
`Adt` is the biggest variant in the enum and probably isn't used very often compared to the other expr kinds, so boxing it should be beneficial for performance. We need a perf test to be sure.
2021-06-16 20:00:17 +00:00
bors
8daad743c4
Auto merge of #86332 - rylev:fix-ice-docalias, r=GuillaumeGomez
...
Fix ICE when doc aliases were put on function params
Fixes #86239
r? `@GuillaumeGomez`
2021-06-16 10:01:20 +00:00
Yuki Okushi
d828eadd7a
Remove invalid suggestions for assoc consts on placeholder type error
2021-06-16 18:57:53 +09:00
Aris Merchant
f1f1c9b25b
Improve errors for missing Debug and Display impls
2021-06-16 01:13:28 -07:00
Yuki Okushi
280d19395d
Remove projection_ty_from_predicates
2021-06-16 16:33:03 +09:00
bors
2336406b38
Auto merge of #86291 - crlf0710:trait_vtbl_refactor, r=bjorn3
...
Refactor vtable codegen
This refactor the codegen of vtables of miri interpreter, llvm, cranelift codegen backends.
This is preparation for the implementation of trait upcasting feature. cc #65991
Note that aside from code reorganization, there's an internal behavior change here that now InstanceDef::Virtual's index now include the three metadata slots, and now the first method is with index 3.
cc `@RalfJung` `@bjorn3`
2021-06-16 07:20:27 +00:00
Yuki Okushi
c8a8a23a31
Do not emit invalid suggestions on multiple mutable borrow errors
2021-06-16 09:47:37 +09:00
LingMan
e42d5eed31
Stop returning a value from report_assert_as_lint
...
This function only ever returns `None`. Make that explicity by not returning a value at all.
2021-06-16 01:55:05 +02:00
Smitty
4fe4ff95f6
Use better error message for hard errors in CTFE
...
Currently the same message is used for hard errors and soft errors. This
makes hard errors use a message that indicates the reality of the
situation correctly, since usage of the constant is never allowed when
there was a hard error evaluating it.
2021-06-15 19:16:10 -04:00
bors
607d6b00d4
Auto merge of #86321 - JohnTitor:rollup-q61c8q4, r=JohnTitor
...
Rollup of 10 pull requests
Successful merges:
- #80269 (Explain non-dropped sender recv in docs)
- #82179 (Add functions `Duration::try_from_secs_{f32, f64}`)
- #85608 (Stabilize `ops::ControlFlow` (just the type))
- #85792 (Refactor windows sockets impl methods)
- #86220 (Improve maybe_uninit_extra docs)
- #86277 (Remove must_use from ALLOWED_ATTRIBUTES)
- #86285 (⬆️ rust-analyzer)
- #86294 (Stabilize {std, core}::prelude::rust_*.)
- #86306 (Add mailmap entries for myself)
- #86314 (Remove trailing triple backticks in `mut_keyword` docs)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2021-06-15 20:15:23 +00:00
Ryan Levick
5f74ba50bc
Fix ICE when doc aliases were put on function params
2021-06-15 19:01:11 +02:00
bors
12d0849f9d
Auto merge of #85154 - cjgillot:lessfn, r=bjorn3
...
Reduce amount of function pointers in query invocation.
r? `@ghost`
2021-06-15 14:52:58 +00:00
Yuki Okushi
5936ecc24f
Rollup merge of #85608 - scottmcm:stabilize-control-flow-enum-basics, r=m-ou-se
...
Stabilize `ops::ControlFlow` (just the type)
Tracking issue: https://github.com/rust-lang/rust/issues/75744 (which also tracks items *not* closed by this PR).
With the new `?` desugar implemented, [it's no longer possible to mix `Result` and `ControlFlow`](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=13feec97f5c96a9d791d97f7de2d49a6 ). (At the time of making this PR, godbolt was still on the 2021-05-01 nightly, where you can see that [the mixing example compiled](https://rust.godbolt.org/z/13Ke54j16 ).) That resolves the only blocker I know of, so I'd like to propose that `ControlFlow` be considered for stabilization.
Its basic existence was part of https://github.com/rust-lang/rfcs/pull/3058 , where it got a bunch of positive comments (examples [1](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-758277325 ) [2](https://github.com/rust-lang/rfcs/pull/3058#pullrequestreview-592106494 ) [3](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-784444155 ) [4](https://github.com/rust-lang/rfcs/pull/3058#issuecomment-797031584 )). Its use in the compiler has been well received (https://github.com/rust-lang/rust/pull/78182#issuecomment-713695594 ), and there are ecosystem updates interested in using it (https://github.com/rust-itertools/itertools/issues/469#issuecomment-677729589 , https://github.com/jonhoo/rust-imap/issues/194 ).
As this will need an FCP, picking a libs member manually:
r? `@m-ou-se`
## Stabilized APIs
```rust
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ControlFlow<B, C = ()> {
/// Exit the operation without running subsequent phases.
Break(B),
/// Move on to the next phase of the operation as normal.
Continue(C),
}
```
As well as using `?` on a `ControlFlow<B, _>` in a function returning `ControlFlow<B, _>`. (Note, in particular, that there's no `From::from`-conversion on the `Break` value, the way there is for `Err`s.)
## Existing APIs *not* stabilized here
All the associated methods and constants: `break_value`, `is_continue`, `map_break`, [`CONTINUE`](https://doc.rust-lang.org/nightly/std/ops/enum.ControlFlow.html#associatedconstant.CONTINUE ), etc.
Some of the existing methods in nightly seem reasonable, some seem like they should be removed, and some need more discussion to decide. But none of them are *essential*, so [as in the RFC](https://rust-lang.github.io/rfcs/3058-try-trait-v2.html#methods-on-controlflow ), they're all omitted from this PR.
They can be considered separately later, as further usage demonstrates which are important.
2021-06-15 17:40:08 +09:00
bors
6936ca8c99
Auto merge of #86311 - LeSeulArtichaut:cleanup-array-iter, r=jackh726
...
Use the now available implementation of `IntoIterator` for arrays
2021-06-15 07:46:48 +00:00
jam1garner
56108f67b1
Add future_prelude_collision to 2021 compat group
...
* Add to 2021 compatibility group
* Set default to Allow
2021-06-15 01:48:04 -04:00
jam1garner
3efa5b4b83
Emit additional arguments in future_prelude_collision
lint
2021-06-14 22:43:19 -04:00
LeSeulArtichaut
e3ca81fd5a
Use the now available implementation of IntoIterator
for arrays
2021-06-14 23:40:09 +02:00
bors
539d7bd399
Auto merge of #86275 - lqd:ctfe-validation, r=RalfJung
...
Improve CTFE UB validation error messages
As mentioned in https://github.com/rust-lang/rust/pull/86245#discussion_r650494012 this PR slightly improves the formatting of validation errors, to move the path to the error prefix.
From:
`type validation failed: encountered invalid vtable: size is bigger than largest supported object at .0`
To:
`type validation failed at .0: encountered invalid vtable: size is bigger than largest supported object`.
2021-06-14 20:17:02 +00:00
Niko Matsakis
17ab9c0ff9
extract Rust 2021 prelude logic to its own module
2021-06-14 13:59:43 -04:00
Charles Lew
a86d3a7e45
Refactor to make interpreter and codegen backend neutral to vtable internal representation.
2021-06-15 01:59:00 +08:00
Niko Matsakis
8d42f3da63
don't warn for fully qual inherent methods
...
But do continue to warn for trait methods.
2021-06-14 13:27:25 -04:00
jam1garner
64c61a32f6
Fix future_prelude_collision
adding unneeded generic arguments
2021-06-14 13:27:25 -04:00
jam1garner
4a21a0bebc
Fix future_prelude_collision
not maintaining type aliases
2021-06-14 13:27:25 -04:00
jam1garner
cb4999242d
Fix future_prelude_collision
lint breaking for pointer mutabilty coercion
2021-06-14 13:27:24 -04:00
jam1garner
93c60f26bf
Fix missing generic parameters from future_prelude_collision
lint suggestion
2021-06-14 13:27:24 -04:00
jam1garner
327697a540
Fix autoderef and autoref for future_prelude_collision
lint
2021-06-14 13:27:24 -04:00
jam1garner
c41a157b90
Fix incorrect argument description on FnCtxt::resolve_ufcs
2021-06-14 13:27:24 -04:00
jam1garner
35af38353e
Add UI tests for future_prelude_collision
lint
2021-06-14 13:27:24 -04:00
jam1garner
c341d5b9d7
Improve documentation for future_prelude_collision
lint
2021-06-14 13:27:24 -04:00
jam1garner
1626e1938a
Add support for associated functions to future_prelude_collision
lint
2021-06-14 13:27:24 -04:00
jam1garner
a9dc234c43
Add docs for FnCtxt::resolve_ufcs
2021-06-14 13:27:24 -04:00
jam1garner
01bdb8e38a
Disable future_prelude_collision
for 2021 edition
2021-06-14 13:27:24 -04:00
jam1garner
79388aa067
Add future_prelude_collision lint
2021-06-14 13:27:23 -04:00
bors
304441960e
Auto merge of #86117 - ehuss:force-warns-underscore, r=rylev
...
Fix force-warns to allow dashes.
The `--force-warns` flag was not allowing lint names with dashes, only supporting underscores. This changes it to allow dashes to match the behavior of the A/W/D/F flags.
2021-06-14 17:21:28 +00:00
Rémy Rakic
5af1c72513
Adjust throw_validation_failure
macro to shorten the use of with_no_trimmed_paths
2021-06-14 18:57:53 +02:00
Rémy Rakic
19fddc019f
Improve documentation on UndefinedBehaviorInfo::ValidationFailure
2021-06-14 18:57:06 +02:00
Ethan Brierley
b59f7d9662
stabilize int_error_matching
2021-06-14 09:58:32 +01:00
Yuki Okushi
4e755a96a7
Adjust documentation
2021-06-14 07:42:15 +09:00
Yuki Okushi
ea188e9d21
Permit zero non-zero-field on transparent types
2021-06-14 07:42:14 +09:00
Rémy Rakic
87ecf84c36
Improve CTFE validation error message
2021-06-13 22:40:42 +02:00
Shadlock0133
dab89b51ac
Fix typo with custom a custom
-> with a custom
2021-06-13 21:21:45 +02:00
Manuel Drehwald
4dbdcd1c5c
allow loading of llvm plugins on nightly
2021-06-13 18:23:01 +02:00