Commit Graph

267031 Commits

Author SHA1 Message Date
Michael Goulet
01d19d7be9 Don't call try_eval_target_usize in error reporting 2024-09-22 13:55:06 -04:00
Michael Goulet
8f579497f7 Don't call const normalize in error reporting 2024-09-22 13:55:06 -04:00
Gabriel Bjørnager Jensen
2daf076fd8 Mark 'make_ascii_uppercase' and 'make_ascii_lowercase' in 'u8' as const; Rename 'const_char_make_ascii' feature gate to 'const_make_ascii'; 2024-09-22 19:54:35 +02:00
Michael Goulet
3b8089a320 Introduce structurally_normalize_const, use it in hir_typeck 2024-09-22 13:54:16 -04:00
bjorn3
27b21af624 Rustup to rustc 1.83.0-nightly (1d68e6dd1 2024-09-21) 2024-09-22 17:35:29 +00:00
Guillaume Gomez
a34e0f5600
Rollup merge of #130702 - clubby789:unstable-book-docs, r=ehuss
Add some missing unstable book tracking issue links
2024-09-22 19:19:16 +02:00
Guillaume Gomez
c43a9ea146
Rollup merge of #130692 - RalfJung:result-flatten, r=Noratrieb
make unstable Result::flatten a const fn

This method is still unstable (tracked at https://github.com/rust-lang/rust/issues/70142), but there's no reason I can see for it not to be const -- after all, `Option::flatten` is const. So let's make the `Result` one `const` as well, under the same feature gate.

Cc https://github.com/rust-lang/rust/issues/70142
2024-09-22 19:19:16 +02:00
Guillaume Gomez
f40efa44ab
Rollup merge of #130690 - RalfJung:interpret-abi-compat-fixme, r=jieyouxu
interpret: remove outdated FIXME

The rule about `repr(C)` types with compatible fields got removed from the ABI compat docs before they landed, so this FIXME here is no longer correct. (So this is basically a follow-up to https://github.com/rust-lang/rust/pull/130185, doing some more cleanup around deciding not to guarantee ABI compatibility for structurally compatible `repr(C)` types.)
2024-09-22 19:19:15 +02:00
Guillaume Gomez
82b4177395
Rollup merge of #130670 - the8472:read-to-end-heuristics, r=ChrisDenton
delay uncapping the max_read_size in File::read_to_end

In https://github.com/rust-lang/rust/issues/130600#issuecomment-2365136985 I realized that we're likely still passing too-large buffers to the OS, at least once at the end.

Previous issues and PRs:
* #110650
* #110655
* #118222

r? ChrisDenton
2024-09-22 19:19:15 +02:00
Guillaume Gomez
cbf23960ea
Rollup merge of #130658 - EqualMa:patch-1, r=scottmcm
Fix docs of compare_bytes

The docs of `compare_bytes`. The return value is positive if <del>`right`</del> `left` is greater
2024-09-22 19:19:14 +02:00
bors
8ed95d1d9e Auto merge of #130709 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-09-22 17:17:11 +00:00
bjorn3
1d53572570 Sync from rust 1d68e6dd1d 2024-09-22 17:14:10 +00:00
bors
599b3295f5 Auto merge of #3852 - tiif:rwrefactor, r=RalfJung
Refactor fd read/write

This PR passed the responsibility of reading to user supplied buffer and dest place to each implementation of ``FileDescription::read/write/pread/pwrite``.

This is part of #3665.
2024-09-22 14:54:30 +00:00
Ralf Jung
d70fd882ef simplify eventfd handling a bit 2024-09-22 16:50:38 +02:00
Ralf Jung
ed24426824 remove some unnecessary to_owned 2024-09-22 16:50:38 +02:00
Ralf Jung
5dee646aea read, write: move cast-to-usize logic up and deduplicate it 2024-09-22 16:50:37 +02:00
Ralf Jung
fb1193078d further tweak FileDescription comments 2024-09-22 16:50:37 +02:00
tiif
d29be1f90a Pass pointer and len to FileDescription::write and change the type of len in read to usize 2024-09-22 16:50:36 +02:00
tiif
503b6af065 Use &[u8] instead of Vec<u8> and improve docs 2024-09-22 16:50:17 +02:00
Michael Goulet
95469dc09a No longer mark RTN as incomplete 2024-09-22 10:46:59 -04:00
bors
abdf173ef2 Auto merge of #13322 - RuairidhWilliamson:anon-trait-import, r=y21
Unused trait imports (formerly anonymous trait import)

For #11969

I'm looking for help and feedback on implementing a new lint for suggesting `use ... as _` for traits where possible.

I have had a go at implementing this but I don't know if this is the best way to do it as I am new to clippy.

There are some edge cases I can think of where this doesn't work but have aired on the side of false negatives instead of false positives.

An example of a false negative. I couldn't figure out the best way to resolve an import from within clippy. The sub module imports MyAny so that cannot be anonymized but `use std::any::Any` could be. In this case it is not caught because `Any` and `MyAny` have the same DefId.
```rust
mod nested_mod_used_bad1 {
    use std::any::Any;
    use std::any::Any as MyAny;
    mod foo {
        use crate::nested_mod_used_bad1::MyAny;
        fn foo() {
            println!("{:?}", MyAny::type_id("foo"));
        }
    }
}
```

Any feedback is much appreciated.

-------
changelog: new lint: `unused_trait_names`
2024-09-22 14:22:40 +00:00
clubby789
0510f06ad7 Add some missing tracking issue links 2024-09-22 14:03:48 +00:00
bors
0af7f0f4c4 Auto merge of #130697 - bjoernager:const-char-make-ascii, r=dtolnay
Mark `char::make_ascii_uppercase` and `char::make_ascii_lowercase` as const.

Relevant tracking issue: #130698

The `make_ascii_uppercase` and `make_ascii_lowercase` methods in `char` should be marked "const."

With the stabilisation of [`const_mut_refs`](https://github.com/rust-lang/rust/issues/57349/), this simply requires adding the `const` specifier to the function signatures.
2024-09-22 13:55:07 +00:00
nora
f5686e3cc9
Write return value for ptr_mask intrinsic (#1536)
This was forgotten. Without it, ptr_mask just always returns null.
2024-09-22 15:46:44 +02:00
Gabriel Bjørnager Jensen
be9b3b459a Mark 'make_ascii_uppercase' and 'make_ascii_lowercase' in 'char' as const; 2024-09-22 14:26:29 +02:00
Chayim Refael Friedman
393f9cc0ba Consider lifetime GATs object unsafe 2024-09-22 15:00:01 +03:00
bors
612ae353d7 Auto merge of #13409 - lukaslueg:issue13407, r=dswij
Fix `if_then_some_else_none` sugg missing closure intro

Fixes #13407

#13407 works in current stable. The suggestion-generating code got trampled over in 0532104247 :-)

changelog: [`if_then_some_else_none`]: Fix missing closure in suggestion
2024-09-22 11:59:12 +00:00
bors
2c5e600386 Auto merge of #13392 - alex-semenyuk:doc_type_complexity, r=dswij
Clarify example for `type_complexity`

As mentioned #13387 it's not clear how to fix issue with complexity so add example for this

changelog: none
2024-09-22 11:51:07 +00:00
bors
8243a8ca93 Auto merge of #3903 - RalfJung:auto-prs, r=RalfJung
try to give the CI job permission to create PRs

See the discussion [here](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/did.20github.20token.20permissions.20change.3F).

`@rust-lang/infra` just a heads-up that we are doing this -- I have no idea if this could cause any issues elsewhere, or if it is important that we limit the permissions here somehow, or so.
2024-09-22 10:53:45 +00:00
Ralf Jung
2859f2bafc try to give the CI job permission to create PRs 2024-09-22 12:51:11 +02:00
bors
4ae36d906f Auto merge of #130689 - RalfJung:rustc_nonnull_optimization_guaranteed, r=jieyouxu
fix rustc_nonnull_optimization_guaranteed docs

As far as I can tell, even back when this was [added](https://github.com/rust-lang/rust/pull/60300) it never *enabled* any optimizations. It just indicates that the FFI compat lint should accept those types for NPO.
2024-09-22 10:18:59 +00:00
Ralf Jung
8103505a4d fix rustc_nonnull_optimization_guaranteed docs 2024-09-22 10:00:24 +02:00
bors
80aa6fa731 Auto merge of #130688 - workingjubilee:rollup-ovre6p7, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #130648 (move enzyme flags from general cargo to rustc-specific cargo)
 - #130650 (Fixup Apple target's description strings)
 - #130664 (Generate line numbers for non-rust code examples as well)
 - #130665 (Prevent Deduplication of `LongRunningWarn`)
 - #130669 (tests: Test that `extern "C" fn` ptrs lint on slices)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-22 07:48:56 +00:00
Ralf Jung
89c3cbafb8 make unstable Result::flatten a const fn 2024-09-22 08:40:25 +02:00
bors
ee20c86282 Auto merge of #3902 - RalfJung:rustup, r=RalfJung
Rustup
2024-09-22 06:31:10 +00:00
Ralf Jung
d877ec2a3e rustfmt: switch over to setting style_edition 2024-09-22 08:29:28 +02:00
Ralf Jung
96cb08d499 Merge from rustc 2024-09-22 08:22:27 +02:00
Ralf Jung
b4c7ce55a7 Preparing for merge from rustc 2024-09-22 08:22:18 +02:00
Ralf Jung
27400ea4ed interpret: remove outdated FIXME 2024-09-22 08:18:30 +02:00
Jubilee
f314db6d6b
Rollup merge of #130669 - workingjubilee:slicing-fnptr-tests-finely, r=compiler-errors
tests: Test that `extern "C" fn` ptrs lint on slices

This seems to have slipped past the `improper_ctypes_definitions` lint at some point. I found similar tests but not one with this exact combination, so test the semi-unique combination.
2024-09-21 22:34:34 -07:00
Jubilee
b0208640c6
Rollup merge of #130665 - veera-sivarajan:fix-118612, r=compiler-errors
Prevent Deduplication of `LongRunningWarn`

Fixes #118612

As mention in the issue, `LongRunningWarn` is meant to be repeated multiple times.

Therefore, this PR stores a unique number in every instance of `LongRunningWarn` so that it's not hashed into the same value and omitted by the deduplication mechanism.
2024-09-21 22:34:34 -07:00
Jubilee
825b22fab2
Rollup merge of #130664 - GuillaumeGomez:generate-line-numbers-on-non-rust, r=notriddle
Generate line numbers for non-rust code examples as well

Currently, the "enable line numbers" setting only generated it for rust code examples. Found this limitation a bit strange so I decided to remove it.

You can test it [here](https://rustdoc.crud.net/imperio/generate-line-number-non-rust/doc/lib2/sub_mod/struct.Foo.html).

r? ``@notriddle``
2024-09-21 22:34:33 -07:00
Jubilee
2875d6f98e
Rollup merge of #130650 - BlackHoleFox:apple-target-desc-consistency, r=jieyouxu
Fixup Apple target's description strings

Noticed this inconsistency in how the Apple target's had their new descriptions written while looking at https://github.com/rust-lang/rust/pull/130614, and figured it was easy enough to fixup shortly. I think prefixing every OS with `Apple` is clearer, especially for less known ones like `visionOS` and `watchOS`; so that's what was done here along with making the architecture names more consistent and then some other small tweaks.

~~r​? `@thomcc~~`

cc `@madsmtm`
2024-09-21 22:34:32 -07:00
Jubilee
959f33ac85
Rollup merge of #130648 - onur-ozkan:enzyme-linking, r=Kobzol
move enzyme flags from general cargo to rustc-specific cargo

Resolves #130637.
2024-09-21 22:34:32 -07:00
bors
1f9a018fa3 Auto merge of #130446 - durin42:llvm-20-fix-CommandLineArgs, r=workingjubilee
rustc_llvm: adapt to flattened CLI args in LLVM

This changed in
llvm/llvm-project@e190d074a0. I decided to stick with more duplication between the ifdef blocks to make the code easier to read for the next two years before we can plausibly drop LLVM 19.

`@rustbot` label: +llvm-main

try-job: x86_64-msvc
2024-09-22 05:26:41 +00:00
Chayim Refael Friedman
ded3a5cd89 Include dereferences in consuming postfix completions (e.g. call) 2024-09-22 06:07:49 +03:00
Chayim Refael Friedman
2818d1e850 Properly account for mutable references when postfix-completing consuming completions (e.g. call) 2024-09-22 06:07:27 +03:00
bors
6ce376774c Auto merge of #130246 - dianne:issue-97589-fix, r=petrochenkov
rustc_expand: remember module `#[path]`s during expansion

During invocation collection, if a module item parsed from a `#[path]` attribute needed a second pass after parsing, its path wouldn't get added to the file path stack, so cycle detection broke. This checks the `#[path]` in such cases, so that it gets added appropriately. I think it should work identically to the case for external modules that don't need a second pass, but I'm not 100% sure.

Fixes #97589
2024-09-22 02:59:38 +00:00
Chayim Refael Friedman
0a259082df Fix name resolution when an import is resolved to some namespace and then later in the algorithm another namespace is added
The import is flagged as "indeterminate", and previously it was re-resolved, but only at the end of name resolution, when it's already too late for anything that depends on it.

This issue was tried to fix in https://github.com/rust-lang/rust-analyzer/pull/2466, but it was not fixed fully.
2024-09-22 04:19:10 +03:00
bors
55043f067d Auto merge of #130337 - BoxyUwU:anon_const_macro_call, r=camelid
Fix anon const def-creation when macros are involved take 2

Fixes #130321

There were two cases that #129137 did not handle correctly:

- Given a const argument `Foo<{ bar!() }>` in which `bar!()` expands to `N`, we would visit the anon const and then visit the `{ bar() }` expression instead of visiting the macro call. This meant that we would build a def for the anon const as `{ bar!() }` is not a trivial const argument as `bar!()` is not a path.
- Given a const argument `Foo<{ bar!() }>` is which `bar!()` expands to `{ qux!() }` in which `qux!()` expands to `N`, it should not be considered a trivial const argument as `{{ N }}` has two pairs of braces.  If we only looked at `qux`'s expansion it would *look* like a trivial const argument even though it is not. We have to track whether we have "unwrapped" a brace already when recursing into the expansions of `bar`/`qux`/any macro

r? `@camelid`
2024-09-22 00:31:03 +00:00