Commit Graph

236073 Commits

Author SHA1 Message Date
Matthias Krüger 2266e79421
Rollup merge of #116543 - ouz-a:crate_return_vec, r=oli-obk
In smir `find_crates` returns `Vec<Crate>` instead of `Option<Crate>`

Addresses https://github.com/rust-lang/project-stable-mir/issues/40

r? `@oli-obk`
2023-10-09 16:26:01 +02:00
Matthias Krüger 374c885f4a
Rollup merge of #116537 - gurry:116473-ice-sugg-overlap, r=compiler-errors
Fix suggestion span involving wrongly placed generic arg on variant

Fixes #116473

The span computation was wrong. It went from the end of the variant to the end of the (wrongly placed) args. However, the variant lived in a different expansion and this resulted in a nonsensical span that overlaps with another and thereby leads to the ICE.

In the fix I've changed span computation to not be based on the location of the variant, but purely on the location of the args. I simply extend the start of the args span 2 positions to the left and that includes the `::` and that's all we need apparently.

This approach produces a correct span regardless of which macro/expansion the args reside in and where the variant is.
2023-10-09 16:26:01 +02:00
Matthias Krüger 389747c41d
Rollup merge of #115882 - aliemjay:diag-name-region-1, r=compiler-errors
improve the suggestion of `generic_bound_failure`

- Fixes #115375
- suggest the bound in the correct scope: trait or impl header vs assoc item. See `tests/ui/suggestions/lifetimes/type-param-bound-scope.rs`
- don't suggest a lifetime name that conflicts with the other late-bound regions of the function:
```rust
type Inv<'a> = *mut &'a ();
fn check_bound<'a, T: 'a>(_: T, _: Inv<'a>) {}
fn test<'a, T>(_: &'a str, t: T, lt: Inv<'_>) { // suggests a new name `'a`
    check_bound(t, lt); //~ ERROR
}
```
2023-10-09 16:26:00 +02:00
bors be581d9f82 Auto merge of #116142 - GuillaumeGomez:enum-variant-display, r=fmease
[rustdoc] Show enum discrimant if it is a C-like variant

Fixes https://github.com/rust-lang/rust/issues/101337.

We currently display values for associated constant items in traits:

![image](https://github.com/rust-lang/rust/assets/3050060/03e566ec-c670-47b4-8ca2-b982baa7a0f4)

And we also display constant values like [here](file:///home/imperio/rust/rust/build/x86_64-unknown-linux-gnu/doc/std/f32/consts/constant.E.html).

I think that for coherency, we should display values of C-like enum variants.

With this change, it looks like this:

![image](https://github.com/rust-lang/rust/assets/3050060/b53fbbe0-bdb1-4289-8537-f2dd4988e9ac)

As for the display of the constant value itself, I used what we already have to keep coherency.

We display the C-like variants value in the following scenario:
 1. It is a C-like variant with a value set => all the time
 2. It is a C-like variant without a value set: All other variants are C-like variants and at least one them has its value set.

Here is the result in code:

```rust
// Ax and Bx value will be displayed.
enum A {
    Ax = 12,
    Bx,
}

// Ax and Bx value will not be displayed
enum B {
    Ax,
    Bx,
}

// Bx value will not be displayed
enum C {
    Ax(u32),
    Bx,
}

// Bx value will not be displayed, Cx value will be displayed.
#[repr(u32)]
enum D {
    Ax(u32),
    Bx,
    Cx = 12,
}
```

r? `@notriddle`
2023-10-09 13:18:47 +00:00
Guillaume Gomez 1210aac1c0 Add more complex test cases for enum discriminant display 2023-10-09 14:33:04 +02:00
Guillaume Gomez 4b6fc8b70f Improve code 2023-10-09 14:26:52 +02:00
Michael Goulet 592163fb71 Extend impl's def_span to include where clauses 2023-10-09 11:47:02 +00:00
Oğuz Ağcayazı 2e000ebaa5 add test 2023-10-09 13:57:26 +03:00
Oğuz Ağcayazı 77df2cd9a5 spans are now indexmapped 2023-10-09 13:03:58 +03:00
Oğuz Ağcayazı 5f079dd2ff alloc id is indexmapped 2023-10-09 12:58:41 +03:00
Oğuz Ağcayazı 0f27c1b5b5 defids are indexmapped 2023-10-09 12:56:14 +03:00
bors 7ed044c075 Auto merge of #115238 - workingjubilee:ich-entferne-welke-blumen, r=nikic
Formally demote tier 2 MIPS targets to tier 3

Per https://github.com/rust-lang/compiler-team/issues/648

Fixes https://github.com/rust-lang/rust/issues/115218
2023-10-09 09:43:10 +00:00
Sven Bartscher d60b43c06a Make BTreeSet::new_in const 2023-10-09 11:17:56 +02:00
Sven Bartscher bbc230478c Make BTreeMap::new_in const
Closes rust-lang/wg-allocators#118
2023-10-09 11:08:48 +02:00
bjorn3 3ed3765259 Remove no longer used dependency from the list of allowed dependencies 2023-10-09 09:04:52 +00:00
bjorn3 169055f2ff Merge commit '81dc066758ec150b43822d4a0c84aae20fe10f40' into sync_cg_clif-2023-10-09 2023-10-09 08:52:46 +00:00
bjorn3 81dc066758 Rustup to rustc 1.75.0-nightly (bf9a1c8a1 2023-10-08) 2023-10-09 08:33:47 +00:00
bjorn3 88198c70e4 Sync from rust bf9a1c8a19 2023-10-09 08:26:09 +00:00
Oğuz Ağcayazı 4ff6e87a8c return crates instead of a crate 2023-10-09 10:33:23 +03:00
Ralf Jung 08deb0daed float-to-float casts also have non-deterministic NaN results 2023-10-09 08:30:34 +02:00
Qiu Chaofan 14d29be03c Support AIX in Rust standard library 2023-10-09 14:02:57 +08:00
bors 093b9d5b29 Auto merge of #116533 - cjgillot:skip-trivial-mir, r=oli-obk
Do not run optimizations on trivial MIR.

Fixes https://github.com/rust-lang/rust/issues/116513

The bug was introduced in https://github.com/rust-lang/rust/pull/110728, which put the check too early in the query chain.

cc `@oli-obk` `@ouz-a`
2023-10-09 06:00:23 +00:00
Ralf Jung 615d738abe ensure unary minus propagates NaN payloads exactly 2023-10-09 07:37:24 +02:00
DaniPopes 47ebffabb8
Simplify some mir passes by using let chains 2023-10-09 05:22:31 +02:00
Michael Howell 8222335596 Clean up subversion layout 2023-10-08 20:17:53 -07:00
Michael Howell 7bb2c96c69 rustdoc: add missing macros to sibling nav sidebar 2023-10-08 20:17:53 -07:00
Michael Howell 47c46324aa rustdoc: clean up the In [name] up-pointer
This commit makes three changes for consistency and readability:

  - It shows the sibling navigation on module pages. It's weird
    that it didn't work before, and is inconsistent with everything
    else (even Crates have sibling navigation with other Crates).
  - It hides the "In [parent]" header if it's the same as the
    current crate, and if there's no other header between them.
    We need to keep it on modules and types, since they have
    their own header and data between them, and we don't want
    to show siblings under a header implying that they're children.
  - It adds a margin to deal with the headers butting directly into
    the branding lockup.
2023-10-08 20:17:53 -07:00
Michael Howell b0d76a7efe rustdoc: align crate name with search bar
Based on PR feedback.
2023-10-08 20:17:53 -07:00
Michael Howell 7c10c6f63d rustdoc: fix rustdoc-gui tests for logo changes 2023-10-08 20:17:53 -07:00
Michael Howell c6e6ecb1af rustdoc: remove rust logo from non-Rust crates 2023-10-08 20:17:53 -07:00
Michael Howell 6d6fa792ff rustdoc: clean up the layout for annotated version numbers
This should result in a layout for the actual standard library,
when built on CI, that looks like this:

    _____
   /     \ std
   |  R  | 1.74.0-nightly
   \_____/

   (203c57dbe 2023-09-17)

Having the whole version as one string caused it to flex wrap,
because the sidebar isn't wide enough to fit the whole thing.
2023-10-08 20:17:53 -07:00
Michael Howell 957c5db6be compiletest: add a way to specify params with spaces
This use single quotes, because those aren't used in params,
while double quotes are and would be tougher to parse.
2023-10-08 20:17:53 -07:00
Michael Howell 28ee5da4b7 rustdoc: show crate name beside small logo
This commit changes the layout to something a bit less "look at my logo!!!111"
gigantic, and makes it clearer where clicking the logo will actually take you.
It also means the crate name is persistently at the top of the sidebar, even
when in a sub-item page, and clicking that name takes you back to the root.

|         | Short crate name | Long crate name |
|---------|------------------|-----------------|
| Root    | ![short-root]    | ![long-root]
| Subpage | ![short-subpage] | ![long-subpage]

[short-root]: https://github.com/rust-lang/rust/assets/1593513/fe2ce102-d4b8-44e6-9f7b-68636a907f56
[short-subpage]: https://github.com/rust-lang/rust/assets/1593513/29501663-56c0-4151-b7de-d2637e167125
[long-root]: https://github.com/rust-lang/rust/assets/1593513/f6a385c0-b4c5-4a9c-954b-21b38de4192f
[long-subpage]: https://github.com/rust-lang/rust/assets/1593513/97ec47b4-61bf-4ebe-b461-0d2187b8c6ca

https://notriddle.com/rustdoc-html-demo-4/logo-lockup/image/index.html

https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/index.html

https://notriddle.com/rustdoc-html-demo-4/logo-lockup/adler/struct.Adler32.html

https://notriddle.com/rustdoc-html-demo-4/logo-lockup/crossbeam_channel/struct.Sender.html

This improves visual information density (the construct with the logo and
crate name is *shorter* than the logo on its own, because it's not
square) and navigation clarity (we can now see what clicking the Rust logo
does, specifically).

Compare this with the layout at [Phoenix's Hexdocs] (which is what this
proposal is closely based on), the old proposal on [Internals Discourse]
(which always says "Rust standard library" in the sidebar, but doesn't do the
side-by-side layout).

[Phoenix's Hexdocs]: https://hexdocs.pm/phoenix/1.7.7/overview.html
[Internals Discourse]: https://internals.rust-lang.org/t/poc-of-a-new-design-for-the-generated-rustdoc/11018

In newer versions of rustdoc, the crate name and version are always shown in
the sidebar, even in subpages. Clicking the crate name does the same thing
clicking the logo always did: return you to the crate root.

While this actually takes up less screen real estate than the old layout on
desktop, it takes up more HTML. It's also a bit more visually complex.

I could do what the Internals POC did and keep the vertically stacked layout
all the time, instead of doing a horizontal stack where possible. It would
take up more screen real estate, though.

This design is lifted almost verbatim from Hexdocs. It seems to work for them.
[`opentelemetry_process_propagator`], for example, has a long application name.

[`opentelemetry_process_propagator`]: https://hexdocs.pm/opentelemetry_process_propagator/OpentelemetryProcessPropagator.html

Has anyone written the rationale on why the Rust logo shows up on projects that
aren't the standard library? If we turned it off on non-standard crates by
default, it would line wrap crate names a lot less often.

Or maybe we should encourage crate authors to include their own logo more
often? It certainly helps give people a better sense of "place."

I'm not sure of anything that directly follows up this one. Plenty of other
changes could be made to improve the layout, like

* coming up with a less cluttered way to do disclosure (there's a lot of `[-]`
  on the page)
* doing a better job of separating lateral navigation (vec::Vec links to
  vec::IntoIter) and the table of contents (vec::Vec links to vec::Vec::new)
* giving readers more control of how much rustdoc hows them, and giving doc
  authors more control of how much it generates
* better search that reduces the need to browse

But those are mostly orthogonal, not future possibilities unlocked by this change.
2023-10-08 20:17:40 -07:00
Gurinder Singh 23a3b9e449 Fix suggestion span involving wrongly placed generic arg on enum variants
When the variant and the (wrongly placed) args are at separate
source locations such as being in different macos or one in a macro and
the other somwhere outside of it, the arg spans we computed spanned
the entire distance between such locations and were hence invalid.
.
2023-10-09 08:04:00 +05:30
bors 1f48cbc3f8 Auto merge of #116096 - cjgillot:debuginfo-fndef-size, r=nikic
Make FnDef 1-ZST in LLVM debuginfo.

Discussed in https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/LLVM.20HEAD.20llvm.2Edbg.2Edeclare.2Falloca.20size.20mismatch

r? `@nikic`
2023-10-09 02:08:13 +00:00
bors 37fda989ea Auto merge of #116468 - nnethercote:rustc_serialize, r=Mark-Simulacrum
Streamline `rustc_serialize`

r? `@Mark-Simulacrum`
2023-10-09 00:03:52 +00:00
Jubilee Young 31cb61b311 Drop all MIPS targets from CI 2023-10-08 15:35:07 -07:00
Jubilee Young 14cdb3808d Drop mips*-unknown-linux-musl* to tier 3
Also be more pedantic about spelling:
- LE? Is it "less than or equal to"? Say "little endian".
- We're Rust, not C, preserve the initial capital in "N64".
- "MUSL" doesn't stand for anything; Rich Felker spells it "musl".
2023-10-08 15:25:17 -07:00
Jubilee Young 03870154f4 Drop mips*-unknown-linux-gnu* to tier 3
In the process, be more pedantic about spelling:
- LE? Do you mean "limited edition"? It's "little endian".
- The name of the ABI is "N64" as in "Nintendo 64".
2023-10-08 15:19:04 -07:00
Rémy Rakic d634cc5a55 add test for `-Clink-self-contained` consistency 2023-10-08 21:57:39 +00:00
Rémy Rakic 13948747d0 consistency check for self-contained linking components CLI options
emit an error if components are both enabled and disabled on the CLI
2023-10-08 21:57:39 +00:00
Rémy Rakic 6f54cbf754 add `IntoIterator` impl for self-contained linking components 2023-10-08 21:57:39 +00:00
Rémy Rakic 5b9aa26401 implement opt out `-Clink-self-contained=-linker`
record both enabled and disabled components so that they can be merged
with the ones that the target spec will define
2023-10-08 21:57:39 +00:00
Rémy Rakic 2ce46f8e8c move single component parsing to dedicated function
this will prevent parsing when expecting more than a single component
to be parsed, and prepare for the symetric variant-to-name function to
be added
2023-10-08 21:57:39 +00:00
Rémy Rakic acc3b61c5e move `LinkSelfContainedComponents` to `rustc_target` 2023-10-08 21:57:38 +00:00
Rémy Rakic 71285c1da0 prepare stabilization of modern linker-flavors
fix a few comments
2023-10-08 21:57:36 +00:00
Ralf Jung 6796c5765d miri: make NaN generation non-deterministic 2023-10-08 20:35:46 +02:00
Camille GILLOT 9d211b044d Ignore MSVC in test. 2023-10-08 16:45:45 +00:00
Camille GILLOT 098fc9715e Make FnDef 1-ZST in LLVM debuginfo. 2023-10-08 16:42:45 +00:00
Camille GILLOT 37f080edbc Also consider call and yield as MIR SSA. 2023-10-08 16:05:26 +00:00