[debuginfo] Make cpp-like debuginfo type names for slices and str consistent.
Before this PR, the compiler would emit the debuginfo name `slice$<T>` for all kinds of slices, regardless of whether they are behind a reference or not and regardless of the kind of reference. As a consequence, the types `Foo<&[T]>`, `Foo<[T]>`, and `Foo<&mut [T]>` would end up with the same type name `Foo<slice$<T> >` in debuginfo, making it impossible to disambiguate between them by name. Similarly, `&str` would get the name `str` in debuginfo, so the debuginfo name for `Foo<str>` and `Foo<&str>` would be the same. In contrast, `*const [bool]` and `*mut [bool]` would be `ptr_const$<slice$<bool> >` and `ptr_mut$<slice$<bool> >`, i.e. the encoding does not lose information about the type.
This PR removes all special handling for slices and `str`. The types `&[bool]`, `&mut [bool]`, and `&str` thus get the names `ref$<slice2$<bool> >`, `ref_mut$<slice2$<bool> >`, and `ref$<str$>` respectively -- as one would expect.
The new special name for slices is `slice2$` to differentiate it from the previous name `slice$`, which has different semantics. The same is true for `str` and `str$`. This kind of versioning already has a precedent with the case of `enum$` and `enum2$` and hopefully will make it easier to transition existing consumers of these names.
cc `@rust-lang/wg-debugging` `@vadimcn`
r? `@wesleywiser`
UPDATE: Here is a table to clarify the changes
| Rust type | DWARF name | C++-like name (before) | C++-like name (after) |
|-----------|------------|------------------------|------------------------|
| `[T]` | `[T]` | `slice$<T>` | `slice2$<T>` |
| `&[T]` | `&[T]` | `slice$<T>` | `ref$<slice2$<T> >` |
| `&mut [T]` | `&mut [T]` | `slice$<T>` | `ref_mut$<slice2$<T> >`|
| `str` | `str` | `str` | `str$` |
| `&str` | `&str` | `str` | `ref$<str$>` |
| `&mut str` | `&mut str` | `str` | `ref_mut$<str$>`|
| `*const [T]` | `*const [T]` | `ptr_const$<slice$<T> >` | `ptr_const$<slice2$<T> >` |
| `*mut [T]` | `*mut [T]` | `ptr_mut$<slice$<T> >` | `ptr_mut$<slice2$<T> >` |
As you can see, before the PR many types would end up with the same name, making it impossible to distinguish between them in NatVis or other places where types are matched or looked up by name. The DWARF version of names is not changed.
Remove `has_errors` from `FnCtxt`
It doesn't seem like this `has_errors` flag actually suppresses any errors (at least in the UI test suite) --- except for one test (`E0767.rs`), and I think that error really should be considered legitimate, since it has nothing to do with the error code and continues to exist after you fix the first error...
This flag was added by ```@eddyb``` in 6b3cc0b8c8, and it's likely that it was made redundant due to subsequent restructuring of the compiler.
It only affects block type-checking anyways, so its effect does seem limited these days anyway.
improve `filesearch::get_or_default_sysroot`
`fn get_or_default_sysroot` is now improved and used in `miri` and `clippy`, and tests are still passing as they should. So we no longer need to implement custom workarounds/hacks to find sysroot in tools like miri/clippy.
Resolves https://github.com/rust-lang/rust/issues/98832
re-opened from #103581
Spans are independent of the body being borrow-checked, so they don't
need remapping when promoting type-tests and they yield more specific
error spans inside bodies of closures/inline consts.
Don't use `ConstraintCategory::ClosureBounds`!
Set the category and the span for the promoted constraints to that of
the original constraint earlier than before.
This eliminates the need for `closure_bounds_mapping`.
LLVM 16: Switch to using MemoryEffects
This adapts the compiler to the changes required by 304f1d59ca.
AFAICT, `WriteOnly` isn't used by the compiler, all `ReadNone` uses were migrated and the remaining use of `ReadOnly` is only for function parameters.
To simplify the FFI, this PR uses an enum to represent `MemoryEffects` across the FFI boundary, which then gets mapped to the matching static factory method when constructing the attribute.
Fixes#103961.
`@rustbot` label +llvm-main
r? `@nikic`
Make mir opt unused file check blessable
Makes it slightly nicer to work with.
Can't write automated test but tested locally via
```
$ touch src/test/mir-opt/random
$ x test tidy // shows failure
$ x test tidy --bless // file gone
```
r? `@jyn514`
Fix artifact version/channel detection for stable
On stable, our artifacts are uploaded with the raw version number (e.g., 1.65.0), not the channel. This adjusts our detection logic to use the version number from src/version when we detect the stable channel.
This is really only important for stable channel re-builds, I think, but those do happen from time to time. I'm backporting a similar commit in https://github.com/rust-lang/rust/pull/103859 to make that PR pass CI.
This commit should result in no appearance changes.
To make the logo container exactly the desired height, you want to get rid
of the part of the box used for typographic descenders (you know, the part
of g, y, and j that descends below the baseline). After all, it contains no
text, but the space is still left open in the layout by default, because
`<img>` is `display:inline`. The CSS used to employ three different tricks
to accomplish this:
* By making `.sidebar .logo-container` a flex container, the image becomes
a flex item and is [blockified], without synthesizing any inline boxes.
No inline boxes means no descenders.
* By giving `.mobile-topbar .logo-container` a max-height exactly the same
as the height of the image plus the padding, the descender area gets
cut off.
* By setting `.sub-logo-container { line-height: 0 }`, we ensure that the
only box that contributes to the height of the line box is the image
itself, and not any zero-content text boxes that neighbor it. See the
[logical height algorithm].
This commit gets rid of the first two hacks, leaving only the third,
since it requires only one line of code to accomplish and doesn't require
setting the value based on math.
[blockified]: https://drafts.csswg.org/css-flexbox-1/#flex-items
[logical height algorithm]: https://www.w3.org/TR/css-inline-3/#inline-height
Ensure that compile-flags arguments are the last in UI tests
Before this PR, compiletest would add `-L path/to/aux` at the end of the rustc flags, even after the custom ones set with the compile-flags header comment. This made it impossible to check how rustc would behave when a flag requiring an argument was passed without the argument, because the argument would become `-L`.
This PR fixes that by adding the `-L path/to/aux` before the arguments defined in compile-flags, at least for UI tests. Other test suites might either be fixed as well by this change, or still present the old behavior (`-L` is now always passed before, but other tests suites might add additional flags after the custom ones).
Rollup of 8 pull requests
Successful merges:
- #103367 (Remove std's transitive dependency on cfg-if 0.1)
- #103397 (Port `dead_code` lints to be translatable.)
- #103681 (libtest: run all tests in their own thread, if supported by the host)
- #103792 (Migrate `codegen_ssa` to diagnostics structs - [Part 2])
- #103897 (asm: Work around LLVM bug on AArch64)
- #103937 (minor changes to make method lookup diagnostic code easier to read)
- #103958 (Test tidy should not count untracked paths towards entries limit)
- #103964 (Give a specific lint for unsafety not being inherited)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup