Commit Graph

199428 Commits

Author SHA1 Message Date
Nicholas Nethercote
08a00eb0da Address review comments. 2022-09-05 14:20:29 +10:00
Nicholas Nethercote
bb0ae3c446 Make hir::PathSegment::hir_id non-optional. 2022-09-05 14:20:25 +10:00
Nicholas Nethercote
6d850d936b Make hir::PathSegment::res non-optional. 2022-09-05 14:20:25 +10:00
Nicholas Nethercote
ee244bf196 Remove dead code from print_generic_args. 2022-09-05 14:20:25 +10:00
Nicholas Nethercote
49b90573ac Add some blank lines to the definition of Res.
To make the spacing consistent.

Also shorten an overly long comment line.
2022-09-05 14:20:16 +10:00
bors
406e03fd02 Auto merge of #101386 - aDotInTheVoid:rdj-discriminant, r=GuillaumeGomez
Rustdoc-Json: Add enum discriminant

Does the first part of #101337, by adding it to `clean`, but doesn't change HTML output, as

1. [No Consensus has appeared on the UI for this](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Enum.20discriminant.20values.20in.20HTML.20output)
2. [When inlining across crates, information is lost](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60clean_variant_def.20.60vs.20.60clean_variant_data.60)

JSON doesn't have either of these limitations.

r? `@GuillaumeGomez`
2022-09-05 04:16:08 +00:00
bors
9358d09a55 Auto merge of #100759 - fee1-dead-contrib:const_eval_select_real_intrinsic, r=oli-obk,RalfJung
Make `const_eval_select` a real intrinsic

This fixes issues where `track_caller` functions do not have nice panic
messages anymore when there is a call to the function, and uses the
MIR system to replace the call instead of dispatching via lang items.

Fixes #100696.
2022-09-05 01:35:01 +00:00
Nicholas Nethercote
d565d51071 Put size assertions together.
As has already been done in various other places in the compiler.
2022-09-05 10:59:00 +10:00
bors
e7cdd4c090 Auto merge of #100576 - joboet:movable_const_remutex, r=Mark-Simulacrum
Make `ReentrantMutex` movable and `const`

As `MovableMutex` is now `const`, it can be used to simplify the implementation and interface of the internal reentrant mutex type. Consequently, the standard error stream does not need to be wrapped in `OnceLock` and `OnceLock::get_or_init_pin()` can be removed.
2022-09-04 22:53:58 +00:00
Martin Kröning
3b985b4dd6 Hermit: Add File::set_time stub
This is not supported on hermit yet. This change is required for compiling std.
2022-09-05 00:17:46 +02:00
Michael Goulet
3b3c7063c2 Point at type parameter in plain path expr 2022-09-04 20:48:39 +00:00
bors
289279de11 Auto merge of #93455 - asquared31415:vec-zero-opts, r=thomcc
Implement internal `IsZero` for Wrapping and Saturating for `Vec` optimizations

This implements the `IsZero` trait for the `Wrapping` and `Saturating` types so that users of these types can get the improved performance from the specialization of creating a `Vec` from a single element repeated when it has a zero bit pattern (example `vec![0_i32; 500]`, or after this PR `vec![Wrapping(0_i32); 500]`)

CC #60978
2022-09-04 20:33:50 +00:00
kraktus
e1bb09edff Fix hir::Local doc to match with the variable name used: init 2022-09-04 21:46:28 +02:00
Jonas Schievink
f5cd223006
Revert "Mention rust-analyzer maintainers when proc_macro bridge is changed" 2022-09-04 21:11:31 +02:00
bors
67920f7975 Auto merge of #13187 - matklad:return, r=Veykril
fix: correct broken logic for return complition

It seems that we've accidentally deleted the tests here couple of years
ago, and then fairly recently made a typo during refactor as well.

Reinstall tests, with coverage marks this time :-)
2022-09-04 18:25:55 +00:00
bors
0ebd3ab63a Auto merge of #101411 - matthiaskrgr:rollup-uj24yb5, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #101322 (Fix internal doc link)
 - #101385 (updated description of File struct in std::fs)
 - #101388 (Don't delay invalid LHS bug unless it will be covered by an error in `check_overloaded_binop`)
 - #101394 (Forbid mixing `System` with direct sytem allocator calls)
 - #101397 (rustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub`)
 - #101401 (Make `char::is_lowercase` and `char::is_uppercase` const)
 - #101407 (Remove duplicated test (superseeded by search-form-elements.goml))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-04 18:10:04 +00:00
Nika Layzell
efda49712b proc_macro/bridge: use the cross-thread executor for nested proc-macros
While working on some other changes in the bridge, I noticed that when
running a nested proc-macro (which is currently only possible using
the unstable `TokenStream::expand_expr`), any symbols held by the
proc-macro client would be invalidated, as the same thread would be used
for the nested macro by default, and the interner doesn't handle nested
use.

After discussing with @eddyb, we decided the best approach might be to
force the use of the cross-thread executor for nested invocations, as it
will never re-use thread-local storage, avoiding the issue. This
shouldn't impact performance, as expand_expr is still unstable, and
infrequently used.

This was chosen rather than making the client symbol interner handle
nested invocations, as that would require replacing the internal
interner `Vec` with a `BTreeMap` (as valid symbol id ranges could now be
disjoint), and the symbol interner is known to be fairly perf-sensitive.

This patch adds checks to the execution strategy to use the cross-thread
executor when doing nested invocations. An alternative implementation
strategy could be to track this information in the `ExtCtxt`, however a
thread-local in the `proc_macro` crate was chosen to add an assertion so
that `rust-analyzer` is aware of the issue if it implements
`expand_expr` in the future.

r? @eddyb
2022-09-04 14:06:26 -04:00
Aleksey Kladov
d7ef3f51ec fix: correct broken logic for return complition
It seems that we've accidentally deleted the tests here couple of years
ago, and then fairly recently made a typo during refactor as well.

Reinstall tests, with coverage marks this time :-)
2022-09-04 18:12:55 +01:00
Matthias Krüger
cea11f50dc
Rollup merge of #101407 - GuillaumeGomez:rm-duplicated-gui-test, r=Dylan-DPC
Remove duplicated test (superseeded by search-form-elements.goml)

I realized it when I worked on https://github.com/rust-lang/rust/pull/101348. The checks are more complete in `search-form-elements.goml` (for example [here](https://github.com/rust-lang/rust/blob/master/src/test/rustdoc-gui/search-form-elements.goml#L12-L29)).

r? `@Dylan-DPC`
2022-09-04 18:55:50 +02:00
Matthias Krüger
d9bba11344
Rollup merge of #101401 - mx00s:expand-const, r=fee1-dead
Make `char::is_lowercase` and `char::is_uppercase` const

Implements #101400.
2022-09-04 18:55:48 +02:00
Matthias Krüger
43a7438e27
Rollup merge of #101397 - notriddle:notriddle/source-nav-not-sidebar-sub, r=GuillaumeGomez
rustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub`

It's redundant because there's already a selector `.source nav.sub` with exactly the same margin-left at [line 796].

[line 796]: 84f0c3f79a/src/librustdoc/html/static/css/rustdoc.css (L796)

This selector was added in 1e98fb1027, along with an identical desktop selector, but that desktop selector was removed in 6a5f8b1aef as part of a larger simplification.
2022-09-04 18:55:47 +02:00
Matthias Krüger
723f0c477b
Rollup merge of #101394 - CAD97:patch-3, r=Mark-Simulacrum
Forbid mixing `System` with direct sytem allocator calls

e.g. [on windows](dec689432f/library/std/src/sys/windows/alloc.rs (L129-L178)), trying to mix `System::alloc` and `HeapFree` will not work because of the extra work done to serve higher alignments.
2022-09-04 18:55:46 +02:00
Matthias Krüger
dd35e2f79b
Rollup merge of #101388 - compiler-errors:issue-101376, r=fee1-dead
Don't delay invalid LHS bug unless it will be covered by an error in `check_overloaded_binop`

Fixes #101376
2022-09-04 18:55:45 +02:00
Matthias Krüger
8f8a36d1c2
Rollup merge of #101385 - BartMassey-upstream:file-doc, r=thomcc
updated description of File struct in std::fs

I've seen several folks confused by the description of `std::fs::File` as "A reference to an open file on the filesystem." Apparently the word `reference` is sometimes taken to mean a Rust `&` reference, leading to confusion. Here's a recent representative [Reddit thread](https://www.reddit.com/r/rust/comments/x4k0lv/comment/imxu7v2/?utm_source=share&utm_medium=web2x&context=3), but I've seen this before as well.

This patch changes the description to "An object providing access to an open file on the filesystem." Hopefully this is clearer.
2022-09-04 18:55:43 +02:00
Matthias Krüger
c4ea4fb576
Rollup merge of #101322 - ChrisDenton:internal-doc, r=Mark-Simulacrum
Fix internal doc link

The doc link from `DedupSortedIter` to `BTreeMap::bulk_build_from_sorted_iter` was broken when building internal documentation,

This prevented me from building internal documentation locally:

```
R:\Rust\rust> $env:RUSTDOCFLAGS="--document-private-items"
R:\Rust\rust> x doc library/std --open --stage 0
Building rustbuild
   Compiling bootstrap v0.0.0 (R:\Rust\rust\src\bootstrap)
    Finished dev [unoptimized] target(s) in 3.15s
Documenting stage0 std (x86_64-pc-windows-msvc)
 Documenting core v0.0.0 (R:\Rust\rust\library\core)
    Finished release [optimized] target(s) in 36.42s
    Checking core v0.0.0 (R:\Rust\rust\library\core)
    Checking rustc-std-workspace-core v1.99.0 (R:\Rust\rust\library\rustc-std-workspace-core)
    Checking compiler_builtins v0.1.79
 Documenting alloc v0.0.0 (R:\Rust\rust\library\alloc)
error: unresolved link to `BTreeMap::bulk_build_from_sorted_iter`
 --> library\alloc\src\collections\btree\dedup_sorted_iter.rs:6:15
  |
6 | /// Used by [`BTreeMap::bulk_build_from_sorted_iter`].
  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `BTreeMap` in scope
  |
  = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`

error: could not document `alloc`
```
2022-09-04 18:55:42 +02:00
Maybe Waffle
5a672921a3 replace as usize casts with usize::from in slice sort 2022-09-04 20:54:51 +04:00
Maybe Waffle
fff92d5238 remove some integer casts from slice iter 2022-09-04 20:45:29 +04:00
Maybe Waffle
fcd42d628c Don't fire rust_2021_incompatible_closure_captures in edition = 2021 2022-09-04 20:04:51 +04:00
Chris Denton
835a4612d2
Test internal documentation 2022-09-04 16:51:11 +01:00
Sage Mitchell
2b328ea5ee
Address feedback from PR #101401 2022-09-04 08:07:53 -07:00
Sage Mitchell
4a3e169da7
Make char::is_lowercase and char::is_uppercase const
Implements #101400.
2022-09-04 08:07:53 -07:00
Guillaume Gomez
41703e649b Remove duplicated test (superseeded by search-form-elements.goml) 2022-09-04 15:16:55 +02:00
bors
a2cdcb3fea Auto merge of #101296 - compiler-errors:head-span-for-enclosing-scope, r=oli-obk
Use head span for `rustc_on_unimplemented`'s `enclosing_scope` attr

This may make #101281 slightly easier to understand
2022-09-04 13:03:07 +00:00
Deadbeef
65b685e82d Add inline(always) to rt functions 2022-09-04 20:35:23 +08:00
Deadbeef
58c8823e31 remap mir before running optimization passes 2022-09-04 20:35:23 +08:00
Deadbeef
bd61b8fb3f Add inline(always) to function generated by macro 2022-09-04 20:35:23 +08:00
Deadbeef
075084f772 Make const_eval_select a real intrinsic 2022-09-04 20:35:23 +08:00
Nixon Enraght-Moony
efbd8f62ed rustdoc: Compute enum discriminant on demand 2022-09-04 12:53:25 +01:00
bors
b11bf65e4a Auto merge of #101250 - klensy:bump-deps-08-22, r=Dylan-DPC
bump deps

Update few crates to drop old/duplicated versions.

updates pest* crates (no separate changelog, sadly: https://github.com/pest-parser/pest/releases), thiserror, handlebars(https://github.com/sunng87/handlebars-rust/blob/v4.3.3/CHANGELOG.md#433---2022-07-20) to drop old ones:
```
 Removing block-buffer v0.7.3
 Removing block-padding v0.1.5
 Removing byte-tools v0.3.1
 Removing byteorder v1.3.4
 Removing digest v0.8.1
 Removing fake-simd v0.1.2
 Removing generic-array v0.12.4
 Updating handlebars v4.1.0 -> v4.3.3
 Removing opaque-debug v0.2.3
 Updating pest v2.1.3 -> v2.3.0
 Updating pest_derive v2.1.0 -> v2.3.0
 Updating pest_generator v2.1.3 -> v2.3.0
 Updating pest_meta v2.1.3 -> v2.3.0
 Removing quick-error v2.0.0
 Removing sha-1 v0.8.2
 Updating thiserror v1.0.30 -> v1.0.33
 Updating thiserror-impl v1.0.30 -> v1.0.33
```

combine v4.6.3 -> v4.6.6: drops `use_std` features, addressed this comment:
4fd4de7ea3/src/tools/rustc-workspace-hack/Cargo.toml (L80-L82)

im-rc v15.0.0 -> v15.1.0 to drop rand_xoshiro duplicated version
```
Updating im-rc v15.0.0 -> v15.1.0
Removing rand_xoshiro v0.4.0
```
2022-09-04 10:43:44 +00:00
beetrees
0e0756cf0d
Don't duplicate file descriptors into stdio fds 2022-09-04 10:22:36 +01:00
bors
8521a8c92d Auto merge of #100726 - jswrenn:transmute, r=oli-obk
safe transmute: use `Assume` struct to provide analysis options

This task was left as a TODO in #92268; resolving it brings [`BikeshedIntrinsicFrom`](https://doc.rust-lang.org/nightly/core/mem/trait.BikeshedIntrinsicFrom.html) more in line with the API defined in [MCP411](https://github.com/rust-lang/compiler-team/issues/411).

**Before:**
```rust
pub unsafe trait BikeshedIntrinsicFrom<
    Src,
    Context,
    const ASSUME_ALIGNMENT: bool,
    const ASSUME_LIFETIMES: bool,
    const ASSUME_VALIDITY: bool,
    const ASSUME_VISIBILITY: bool,
> where
    Src: ?Sized,
{}
```
**After:**
```rust
pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }>
where
    Src: ?Sized,
{}
```

`Assume::visibility` has also been renamed to `Assume::safety`, as library safety invariants are what's actually being assumed; visibility is just the mechanism by which it is currently checked (and that may change).

r? `@oli-obk`

---

Related:
- https://github.com/rust-lang/compiler-team/issues/411
- https://github.com/rust-lang/rust/issues/99571
2022-09-04 07:55:44 +00:00
Michael Goulet
98f4b20abc Also suggest dereferencing LHS when both &mut T and T are valid binop LHS 2022-09-04 05:35:18 +00:00
bors
c2d140bd36 Auto merge of #101312 - nikic:update-llvm-7, r=cuviper
Update LLVM submodule

This updates to the current 15.x branch plus one cherry-pick.

Fixes #100834.
Fixes #101121.
2022-09-04 05:14:34 +00:00
bors
5fecdb7c0a Auto merge of #101396 - matthiaskrgr:rollup-9n0257m, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #100302 (Suggest associated method on deref types when path syntax method fails)
 - #100647 ( Make trait bound not satisfied specify kind)
 - #101349 (rustdoc: remove `.impl-items { flex-basis }` CSS, not in flex container)
 - #101369 (Fix `global_asm` macro pretty printing)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-04 02:59:45 +00:00
Michael Goulet
edba0c92de Address nits, rename enclosing_scope => parent_label 2022-09-04 02:10:31 +00:00
Michael Goulet
c23fe81764 Use head span for rustc_on_unimplemented's enclosing_scope attr 2022-09-04 01:55:51 +00:00
Michael Howell
3e743a064e rustdoc: remove redundant mobile-sized .source nav:not(.sidebar).sub
It's redundant because there's already a selector `.source nav.sub` with
exactly the same margin-left at line 796.

This selector was added in 1e98fb1027, along
with an identical desktop selector, but that desktop selector was removed in
6a5f8b1aef as part of a larger simplification.
2022-09-03 15:27:04 -07:00
Matthias Krüger
a3dda51438
Rollup merge of #101369 - compiler-errors:global-asm-pprint, r=jackh726
Fix `global_asm` macro pretty printing

Fixes #101051
Fixes #101047
2022-09-04 00:20:43 +02:00
Matthias Krüger
037c979a52
Rollup merge of #101349 - notriddle:notriddle/flex-basis, r=GuillaumeGomez
rustdoc: remove `.impl-items { flex-basis }` CSS, not in flex container

Added in 34bd2b845b

For this to actually do anything, [according to MDN] (and Firefox Dev Tools), it must be a "flex item", which only happens if its a direct child of a node with `display: flex` on it. It seems like it could not have worked at the time when this rule was added, because the only items in `rustdoc.css` with `display: flex` active were:

* `#help`

  This should not contain anything like this.

* `.impl-items h4, h4.impl, h3.impl`

  These are all headers, so they shouldn't contain `.impl-items` either.

* `.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant`

  Associated constants and methods definitely shouldn't contain a list of impl items, and the `.type` class seems to refer to type aliases, which, when shown inside of an impl, only show a link to the aliased type.

[according to MDN]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis

Nowadays, `display: flex` is a lot more prolific, but `.impl-items` still seems to only be used in plain block parents:

* If it's not a trait impl, then it's nested below a `<div>` with an id but no class, added in a5216cf67d. This will be `display: block`, probably. For example, [vec deref]
* Inherent impls also get a `<div>` tag, for example [vec impl], and they are also wrapped by their own non-flexbox `<details>` tag.
* If it's a tait implementation, then it's also nested below a `<details>` container, like [deref cstring].

[vec impl]: https://doc.rust-lang.org/1.63.0/std/vec/struct.Vec.html#impl
[vec deref]: https://doc.rust-lang.org/1.63.0/std/vec/struct.Vec.html#deref-methods-%5BT%5D
[deref cstring]: https://doc.rust-lang.org/1.63.0/std/ops/trait.Deref.html#impl-Deref

Also, this would imply that trait items ought to take up as much space as possible, pushing everything else to the edge of the screen. If this is nested directly below the `.rustdoc` container, which has a row basis, that would be bad.
2022-09-04 00:20:42 +02:00
Matthias Krüger
d085194539
Rollup merge of #100647 - obeis:issue-99875, r=nagisa
Make trait bound not satisfied specify kind

Closes #99875
2022-09-04 00:20:40 +02:00