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
345c42a2d6
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
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
Josh Stone
9e5bc44be4
ci: Upgrade android containers from ubuntu:16.04 to 22.04
2022-08-23 17:05:45 -07:00
Benoît du Garreau
3aa6fe376d
Remove a packing branch from fmt::builders::PadAdapter
2022-08-24 01:21:40 +02: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
b33002d5ff
Auto merge of #9366 - Alexendoo:manual_string_new, r=xFrednet
...
Rename `manual_empty_string_creation` and move to pedantic
Renames it to `manual_string_new` and moves it to the pedantic category
Pedantic because it's a fairly minor style change but could be very noisy
changelog: *doesn't need its own entry, but remember to s/manual_empty_string_creation/manual_string_new/ the changelog entry for #9295*
r? `@xFrednet` to get it in before the upcoming sync as this isn't a `cargo dev rename_lint` style rename
2022-08-23 21:00:03 +00:00
Josh Stone
b96cde7cba
test: bump the mobile width in rustdoc-gui/type-declation-overflow.goml
2022-08-23 13:00:18 -07:00
Josh Stone
4a5082e91e
ci: Test rustdoc-gui with --jobs 1
2022-08-23 13:00:18 -07:00
Josh Stone
2fd82bbfe5
ci: upgrade Node.js in x86_64-gnu-tools
2022-08-23 13:00:18 -07:00
Josh Stone
6d7083227c
ci: Test rustdoc-gui with --no-sandbox
2022-08-23 13:00:18 -07:00
Josh Stone
d3f2d0cae0
rustbuild: fix version parsing for browser-ui-test
2022-08-23 13:00:18 -07:00
Josh Stone
2ead65f002
ci: Upgrade non-dist Linux testers from 16.04 to 22.04
2022-08-23 13:00:18 -07: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
bors
e3dc5a588f
Auto merge of #13101 - Veykril:sem-tokens, r=jonas-schievink
...
internal: Re-export standard semantic token types and mods
Should help in preventing future occurences of #13099 by having all token types and mods come through the same place
2022-08-23 16:24:39 +00: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
Lukas Wirth
715e3fc119
Re-export standard semantic token types and mods
2022-08-23 18:06:32 +02:00
bjorn3
f9d60cf551
Do asm compilation and object file emission in parallel
2022-08-23 16:05:29 +00:00
bors
1456b80167
Auto merge of #13100 - jonas-schievink:doc-links-on-impl, r=jonas-schievink
...
fix: Resolve doc links on impl blocks
Fixes https://github.com/rust-lang/rust-analyzer/issues/13089
2022-08-23 15:57:12 +00: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
Jonas Schievink
322e7060de
Resolve doc links on impl blocks
2022-08-23 17:50:45 +02:00
bors
8dcf4c70c4
Auto merge of #13099 - jonas-schievink:add-decorator-token, r=jonas-schievink
...
fix: Register decorator token type to avoid panic
Followup to https://github.com/rust-lang/rust-analyzer/pull/13084
2022-08-23 15:47:21 +00:00
Jonas Schievink
5804412869
Register decorator token type to avoid panic
2022-08-23 17:46:29 +02:00
bjorn3
1a0dfb399c
Add a jobserver based concurrency limiter
2022-08-23 15:44:39 +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
bjorn3
5896e5cdfa
Store symbol name as owned string
2022-08-23 15:23:56 +00:00