Commit Graph

267981 Commits

Author SHA1 Message Date
许杰友 Jieyou Xu (Joe)
de588a6e60 Remove valgrind test suite support from bootstrap 2024-10-07 07:53:48 +00:00
许杰友 Jieyou Xu (Joe)
a961be9f13 Remove valgrind test suite and support from compiletest 2024-10-07 07:53:42 +00:00
codemountains
fc64ff7ec2 Rename nested_meta to meta_item_inner 2024-10-07 15:22:03 +09:00
bors
690332a251 Auto merge of #131345 - Zalathar:rollup-scdxuou, r=Zalathar
Rollup of 3 pull requests

Successful merges:

 - #128399 (liballoc: introduce String, Vec const-slicing)
 - #131308 (enable f16 and f128 on windows-gnullvm targets)
 - #131325 (coverage: Multiple small tweaks to counter creation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-07 06:01:07 +00:00
许杰友 Jieyou Xu (Joe)
64efbe2b53 Prune invalid ignore-mode-* directives
These are only valid for coverage test modes.
2024-10-07 05:42:43 +00:00
Stuart Cook
99e12442da
Rollup merge of #131325 - Zalathar:tweak-counters, r=jieyouxu
coverage: Multiple small tweaks to counter creation

I've been experimenting with some larger changes to how coverage counters are assigned to parts of the control-flow graph, and while none of that is ready yet, along the way I've repeatedly found myself wanting these smaller tweaks as a base.

There are no changes to compiler output.
2024-10-07 15:37:07 +11:00
Stuart Cook
5c1c49a0c4
Rollup merge of #131308 - mati865:gnullvm-f16-f128, r=tgross35
enable f16 and f128 on windows-gnullvm targets

Continuation of https://github.com/rust-lang/rust/pull/130959
2024-10-07 15:37:07 +11:00
Stuart Cook
dd4f062b07
Rollup merge of #128399 - mammothbane:master, r=Amanieu,tgross35
liballoc: introduce String, Vec const-slicing

This change `const`-qualifies many methods on `Vec` and `String`, notably `as_slice`, `as_str`, `len`. These changes are made behind the unstable feature flag `const_vec_string_slice`.

## Motivation
This is to support simultaneous variance over ownership and constness. I have an enum type that may contain either `String` or `&str`, and I want to produce a `&str` from it in a possibly-`const` context.

```rust
enum StrOrString<'s> {
    Str(&'s str),
    String(String),
}

impl<'s> StrOrString<'s> {
    const fn as_str(&self) -> &str {
        match self {
             // In a const-context, I really only expect to see this variant, but I can't switch the implementation
             // in some mode like #[cfg(const)] -- there has to be a single body
             Self::Str(s) => s,

             // so this is a problem, since it's not `const`
             Self::String(s) => s.as_str(),
        }
    }
}
```

Currently `String` and `Vec` don't support this, but can without functional changes. Similar logic applies for `len`, `capacity`, `is_empty`.

## Changes

The essential thing enabling this change is that `Unique::as_ptr` is `const`. This lets us convert `RawVec::ptr` -> `Vec::as_ptr` -> `Vec::as_slice` -> `String::as_str`.

I had to move the `Deref` implementations into `as_{str,slice}` because `Deref` isn't `#[const_trait]`, but I would expect this change to be invisible up to inlining. I moved the `DerefMut` implementations as well for uniformity.
2024-10-07 15:37:06 +11:00
bors
8841a3dadd Auto merge of #131226 - nnethercote:rustc_infer-cleanups, r=lcnr
`rustc_infer` cleanups

Various small improvements I found while reading over this code.

r? `@lcnr`
2024-10-07 03:22:04 +00:00
Nicholas Nethercote
4547c0a990 Avoid another &Lrc<..> in a return value. 2024-10-07 13:59:50 +11:00
Nicholas Nethercote
2123509351 Remove an unnecessary &Lrc<_> local variable. 2024-10-07 13:58:29 +11:00
Nicholas Nethercote
860cbccad9 Convert a &Lrc<T> argument to Lrc<T>.
It's slightly simpler.
2024-10-07 13:58:10 +11:00
Nicholas Nethercote
731469fee5 Convert Option<&Lrc<T>> return types to Option<&T>.
It's simpler and more concise.
2024-10-07 13:56:29 +11:00
bors
a964a92277 Auto merge of #131068 - RalfJung:immediate-offset-sanity-check, r=nnethercote
Don't use Immediate::offset to transmute pointers to integers

This applies the relatively new `assert_matches_abi` check in the `offset` operation on immediates, which makes sure that if offsets are used to alter the layout (which is possible because the field layout is arbitrarily picked by the caller), this is not done in a way that breaks the invariant of the `Immediate` type.

This leads to ICEs in a GVN mir-opt test, so the second commit fixes GVN.

Fixes https://github.com/rust-lang/rust/issues/131064.
2024-10-07 00:45:41 +00:00
Nathan Perry
d793766a61 liballoc: introduce String, Vec const-slicing
This change `const`-qualifies many methods on Vec and String, notably
`as_slice`, `as_str`, `len`. These changes are made behind the unstable
feature flag `const_vec_string_slice` with the following tracking issue:

https://github.com/rust-lang/rust/issues/129041
2024-10-06 19:58:35 -04:00
Nicholas Nethercote
3fdcde76d9 Remove out-of-date comment. 2024-10-07 09:50:51 +11:00
Nicholas Nethercote
afbff05c84 Move a use statement so it's with the other use statements. 2024-10-07 09:50:51 +11:00
Nicholas Nethercote
e800967478 Simplify two matches.
Matches involving `GenericArgKind` pairs typically use a single `_` for
the impossible case. This commit shortens two verbose matches in this
way.
2024-10-07 09:50:51 +11:00
Nicholas Nethercote
3386530c91 Streamline next_*_var* methods.
Inline and remove `next_const_var_id`, `next_int_var_id`,
`next_float_var_id`, all of which have a single call site.
2024-10-07 09:50:51 +11:00
Nicholas Nethercote
deeb0c5cf3 Inline and remove InferCtxtBuilder::with_defining_opaque_types.
It has a single use.
2024-10-07 09:50:51 +11:00
Nicholas Nethercote
0ca4784c45 Fix FIXME comment on FixupError.
`FixupError` is isomorphic with `TyOrConstInferVar`, so this commit
changes it to just be a wrapper around `TyOrConstInferVar`.

Also, move the `Display` impl for `FixupError` next to `FixupError`.
2024-10-07 09:50:51 +11:00
Nicholas Nethercote
25d1ef1993 Remove InferCtxt::err_count_on_creation.
It's no longer used meaningfully.

This also means `DiagCtxtHandle::err_count_excluding_lint_errs` can be
removed.
2024-10-07 09:50:50 +11:00
Nicholas Nethercote
2d2755ff97 Reduce visibilities some more.
It helps people reading the code understand how widely things are used.
2024-10-07 09:50:50 +11:00
Nicholas Nethercote
5c015eed47 Remove unused UnitResult type. 2024-10-07 09:50:50 +11:00
Nicholas Nethercote
5486d72e77 Reduce visibilities.
Three of the modules don't need to be `pub`, and then
`warn(unreachable_pub)` identifies a bunch more things that also
shouldn't be `pub`, plus a couple of things that are unused.
2024-10-07 09:50:50 +11:00
Nicholas Nethercote
7a9bbd05c4 Rename errors/mod.rs as errors.rs.
It's simpler, for this tiny module.
2024-10-07 09:50:50 +11:00
Nicholas Nethercote
cfeee7bcbf Remove unused features. 2024-10-07 09:50:49 +11:00
Brezak
aa4f16a6e7
Check that #[pointee] is applied only to generic arguments 2024-10-06 23:56:27 +02:00
bors
1b3b8e7b02 Auto merge of #128651 - folkertdev:naked-asm-macro-v2, r=Amanieu
add `naked_asm!` macro for use in `#[naked]` functions

tracking issue: https://github.com/rust-lang/rust/issues/90957

Adds the `core::arch::naked_asm` macro, to be used in `#[naked]` functions, but providing better error messages and a place to explain the restrictions on assembly in naked functions.

This PR does not yet require that the `naked_asm!` macro is used inside of `#[naked]` functions:

- the `asm!` macro can still be used in `#[naked]` functions currently, with the same restrictions and error messages as before.
- the `naked_asm!` macro can be used outside of `#[naked]` functions. It has not yet been decided whether that should be allowed long-term.

In this PR, the parsing code of `naked_asm!` now enforces the restrictions on assembly in naked functions, with the exception of checking that the `noreturn` option is specified. It also has not currently been decided if `noreturn` should be implicit or not.

This PR looks large because it touches a bunch of tests. The code changes are mostly straightforward I think: we now have 3 flavors of assembly macro, and that information must be propagated through the parsing code and error messages.

cc `@Lokathor`

r? `@Amanieu`
2024-10-06 21:51:18 +00:00
bors
d5984c7f71 Auto merge of #18255 - ChayimFriedman2:stack-overflow, r=HKalbasi
Use external stack in borrowck DFS

Because damnit, it can crash r-a. Why do people make this stupid DFSes anyway (I get it, it's easier until it blows).

Fixes #18223 (who thought DFS will be the problem).
2024-10-06 21:23:00 +00:00
Chayim Refael Friedman
0e96fd02f0 Use external stack in borrowck DFS
Because damnit, it can crash r-a. Why do people make this stupid DFSes anyway (I get it, it's easier until it blows).
2024-10-06 23:48:16 +03:00
bors
55a22d2a63 Auto merge of #131337 - matthiaskrgr:rollup-j37xn8o, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #131001 (add clarity for custom path installation)
 - #131307 (Android: Debug assertion after setting thread name)
 - #131322 (Update out-dated link)
 - #131335 (grammar fix)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-06 19:24:25 +00:00
Matthias Krüger
93b94657b2
Rollup merge of #131335 - dacianpascu06:fix-typo, r=joboet
grammar fix
2024-10-06 20:43:41 +02:00
Matthias Krüger
ab81e044e0
Rollup merge of #131322 - mu001999-contrib:cleanup/invalid-url, r=jieyouxu
Update out-dated link
2024-10-06 20:43:40 +02:00
Matthias Krüger
9e8c03018f
Rollup merge of #131307 - YohDeadfall:prctl-set-name-dbg-assert, r=workingjubilee
Android: Debug assertion after setting thread name

While `prctl` cannot fail if it points to a valid buffer, it's still better to assert the result as it's done for other places.
2024-10-06 20:43:40 +02:00
Matthias Krüger
1e2b77d9ab
Rollup merge of #131001 - iyernaveenr:naveen_iyer/installation_clarity, r=onur-ozkan
add clarity for custom path installation

install.sysconfdir is another value, in addition to install.prefix, that could be set for custom path installation.
2024-10-06 20:43:39 +02:00
dacian
3b2be4457d grammar fix 2024-10-06 20:37:10 +03:00
Folkert de Vries
5fc60d1e52 various fixes for naked_asm! implementation
- fix for divergence
- fix error message
- fix another cranelift test
- fix some cranelift things
- don't set the NORETURN option for naked asm
- fix use of naked_asm! in doc comment
- fix use of naked_asm! in run-make test
- use `span_bug` in unreachable branch
2024-10-06 19:00:09 +02:00
bors
8422e27b27 Auto merge of #129670 - est31:cfg_attr_crate_type_name_error, r=Urgau
Make deprecated_cfg_attr_crate_type_name a hard error

Turns the forward compatibility lint added by #83744 into a hard error, so now, while the `#![crate_name]` and `#![crate_type]` attributes are still allowed in raw form, they are now forbidden to be nested inside a `#![cfg_attr()]` attribute.

The following will now be an error:

```Rust
#![cfg_attr(foo, crate_name = "foobar")]
#![cfg_attr(foo, crate_type = "bin")]
```

This code will continue working and is not deprecated:

```Rust
#![crate_name = "foobar"]
#![crate_type = "lib"]
```

The reasoning for this is explained in #83744: it allows us to not have to cfg-expand in order to determine the crate's type and name.

As of filing the PR, exactly two years have passed since #99784 has been merged, which has turned the lint's default warning level into an error, so there has been ample time to move off the now-forbidden syntax.

cc #91632 - tracking issue for the lint
2024-10-06 17:00:02 +00:00
Folkert de Vries
10fa482906 remove checks that are now performed during macro expansion of naked_asm! 2024-10-06 18:12:25 +02:00
Folkert de Vries
bc0a9543a3 more asm! -> naked_asm! in tests 2024-10-06 18:12:25 +02:00
Folkert de Vries
562ec5a6fb disallow asm! in #[naked] functions
also disallow the `noreturn` option, and infer `naked_asm!` as `!`
2024-10-06 18:12:25 +02:00
Folkert
1a9c1cbf36 use naked_asm! in feature-gate-naked_functions test 2024-10-06 18:12:25 +02:00
Folkert
47b42bef32 use naked_asm! in naked-function tests 2024-10-06 18:12:25 +02:00
Folkert
0aec55504c use naked_asm! in tests/ui/asm/naked-functions.rs 2024-10-06 18:12:25 +02:00
Folkert
aa5bbf05f4 implement naked_asm macro 2024-10-06 18:12:25 +02:00
onur-ozkan
1e5c4cb0a2 Revert "Rollup merge of #129584 - lolbinarycat:old-upstream-warning, r=albertlarsan68"
This reverts commit 776187d2c9, reversing
changes made to 7d015575ad.
2024-10-06 19:04:35 +03:00
onur-ozkan
dd0bcf5185 Revert "Auto merge of #130121 - lolbinarycat:bootstrap-warn-old-upstream-worktree, r=albertlarsan68"
This reverts commit 507c05bead, reversing
changes made to 0609062a91.
2024-10-06 18:59:40 +03:00
codemountains
6dfc4a0473 Rename NestedMetaItem to MetaItemInner 2024-10-06 23:28:30 +09:00
bors
373971abe4 Auto merge of #131259 - ismailarilik:handle-potential-query-instability-lint-for-librustdoc, r=notriddle
Handle `librustdoc` cases of `rustc::potential_query_instability` lint

This PR removes `#![allow(rustc::potential_query_instability)]` line from [`src/librustdoc/lib.rs`](https://github.com/rust-lang/rust/blob/master/src/librustdoc/lib.rs#L23) and converts `FxHash{Map,Set}` types into `FxIndex{Map,Set}` to suppress lint errors.

A somewhat tracking issue: https://github.com/rust-lang/rust/issues/84447

r? `@compiler-errors`
2024-10-06 14:04:21 +00:00