Guillaume Gomez
097b3823dd
Unify rightside rendering
2022-08-24 15:10:26 +02:00
Josh Triplett
3c8618fd82
Update write!
docs: can now import traits as _
to avoid conflicts
2022-08-24 14:42:25 +02:00
Josh Triplett
a7886506ad
Remove some documentation duplicated between writeln!
and write!
...
`writeln!` already includes a reference to `write!` for more
information, so remove duplicated information.
2022-08-24 14:41:22 +02:00
bjorn3
293223d0cf
Tune drop_excess_capacity
2022-08-24 12:22:01 +02: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
bors
4a24f08ba4
Auto merge of #100942 - ehuss:update-cargo, r=ehuss
...
Update cargo
7 commits in 9809f8ff33c2b998919fd0432c626f0f7323697a..6da726708a4406f31f996d813790818dce837161
2022-08-16 22:10:06 +0000 to 2022-08-23 21:39:56 +0000
- Update non-ASCII crate name warning message (rust-lang/cargo#11017 )
- Add more tests for aggressive or precise update (rust-lang/cargo#11011 )
- Ignore broken but excluded file during traversing (rust-lang/cargo#11008 )
- Improve error message for wrong target names (rust-lang/cargo#10999 )
- Bump snapbox to 0.3 (rust-lang/cargo#11005 )
- remove missed reference to workspace inheritance in unstable.md (rust-lang/cargo#11001 )
- Warning when precise or aggressive without -p flag (rust-lang/cargo#10988 )
2022-08-24 05:34:43 +00:00
Takayuki Maeda
56f9e29d2a
add a missing test case for impl generic mismatch
2022-08-24 14:09:55 +09: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
Eric Huss
6e4603e09f
Update cargo
2022-08-23 20:58:12 -07: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
25ea5a36c6
Auto merge of #96869 - sunfishcode:main, r=joshtriplett
...
Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8.
Add a `is_known_utf8` flag to `Wtf8Buf`, which tracks whether the
string is known to contain UTF-8. This is efficiently computed in many
common situations, such as when a `Wtf8Buf` is constructed from a `String`
or `&str`, or with `Wtf8Buf::from_wide` which is already doing UTF-16
decoding and already checking for surrogates.
This makes `OsString::into_string` O(1) rather than O(N) on Windows in
common cases.
And, it eliminates the need to scan through the string for surrogates in
`Args::next` and `Vars::next`, because the strings are already being
translated with `Wtf8Buf::from_wide`.
Many things on Windows construct `OsString`s with `Wtf8Buf::from_wide`,
such as `DirEntry::file_name` and `fs::read_link`, so with this patch,
users of those functions can subsequently call `.into_string()` without
paying for an extra scan through the string for surrogates.
r? `@ghost`
2022-08-24 01:17:52 +00:00
Michael Howell
b1925b811e
rustdoc: remove unused CSS rule
...
According to [blame], this rule was added to support enum struct
variants. However, enum struct variants don't use tables in their design
any more, so this rule does nothing.
[blame]: 87991d5f5d/src/librustdoc/html/static/css/rustdoc.css (L748)
2022-08-23 18:15:53 -07:00
Benoît du Garreau
289d7cca1d
Reduce code size of assert_matches_failed
2022-08-24 00:56:04 +02: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
Josh Stone
4eb748bf39
Use --userns=keep-id
when "docker" is really podman
...
Rootless podman creates a separate user namespace, where an inner
`LOCAL_USER_ID` will map to a different subuid range on the host.
The "keep-id" mode maps the current UID directly into the container.
This makes `src/ci/docker/run.sh` work better for testing container
images on systems running podman, where "docker" is just a shim.
2022-08-23 15:10:36 -07: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
bors
060e47f74a
Auto merge of #99917 - yaahc:error-in-core-move, r=thomcc
...
Move Error trait into core
This PR moves the error trait from the standard library into a new unstable `error` module within the core library. The goal of this PR is to help unify error reporting across the std and no_std ecosystems, as well as open the door to integrating the error trait into the panic reporting system when reporting panics whose source is an errors (such as via `expect`).
This PR is a rewrite of https://github.com/rust-lang/rust/pull/90328 using new compiler features that have been added to support error in core.
2022-08-23 19:48:55 +00:00
Guillaume Gomez
4398d9229a
Fix links to error codes
2022-08-23 21:47:31 +02:00
Guillaume Gomez
c664a36033
Handle error code hash by redirecting to the correct error code page
2022-08-23 21:44:29 +02:00
Tushar Dahiya
9397b6c38d
Update README.md
2022-08-23 23:27:23 +05:30
est31
754b3e7567
Change hint to correct path
2022-08-23 19:06:27 +02:00
est31
0a6af989f6
Simplify unicode_downloads.rs
...
Reduce duplication by moving fetching logic into a dedicated function.
2022-08-23 19:04:07 +02:00
bjorn3
f71c545746
Make sure to count reused cgus towards the count of jobs done
2022-08-23 16:51:06 +00:00
est31
6a1f7afd2f
Use direct pointer to filter_dirs function
2022-08-23 18:47:29 +02:00
bjorn3
5b4195669e
Add some self profiler calls
2022-08-23 16:32:38 +00:00
bjorn3
d081c20273
Compile functions from clif ir to object code in parallel
2022-08-23 16:32:38 +00:00
bjorn3
1a6323313b
Use correct CguReuse variant
2022-08-23 16:32:20 +00:00
Guillaume Gomez
8ad36c45f8
Rewrite error index generator to greatly reduce the size of the pages
2022-08-23 18:27:18 +02:00
Chayim Refael Friedman
eb2fdd917e
Add a warning about Option/Result::and()
being eagerly evaluated
...
Copied from `or()`.
2022-08-23 16:15:09 +00:00
bjorn3
f9d60cf551
Do asm compilation and object file emission in parallel
2022-08-23 16:05:29 +00:00
bjorn3
1a0dfb399c
Add a jobserver based concurrency limiter
2022-08-23 15:44:39 +00:00
bjorn3
5896e5cdfa
Store symbol name as owned string
2022-08-23 15:23:56 +00: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
bors
a1bea1551b
Auto merge of #100920 - Dylan-DPC:rollup-vlcw3sr, r=Dylan-DPC
...
Rollup of 9 pull requests
Successful merges:
- #99249 (Do not re-parse function signatures to suggest generics)
- #100309 (Extend comma suggestion to cases where fields arent missing)
- #100368 (InferCtxt tainted_by_errors_flag should be Option<ErrorGuaranteed>)
- #100768 (Migrate `rustc_plugin_impl` to `SessionDiagnostic`)
- #100835 (net listen backlog update, follow-up from #97963.)
- #100851 (Fix rustc_parse_format precision & width spans)
- #100857 (Refactor query modifier parsing)
- #100907 (Fix typo in UnreachableProp)
- #100909 (Minor `ast::LitKind` improvements)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-23 15:12:09 +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