Commit graph

161343 commits

Author SHA1 Message Date
Scott McMurray
3dfcc66d48 Add log2 and log10 to NonZeroU*
This version is nice in that it doesn't need to worry about zeros, and thus doesn't have any error cases.
2022-01-15 17:14:13 -08:00
Ariel Davis
8f33b4eed1 Copy an example to PartialOrd as well 2022-01-15 16:25:09 -08:00
bors
f9d61cd2ed Auto merge of #90146 - cjgillot:no-id-map, r=nagisa
Reduce use of LocalDefId <-> HirId maps

This is an attempt to reduce the perf effect of https://github.com/rust-lang/rust/pull/89278.
r? `@ghost`
2022-01-15 23:10:14 +00:00
Roc Yu
47de5b45be
Remove collect 2022-01-15 18:06:45 -05:00
bors
27845a9205 Auto merge of #8274 - andrewarchi:master, r=camsteffen
Update markdown-it version

Fixes improperly-escaped pipes in Markdown tables for the [documentation of bad_bit_mask](https://rust-lang.github.io/rust-clippy/master/index.html#bad_bit_mask) and [ineffective_bit_mask](https://rust-lang.github.io/rust-clippy/master/index.html#ineffective_bit_mask). A column pipe takes precedence over inline code markers, so some back ticks are displayed literally and the pipes need to be escaped. I found no other occurrences of the same problem when searching rust-clippy by ```\|.*`.*\|```.

changelog: Update markdown-it version
2022-01-15 22:17:37 +00:00
Ariadne Conill
1a37262bf9 Exclude llvm-libunwind from the self-contained set on s390x-musl targets.
llvm-libunwind does not support s390x targets at present, so we cannot build it
for s390x targets.  Accordingly, remove it from the self-contained set.
2022-01-15 21:33:07 +00:00
Jason Newcomb
cb384ff03b Handle implicit named arguments in useless_format 2022-01-15 16:28:49 -05:00
Marek Downar
49502727e7
issue #8239: fix to prev commit && 4 test cases 2022-01-15 22:19:01 +01:00
Camille GILLOT
8617ff0f0b Add inline. 2022-01-15 21:26:25 +01:00
Camille GILLOT
d9c6e70c57 Do not ICE when accesing large LocalDefId. 2022-01-15 21:26:25 +01:00
Camille GILLOT
67727aa7c3 Reduce use of local_def_id_to_hir_id. 2022-01-15 21:26:25 +01:00
Camille GILLOT
ebcc847369 Make ty_param_owner return a LocalDefId. 2022-01-15 21:26:24 +01:00
Camille GILLOT
79afe99973 Use LocalDefId in rustc_passes::hir_id_validator. 2022-01-15 21:26:24 +01:00
Camille GILLOT
a5b7e235d3 Simplify DefIdForest. 2022-01-15 21:26:24 +01:00
Camille GILLOT
c9de7d7a20 Use LocalDefId in rustc_passes::entry. 2022-01-15 21:26:24 +01:00
Camille GILLOT
60064726ae Return a LocalDefId in get_parent_item. 2022-01-15 21:26:20 +01:00
Camille GILLOT
5a123c265b Add fast path to opt_local_def_id. 2022-01-15 21:17:34 +01:00
Noah Lev
9c6d8ef80c htmldocck: Add support for /text() in @snapshot
This allows just testing the text, in cases where the HTML tags don't
matter.
2022-01-15 10:37:40 -08:00
Noah Lev
554c7659e8 Fix broken link 2022-01-15 10:18:24 -08:00
Guillaume Gomez
75967ceeae Add test for dot separator 2022-01-15 18:19:54 +01:00
Guillaume Gomez
29b659a7ae Fix missing dot separator 2022-01-15 18:19:44 +01:00
Roc Yu
07fd90e2a2
Remove collect 2022-01-15 12:03:17 -05:00
Marek Downar
ee84ac3396
issue #8239: Printed hint for lint or_fun_call is cropped and does not show the solution 2022-01-15 15:51:46 +01:00
bors
ec4bcaac45 Auto merge of #92441 - cjgillot:resolve-trait-impl-item, r=matthewjasper
Link impl items to corresponding trait items in late resolver.

Hygienically linking trait impl items to declarations in the trait can be done directly by the late resolver. In fact, it is already done to diagnose unknown items.

This PR uses this resolution work and stores the `DefId` of the trait item in the HIR. This avoids having to do this resolution manually later.

r? `@matthewjasper`
Related to #90639. The added `trait_item_id` field can be moved to `ImplItemRef` to be used directly by your PR.
2022-01-15 14:43:45 +00:00
bors
b13a5bf3c4 Auto merge of #92927 - matthiaskrgr:rollup-pgzwfcm, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #92747 (Simplification of BigNum::bit_length)
 - #92767 (Use the new language identifier for Rust in the PDB debug format)
 - #92775 (Inline std::os::unix::ffi::OsStringExt methods)
 - #92863 (Remove `&mut` from `io::read_to_string` signature)
 - #92865 (Ignore static lifetimes for GATs outlives lint)
 - #92873 (Generate more precise generator names)
 - #92879 (Add Sync bound to allocator parameter in vec::IntoIter)
 - #92892 (Do not fail evaluation in const blocks)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-15 10:57:03 +00:00
Matthias Krüger
539175c026
Rollup merge of #92892 - compiler-errors:const-param-env-for-const-block, r=fee1-dead
Do not fail evaluation in const blocks

Evaluate const blocks with a const param-env, so we properly check `~const` trait bounds.

Fixes #92713
(I will fix the poor diagnostics in #92713 and #92712 in a separate PR)

cc `@nbdd0121` who wrote the code this PR touches in #89561
2022-01-15 11:28:28 +01:00
Matthias Krüger
784e4ba9a4
Rollup merge of #92879 - compiler-errors:into_iter_unsound, r=dtolnay
Add Sync bound to allocator parameter in vec::IntoIter

The `A: Sync` bound was forgotten in 8725e4c337 (diff-b78c3ab6d37f4ede32195707528f8a76c49d4557cc9d3a7a09417b5157729b9fR3132)

Similar `unsafe impl Sync` in that commit _do_ include the `A: Sync` bound (and around the alloc lib), so I think this was just an honest mistake.

Here's an example of the unsoundness:  https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=16cbfeff7c934ae72ab632c1476fdd8b

`@steffahn` found this, I'm just putting up the fix cause nobody else did :^)

Fixes #92633
2022-01-15 11:28:27 +01:00
Matthias Krüger
85c119cd51
Rollup merge of #92873 - eholk:async-symbol-names, r=tmandry
Generate more precise generator names

Currently all generators are named with a `generator$N` suffix, regardless of where they come from. This means an `async fn` shows up as a generator in stack traces, which can be surprising to async programmers since they should not need to know that async functions are implementated using generators.

This change generators a different name depending on the generator kind, allowing us to tell whether the generator is the result of an async block, an async closure, an async fn, or a plain generator.

r? `@tmandry`
cc `@michaelwoerister` `@wesleywiser` `@dpaoliello`
2022-01-15 11:28:26 +01:00
Matthias Krüger
cd93be0094
Rollup merge of #92865 - jackh726:gats-outlives-no-static, r=nikomatsakis
Ignore static lifetimes for GATs outlives lint

cc https://github.com/rust-lang/rust/issues/87479#issuecomment-1010484170

Also included a bit of cleanup of `ty_known_to_outlive` and `region_known_to_outlive`

r? `@nikomatsakis`
2022-01-15 11:28:25 +01:00
Matthias Krüger
d878ad0559
Rollup merge of #92863 - camelid:read_to_string-rm-mut, r=m-ou-se
Remove `&mut` from `io::read_to_string` signature

``@m-ou-se`` [realized][1] that because `Read` is implemented for `&mut impl
Read`, there's no need to take `&mut` in `io::read_to_string`.

Removing the `&mut` from the signature allows users to remove the `&mut`
from their calls (and thus pass an owned reader) if they don't use the
reader later.

r? `@m-ou-se`

[1]: https://github.com/rust-lang/rust/issues/80218#issuecomment-874322129
2022-01-15 11:28:24 +01:00
Matthias Krüger
1b241bb703
Rollup merge of #92775 - xfix:osstringext-inline, r=m-ou-se
Inline std::os::unix::ffi::OsStringExt methods

Those methods essentially do nothing at assembly level. On Unix systems, `OsString` is represented as a `Vec` without performing any transformations.
2022-01-15 11:28:23 +01:00
Matthias Krüger
ff1db43b50
Rollup merge of #92767 - arlosi:pdbenum, r=cuviper
Use the new language identifier for Rust in the PDB debug format

Rust currently identifies as MASM (Microsoft Assembler) in the PDB
debug info format on Windows because no identifier was available.

This change pulls in a cherry-pick to Rust's LLVM that includes the
change to use the new identifier for Rust.

https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang
2022-01-15 11:28:22 +01:00
Matthias Krüger
f511360fd2
Rollup merge of #92747 - swenson:bignum-bit-length-optimization, r=scottmcm
Simplification of BigNum::bit_length

As indicated in the comment, the BigNum::bit_length function could be
optimized by using CLZ, which is often a single instruction instead a
loop.

I think the code is also simpler now without the loop.

I added some additional tests for Big8x3 and Big32x40 to ensure that
there were no regressions.
2022-01-15 11:28:22 +01:00
bors
38c22af015 Auto merge of #92604 - nnethercote:optimize-impl_read_unsigned_leb128, r=michaelwoerister
Optimize `impl_read_unsigned_leb128`

I see instruction count improvements of up to 3.5% locally with these changes, mostly on the smaller benchmarks.

r? `@michaelwoerister`
2022-01-15 07:27:30 +00:00
bors
496f26c229 Auto merge of #8287 - Jarcho:iter_not_returning_iterator_8285, r=Manishearth
Erase late bound regions in `iter_not_returning_iterator`

fixes #8285

changelog: None
2022-01-15 05:31:46 +00:00
Jason Newcomb
70a6d7b012 Erase late bound regions in iter_not_returning_iterator 2022-01-15 00:15:25 -05:00
David Tolnay
953da9832d
Rename Printer constructor from mk_printer() to Printer::new() 2022-01-14 21:12:39 -08:00
Michael Goulet
272fb2395c Don't use source-map when detecting struct field shorthand 2022-01-14 20:34:38 -08:00
Michael Goulet
dae6dc6b97 Fix try wrapping expression in variant suggestion with struct field shorthand 2022-01-14 20:30:32 -08:00
bors
69d25fc582 Auto merge of #92915 - matthiaskrgr:rollup-pxxk8jp, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #92191 (Prefer projection candidates instead of param_env candidates for Sized predicates)
 - #92382 (Extend const_convert to rest of blanket core::convert impls)
 - #92625 (Add `#[track_caller]` to `mirbug`)
 - #92684 (Export `tcp::IntoIncoming`)
 - #92743 (Use pre-interned symbols in a couple of places)
 - #92838 (Clean up some links in RELEASES)
 - #92868 (librustdoc: Address some clippy lints)
 - #92875 (Make `opt_const_param_of` work in the presence of `GenericArg::Infer`)
 - #92891 (Add myself to .mailmap)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-15 04:24:13 +00:00
Jacob Hoffman-Andrews
04f04026c5 Add support for "always theme" in setting 2022-01-14 19:33:37 -08:00
Jacob Hoffman-Andrews
c4b994ff80 Pick themes on settings page, not every page
This hides the paintbrush icon on most pages by default, in preference
for the settings on the settings page.  When loading from a local file,
and not in mobile view, continue to show the theme picker. That's
because some browsers limit access to localStorage from file:/// URLs,
so choosing a theme from settings.html doesn't take effect.
2022-01-14 18:20:15 -08:00
Jacob Hoffman-Andrews
4d5a6c90b1 Enable wrapping words by default
Faced with a very long word, browsers will let it overflow its
box horizontally rather than break it in the middle. We essentially
never want that behavior. We would rather break the word and keep it
inside its horizontal limits. So we apply a default overflow-wrap:
break-word/anywhere to the document as a while.

In some contexts we would rather add a horizontal scrollbar (code
blocks), or elide the excess text with an ellipsis (sidebar). Those
still work as expected.
2022-01-14 18:08:24 -08:00
Matthias Krüger
ff6c17598f
Rollup merge of #92891 - JamesHinshelwood:patch-1, r=Mark-Simulacrum
Add myself to .mailmap

(to de-duplicate my identities in the contributors list)
2022-01-15 02:25:21 +01:00
Matthias Krüger
6c94f99d83
Rollup merge of #92875 - BoxyUwU:infer_arg_opt_const_param_of, r=lcnr
Make `opt_const_param_of` work in the presence of `GenericArg::Infer`

highly recommend viewing the first and second commits on their own rather than looking at file changes 🤣

Because we filtered args down to just const args we would ignore `GenericArg::Infer` which made us get a `arg_index` which was wrong by however many const `GenericArg::Infer` came previously

[example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=46dba6a53aca6333028a10908ef16e0b) of the [bugs](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=a8eebced26eefa4119fc2e7ae0c76de6) fixed.

r? ```@lcnr```
2022-01-15 02:25:20 +01:00
Matthias Krüger
8f4155909c
Rollup merge of #92868 - pierwill:librustdoc-clippy, r=camelid
librustdoc: Address some clippy lints
2022-01-15 02:25:19 +01:00
Matthias Krüger
c693442f4c
Rollup merge of #92838 - ehuss:cleanup-release-links, r=Mark-Simulacrum
Clean up some links in RELEASES

This fixes some issues with markdown links in the RELEASES file.
2022-01-15 02:25:18 +01:00
Matthias Krüger
8326f3f317
Rollup merge of #92743 - bjorn3:less_symbol_intern, r=camelid
Use pre-interned symbols in a couple of places

Re-open of https://github.com/rust-lang/rust/pull/92733 as bors glitched.
2022-01-15 02:25:17 +01:00
Matthias Krüger
d7e512c5c7
Rollup merge of #92684 - ibraheemdev:patch-10, r=m-ou-se
Export `tcp::IntoIncoming`

Added in #88339 but not publicly exported.
2022-01-15 02:25:16 +01:00
Matthias Krüger
8df08e8bce
Rollup merge of #92625 - inquisitivecrystal:mirbug-caller, r=michaelwoerister
Add `#[track_caller]` to `mirbug`

When a "'no errors encountered even though `delay_span_bug` issued" error results from the `mirbug` function, the file location information points to the `mirbug` function itself, rather than its caller. This doesn't make sense, since the caller is the real source of the bug. Adding `#[track_caller]` will produce diagnostics that are more useful to anyone fixing the ICE.
2022-01-15 02:25:15 +01:00