about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2023-10-07linker: Remove unstable legacy CLI linker flavorsVadim Petrochenkov-12/+3
2023-10-07Auto merge of #116330 - RalfJung:dont-key-on-allocid, r=oli-obkbors-33/+0
remove Key impls for types that involve an AllocId I don't understand how but somehow that leads to issues like https://github.com/rust-lang/rust/issues/83085? Anyway removing unused impls doesn't seem like a bad idea. The concerning part is that of course nothing will stop us from having such impls again in the future, alongside re-introducing bugs like #83085. r? `@oli-obk`
2023-10-07Auto merge of #116310 - Enselic:check_fn_args_move_size, r=oli-obkbors-58/+83
rustc_monomorphize: Introduce check_fn_args_move_size() This is in preparation of improving diagnostics of "large moves into functions", a.k.a. passing args. Note: This PR consists of two self-contained commits that can be reviewed independently. For https://github.com/rust-lang/rust/issues/83518 Also see https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/arg.20Spans.20for.20TerminatorKind.3A.3ACall.3F r? `@oli-obk` who is E-mentor
2023-10-07Auto merge of #115583 - RalfJung:packed-unsized, r=lcnrbors-1/+9
fix detecting references to packed unsized fields Fixes https://github.com/rust-lang/rust/issues/115396 This is a breaking change, but permitted as a soundness fix.
2023-10-07Auto merge of #116457 - RalfJung:try_eval_scalar_int, r=cjgillotbors-15/+15
fix fast-path for try_eval_scalar_int Cc https://github.com/rust-lang/rust/pull/116281 `@Nadrieril`
2023-10-07rustc_monomorphize: Introduce check_fn_args_move_size()Martin Nordholts-56/+76
So that we later can improve the accuracy of diagnostics.
2023-10-07rustc_monomorphize: Move limit check into check_move_size()Martin Nordholts-5/+10
And rename to check_operand_move_size(). Later we will introduce check_fn_args_move_size().
2023-10-07Copy 1-element arrays as scalars, not vectorsScott McMurray-1/+6
For `[T; 1]` it's silly to copy as `<1 x T>` when we can just copy as `T`.
2023-10-06Rollup merge of #116400 - estebank:issue-78585, r=WaffleLapkinJubilee-19/+89
Detect missing `=>` after match guard during parsing ``` error: expected one of `,`, `:`, or `}`, found `.` --> $DIR/missing-fat-arrow.rs:25:14 | LL | Some(a) if a.value == b { | - while parsing this struct LL | a.value = 1; | -^ expected one of `,`, `:`, or `}` | | | while parsing this struct field | help: try naming a field | LL | a: a.value = 1; | ++ help: you might have meant to start a match arm after the match guard | LL | Some(a) if a.value == b => { | ++ ``` Fix #78585.
2023-10-06Rollup merge of #116277 - RalfJung:post-mono, r=oli-obkJubilee-79/+31
dont call mir.post_mono_checks in codegen It seems like all tests are still passing when I remove this... let's see what CI says.
2023-10-06Auto merge of #116492 - matthiaskrgr:rollup-xzfhmq1, r=matthiaskrgrbors-157/+69
Rollup of 7 pull requests Successful merges: - #114564 (Attempt to describe the intent behind the `From` trait further) - #116297 (add some docs to hooks/mod.rs) - #116423 (Fix typo in attrs.rs) - #116466 (`rustc_transmute` cleanups) - #116474 (Assorted small cleanups) - #116481 (Reuse existing `Some`s in `Option::(x)or`) - #116484 (Minor doc clarification in Once::call_once) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-06Rollup merge of #116474 - nnethercote:rustc_assorted, r=spastorinoMatthias Krüger-79/+28
Assorted small cleanups r? `@spastorino`
2023-10-06Rollup merge of #116466 - nnethercote:rustc_transmute, r=oli-obkMatthias Krüger-78/+36
`rustc_transmute` cleanups Just some things I found while poking around this code. r? `@oli-obk`
2023-10-06Rollup merge of #116297 - RalfJung:hooks, r=oli-obkMatthias Krüger-0/+5
add some docs to hooks/mod.rs r? `@oli-obk`
2023-10-06Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiserbors-3511/+3644
Show more information when multiple `impl`s apply - When there are `impl`s without type params, show only those (to avoid showing overly generic `impl`s). ``` error[E0283]: type annotations needed --> $DIR/multiple-impl-apply.rs:34:9 | LL | let y = x.into(); | ^ ---- type must be known at this point | note: multiple `impl`s satisfying `_: From<Baz>` found --> $DIR/multiple-impl-apply.rs:14:1 | LL | impl From<Baz> for Bar { | ^^^^^^^^^^^^^^^^^^^^^^ ... LL | impl From<Baz> for Foo { | ^^^^^^^^^^^^^^^^^^^^^^ = note: required for `Baz` to implement `Into<_>` help: consider giving `y` an explicit type | LL | let y: /* Type */ = x.into(); | ++++++++++++ ``` - Lower the importance of `T: Sized`, `T: WellFormed` and coercion errors, to prioritize more relevant errors. The pre-existing deduplication logic deals with hiding redundant errors better that way, and we show errors with more metadata that is useful to the user. - Show `<SelfTy as Trait>::assoc_fn` suggestion in more cases. ``` error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> $DIR/cross-return-site-inference.rs:38:16 | LL | return Err(From::from("foo")); | ^^^^^^^^^^ cannot call associated function of trait | help: use a fully-qualified path to a specific available implementation | LL | return Err(</* self type */ as From>::from("foo")); | +++++++++++++++++++ + ``` Fix #88284.
2023-10-06add some comments explaining how the required_consts stuff fits togetherRalf Jung-0/+10
2023-10-06Preserve DebugInfo in DeadStoreElimination.Camille GILLOT-8/+43
2023-10-06Fix sdkname for tvos simulatorSebastian Imlay-0/+1
2023-10-06Fix typosSebastian Imlay-5/+3
2023-10-06Initial target specification for aarch64-apple-tvos-simSebastian Imlay-0/+34
2023-10-06Auto merge of #115304 - Enselic:trailing-gt, r=cjgillotbors-1/+0
Allow file names to end with '>' The [`rustc_span::FileName`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_span/enum.FileName.html) enum already differentiates between real files and "fake" files such as `<anon>`. We do not need to artificially forbid real file names from ending in `>`. Closes #73419
2023-10-06rustc_metadata: use try_canonicalizeTamir Duberstein-2/+3
This is simpler and avoids unnecessary calls to `env::current_dir`. rustc_plugin is left unchanged to avoid conflicts with #116412. Updates #116426.
2023-10-06rustc_codegen_ssa: use try_canonicalize in rpathTamir Duberstein-8/+6
This is simpler and avoids unnecessary calls to `env::current_dir`.
2023-10-06rustc_driver: avoid fallible conversionsTamir Duberstein-15/+18
Use `std::path::PathBuf` rather than `String`; use `std::env::var_os` rather than `std::env::var`. These changes avoid a number of error paths which can arise in the presence of non-UTF-8 paths.
2023-10-06compiler: always use var_os("RUST_BACKTRACE")Tamir Duberstein-3/+3
There are 3 instances of var(...) and 3 instances of var_os(...); the latter avoids an appearance of unhandled error, so use it everywhere.
2023-10-06fix to register analysis pass from llvm pluginEmanuele Vannacci-14/+14
2023-10-06Rollup merge of #116329 - RalfJung:swap-comments, r=scottmcmGuillaume Gomez-1/+1
update some comments around swap() Based on ``@eddyb's`` comment [here](https://github.com/rust-lang/unsafe-code-guidelines/issues/461#issuecomment-1742156410). And then I noticed the wrong capitalization for Miri and fixed it in some other places as well.
2023-10-06Rollup merge of #116198 - Jarcho:diag_items, r=WaffleLapkinGuillaume Gomez-0/+49
Add more diagnostic items for clippy
2023-10-06Sort `rustc_driver_impl` dependencies.Nicholas Nethercote-26/+28
As per https://github.com/rust-lang/rust/blob/master/src/doc/style-guide/src/cargo.md, which says: > Sort key names alphabetically within each section, with the exception > of the [package] section. And use tidy to enforce it.
2023-10-06Rollup merge of #116421 - Urgau:inter-mut-invalid_ref_casting, r=oli-obkMatthias Krüger-11/+21
Clarify `invalid_reference_casting` lint around interior mutable types This is PR intends to clarify the `invalid_reference_casting` lint around interior mutable types by adding a note for them saying that they should go through `UnsafeCell::get`. So for this code: ```rust let cell = &std::cell::UnsafeCell::new(0); let _num = &mut *(cell as *const _ as *mut i32); ``` the following note will be added to the lint output: ```diff error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell` --> $DIR/reference_casting.rs:68:16 | LL | let _num = &mut *(cell as *const _ as *mut i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html> + = note: even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get` ``` Suggestion are welcome around the note contents. Fixes https://github.com/rust-lang/rust/issues/116410 cc `@RalfJung`
2023-10-06Remove unnecessary `pub`.Nicholas Nethercote-1/+1
2023-10-06Remove unneeded features.Nicholas Nethercote-4/+0
2023-10-06Remove unneeded dependency.Nicholas Nethercote-4/+3
Also sort them.
2023-10-06Factor out `insert_or_error`.Nicholas Nethercote-62/+23
It appears identically as a closure in two functions. Also change its return type from `bool` to `Option<()>` so it can be used with `?`.
2023-10-06Remove unused `FileName::CfgSpec`.Nicholas Nethercote-7/+1
2023-10-06Remove unneeded dependency.Nicholas Nethercote-1/+0
2023-10-06Remove the `MaybeTransmutableQuery<&'l Dfa<...>, C>` impl.Nicholas Nethercote-16/+0
Because there is also a `MaybeTransmutableQuery<Dfa<...>, C>` impl, and we don't need both.
2023-10-06Fix a comment.Nicholas Nethercote-3/+1
It was duplicated from the method above.
2023-10-06Remove `map_layouts`.Nicholas Nethercote-57/+33
As per the `FIXME` comment, it's an abstraction that makes the code harder to read.
2023-10-06Auto merge of #116269 - Veykril:rustc-abi, r=WaffleLapkinbors-232/+294
Bring back generic parameters for indices in rustc_abi and make it compile on stable This effectively reverses https://github.com/rust-lang/rust/pull/107163, allowing rust-analyzer to depend on this crate again, It also moves some glob imports / expands them in the first commit because they made it more difficult for me to reason about things.
2023-10-06Use `collect` to decode `Vec`.Nicholas Nethercote-23/+10
It's hyper-optimized, we don't need our own unsafe code here. This requires getting rid of all the `Allocator` stuff, which isn't needed anyway.
2023-10-06Streamline some `Encodable` impls.Nicholas Nethercote-6/+3
Making them consistent with similar impls.
2023-10-06Use `collect` for decoding more collection types.Nicholas Nethercote-40/+6
2023-10-06rustc_serialize: merge `collection_impls.rs` into `serialize.rs`.Nicholas Nethercote-264/+258
`serialize.rs` has the `Encodable`/`Decodable` impls for lots of basic types, including `Vec`. `collection_impls` has it for lots of collection types. The distinction isn't really meaningful, and it's simpler to have them all in a single file.
2023-10-06Make the comment order match variant declaration order.Nicholas Nethercote-1/+1
2023-10-06Remove an unnecessary `pub(crate)`.Nicholas Nethercote-1/+1
2023-10-05Add more diagnostic items for clippyJason Newcomb-0/+49
2023-10-06Remove unused serialization support for `LinkedList`.Nicholas Nethercote-17/+1
2023-10-06rustc_serialize: Remove unneeded feature decls.Nicholas Nethercote-11/+5
I.e. `maybe_uninit_slice` and `new_uninit`. Also sort the remaining features and remove an ugly, low-value comment.
2023-10-05Replace LocationExtended with DefLocation in SsaLocalsTomasz Miąsko-27/+11