about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2025-01-31it-self → itself, build-system → build system, type-alias → type aliasTobias Bucher-2/+2
2025-01-31bootstrap: only build `crt{begin,end}.o` when compiling to MUSLJorge Aparicio-2/+8
only MUSL needs those objects and trying to compile them to other targets, e.g. Windows or macOS, will produce C compilation errors check the target before shelling out to the C compiler and tweak `make_run` to skip the actual C compilation when the target is not MUSL fixes #135782
2025-01-31Rollup merge of #135992 - madsmtm:new-target-docs, r=jieyouxuMatthias Krüger-0/+16
Improve documentation when adding a new target https://github.com/rust-lang/rust/pull/133631#issuecomment-2607877936 shows that it can be a bit difficult process-wise to add a new target. I've added a bit of text to the docs, suggesting that users add the target defintion/spec first, and later work on `std` support. I also found that we have two places where we document how to add a new target. I've linked these for now, but they should probably be merged somehow in the future. `@rustbot` label A-docs r? compiler CC `@workingjubilee` who's worked a lot on target specs IIRC.
2025-01-31Rollup merge of #134531 - GuillaumeGomez:extract-doctests, ↵Matthias Krüger-38/+288
r=notriddle,aDotInTheVoid [rustdoc] Add `--extract-doctests` command-line flag Part of https://github.com/rust-lang/rust/issues/134529. It was discussed with the Rust-for-Linux project recently that they needed a way to extract doctests so they can modify them and then run them more easily (look for "a way to extract doctests" [here](https://github.com/Rust-for-Linux/linux/issues/2)). For now, I output most of `ScrapedDoctest` fields in JSON format with `serde_json`. So it outputs the following information: * filename * line * langstr * text cc `@ojeda` r? `@notriddle`
2025-01-31Insert null checks for pointer dereferences when debug assertions are enabledBastian Kersting-0/+2
Similar to how the alignment is already checked, this adds a check for null pointer dereferences in debug mode. It is implemented similarly to the alignment check as a MirPass. This is related to a 2025H1 project goal for better UB checks in debug mode: https://github.com/rust-lang/rust-project-goals/pull/177.
2025-01-31Insert null checks for pointer dereferences when debug assertions are enabledBastian Kersting-1/+5
Similar to how the alignment is already checked, this adds a check for null pointer dereferences in debug mode. It is implemented similarly to the alignment check as a MirPass. This is related to a 2025H1 project goal for better UB checks in debug mode: https://github.com/rust-lang/rust-project-goals/pull/177.
2025-01-31merge duplicate issue-46589 testsRémy Rakic-1/+0
also add explicit revisions for -Zpolonius=next
2025-01-31miri: make float min/max non-deterministicRalf Jung-4/+44
2025-01-31increase thread limit for many-seeds modeRalf Jung-2/+2
2025-01-31Auto merge of #136332 - jhpratt:rollup-aa69d0e, r=jhprattbors-94/+89
Rollup of 9 pull requests Successful merges: - #132156 (When encountering unexpected closure return type, point at return type/expression) - #133429 (Autodiff Upstreaming - rustc_codegen_ssa, rustc_middle) - #136281 (`rustc_hir_analysis` cleanups) - #136297 (Fix a typo in profile-guided-optimization.md) - #136300 (atomic: extend compare_and_swap migration docs) - #136310 (normalize `*.long-type.txt` paths for compare-mode tests) - #136312 (Disable `overflow_delimited_expr` in edition 2024) - #136313 (Filter out RPITITs when suggesting unconstrained assoc type on too many generics) - #136323 (Fix a typo in conventions.md) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-31Add amdgpu targetFlakebi-2/+117
Add target and compile the amdgpu llvm backend.
2025-01-31Recommend adding target spec first, then std support laterMads Marquart-0/+7
Co-Authored-By: Jieyou Xu <jieyouxu@outlook.com>
2025-01-31Auto merge of #136331 - jhpratt:rollup-curo1f4, r=jhprattbors-1/+5
Rollup of 8 pull requests Successful merges: - #135414 (Stabilize `const_black_box`) - #136150 (ci: use windows 2025 for i686-mingw) - #136258 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 11)) - #136270 (Remove `NamedVarMap`.) - #136278 (add constraint graph to polonius MIR dump) - #136287 (LLVM changed the nocapture attribute to captures(none)) - #136291 (some test suite cleanups) - #136296 (float::min/max: mention the non-determinism around signed 0) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-31CompileTest: Add Directives to Ignore `arm-unknown-*` TestsVeera-0/+4
2025-01-31Rollup merge of #136323 - etaoins:fix-typo-in-conventions-md, r=tgross35Jacob Pratt-1/+1
Fix a typo in conventions.md Introduced in #135950
2025-01-31Rollup merge of #136312 - compiler-errors:overflow_delimited_expr-2024, r=ytmimiJacob Pratt-89/+58
Disable `overflow_delimited_expr` in edition 2024 This reverts the style guide changes and sets the default to "false" in rustfmt for style edition 2024. r? `@ytmimi` cc `@rust-lang/style` `@rust-lang/rustfmt`
2025-01-31Rollup merge of #136297 - zeenix:patch-1, r=lqdJacob Pratt-1/+1
Fix a typo in profile-guided-optimization.md It's either "profile-guided" or "profiled-guided" and I think it'sw the former. :)
2025-01-31Rollup merge of #133429 - EnzymeAD:autodiff-middle, r=oli-obkJacob Pratt-3/+29
Autodiff Upstreaming - rustc_codegen_ssa, rustc_middle This PR should not be merged until the rustc_codegen_llvm part is merged. I will also alter it a little based on what get's shaved off from the cg_llvm PR, and address some of the feedback I received in the other PR (including cleanups). I am putting it already up to 1) Discuss with `@jieyouxu` if there is more work needed to add tests to this and 2) Pray that there is someone reviewing who can tell me why some of my autodiff invocations get lost. Re 1: My test require fat-lto. I also modify the compilation pipeline. So if there are any other llvm-ir tests in the same compilation unit then I will likely break them. Luckily there are two groups who currently have the same fat-lto requirement for their GPU code which I have for my autodiff code and both groups have some plans to enable support for thin-lto. Once either that work pans out, I'll copy it over for this feature. I will also work on not changing the optimization pipeline for functions not differentiated, but that will require some thoughts and engineering, so I think it would be good to be able to run the autodiff tests isolated from the rest for now. Can you guide me here please? For context, here are some of my tests in the samples folder: https://github.com/EnzymeAD/rustbook Re 2: This is a pretty serious issue, since it effectively prevents publishing libraries making use of autodiff: https://github.com/EnzymeAD/rust/issues/173. For some reason my dummy code persists till the end, so the code which calls autodiff, deletes the dummy, and inserts the code to compute the derivative never gets executed. To me it looks like the rustc_autodiff attribute just get's dropped, but I don't know WHY? Any help would be super appreciated, as rustc queries look a bit voodoo to me. Tracking: - https://github.com/rust-lang/rust/issues/124509 r? `@jieyouxu`
2025-01-31Rollup merge of #136150 - marcoieni:windows-25-i686-mingw, r=KobzolJacob Pratt-1/+5
ci: use windows 2025 for i686-mingw try-job: i686-mingw
2025-01-31fmtThe Miri Cronjob Bot-2/+1
2025-01-31Merge from rustcThe Miri Cronjob Bot-91/+257
2025-01-31Preparing for merge from rustcThe Miri Cronjob Bot-1/+1
2025-01-30implement unstable `new_range` featurePeter Jaszkowiak-0/+9
for RFC 3550, tracking issue #123741
2025-01-31tests: port `symbol-mangling-hashed` to rmake.rs许杰友 Jieyou Xu (Joe)-1/+0
- Use `object` based test logic instead of processing `nm` human-readable textual output. - Try to expand test coverage to not be limited to only linux + x86_64. Co-authored-by: binarycat <binarycat@envs.net>
2025-01-31run-make-support: add `object`-based symbol helpers许杰友 Jieyou Xu (Joe)-9/+25
- `dynamic_symbol_names` - `text_section_global_dynamic_symbol_names` - `global_undefined_dynamic_symbol_names` Also add some missing `#[track_caller]` attributes. Co-authored-by: binarycat <binarycat@envs.net>
2025-01-31run-make-support: add `is_windows_gnu` helper许杰友 Jieyou Xu (Joe)-1/+10
2025-01-31run-make-support: collapse re-export许杰友 Jieyou Xu (Joe)-2/+3
2025-01-31run-make-support: add `-Csymbol-mangling-version` and `-Cprefer-dynamic` ↵许杰友 Jieyou Xu (Joe)-0/+12
helpers to rustc Co-authored-by: binarycat <binarycat@envs.net>
2025-01-31Auto merge of #135318 - compiler-errors:vtable-fixes, r=lcnrbors-1/+55
Fix deduplication mismatches in vtables leading to upcasting unsoundness We currently have two cases where subtleties in supertraits can trigger disagreements in the vtable layout, e.g. leading to a different vtable layout being accessed at a callsite compared to what was prepared during unsizing. Namely: ### #135315 In this example, we were not normalizing supertraits when preparing vtables. In the example, ``` trait Supertrait<T> { fn _print_numbers(&self, mem: &[usize; 100]) { println!("{mem:?}"); } } impl<T> Supertrait<T> for () {} trait Identity { type Selff; } impl<Selff> Identity for Selff { type Selff = Selff; } trait Middle<T>: Supertrait<()> + Supertrait<T> { fn say_hello(&self, _: &usize) { println!("Hello!"); } } impl<T> Middle<T> for () {} trait Trait: Middle<<() as Identity>::Selff> {} impl Trait for () {} fn main() { (&() as &dyn Trait as &dyn Middle<()>).say_hello(&0); } ``` When we prepare `dyn Trait`, we see a supertrait of `Middle<<() as Identity>::Selff>`, which itself has two supertraits `Supertrait<()>` and `Supertrait<<() as Identity>::Selff>`. These two supertraits are identical, but they are not duplicated because we were using structural equality and *not* considering normalization. This leads to a vtable layout with two trait pointers. When we upcast to `dyn Middle<()>`, those two supertraits are now the same, leading to a vtable layout with only one trait pointer. This leads to an offset error, and we call the wrong method. ### #135316 This one is a bit more interesting, and is the bulk of the changes in this PR. It's a bit similar, except it uses binder equality instead of normalization to make the compiler get confused about two vtable layouts. In the example, ``` trait Supertrait<T> { fn _print_numbers(&self, mem: &[usize; 100]) { println!("{mem:?}"); } } impl<T> Supertrait<T> for () {} trait Trait<T, U>: Supertrait<T> + Supertrait<U> { fn say_hello(&self, _: &usize) { println!("Hello!"); } } impl<T, U> Trait<T, U> for () {} fn main() { (&() as &'static dyn for<'a> Trait<&'static (), &'a ()> as &'static dyn Trait<&'static (), &'static ()>) .say_hello(&0); } ``` When we prepare the vtable for `dyn for<'a> Trait<&'static (), &'a ()>`, we currently consider the PolyTraitRef of the vtable as the key for a supertrait. This leads two two supertraits -- `Supertrait<&'static ()>` and `for<'a> Supertrait<&'a ()>`. However, we can upcast[^up] without offsetting the vtable from `dyn for<'a> Trait<&'static (), &'a ()>` to `dyn Trait<&'static (), &'static ()>`. This is just instantiating the principal trait ref for a specific `'a = 'static`. However, when considering those supertraits, we now have only one distinct supertrait -- `Supertrait<&'static ()>` (which is deduplicated since there are two supertraits with the same substitutions). This leads to similar offsetting issues, leading to the wrong method being called. [^up]: I say upcast but this is a cast that is allowed on stable, since it's not changing the vtable at all, just instantiating the binder of the principal trait ref for some lifetime. The solution here is to recognize that a vtable isn't really meaningfully higher ranked, and to just treat a vtable as corresponding to a `TraitRef` so we can do this deduplication more faithfully. That is to say, the vtable for `dyn for<'a> Tr<'a>` and `dyn Tr<'x>` are always identical, since they both would correspond to a set of free regions on an impl... Do note that `Tr<for<'a> fn(&'a ())>` and `Tr<fn(&'static ())>` are still distinct. ---- There's a bit more that can be cleaned up. In codegen, we can stop using `PolyExistentialTraitRef` basically everywhere. We can also fix SMIR to stop storing `PolyExistentialTraitRef` in its vtable allocations. As for testing, it's difficult to actually turn this into something that can be tested with `rustc_dump_vtable`, since having multiple supertraits that are identical is a recipe for ambiguity errors. Maybe someone else is more creative with getting that attr to work, since the tests I added being run-pass tests is a bit unsatisfying. Miri also doesn't help here, since it doesn't really generate vtables that are offset by an index in the same way as codegen. r? `@lcnr` for the vibe check? Or reassign, idk. Maybe let's talk about whether this makes sense. <sup>(I guess an alternative would also be to not do any deduplication of vtable supertraits (or only a really conservative subset) rather than trying to normalize and deduplicate more faithfully here. Not sure if that works and is sufficient tho.)</sup> cc `@steffahn` -- ty for the minimizations cc `@WaffleLapkin` -- since you're overseeing the feature stabilization :3 Fixes #135315 Fixes #135316
2025-01-31Update deployment target setup in jobs.ymlMads Marquart-2/+10
Note that specifying MACOSX_STD_DEPLOYMENT_TARGET is still completely unnecessary here, but it's nice to have for future changes where we might want to version `std` and `rustc`'s deployment target separately.
2025-01-31Explain why MACOSX_STD_DEPLOYMENT_TARGET existMads Marquart-1/+9
2025-01-31Always set the deployment target when building stdMads Marquart-2/+35
2025-01-31Bootstrap: Don't duplicate cc-rs flagsMads Marquart-17/+36
Commands that end up invoking cc-rs, i.e. Cargo (through build scripts) and cmake-rs don't need the CFLAGS from cc-rs itself, as they will just end up as duplicates. We do still choose to pass them in certain places, but now it's at least clear which flags are default, and which flags are extra flags added on.
2025-01-31Fix a typo in conventions.mdRyan Cumming-1/+1
Introduced in #135950
2025-01-30Auto merge of #136318 - matthiaskrgr:rollup-a159mzo, r=matthiaskrgrbors-30/+31
Rollup of 9 pull requests Successful merges: - #135026 (Cast global variables to default address space) - #135475 (uefi: Implement path) - #135852 (Add `AsyncFn*` to `core` prelude) - #136004 (tests: Skip const OOM tests on aarch64-unknown-linux-gnu) - #136157 (override build profile for bootstrap tests) - #136180 (Introduce a wrapper for "typed valtrees" and properly check the type before extracting the value) - #136256 (Add release notes for 1.84.1) - #136271 (Remove minor future footgun in `impl Debug for MaybeUninit`) - #136288 (Improve documentation for file locking) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-30set rustc dylib on manually constructed rustc commandonur-ozkan-1/+5
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-30fix(rustdoc): always use a channel when linking to doc.rust-lang.orgAlexis (Poliorcetics) Bourget-28/+29
2025-01-30Rollup merge of #136180 - lukas-code:typed-valtree, r=oli-obkMatthias Krüger-11/+7
Introduce a wrapper for "typed valtrees" and properly check the type before extracting the value This PR adds a new wrapper type `ty::Value` to replace the tuple `(Ty, ty::ValTree)` and become the new canonical representation of type-level constant values. The value extraction methods `try_to_bits`/`try_to_bool`/`try_to_target_usize` are moved to this new type. For `try_to_bits` in particular, this avoids some redundant matches on `ty::ConstKind::Value`. Furthermore, these methods and will now properly check the type before extracting the value, which fixes some ICEs. The name `ty::Value` was chosen to be consistent with `ty::Expr`. Commit 1 should be non-functional and commit 2 adds the type check. --- fixes https://github.com/rust-lang/rust/issues/131102 supercedes https://github.com/rust-lang/rust/pull/136130 r? `@oli-obk` cc `@FedericoBruzzone` `@BoxyUwU`
2025-01-30Rollup merge of #136157 - onur-ozkan:override-release-profile, r=KobzolMatthias Krüger-8/+23
override build profile for bootstrap tests Using the release profile for bootstrap self tests puts too much load on the CPU and makes it quite hot on `x test bootstrap` invocation for no good reason. It also makes the compilation take longer than usual (see https://github.com/rust-lang/rust/pull/136048#issuecomment-2616908484). This change turns off the release flag for bootstrap self tests.
2025-01-30Rollup merge of #136004 - mrkajetanp:aarch64-skip-large-const-alloc-tests, ↵Matthias Krüger-11/+1
r=Kobzol tests: Skip const OOM tests on aarch64-unknown-linux-gnu Skip const OOM tests on AArch64 Linux through explicit annotations instead of inside opt-dist. Intended to avoid confusion in cases like #135952. Prerequisite for https://github.com/rust-lang/rust/pull/135960. r? `@Kobzol` cc `@workingjubilee` try-job: dist-aarch64-linux
2025-01-30Run rustc-pull CI every day, don't notify when there is nothing to updateJakub Beránek-7/+33
2025-01-30Disable overflow_delimited_expr in edition 2024Michael Goulet-37/+51
2025-01-30Revert "[style 2024] Combine all last arg delimited exprs"Michael Goulet-52/+7
This reverts commit bed0c9d97f098b71f4968808ab16d9ba40bce49c.
2025-01-30More assertions, tests, and miri coverageMichael Goulet-0/+54
2025-01-30Rewrite section on executing Docker testsJakub Beránek-33/+32
2025-01-30Auto merge of #136292 - matthiaskrgr:rollup-fw1tlca, r=matthiaskrgrbors-5/+119
Rollup of 7 pull requests Successful merges: - #133636 ([rustdoc] Add sans-serif font setting) - #135434 (Match Ergonomics 2024: update edition 2024 behavior of feature gates) - #135739 (Clean up uses of the unstable `dwarf_version` option) - #135882 (simplify `similar_tokens` from `Option<Vec<_>>` to `&[_]`) - #136179 (Allow transmuting generic pattern types to and from their base) - #136199 (Fix a couple Emscripten tests) - #136251 (use impl Into<String> instead of explicit type args with bounds) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-30introduce `ty::Value`Lukas Markeffsky-11/+7
Co-authored-by: FedericoBruzzone <federico.bruzzone.i@gmail.com>
2025-01-30Merge pull request #4140 from geetanshjuneja/derefRalf Jung-34/+39
Use deref_pointer_as instead of deref_pointer
2025-01-30Distinguish between "nothing to pull" and "pull error" in josh-syncJakub Beránek-7/+32
2025-01-30use deref_pointer_as instead of deref_pointergeetanshjuneja-34/+39