Commit Graph

206703 Commits

Author SHA1 Message Date
bjorn3
a3cc67c796 Remove unused target_cpu and tune_cpu methods from ExtraBackendMethods 2022-10-01 16:45:33 +00:00
bjorn3
c431ea681c Remove several unused methods from MiscMethods 2022-10-01 16:45:07 +00:00
bjorn3
7c91ec4652 Remove unused Context assoc type from WriteBackendMethods 2022-10-01 16:34:45 +00:00
Nikita Popov
49eaa0f6ac Mark Cell::replace() as #[inline] 2022-10-01 17:30:54 +02:00
Matthias Krüger
51e2f03af2
Rollup merge of #102533 - notriddle:notriddle/a-source, r=Dylan-DPC
rustdoc: remove unused CSS selector `a.source`

The link with this class attribute was removed in 4d16de01d0 (diff-3fe025bd3bd6b48044d0bd8d8c3122de5ecdb1dcd72a9dbe3c24430883595012L1281-R1324)
2022-10-01 16:45:05 +02:00
Matthias Krüger
cc009bc536
Rollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillot
Remove `expr_parentheses_needed` from `ParseSess`

Not sure why this method needed to exist on `ParseSess`, but we can achieve the same behavior by just inlining it everywhere.
2022-10-01 16:45:05 +02:00
Matthias Krüger
21fc218532
Rollup merge of #101675 - beetrees:set-times-no-panic, r=joshtriplett
Improve `File::set_times` error handling

Makes `File::set_times` return an error if the `SystemTime` cannot fit into the required type instead of panicking in `FileTimes::set_{accessed,modified}`. Also makes `File::set_times` return an error on Windows if either of the passed times are `0xFFFF_FFFF_FFFF_FFFF`, as [the documentation for `SetFileTime`](https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-setfiletime) states that this will prevent operations on the file handle from updating the corresponding file time instead of setting the corresponding file time to that value.

Tracking issue: #98245
2022-10-01 16:45:04 +02:00
Camille GILLOT
fec53fd9db Add sanity Drop impl. 2022-10-01 16:24:44 +02:00
Camille GILLOT
299e10d7ad Add FIXME. 2022-10-01 16:24:34 +02:00
Camille GILLOT
9f2ab5b9ad Use a SortedMap instead of a VecMap. 2022-10-01 16:24:30 +02:00
Camille GILLOT
13608715d8 Replace retain with assertion. 2022-10-01 16:23:20 +02:00
Camille GILLOT
c2d5dd2566 Add fast path without visiting. 2022-10-01 16:23:10 +02:00
Camille GILLOT
e78dd6d781 Simplify LintLevelsProvider. 2022-10-01 16:23:00 +02:00
Camille GILLOT
d08669c4fa Compute by owner instead of HirId. 2022-10-01 16:22:40 +02:00
Camille GILLOT
26e5fe9e85 Do not fetch HIR node when iterating to find lint. 2022-10-01 16:20:21 +02:00
Camille GILLOT
6e76599f5f Correct Key impl for HirId. 2022-10-01 16:20:08 +02:00
Camille GILLOT
273b54d6ac Add FIXME. 2022-10-01 16:19:52 +02:00
Camille GILLOT
af495f8bb6 Comment LintLevelSets. 2022-10-01 16:19:40 +02:00
Camille GILLOT
34bc5c8824 Move lint level computation to rustc_middle::lint. 2022-10-01 16:18:54 +02:00
Camille GILLOT
6977f7dbe9 Reduce visibilities and remove dead code. 2022-10-01 16:18:42 +02:00
Camille GILLOT
41db9b152f Move code to rustc_lint. 2022-10-01 16:18:13 +02:00
bors
edadc7ccdd Auto merge of #102519 - Alexendoo:format-args-macro-str, r=m-ou-se
Fix `format_args` capture for macro expanded format strings

Since #100996 `format_args` capture for macro expanded strings aren't prevented when the span of the expansion points to a string literal, e.g.

```rust
// not a terribly realistic example, but also happens for proc_macros that set
// the span of the output to an input str literal, such as indoc
macro_rules! x {
    ($e:expr) => { $e }
}

fn main() {
    let a = 1;
    println!(x!("{a}"));
}
```

The tests didn't catch it as the span of `concat!()` points to the macro invocation

r? `@m-ou-se`
2022-10-01 14:15:29 +00:00
Camille GILLOT
107170b9c3 Remove unused tool_name. 2022-10-01 16:12:54 +02:00
Deadbeef
3cb1811e45 Compute lint_levels by definition 2022-10-01 16:12:50 +02:00
Camille GILLOT
6019cbbfd3 Allow query system to recover a HirId. 2022-10-01 15:58:42 +02:00
bors
744e397d88 Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebank
Move lint level source explanation to the bottom

So, uhhhhh

r? `@estebank`

## User-facing change

"note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic:
```diff
-   = note: `#[warn(unsupported_calling_conventions)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
+   = note: `#[warn(unsupported_calling_conventions)]` on by default
```

Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO.

## Developer-facing change

`struct_span_lint` and similar methods have a different signature.

Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)`
After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>`

The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion.

Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere.

## Subtle problem

By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings...

I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate.

## P.S.

I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01 10:44:25 +00:00
Maybe Waffle
b5b3ffe3fc Remove LintDiagnosticBuilder 2022-10-01 10:03:07 +00:00
Maybe Waffle
d028db9dbd ui-fulldeps: adopt to the new rustc lint API 2022-10-01 10:03:07 +00:00
Maybe Waffle
b3071153c2 bless rustdoc-ui 2022-10-01 10:03:06 +00:00
Maybe Waffle
afa886e7d4 bless a miri test 2022-10-01 10:03:06 +00:00
Maybe Waffle
9d388dc390 bless clippy 2022-10-01 10:03:06 +00:00
Maybe Waffle
13b67fb9d2 bless ui tests 2022-10-01 10:03:06 +00:00
Maybe Waffle
ad3d1fc9d5 Move lint level source explanation to the bottom 2022-10-01 10:03:06 +00:00
Maybe Waffle
6ecacf76bc rustdoc: adopt to the new lint API 2022-10-01 10:03:06 +00:00
Maybe Waffle
7e90a41844 clippy: adopt to the new lint API 2022-10-01 10:03:06 +00:00
Maybe Waffle
a8f7e244b7 Refactor rustc lint API 2022-10-01 10:03:06 +00:00
Camille GILLOT
c321933e22 Give def_span the same SyntaxContext as span_with_body. 2022-10-01 11:38:59 +02:00
bors
277bb6653b Auto merge of #102237 - GuillaumeGomez:sidebar-links-color, r=notriddle
Migrate sidebar links color to CSS variables and unify themes with ayu

Part of https://github.com/rust-lang/rust/pull/98460.

This PR does two things:
 1. Migrate more theme CSS rules toward CSS variables.
 2. Remove `a.current` specific colors depending on the kind of the item behind the link. The `ayu` theme was already doing it this way and I think it makes much more sense like this.

You can test it [here](https://rustdoc.crud.net/imperio/sidebar-links-color/lib2/struct.Foo.html) by hovering other module's items in the sidebar (or check the selector `a.current`).

cc `@jsha`
r? `@notriddle`
2022-10-01 08:14:25 +00:00
Scott McMurray
c7af338e6f Tell LLVM that partition_point returns a valid fencepost
This was already done for a successful `binary_search`, but this way `partition_point` can get similar optimizations.
2022-09-30 23:39:15 -07:00
Michael Howell
fcb4e0abfc rustdoc: remove unused CSS selector a.source
The link with this class attribute was removed in
4d16de01d0.
2022-09-30 22:17:04 -07:00
bors
de341fe668 Auto merge of #102526 - matthiaskrgr:rollup-9o6p98c, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #102361 (Fix ICE in const_trait check code)
 - #102373 (Flush delayed bugs before codegen)
 - #102483 (create def ids for impl traits during ast lowering)
 - #102490 (Generate synthetic region from `impl` even in closure body within an associated fn)
 - #102492 (Don't lower assoc bindings just to deny them)
 - #102493 (Group together more size assertions.)
 - #102521 (rustdoc: add missing margin to no-docblock methods)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-01 03:56:21 +00:00
beetrees
c66860ab3e
SetFileTime doesn't allow setting the file time to 0xFFFF_FFFF_FFFF_FFFF 2022-10-01 03:23:08 +01:00
beetrees
39c0b00cf9
Error instead of panicking when setting file times if the passed SystemTime doesn't fit into the required type 2022-10-01 03:22:55 +01:00
bors
c5b105dc9a Auto merge of #101969 - reez12g:issue-101306, r=reez12g
Make fmt downloaded on every invocation of bootstrap

Fixes https://github.com/rust-lang/rust/issues/101306
2022-10-01 01:03:35 +00:00
Josh Stone
cd1a3690c4 Upgrade dist-i586-gnu-i586-i686-musl to ubuntu:22.04
The system GCC 5 in ubuntu:16.04 will be too old to compile LLVM 16, so
we need an upgrade. To avoid raising the minimum glibc requirements for
`i586-unknown-linux-gnu`, this target is converted to a crosstool-ng
toolchain, *relaxing* it to the same Linux 3.2 / glibc 2.17 minimum we
use elsewhere. The musl targets still use Ubuntu's system toolchain, but
this doesn't have the same compatibility concerns.
2022-09-30 17:32:12 -07:00
Rento Ezoe
9f201d6820
Add a comment to downloading fmt statement
Co-authored-by: Joshua Nelson <github@jyn.dev>
2022-10-01 08:06:24 +09:00
Dan Gohman
72f15572ee Allow hidden in src/test/codegen/abi-main-signature-32bit-c-int.rs 2022-09-30 14:55:26 -07:00
Matthias Krüger
2fadfe0284
Rollup merge of #102521 - notriddle:notriddle/impl-items-section, r=GuillaumeGomez
rustdoc: add missing margin to no-docblock methods

Fixes another regression caused by 8846c0853d, this time fixing the appearance of methods that have no docblock (we didn't notice this one because libstd docs *always* have docblocks).

See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/enum.Type.html#implementations

<details>

# Before

![image](https://user-images.githubusercontent.com/1593513/193318777-2bc082fb-6579-4bd8-a0e3-d23a32b4820f.png)

# After

![image](https://user-images.githubusercontent.com/1593513/193318968-b6ccacad-940b-4ed3-a0ae-dcf2079c2bae.png)

</details>

See how it looks at https://doc.rust-lang.org/nightly/nightly-rustc/rustdoc/clean/types/trait.AttributesExt.html

<details>

# Before

![image](https://user-images.githubusercontent.com/1593513/193319636-7ff9c99e-0208-462c-99de-7672e92ce4d6.png)

# After

![image](https://user-images.githubusercontent.com/1593513/193322675-403bd165-7394-43e2-8ab4-d1f364666093.png)

</details>
2022-09-30 23:38:27 +02:00
Matthias Krüger
eaf1c7a0da
Rollup merge of #102493 - nnethercote:improve-size-assertions-some-more, r=lqd
Group together more size assertions.

Also add a few more assertions for some relevant token-related types.

And fix an erroneous comment in `rustc_errors`.

r? `@lqd`
2022-09-30 23:38:27 +02:00
Matthias Krüger
842a7d34f5
Rollup merge of #102492 - compiler-errors:simplify-deny-assoc-bindings, r=cjgillot
Don't lower assoc bindings just to deny them

Some clean-up: https://github.com/rust-lang/rust/pull/102338#discussion_r981590931
2022-09-30 23:38:26 +02:00