Skip to content

Commit 66099cd

Browse files
committed
Don't trim non-parenthesis spans in unused_parens for bounds
`poly_trait_ref.parens` only records that the parser saw parentheses around a trait-object/impl-trait bound; it does not guarantee that the bound's span actually points at those parentheses in the source. A proc-macro can synthesize the parentheses while reusing an unrelated span from its input, so the span may not be wrapped in parentheses at all. Previously the lint unconditionally trimmed the first and last byte of the span to build the "remove these parentheses" suggestion. On such reused spans this produced an invalid suggestion (e.g. rewriting a field `val: u8` to `al: u`) and could even ICE when the span started or ended on a multibyte character. Only emit the lint when the source text at the span really is wrapped in parentheses.
0 parents  commit 66099cd

60,053 files changed

Lines changed: 6067885 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BasedOnStyle: LLVM

.editorconfig

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
indent_style = space
13+
indent_size = 4
14+
15+
[*.css]
16+
indent_style = tab
17+
18+
# some tests need trailing whitespace in output snapshots
19+
[tests/**]
20+
trim_trailing_whitespace = false
21+
# for actual source code files of test, we still don't want trailing whitespace
22+
[tests/**.{rs,js}]
23+
trim_trailing_whitespace = true
24+
# these specific source files need to have trailing whitespace.
25+
[tests/ui/{frontmatter/frontmatter-whitespace-3.rs,parser/shebang/shebang-space.rs}]
26+
trim_trailing_whitespace = false
27+
28+
[src/llvm-project]
29+
indent_style = unset
30+
indent_size = unset
31+
32+
[*.rs]
33+
max_line_length = 100
34+
35+
[*.md]
36+
# double whitespace at end of line
37+
# denotes a line break in Markdown
38+
trim_trailing_whitespace = false
39+
40+
[*.yml]
41+
indent_size = 2
42+
43+
[Makefile]
44+
indent_style = tab

.git-blame-ignore-revs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Use `git config blame.ignorerevsfile .git-blame-ignore-revs` to make `git blame` ignore the following commits.
2+
3+
# format the world
4+
a06baa56b95674fc626b3c3fd680d6a65357fe60
5+
# format libcore
6+
95e00bfed801e264e9c4ac817004153ca0f19eb6
7+
# reformat with new rustfmt
8+
971c549ca334b7b7406e61e958efcca9c4152822
9+
# refactor infcx building
10+
283abbf0e7d20176f76006825b5c52e9a4234e4c
11+
# format libstd/sys
12+
c34fbfaad38cf5829ef5cfe780dc9d58480adeaa
13+
# move tests
14+
cf2dff2b1e3fa55fa5415d524200070d0d7aacfe
15+
# Run rustfmt on bootstrap
16+
b39a1d6f1a30ba29f25d7141038b9a5bf0126e36
17+
# reorder fluent message files
18+
f97fddab91fbf290ea5b691fe355d6f915220b6e
19+
# format let-else
20+
cc907f80b95c6ec530c5ee1b05b044a468f07eca
21+
# format let-chains
22+
b2d2184edea578109a48ec3d8decbee5948e8f35
23+
# test directives migration
24+
6e48b96692d63a79a14563f27fe5185f122434f8
25+
ec2cc761bc7067712ecc7734502f703fe3b024c8
26+
# format use declarations
27+
84ac80f1921afc243d71fd0caaa4f2838c294102
28+
# bless mir-opt tests to add `copy`
29+
99cb0c6bc399fb94a0ddde7e9b38e9c00d523bad
30+
# reformat with rustfmt edition 2024
31+
c682aa162b0d41e21cc6748f4fecfe01efb69d1f
32+
# reformat with updated edition 2024
33+
1fcae03369abb4c2cc180cd5a49e1f4440a81300
34+
# Breaking up of compiletest runtest.rs
35+
60600a6fa403216bfd66e04f948b1822f6450af7

.gitattributes

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[attr]rust text eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4
2+
3+
* text=auto eol=lf
4+
*.cpp rust
5+
*.h rust
6+
*.rs rust diff=rust
7+
*.fixed linguist-language=Rust
8+
*.pp linguist-language=Rust
9+
*.mir linguist-language=Rust
10+
src/etc/installer/gfx/* binary
11+
src/vendor/** -text
12+
Cargo.lock linguist-generated=false
13+
14+
# Older git versions try to fix line endings on images and fonts, this prevents it.
15+
*.png binary
16+
*.ico binary
17+
*.woff binary
18+
*.woff2 binary

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: rustfoundation
2+
custom: ["rust-lang.org/funding"]
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: Bootstrap (Rust Build System) Report
3+
about: Issues encountered on bootstrap build system
4+
labels: C-bug, T-bootstrap
5+
---
6+
7+
<!--
8+
Thank you for submitting a bootstrap report! Please provide detailed information to help us reproduce and diagnose the issue.
9+
-->
10+
11+
### Summary
12+
13+
<!--
14+
Provide a brief description of the problem you are experiencing.
15+
-->
16+
17+
### Command used
18+
19+
```sh
20+
<command>
21+
```
22+
23+
### Expected behaviour
24+
25+
<!--
26+
Describe what you expected to happen.
27+
-->
28+
29+
### Actual behaviour
30+
31+
<!--
32+
Describe what actually happened.
33+
-->
34+
35+
### Bootstrap configuration (bootstrap.toml)
36+
```toml
37+
<config>
38+
```
39+
40+
### Operating system
41+
42+
<!--
43+
e.g., Ubuntu 22.04, macOS 12, Windows 10
44+
-->
45+
46+
### HEAD
47+
48+
<!--
49+
Output of `git rev-parse HEAD` command, or content of the `git-commit-hash` file if using a tarball source.
50+
-->
51+
52+
### Additional context
53+
<!--
54+
Include any other relevant information (e.g., if you have custom patches or modifications on the project).
55+
-->
56+
57+
58+
<!--
59+
Include the complete build log in the section below.
60+
Enable backtrace and verbose mode if possible for more detailed information e.g., with `RUST_BACKTRACE=1 ./x build -v`.
61+
-->
62+
<details><summary>Build Log</summary>
63+
<p>
64+
65+
```txt
66+
<log>
67+
```
68+
69+
</p>
70+
</details>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Bug Report
3+
about: Create a bug report for Rust.
4+
labels: C-bug
5+
---
6+
<!--
7+
Thank you for filing a bug report! 🐛 Please provide a short summary of the bug,
8+
along with any information you feel relevant to replicating the bug.
9+
-->
10+
11+
I tried this code:
12+
13+
```rust
14+
<code>
15+
```
16+
17+
I expected to see this happen: *explanation*
18+
19+
Instead, this happened: *explanation*
20+
21+
### Meta
22+
<!--
23+
If you're using the stable version of the compiler, you should also check if the
24+
bug also exists in the beta or nightly versions.
25+
-->
26+
27+
`rustc --version --verbose`:
28+
```
29+
<version>
30+
```
31+
32+
<!--
33+
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
34+
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
35+
-->
36+
<details><summary>Backtrace</summary>
37+
<p>
38+
39+
```
40+
<backtrace>
41+
```
42+
43+
</p>
44+
</details>

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
blank_issues_enabled: true
2+
contact_links:
3+
- name: Question
4+
url: https://users.rust-lang.org
5+
about: Please ask and answer questions about Rust on the user forum.
6+
- name: Feature Request
7+
url: https://internals.rust-lang.org/
8+
about: Please discuss language feature requests on the internals forum.
9+
- name: Clippy Bug
10+
url: https://github.com/rust-lang/rust-clippy/issues/new/choose
11+
about: Please report Clippy bugs such as false positives in the Clippy repo.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Diagnostic issue
2+
description: Create a bug report or feature request for a change to `rustc`'s error output
3+
labels: ["A-diagnostics", "T-compiler"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thank you for filing a diagnostics bug report! 🐛
9+
10+
Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug.
11+
12+
If you cannot produce a minimal reproduction case (something that would work in isolation), please provide the steps or even link to a repository that causes the problematic output to occur.
13+
- type: textarea
14+
id: code
15+
attributes:
16+
label: Code
17+
description: Please provide code that can reproduce the problem
18+
placeholder: code
19+
render: Rust
20+
validations:
21+
required: true
22+
- type: textarea
23+
id: output
24+
attributes:
25+
label: Current output
26+
description: Please provide the `rustc` output you see
27+
placeholder: rustc output
28+
render: Shell
29+
validations:
30+
required: true
31+
- type: textarea
32+
id: desired-output
33+
attributes:
34+
label: Desired output
35+
description: Please provide what the output *should* be
36+
placeholder: proposed output
37+
render: Shell
38+
validations:
39+
required: false
40+
- type: textarea
41+
id: rationale
42+
attributes:
43+
label: Rationale and extra context
44+
description: If the problem is not self-explanatory, please provide a rationale for the change.
45+
validations:
46+
required: false
47+
- type: textarea
48+
id: other-output
49+
attributes:
50+
label: Other cases
51+
description: If dramatically different output is caused by small changes, consider also adding them here.
52+
render: Rust
53+
validations:
54+
required: false
55+
- type: textarea
56+
id: version
57+
attributes:
58+
label: Rust Version
59+
description: Please provide the `rustc` version, `rustc --version --verbose`. Make sure that you're using the latest version of the compiler, and not an outdated stable or nightly release!
60+
placeholder: |
61+
$ rustc --version --verbose
62+
rustc 1.XX.Y (SHORTHASH DATE)
63+
binary: rustc
64+
commit-hash: LONGHASHVALUE
65+
commit-date: DATE
66+
host: PLATFORMTRIPLE
67+
release: 1.XX.Y
68+
LLVM version: XX.YY.ZZ
69+
render: Shell
70+
validations:
71+
required: true
72+
- type: textarea
73+
id: extra
74+
attributes:
75+
label: Anything else?
76+
description: If you have more details you want to give us to reproduce this issue, please add it here
77+
validations:
78+
required: false
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Documentation problem
2+
description: Report an issue with documentation content.
3+
labels: ["A-docs"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thank you for finding a documentation problem! 📚
9+
10+
Documentation problems might be grammatical issues, typos, or unclear wording, please provide details regarding the documentation including where it is present.
11+
12+
Note: If your issue is for one of these, please use their dedicated issue tracker instead:
13+
- [The Rust Book](https://github.com/rust-lang/book/issues)
14+
- [Rust by Example](https://github.com/rust-lang/rust-by-example/issues)
15+
- [The Edition Guide](https://github.com/rust-lang/edition-guide/issues)
16+
- [The Cargo Book](https://github.com/rust-lang/cargo/issues)
17+
- [The Clippy Book](https://github.com/rust-lang/rust-clippy/issues)
18+
- [The Reference](https://github.com/rust-lang/reference/issues)
19+
- [The Rustonomicon](https://github.com/rust-lang/nomicon/issues)
20+
- [The Embedded Book](https://github.com/rust-embedded/book/issues)
21+
22+
Or, if you find an issue related to rustdoc (e.g. doctest, rustdoc UI), please use the rustdoc issue template instead.
23+
24+
All other documentation issues should be filed here.
25+
26+
- type: textarea
27+
id: location
28+
attributes:
29+
label: Location (URL)
30+
validations:
31+
required: true
32+
33+
- type: textarea
34+
id: summary
35+
attributes:
36+
label: Summary
37+
validations:
38+
required: true

0 commit comments

Comments
 (0)