about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-08-06Auto merge of #126804 - estebank:short-error-primary-label, r=davidtwcobors-14/+34
On short error format, append primary span label to message The `error-format=short` output only displays the path, error code and main error message all in the same line. We now add the primary span label as well after the error message, to provide more context.
2024-08-06On short error format, append primary span label to messageEsteban Küber-14/+34
The `error-format=short` output only displays the path, error code and main error message all in the same line. We now add the primary span label as well after the error message, to provide more context.
2024-08-06Auto merge of #128200 - estebank:normalize-whitespace, r=pnkfelixbors-30/+38
Change output normalization logic to be linear against size of output Modify the rendered output normalization routine to scan each character *once* and construct a `String` to be printed out to the terminal *once*, instead of using `String::replace` in a loop multiple times. The output doesn't change, but the time spent to prepare a diagnostic is now faster (or rather, closer to what it was before #127528).
2024-08-06Auto merge of #125558 - Amanieu:const-asm-type, r=lcnrbors-265/+295
Tweak type inference for `const` operands in inline asm Previously these would be treated like integer literals and default to `i32` if a type could not be determined. To allow for forward-compatibility with `str` constants in the future, this PR changes type inference to use an unbound type variable instead. The actual type checking is deferred until after typeck where we still ensure that the final type for the `const` operand is an integer type. <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> -->
2024-08-05Auto merge of #128707 - matthiaskrgr:rollup-63klywk, r=matthiaskrgrbors-63/+222
Rollup of 5 pull requests Successful merges: - #122049 (Promote riscv64gc-unknown-linux-musl to tier 2) - #128580 (Use `ParamEnv::reveal_all` in CFI) - #128688 (custom MIR: add support for tail calls) - #128694 (Normalize when equating `dyn` tails in MIR borrowck) - #128697 (interpret: move nullary-op evaluation into operator.rs) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-05Rollup merge of #128697 - RalfJung:nullary-op, r=compiler-errorsMatthias Krüger-41/+49
interpret: move nullary-op evaluation into operator.rs We call it an operator, so we might as well treat it like one. :) Also use more consistent naming for the "evaluate intrinsic" functions. "emulate" is really the wrong term, this *is* a genuine implementation of the intrinsic semantics after all.
2024-08-05Rollup merge of #128694 - compiler-errors:norm, r=WaffleLapkinMatthias Krüger-17/+9
Normalize when equating `dyn` tails in MIR borrowck See the explanation in the comment. Fixes #128621 cc `@WaffleLapkin`
2024-08-05Rollup merge of #128688 - RalfJung:custom-mir-tail-calls, r=compiler-errorsMatthias Krüger-0/+54
custom MIR: add support for tail calls Cc ``@WaffleLapkin``
2024-08-05Rollup merge of #128580 - compiler-errors:cfi-param-env, r=lcnrMatthias Krüger-2/+47
Use `ParamEnv::reveal_all` in CFI I left a huge comment for why this ICEs in the test I committed. `typeid_for_instance` should only be called on monomorphic instances during codegen, and we should just be using `ParamEnv::reveal_all()` rather than the param-env of the instance itself. I added an assertion to ensure that we only do this for fully substituted instances (this may break with polymorphization, but I kinda don't care lol). Fixes #114160 cc `@rcvalle`
2024-08-05Rollup merge of #122049 - Amanieu:riscv64-musl-tier2, r=Mark-SimulacrumMatthias Krüger-3/+63
Promote riscv64gc-unknown-linux-musl to tier 2
2024-08-05interpret: move nullary-op evaluation into operator.rsRalf Jung-41/+49
2024-08-05Auto merge of #128699 - RalfJung:miri-sync, r=RalfJungbors-626/+981
Miri subtree update r? `@ghost`
2024-08-05update lockfileRalf Jung-2/+3
2024-08-05Normalize when equating dyn tails in MIR borrowckMichael Goulet-17/+9
2024-08-05Auto merge of #3789 - RalfJung:deps, r=RalfJungbors-310/+300
bump dependencies In particular pick up https://github.com/RalfJung/rustc-build-sysroot/pull/22 to fix the fallout from https://github.com/rust-lang/rust/pull/128534.
2024-08-05bump dependenciesRalf Jung-307/+297
2024-08-05Auto merge of #3790 - RalfJung:ui-test-folder, r=RalfJungbors-1/+1
use a Miri-specific folder for ui tests
2024-08-05use a Miri-specific folder for ui testsRalf Jung-1/+1
2024-08-05Auto merge of #128689 - matthiaskrgr:rollup-ukyn8wq, r=matthiaskrgrbors-61/+56
Rollup of 5 pull requests Successful merges: - #128385 (rustdoc-json: discard non-local inherent impls for primitives) - #128559 (Don't re-elaborated already elaborated caller bounds in method probe) - #128631 (handle crates when they are not specified for std docs) - #128664 (Add `Debug` impls to API types in `rustc_codegen_ssa`) - #128686 (fix the invalid argument type) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-05bump rustc-build-sysroot dependencyRalf Jung-3/+3
2024-08-05Rollup merge of #128686 - onur-ozkan:unnecessary-type-cast, r=KobzolMatthias Krüger-2/+1
fix the invalid argument type It was obviously wrong..
2024-08-05Rollup merge of #128664 - fuzzypixelz:add-codegen-ssa-debug-impls, r=lcnrMatthias Krüger-6/+6
Add `Debug` impls to API types in `rustc_codegen_ssa` Some types used in `rustc_codegen_ssa`'s interface traits are missing `Debug` impls. Though I did not smear `#[derive(Debug)]` all over the crate (some structs are quite large).
2024-08-05Rollup merge of #128631 - onur-ozkan:hotfix, r=Mark-SimulacrumMatthias Krüger-2/+12
handle crates when they are not specified for std docs Fixes a regression from https://github.com/rust-lang/rust/pull/128182. Resolves #128610
2024-08-05Rollup merge of #128559 - compiler-errors:elaborate, r=lcnrMatthias Krüger-22/+17
Don't re-elaborated already elaborated caller bounds in method probe Caller bounds are already elaborated. Only elaborate object candidates' principals. Also removes the only usage of `transitive_bounds`.
2024-08-05Rollup merge of #128385 - its-the-shrimp:fix_114039, r=aDotInTheVoidMatthias Krüger-29/+20
rustdoc-json: discard non-local inherent impls for primitives Fixes #114039 at least it should r? `@aDotInTheVoid`
2024-08-05custom MIR: add support for tail callsRalf Jung-0/+54
2024-08-05fix the invalid argument type in `helpers::get_closest_merge_base_commit`onur-ozkan-2/+1
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-05Don't re-elaborated already elaborated caller bounds in method probeMichael Goulet-22/+17
2024-08-05Auto merge of #124336 - compiler-errors:super-outlives, r=lcnrbors-15/+132
Enforce supertrait outlives obligations hold when confirming impl **TL;DR:** We elaborate super-predicates and apply any outlives obligations when proving an impl holds to fix a mismatch between implied bounds. Bugs in implied bounds (and implied well-formedness) occur whenever there is a mismatch between the assumptions that some code can assume to hold, and the obligations that a caller/user of that code must prove. If the former is stronger than the latter, then unsoundness occurs. Take a look at the example unsoundness: ```rust use std::fmt::Display; trait Static: 'static {} impl<T> Static for &'static T {} fn foo<S: Display>(x: S) -> Box<dyn Display> where &'static S: Static, { Box::new(x) } fn main() { let s = foo(&String::from("blah blah blah")); println!("{}", s); } ``` This specific example occurs because we elaborate obligations in `fn foo`: * `&'static S: Static` * `&'static S: 'static` <- super predicate * `S: 'static` <- elaborating outlives bounds However, when calling `foo`, we only need to prove the direct set of where clauses. So at the call site for some substitution `S = &'not_static str`, that means only proving `&'static &'not_static str: Static`. To prove this, we apply the impl, which itself holds trivially since it has no where clauses. This is the mismatch -- `foo` is allowed to assume that `S: 'static` via elaborating supertraits, but callers of `foo` never need to prove that `S: 'static`. There are several approaches to fixing this, all of which have problems due to current limitations in our type system: 1. proving the elaborated set of predicates always - This leads to issues since we don't have coinductive trait semantics, so we easily hit new cycles. * This would fix our issue, since callers of `foo` would have to both prove `&'static &'not_static str: Static` and its elaborated bounds, which would surface the problematic `'not_static: 'static` outlives obligation. * However, proving supertraits when proving impls leads to inductive cycles which can't be fixed until we get coinductive trait semantics. 2. Proving that an impl header is WF when applying that impl: * This would fix our issue, since when we try to prove `&'static &'not_static str: Static`, we'd need to prove `WF(&'static &'not_static str)`, which would surface the problematic `'not_static: 'static` outlives obligation. * However, this leads to issues since we don't have higher-ranked implied bounds. This breaks things when trying to apply impls to higher-ranked trait goals. To get around these limitations, we apply a subset of (1.), which is to elaborate the supertrait obligations of the impl but filter only the (region/type) outlives out of that set, since those can never participate in an inductive cycle. This is likely not sufficient to fix a pathological example of this issue, but it does clearly fill in a major gap that we're currently overlooking. This can also result in 'unintended' errors due to missing implied-bounds on binders. We did not encounter this in the crater run and don't expect people to rely on this code in practice: ```rust trait Outlives<'b>: 'b {} impl<'b, T> Outlives<'b> for &'b T {} fn foo<'b>() where // This bound will break due to this PR as we end up proving // `&'b &'!a (): 'b` without the implied `'!a: 'b` // bound. for<'a> &'b &'a (): Outlives<'b>, {} ``` Fixes #98117 --- Crater: https://github.com/rust-lang/rust/pull/124336#issuecomment-2209165320 Triaged: https://github.com/rust-lang/rust/pull/124336#issuecomment-2236321325 All of the fallout is due to generic const exprs, and can be ignored.
2024-08-05Elaborate supertraits in dyn candidatesMichael Goulet-6/+15
2024-08-05Enforce supertrait outlives obligations hold when confirming implMichael Goulet-12/+120
2024-08-05Auto merge of #127095 - Oneirical:testiary-education, r=jieyouxubors-76/+138
Migrate `reproducible-build-2` and `stable-symbol-names` `run-make` tests to rmake Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). Needs try-jobs. try-job: x86_64-msvc try-job: armhf-gnu try-job: test-various try-job: aarch64-apple try-job: i686-msvc try-job: x86_64-mingw
2024-08-05rustdoc-json: discard non-local inherent implsschvv31n-29/+20
2024-08-05Auto merge of #117468 - daxpedda:wasm-relaxed-simd, r=alexcrichtonbors-1/+64
Stabilize Wasm relaxed SIMD This PR stabilizes [Wasm relaxed SIMD](https://github.com/WebAssembly/relaxed-simd) which has already reached [phase 4](https://github.com/WebAssembly/proposals/tree/04fa8c810e1dc99ab399e41052a6e427ee988180?tab=readme-ov-file#phase-4---standardize-the-feature-wg). Tracking issue: #111196 Implementation PR: https://github.com/rust-lang/stdarch/pull/1393 Documentation: https://github.com/rust-lang/reference/pull/1421 Stdarch: https://github.com/rust-lang/stdarch/pull/1494 Closes #111196.
2024-08-05Auto merge of #3786 - RalfJung:rustup, r=RalfJungbors-1068/+1995
Rustup
2024-08-05fmtRalf Jung-1/+4
2024-08-05Merge from rustcRalf Jung-1067/+1991
2024-08-05Preparing for merge from rustcRalf Jung-1/+1
2024-08-05`OperandRef` already had a `Debug` implMahmoud Mazouz-1/+1
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2024-08-05Auto merge of #128673 - matthiaskrgr:rollup-gtvpkm7, r=matthiaskrgrbors-422/+489
Rollup of 8 pull requests Successful merges: - #128026 (std::thread: available_parallelism implementation for vxWorks proposal.) - #128471 (rustdoc: Fix handling of `Self` type in search index and refactor its representation) - #128607 (Use `object` in `run-make/symbols-visibility`) - #128609 (Remove unnecessary constants from flt2dec dragon) - #128611 (run-make: Remove cygpath) - #128619 (Correct the const stabilization of `<[T]>::last_chunk`) - #128630 (docs(resolve): more explain about `target`) - #128660 (tests: more crashes) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-05Rollup merge of #128660 - matthiaskrgr:niceice, r=compiler-errorsMatthias Krüger-0/+87
tests: more crashes r? ``@jieyouxu``
2024-08-05Rollup merge of #128630 - bvanjoi:resolve-comment, r=petrochenkovMatthias Krüger-0/+1
docs(resolve): more explain about `target` r? ```````@petrochenkov```````
2024-08-05Rollup merge of #128619 - glandium:last_chunk, r=scottmcmMatthias Krüger-1/+1
Correct the const stabilization of `<[T]>::last_chunk` `<[T]>::first_chunk` became const stable in 1.77, but `<[T]>::last_chunk` was left out. This was fixed in 3488679768d, which reached stable in 1.80, making `<[T]>::last_chunk` const stable as of that version, but it is documented as being const stable as 1.77. While this is what should have happened, the documentation should reflect what actually did happen.
2024-08-05Rollup merge of #128611 - ChrisDenton:cygpath, r=jieyouxuMatthias Krüger-47/+5
run-make: Remove cygpath Remove cygpath from run-make-support.
2024-08-05Rollup merge of #128609 - swenson:smaller-faster-dragon, r=AmanieuMatthias Krüger-23/+26
Remove unnecessary constants from flt2dec dragon The "dragon" `flt2dec` algorithm uses multi-precision multiplication by (sometimes large) powers of 10. It has precomputed some values to help with these calculations. BUT: * There is no need to store powers of 10 and 2 * powers of 10: it is trivial to compute the second from the first. * We can save a chunk of memory by storing powers of 5 instead of powers of 10 for the large powers (and just shifting as appropriate). * This also slightly speeds up the routines (by ~1-3%) since the intermediate products are smaller and the shift is cheap. In this PR, we remove the unnecessary constants and do the necessary adjustments. Relevant benchmarks before (on my Threadripper 3970X, x86_64-unknown-linux-gnu): ``` num::flt2dec::bench_big_shortest 137.92/iter +/- 2.24 num::flt2dec::strategy::dragon::bench_big_exact_12 2135.28/iter +/- 38.90 num::flt2dec::strategy::dragon::bench_big_exact_3 904.95/iter +/- 10.58 num::flt2dec::strategy::dragon::bench_big_exact_inf 47230.33/iter +/- 320.84 num::flt2dec::strategy::dragon::bench_big_shortest 3915.05/iter +/- 51.37 ``` and after: ``` num::flt2dec::bench_big_shortest 137.40/iter +/- 2.03 num::flt2dec::strategy::dragon::bench_big_exact_12 2101.10/iter +/- 25.63 num::flt2dec::strategy::dragon::bench_big_exact_3 873.86/iter +/- 4.20 num::flt2dec::strategy::dragon::bench_big_exact_inf 47468.19/iter +/- 374.45 num::flt2dec::strategy::dragon::bench_big_shortest 3877.01/iter +/- 45.74 ```
2024-08-05Rollup merge of #128607 - ChrisDenton:visibility, r=jieyouxuMatthias Krüger-44/+32
Use `object` in `run-make/symbols-visibility` This is another case where we can simply use a rust library instead of wrangling nm. try-job: x86_64-msvc try-job: i686-msvc try-job: test-various
2024-08-05Rollup merge of #128471 - camelid:rustdoc-self, r=notriddleMatthias Krüger-306/+326
rustdoc: Fix handling of `Self` type in search index and refactor its representation ### Summary - Add enum variant `clean::Type::SelfTy` and use it instead of `clean::Type::Generic(kw::SelfUpper)`. - Stop treating `Self` as a generic in the search index. - Remove struct formerly known as `clean::SelfTy` (constructed as representation of function receiver type). We're better off without it. ### Before ![image](https://github.com/user-attachments/assets/d257bdd8-3a62-4c71-84a5-9c950f2e4f00) ### After ![image](https://github.com/user-attachments/assets/8f6d3f22-92c1-41e3-9ab8-a881b66816c0) r? ```@notriddle``` cc https://github.com/rust-lang/rust/pull/127589#issuecomment-2259715841
2024-08-05Rollup merge of #128026 - devnexen:available_parallelism_vxworks, ↵Matthias Krüger-1/+11
r=Mark-Simulacrum std::thread: available_parallelism implementation for vxWorks proposal.
2024-08-05Auto merge of #128672 - matthiaskrgr:rollup-txf7siy, r=matthiaskrgrbors-343/+942
Rollup of 6 pull requests Successful merges: - #127655 (turn `invalid_type_param_default` into a `FutureReleaseErrorReportInDeps`) - #127907 (built-in derive: remove BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE hack and lint) - #127974 (force compiling std from source if modified) - #128309 (Implement cursors for `BTreeSet`) - #128500 (Add test for updating enum discriminant through pointer) - #128623 (Do not fire unhandled attribute assertion on multi-segment `AttributeType::Normal` attributes with builtin attribute as first segment) r? `@ghost` `@rustbot` modify labels: rollup
2024-08-05Rollup merge of #128623 - jieyouxu:check-attr-ice, r=nnethercoteMatthias Krüger-71/+152
Do not fire unhandled attribute assertion on multi-segment `AttributeType::Normal` attributes with builtin attribute as first segment ### The Problem In #128581 I introduced an assertion to check that all builtin attributes are actually checked via `CheckAttrVisitor` and aren't accidentally usable on completely unrelated HIR nodes. Unfortunately, the assertion had correctness problems as revealed in #128622. The match on attribute path segments looked like ```rs,ignore // Normal handler [sym::should_panic] => /* check is implemented */ // Fallback handler [name, ..] => match BUILTIN_ATTRIBUTE_MAP.get(name) { // checked below Some(BuiltinAttribute { type_: AttributeType::CrateLevel, .. }) => {} Some(_) => { if !name.as_str().starts_with("rustc_") { span_bug!( attr.span, "builtin attribute {name:?} not handled by `CheckAttrVisitor`" ) } } None => (), } ``` However, it failed to account for edge cases such as an attribute whose: 1. path segments *starts* with a segment matching the name of a builtin attribute such as `should_panic`, and 2. the first segment's symbol does not start with `rustc_`, and 3. the matched builtin attribute is also of `AttributeType::Normal` attribute type upon registration with the builtin attribute map. These conditions when all satisfied cause the span bug to be issued for e.g. `#[should_panic::skip]` because the `[sym::should_panic]` arm is not matched (since it's `[sym::should_panic, sym::skip]`). ### Proposed Solution This PR tries to remedy that by adjusting all normal/specific handlers to not match exactly on a single segment, but instead match a prefix segment. i.e. ```rs,ignore // Normal handler, notice the `, ..` rest pattern [sym::should_panic, ..] => /* check is implemented */ // Fallback handler [name, ..] => match BUILTIN_ATTRIBUTE_MAP.get(name) { // checked below Some(BuiltinAttribute { type_: AttributeType::CrateLevel, .. }) => {} Some(_) => { if !name.as_str().starts_with("rustc_") { span_bug!( attr.span, "builtin attribute {name:?} not handled by `CheckAttrVisitor`" ) } } None => (), } ``` ### Review Remarks This PR contains 2 commits: 1. The first commit adds a regression test. This will ICE without the `CheckAttrVisitor` changes. 2. The second commit adjusts `CheckAttrVisitor` assertion logic. Once this commit is applied, the test should no longer ICE and produce the expected bless stderr. Fixes #128622. r? ``@nnethercote`` (since you reviewed #128581)