bjorn3
e62e1d4347
Rustfmt
2022-08-24 17:06:47 +00:00
bors
ebfc7aa531
Auto merge of #100803 - klensy:do-not-encode-preinterned-symbols, r=bjorn3
...
Symbols: do not write string values of preinterned symbols into compiled artifacts
r? `@bjorn3`
Followup for #98851
https://github.com/rust-lang/rust/pull/98851#issuecomment-1215606291
2022-08-24 16:56:32 +00:00
bjorn3
7b9c8c8781
Merge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into sync_cg_clif-2022-08-24
2022-08-24 18:40:58 +02:00
Michael Benfield
12a9914a86
Remove LLVM ARM bug workaround
...
This memset was inserted as a workaround to Rust issue #34427 , which was
an LLVM bug that apparently no longer manifests.
2022-08-24 16:34:33 +00:00
Matthias Krüger
75b1b69171
Rollup merge of #100940 - TaKO8Ki:do-not-suggest-adding-bound-to-opaque-type, r=fee1-dead
...
Do not suggest adding a bound to a opaque type
fixes #100442
2022-08-24 18:20:20 +02:00
Matthias Krüger
8cdf4080c1
Rollup merge of #100919 - sanxiyn:parallel-liveness, r=oli-obk
...
Use par_body_owners for liveness
I did this refactoring while working on something else. Liveness is about bodies, there is no reason to use par_for_each_module here.
Tests are updated because things are visited in a different order. I checked diagnostics are same, just in a different (and IMO, better) order.
2022-08-24 18:20:15 +02:00
Matthias Krüger
95135bed61
Rollup merge of #100906 - ChayimFriedman2:map-index-mut, r=davidtwco
...
Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing
The error can be quite confusing to newcomers.
Fixes #100873 .
I'm not so sure about the message, open to wording suggestions.
2022-08-24 18:20:13 +02:00
Matthias Krüger
1c0f60f904
Rollup merge of #100901 - TaKO8Ki:make-some-methods-private, r=sanxiyn
...
Make some methods private
2022-08-24 18:20:12 +02:00
Matthias Krüger
0fcabec620
Rollup merge of #100888 - spastorino:coherence-negative-impls-implied-bounds, r=lcnr
...
Coherence negative impls implied bounds
Fixes #93875
This PR is rebased on top of #100789 and it would need to include that one which is already r+ed.
r? ``@nikomatsakis``
cc ``@lcnr`` (which I've talked about 3222f420d9 , I guess after you finish your reordering of modules and work with OutlivesEnvironmentEnv this commit can just be reverted).
2022-08-24 18:20:11 +02:00
Matthias Krüger
f8e128f8ad
Rollup merge of #100826 - vincenzopalazzo:macros/wrong_sugg_with_positional_arg, r=TaKO8Ki
...
sugg: take into count the debug formatting
Closes https://github.com/rust-lang/rust/issues/100648
This PR will fix a suggestion error by taking into consideration also the `:?` symbol and act in a different way
``@rustbot`` r? ``@compiler-errors``
N.B: I did not find a full way to test the change, any idea?
2022-08-24 18:20:09 +02:00
Matthias Krüger
bc05045a01
Rollup merge of #99993 - petrochenkov:linkdated, r=bjorn3
...
linker: Update some outdated comments
r? ``@bjorn3``
2022-08-24 18:20:07 +02:00
IQuant
e1765a9c56
Remove commented lines
2022-08-24 17:09:07 +03:00
Nikita Tomashevich
3fae3904b1
Use IntoDiagnosticArg where it makes sense
2022-08-24 15:46:29 +03:00
Joshua Nelson
b061550ed3
Remove the $tcx:tt parameter from rustc_query_description
...
It's unnecessary.
2022-08-24 00:37:49 -05:00
Joshua Nelson
7b8e2a52ff
Simplify the syntax for macros generated by rustc_queries
...
- Disallow multiple macros callbacks in the same invocation. In practice, this was never used.
- Remove the `[]` brackets around the macro name
- Require an `ident`, not an arbitrary `tt`
2022-08-24 00:37:49 -05:00
Nicholas Nethercote
5a41eb81ca
Add some more THIR size assertions.
2022-08-24 15:06:50 +10:00
Nicholas Nethercote
e3755c1d54
Rename thir::Adt as thir::AdtExpr.
...
This matches the naming scheme used elsewhere, e.g. in the AST, and
avoids name clashes with the `ExprKind::Closure` variant.
2022-08-24 15:06:50 +10:00
Nicholas Nethercote
e57ac764b8
Box thir::ExprKind::InlineAsm.
...
This shrinks `thir::Expr`.
2022-08-24 15:06:50 +10:00
Nicholas Nethercote
b3245a8dff
Box thir::ExprKind::Closure.
...
This shrinks `thir::Expr`.
2022-08-24 15:06:50 +10:00
Nicholas Nethercote
2df805fc7a
Store blocks in Thir.
...
Like expressions, statements, and match arms. This shrinks `thir::Stmt`
and is a precursor to further shrinking `thir::Expr`.
2022-08-24 15:06:44 +10:00
Nicholas Nethercote
e7c25c3a97
Box user_ty fields in thir::ExprKind.
...
This shrinks several large variants of `ExprKind`.
2022-08-24 14:16:09 +10:00
Joshua Nelson
e188868014
get rid of another unnecessary lifetime macro argument
2022-08-23 21:52:29 -05:00
Joshua Nelson
0bedd354ca
Move most of make_query into a generic function, away from the macro
...
This should both make the code easier to read and also greatly reduce the amount of codegen
the compiler has to do, since it only needs to monomorphize `create_query_frame` for each
new key and not for each query.
2022-08-23 21:52:29 -05:00
Takayuki Maeda
3855e039a2
do not suggest adding a bound to a opaque type
2022-08-24 11:34:14 +09:00
Joshua Nelson
1de08b19d1
Get rid of some usages of query_keys
...
Rustdoc documents these with the name of the type alias instead of normalizing them to the underlying type.
Use associated types instead so that the generated docs for nightly-rustc are easier to read.
2022-08-23 21:33:52 -05:00
Joshua Nelson
b53761969f
Remove $tcx metavariable from rustc_query_append
...
It's not actually necessary and it makes the code harder to read.
2022-08-23 21:33:19 -05:00
Joshua Nelson
31e39446ec
Stabilize #![feature(label_break_value)]
...
# Stabilization proposal
The feature was implemented in https://github.com/rust-lang/rust/pull/50045 by est31 and has been in nightly since 2018-05-16 (over 4 years now).
There are [no open issues][issue-label] other than the tracking issue. There is a strong consensus that `break` is the right keyword and we should not use `return`.
There have been several concerns raised about this feature on the tracking issue (other than the one about tests, which has been fixed, and an interaction with try blocks, which has been fixed).
1. nrc's original comment about cost-benefit analysis: https://github.com/rust-lang/rust/issues/48594#issuecomment-422235234
2. joshtriplett's comments about seeing use cases: https://github.com/rust-lang/rust/issues/48594#issuecomment-422281176
3. withoutboats's comments that Rust does not need more control flow constructs: https://github.com/rust-lang/rust/issues/48594#issuecomment-450050630
Many different examples of code that's simpler using this feature have been provided:
- A lexer by rpjohnst which must repeat code without label-break-value: https://github.com/rust-lang/rust/issues/48594#issuecomment-422502014
- A snippet by SergioBenitez which avoids using a new function and adding several new return points to a function: https://github.com/rust-lang/rust/issues/48594#issuecomment-427628251 . This particular case would also work if `try` blocks were stabilized (at the cost of making the code harder to optimize).
- Several examples by JohnBSmith: https://github.com/rust-lang/rust/issues/48594#issuecomment-434651395
- Several examples by Centril: https://github.com/rust-lang/rust/issues/48594#issuecomment-440154733
- An example by petrochenkov where this is used in the compiler itself to avoid duplicating error checking code: https://github.com/rust-lang/rust/issues/48594#issuecomment-443557569
- Amanieu recently provided another example related to complex conditions, where try blocks would not have helped: https://github.com/rust-lang/rust/issues/48594#issuecomment-1184213006
Additionally, petrochenkov notes that this is strictly more powerful than labelled loops due to macros which accidentally exit a loop instead of being consumed by the macro matchers: https://github.com/rust-lang/rust/issues/48594#issuecomment-450246249
nrc later resolved their concern, mostly because of the aforementioned macro problems.
joshtriplett suggested that macros could be able to generate IR directly
(https://github.com/rust-lang/rust/issues/48594#issuecomment-451685983 ) but there are no open RFCs,
and the design space seems rather speculative.
joshtriplett later resolved his concerns, due to a symmetry between this feature and existing labelled break: https://github.com/rust-lang/rust/issues/48594#issuecomment-632960804
withoutboats has regrettably left the language team.
joshtriplett later posted that the lang team would consider starting an FCP given a stabilization report: https://github.com/rust-lang/rust/issues/48594#issuecomment-1111269353
[issue-label]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AF-label_break_value+
## Report
+ Feature gate:
- d695a497bb/src/test/ui/feature-gates/feature-gate-label_break_value.rs
+ Diagnostics:
- 6b2d3d5f3c/compiler/rustc_parse/src/parser/diagnostics.rs (L2629)
- f65bf0b2bb/compiler/rustc_resolve/src/diagnostics.rs (L749)
- f65bf0b2bb/compiler/rustc_resolve/src/diagnostics.rs (L1001)
- 111df9e6ed/compiler/rustc_passes/src/loops.rs (L254)
- d695a497bb/compiler/rustc_parse/src/parser/expr.rs (L2079)
- d695a497bb/compiler/rustc_parse/src/parser/expr.rs (L1569)
+ Tests:
- https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_continue.rs
- https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_unlabeled_break.rs
- https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_illegal_uses.rs
- https://github.com/rust-lang/rust/blob/master/src/test/ui/lint/unused_labels.rs
- https://github.com/rust-lang/rust/blob/master/src/test/ui/run-pass/for-loop-while/label_break_value.rs
## Interactions with other features
Labels follow the hygiene of local variables.
label-break-value is permitted within `try` blocks:
```rust
let _: Result<(), ()> = try {
'foo: {
Err(())?;
break 'foo;
}
};
```
label-break-value is disallowed within closures, generators, and async blocks:
```rust
'a: {
|| break 'a
//~^ ERROR use of unreachable label `'a`
//~| ERROR `break` inside of a closure
}
```
label-break-value is disallowed on [_BlockExpression_]; it can only occur as a [_LoopExpression_]:
```rust
fn labeled_match() {
match false 'b: { //~ ERROR block label not supported here
_ => {}
}
}
macro_rules! m {
($b:block) => {
'lab: $b; //~ ERROR cannot use a `block` macro fragment here
unsafe $b; //~ ERROR cannot use a `block` macro fragment here
|x: u8| -> () $b; //~ ERROR cannot use a `block` macro fragment here
}
}
fn foo() {
m!({});
}
```
[_BlockExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/block-expr.html
[_LoopExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/loop-expr.html
2022-08-23 21:14:12 -05:00
SparrowLii
cbc6bd2019
add depth_limit in QueryVTable
2022-08-24 09:42:12 +08:00
Nicholas Nethercote
c9429b1cec
Define index types within thir_with_elements.
...
The macro already generates other stuff, might as well generate these
index types as well.
2022-08-24 11:37:56 +10:00
bors
87991d5f5d
Auto merge of #100675 - Xiretza:fluent-mandate-crate-prefix, r=davidtwco
...
fluent: mandate slug names to be prefixed by crate name
This is currently only convention, but not actively checked for.
Additionally, improve error messages to highlight the path of the offending fluent file rather than the identifier preceding it.
This will conflict with #100671 , so I'll leave it as draft until that's merged.
2022-08-23 22:30:07 +00:00
Vincenzo Palazzo
3d8c7d2c0a
sugg: take into count the debug formatting
...
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com >
2022-08-23 21:57:30 +00:00
David Wood
c18503f3ff
errors: IntoDiagnosticArg for io::Error/paths
...
Add impls of `IntoDiagnosticArg` for `std::io::Error`, `std::path::Path`
and `std::path::PathBuf`.
Signed-off-by: David Wood <david.wood@huawei.com >
2022-08-24 06:50:44 +09:00
Wonchul Lee
9b95eef6ea
save_analysis: Migrate diagnostics
2022-08-24 06:50:16 +09:00
Camille GILLOT
389c6041a4
Only compute captures once when building MIR.
2022-08-23 22:24:43 +02:00
Jack Wrenn
1d844fe629
safe transmute: use FxIndex{Map,Set} instead of FxHash{Map,Set}
...
resolves query instability issues, and probably better for performance
2022-08-23 15:52:49 +00:00
Maybe Waffle
53565b23ac
Make use of [wrapping_]byte_{add,sub}
...
...replacing `.cast().wrapping_offset().cast()` & similar code.
2022-08-23 19:32:37 +04:00
Chayim Refael Friedman
b0255a1849
Suggest alternatives when trying to mutate a HashMap/BTreeMap via indexing
...
The error can be quite confusing to newcomers.
2022-08-23 15:15:34 +00:00
Dylan DPC
28ead17745
Rollup merge of #100909 - nnethercote:minor-ast-LitKind-improvement, r=petrochenkov
...
Minor `ast::LitKind` improvements
r? `@petrochenkov`
2022-08-23 20:40:09 +05:30
Dylan DPC
12c1ac0a67
Rollup merge of #100907 - Nilstrieb:unrachable-typo-lol, r=Dylan-DPC
...
Fix typo in UnreachableProp
r? ``@Dylan-DPC``
2022-08-23 20:40:08 +05:30
Dylan DPC
fd93ab43ef
Rollup merge of #100857 - camsteffen:query-parse-refactor, r=davidtwco
...
Refactor query modifier parsing
Reduce redundancy and improve error spans.
2022-08-23 20:40:07 +05:30
Dylan DPC
110d8d99b2
Rollup merge of #100851 - Alexendoo:rpf-width-prec-spans, r=fee1-dead
...
Fix rustc_parse_format precision & width spans
When a `precision`/`width` was `CountIsName - {:name$}` or `CountIs - {:10}` the `precision_span`/`width_span` was set to `None`
For `width` the name span in `CountIsName(_, name_span)` had its `.start` off by one
r? ``@fee1-dead`` / cc ``@PrestonFrom`` since this is similar to #99987
2022-08-23 20:40:06 +05:30
Dylan DPC
35f2d125ca
Rollup merge of #100768 - Facel3ss1:plugin-impl-translation, r=davidtwco
...
Migrate `rustc_plugin_impl` to `SessionDiagnostic`
Migration of the `rustc_plugin_impl` crate.
~Draft PR because it is blocked on #100694 for `#[fatal(...)]` support~ (this has been merged, and I've changed over to `#[diag(...)]` now too), but I would also like to know if what I did with `LoadPluginError` is okay, because all it does is display the error message from `libloading` ([See conversation on zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.23100717.20diagnostic.20translation/near/294327843 )). This crate is apparently for a deprecated feature which is used by servo, so I don't know how much this matters anyway.
2022-08-23 20:40:04 +05:30
Dylan DPC
f42cdf76e1
Rollup merge of #100368 - chenyukang:fix-100321, r=lcnr
...
InferCtxt tainted_by_errors_flag should be Option<ErrorGuaranteed>
Fixes #100321 .
Use Cell<Option<ErrorGuaranteed>> to guarantee that we emit an error when that flag is set.
2022-08-23 20:40:03 +05:30
Dylan DPC
8733550870
Rollup merge of #100309 - compiler-errors:issue-100300, r=sanxiyn
...
Extend comma suggestion to cases where fields arent missing
Fixes #100300
2022-08-23 20:40:02 +05:30
Dylan DPC
4d1c273b32
Rollup merge of #99249 - cjgillot:no-reparse-fn, r=fee1-dead
...
Do not re-parse function signatures to suggest generics
This PR uses the existing resolution rib infrastructure to channel the correct span information to suggest generic parameters. This allows to avoid re-parsing a function's source code.
Drive-by cleanup: this removes useless `FnItemRibKind` from late resolution ribs. All the use cases are already covered by `ItemRibKind` and `AssocItemRibKind` which have more precise semantics.
2022-08-23 20:40:01 +05:30
Rejyr
1693993d8f
cleanup: commented lints
2022-08-23 10:41:02 -04:00
5225225
f20cc9ae4e
Rename rustc_mir_dataflow diagnostic to mir_dataflow
2022-08-23 13:48:15 +01:00
Nikita Tomashevich
74f9973824
Fix formating in infer.ftl to make tidy happy
2022-08-23 15:33:06 +03:00
5225225
7f125ed7d5
Remove full stop in diagnostic message
2022-08-23 13:18:45 +01:00
Ralf Jung
cb4cd73664
extra sanity check against consts pointing to mutable memory
2022-08-23 08:12:37 -04:00