Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
2849153
Implement RangeIntersect on core::range types
GrimlockOnline Nov 7, 2026
1ea503d
Prepare for merging from rust-lang/rust
workflows-miri[bot] Nov 10, 2026
be6f854
Merge ref 'ac8310ba643a' from rust-lang/rust
workflows-miri[bot] Nov 10, 2026
5aefb50
windows SetFileInformationByHandle: use stream_len to get current fil…
RalfJung Nov 10, 2026
e142b37
Merge pull request #5607 from rust-lang/rustup-2026-11-10
RalfJung Nov 10, 2026
ab74d54
Merge pull request #5608 from RalfJung/win-SetFileInformationByHandle
RalfJung Nov 10, 2026
0df5544
Rename `this` to `ecx` in shared socket code
WhySoBad Nov 9, 2026
9c41b09
Rename `this` to `ecx` in socket address shim
WhySoBad Nov 9, 2026
a8edb52
Rename `this` to `ecx` in TCP socket shim
WhySoBad Nov 9, 2026
f34c014
Rename `this` to `ecx` in virtual socket shim
WhySoBad Nov 9, 2026
8afbd0f
Merge pull request #5606 from WhySoBad/socket-this-to-ecx
RalfJung Nov 10, 2026
adaa069
rename this -> ecx in sse41, sse42 intrinsics and time shims
programskillforverification Nov 10, 2026
4d5dd2c
Merge pull request #5610 from programskillforverification/this-to-ecx-4
RalfJung Nov 10, 2026
a8eef01
update triagebot config
RalfJung Nov 10, 2026
41c2b0c
Merge pull request #5612 from RalfJung/triagebot
RalfJung Nov 10, 2026
14e5bd7
rename this -> ecx in poll, sync, thread unix shims and unwind shims
Enfey Nov 10, 2026
eaa4d94
Make unsafe unknown diagnostic attributes an error again
mejrs Nov 10, 2026
0160fd6
Prepare for merging from rust-lang/rust
workflows-miri[bot] Nov 11, 2026
915c8c1
Merge ref '9c5648833e5c' from rust-lang/rust
workflows-miri[bot] Nov 11, 2026
d1c1e29
Merge pull request #5613 from Enfey/rename-this-to-ecx-shims
RalfJung Nov 11, 2026
9eb356b
bless priroda tests
RalfJung Nov 11, 2026
3e91a2c
Merge pull request #5614 from rust-lang/rustup-2026-11-11
RalfJung Nov 11, 2026
e8e856e
Add libc direct tests for unlink and symlink
mehmettoplu-rs Nov 7, 2026
6a8c605
slightly extend test
RalfJung Nov 11, 2026
28b06a6
allow more slack in macos semaphore timeout test
RalfJung Nov 11, 2026
9406beb
Merge pull request #5584 from mehmettoplu-rs/test-unlink-symlink
RalfJung Nov 11, 2026
dc58d21
Add libc direct tests for pthread_atfork and sched_yield
mehmettoplu-rs Nov 11, 2026
3b965e3
Deallocate with the right provenance on Windows
saethlin Nov 11, 2026
9af8f54
Enable tidy alphabetical --bless on Windows
mejrs Nov 12, 2026
2ff1a02
Fix docs of alloc fn: Allocator API stabilized
BioTomateDE Nov 12, 2026
2e73ebb
Prepare for merging from rust-lang/rust
workflows-miri[bot] Nov 13, 2026
aea078f
Merge ref '8eb778d04094' from rust-lang/rust
workflows-miri[bot] Nov 13, 2026
94ce7d2
fix lockfile workaround when min-publish-age is set
RalfJung Nov 13, 2026
0a4afdd
bless priroda
RalfJung Nov 13, 2026
417a15d
Merge pull request #5622 from rust-lang/rustup-2026-11-13
RalfJung Nov 13, 2026
ec3d5c5
Merge pull request #5616 from mehmettoplu-rs/test-sched-yield-pthread…
RalfJung Nov 15, 2026
dd95c16
some more this -> ecx
RalfJung Nov 15, 2026
fbb781c
Merge pull request #5627 from RalfJung/ecx
RalfJung Nov 15, 2026
f394280
NULL-terminate argv and add direct tests for _NSGetArgc and _NSGetArgv
mehmettoplu-rs Nov 13, 2026
b6255ac
Extend miri_start_with_std test to check argv[argc] is null
mehmettoplu-rs Nov 15, 2026
39e3586
tweak test
RalfJung Nov 15, 2026
49bc5f3
Merge pull request #5624 from mehmettoplu-rs/argv-null-terminator
RalfJung Nov 15, 2026
06154f0
feat: added more AdtDef queries
adpthegreat Nov 15, 2026
b0fdb91
fix: fixed wrong return type
adpthegreat Nov 15, 2026
6a4efb5
fix : fixed comments
adpthegreat Nov 15, 2026
7a0aab9
Use symbolic alignment checking in the allocator tests
saethlin Nov 13, 2026
0e902ad
Merge pull request #5625 from saethlin/windows-allocator-symbolic-ali…
saethlin Nov 15, 2026
30a6ef9
Don't load/store a LLVM aggregate type when returning an array from a…
beetrees Nov 13, 2026
52ba0a8
Add non-blocking `write` and `send` support for UDP sockets
WhySoBad Oct 19, 2026
3cdd90b
Add non-blocking `read` and `recv` support for UDP sockets, add I/O t…
WhySoBad Oct 19, 2026
5a852b5
Rename `make_listener` libc helper to `make_tcp_listener`
WhySoBad Nov 2, 2026
374819d
Fix x86 dot-product reduction order and signed zero
Kaileshwar16 Nov 10, 2026
14ef98d
Merge pull request #5609 from Kaileshwar16/issue-5599-dot-product
RalfJung Nov 16, 2026
a150369
implement unlinkat to support fs::remove_dir_all
programskillforverification Nov 11, 2026
1a1e3ce
Add libc direct test for abort
mehmettoplu-rs Nov 16, 2026
7078a59
Prepare for merging from rust-lang/rust
workflows-miri[bot] Nov 17, 2026
370e5c8
Merge ref '5df8c02afdf6' from rust-lang/rust
workflows-miri[bot] Nov 17, 2026
b39cd33
Merge pull request #5636 from rust-lang/rustup-2026-11-17
RalfJung Nov 17, 2026
0510b1f
Merge pull request #5414 from programskillforverification/unix-unlinkat
RalfJung Nov 17, 2026
37288a4
triagebot: enable merge command
RalfJung Nov 17, 2026
9607ce1
minor tweaks
RalfJung Nov 17, 2026
e3f9e04
Merge pull request #5637 from RalfJung/triagebot
RalfJung Nov 17, 2026
9fbdb74
Merge pull request #5634 from mehmettoplu-rs/test-abort
RalfJung Nov 17, 2026
67c45b2
Merge pull request #5507 from WhySoBad/udp-non-blocking-io
RalfJung Nov 17, 2026
94c2406
Test GetCurrentProcessId and _NSGetEnviron directly
Kaileshwar16 Nov 10, 2026
0bc008a
track pthread_attr_t stack size and fail pthread_create for huge stacks
programskillforverification Nov 9, 2026
119733c
tweak thread_stack_size_ok
RalfJung Nov 17, 2026
fe2968c
Merge pull request #5601 from programskillforverification/pthread-att…
rustbot Nov 17, 2026
27c1921
miri: use wrapping multiplication when computing element addresses fo…
eduardosm Nov 17, 2026
d6eb2b5
Merge pull request #5639 from eduardosm/gather-failure
RalfJung Nov 17, 2026
68906fb
windows tests: print_safe should not be needed
RalfJung Nov 17, 2026
371f04d
Suggest using `Global.allocate` instead
workingjubilee Nov 17, 2026
ad25332
Merge pull request #5640 from RalfJung/win-print
RalfJung Nov 17, 2026
218e753
portable-sim tests: ensure that float ops are non-deterministic
RalfJung Nov 17, 2026
3bf85fe
[Priroda] Normalize MIR local IDs in UI test output
moabo3li Nov 17, 2026
692201e
[Priroda] Stop asserting unnamed dead MIR locals in the UI output
moabo3li Nov 17, 2026
da58a61
[Priroda] Document what the locals command lists
moabo3li Nov 17, 2026
7565191
move windows tests to their own folder
RalfJung Nov 17, 2026
43a20d3
Merge pull request #5643 from RalfJung/simd-float-nondet
RalfJung Nov 17, 2026
3a842be
Merge pull request #5626 from Kaileshwar16/test/3179-direct-win-macos…
RalfJung Nov 17, 2026
dee9bd8
Prepare for merging from rust-lang/rust
RalfJung Nov 17, 2026
7c09ebf
Merge ref '59cbdee2e7b3' from rust-lang/rust
RalfJung Nov 17, 2026
afc1997
add #[optimize] attribute tests
RalfJung Nov 17, 2026
6c3be76
Merge pull request #5644 from RalfJung/opt-attr
RalfJung Nov 17, 2026
a1ce554
[Priroda] Normalize standard-library paths in UI fixtures
moabo3li Nov 17, 2026
5ffc473
Prepare for merging from rust-lang/rust
workflows-miri[bot] Nov 18, 2026
0b09fbc
Merge ref 'ac7bce927202' from rust-lang/rust
workflows-miri[bot] Nov 18, 2026
828c560
fix genmc build
RalfJung Nov 18, 2026
5bc8443
do not mix backend and rust intrinsics
RalfJung Nov 18, 2026
239c8bf
Merge pull request #5647 from rust-lang/rustup-2026-11-18
RalfJung Nov 18, 2026
d6c7b46
make MetaObj opaque by default
RalfJung Nov 18, 2026
1fd2f0b
Merge pull request #5650 from RalfJung/meta-opaque
RalfJung Nov 18, 2026
e9dd805
Add `r? @ghost` for Josh push PRs
Kobzol Nov 18, 2026
8ca417b
Merge pull request #5653 from Kobzol/josh-push-msg
RalfJung Nov 18, 2026
6c11872
Support `NonNull` pointers as asm! input operands
hsanzg Oct 26, 2026
02725d0
Don't require `extern "llvm-intrinsic"` return structs to be `#[repr(…
beetrees Oct 24, 2026
158d77e
OpenOptions::append: clarify docs
RalfJung Nov 19, 2026
e4611fa
remove `Box` from `Annotatable::Stmt`
cyrgani Oct 30, 2026
0471f67
remove useless wrap
cyrgani Oct 10, 2026
78f12f8
remove `AllocFnFactory`
cyrgani Oct 12, 2026
75f70ce
small debug tweaks
cyrgani Nov 11, 2026
66b2a86
avoid let statements in debug output
cyrgani Nov 11, 2026
05725ef
use `generic_param_to_arg` more
cyrgani Nov 11, 2026
ebeac38
store the corresponding `FieldDef` in the `FieldInfo`
cyrgani Oct 30, 2026
3a2322d
reorder and regroup special case checks
cyrgani Nov 11, 2026
7ed6bd3
add `MethodBody` to transition away from `Substructure`
cyrgani Nov 12, 2026
94ffc73
remove all usages of `StaticStruct` and `StaticEnum`
cyrgani Nov 12, 2026
eed5c03
remove all resulting dead code and outdated documentation
cyrgani Nov 12, 2026
dabbdeb
move `fieldless_variants_strategy` into `MethodBody::SubstructureFunc`
cyrgani Nov 12, 2026
835b140
inline `call_substructure_method`
cyrgani Nov 12, 2026
d48a5b7
move `has_other_selflike_arg` into `MethodBody::SubstructureFunc`
cyrgani Nov 12, 2026
8bd8604
merge `explicit_self` and `nonselflike_args`
cyrgani Nov 12, 2026
4518388
Stop using #![no_core] in profiler_builtins
bjorn3 Nov 19, 2026
f96baed
fix asin value range
RalfJung Nov 19, 2026
cbfed63
fix atan2 NAN handling
RalfJung Nov 19, 2026
bab3e77
Merge pull request #5659 from RalfJung/asin
RalfJung Nov 19, 2026
d025ca0
Add avx512 shift intrinsics
TDecking Nov 19, 2026
354004b
Merge pull request #5651 from TDecking/avx512
rustbot Nov 19, 2026
e86400c
Test append mode with seek and reads
darkraider01 Nov 16, 2026
0a2a775
dont run broken seek-based emulation of pwrite for O_APPEND files
RalfJung Nov 19, 2026
72b2f56
Add support for blocking `send` to UDP socket shim
WhySoBad Nov 10, 2026
753d084
Add support for blocking `recv` to UDP socket shim, add blocking I/O …
WhySoBad Nov 12, 2026
5b0c763
Merge pull request #5635 from darkraider01/rename-shims-ecx
rustbot Nov 19, 2026
ef3b581
Stabilize unchecked `nonzero_ops`
hsanzg Oct 17, 2026
eef56f9
shims/fs tests: also test append mode
RalfJung Nov 19, 2026
748ab15
windows: test creating without writing, and dont falsely set append flag
RalfJung Nov 19, 2026
7c89832
migrate Windows API tests to windows-sys
programskillforverification Nov 20, 2026
bf85368
feat: write tests for new and existing adtdef queries
adpthegreat Nov 20, 2026
08fd6cc
Merge pull request #5655 from programskillforverification/migrate-win…
rustbot Nov 20, 2026
b286dd4
windows/fs: ensure bad read/write requests get rejected
RalfJung Nov 19, 2026
6c60271
libc/fs: test and fix O_CREAT on read-only open
RalfJung Nov 19, 2026
1b58c16
Merge pull request #5646 from moabo3li/priroda-local-id-normalization
oli-obk Nov 20, 2026
d7b3011
Merge pull request #5660 from RalfJung/test-append
RalfJung Nov 20, 2026
042d32c
Merge pull request #5638 from WhySoBad/udp-blocking-io
rustbot Nov 20, 2026
2f5945c
chore: ran ./x fmt
adpthegreat Nov 20, 2026
45426d2
chore: remove whitespace, fix typo
adpthegreat Nov 20, 2026
3e9646b
inline the parts of rustc_tools_util that we use
RalfJung Nov 20, 2026
d54e23b
rename env vars for more consistency
RalfJung Nov 20, 2026
6ade1d0
Show slice split results for empty and singleton slices
arifd Nov 20, 2026
4f2ad6c
Add red-green mark when dumping dep graph. Show DefIds if available
blyxyas Nov 13, 2026
3f47dc0
Merge pull request #5664 from RalfJung/rustc_tools_util
RalfJung Nov 20, 2026
ef7bfc6
update lockfile
RalfJung Nov 20, 2026
1995223
enable more std tests in Miri :)
RalfJung Nov 20, 2026
6515ff5
dont try mutating the original working directory
RalfJung Nov 20, 2026
16c78c6
std: also mark doctests with skip_unsupported_miri_tests
RalfJung Nov 20, 2026
f9becad
use `cfg!(overflow_checks)` in `overflow_checks` intrinsic instead of…
BioTomateDE Nov 21, 2026
42804ba
fmt: Improve `Debug` for `FormattingOptions`
tgross35 Nov 20, 2026
456b3c7
Add lint against duplicate parameter names in fns without body
annieversary Nov 22, 2026
5f5d82b
Rollup merge of #166266 - RalfJung:miri, r=RalfJung
JonathanBrouwer Nov 22, 2026
49f4d41
Rollup merge of #164878 - beetrees:llvm-intrinsic-dont-require-repr-p…
JonathanBrouwer Nov 22, 2026
7c0f2c9
Rollup merge of #165008 - hsanzg:rich-asm-ptr-inputs, r=Amanieu
JonathanBrouwer Nov 22, 2026
d6d299b
Rollup merge of #165892 - cyrgani:builtin-macros-10, r=nnethercote
JonathanBrouwer Nov 22, 2026
220b102
Rollup merge of #165930 - blyxyas:better-dump-dep-graph, r=jackh726
JonathanBrouwer Nov 22, 2026
9170180
Rollup merge of #166280 - RalfJung:miri-std-doctests, r=maxdexh
JonathanBrouwer Nov 22, 2026
b10f497
Rollup merge of #166295 - BioTomateDE:intrinsics-stuff, r=thomcc
JonathanBrouwer Nov 22, 2026
07e6105
Rollup merge of #164485 - hsanzg:stable-nonzero, r=clarfonthey
JonathanBrouwer Nov 22, 2026
71f0c96
Rollup merge of #165366 - annieversary:duplicate-parameter-names, r=J…
JonathanBrouwer Nov 22, 2026
6a98179
Rollup merge of #165618 - Kolgrim33:range-intersect-165428, r=Mark-Si…
JonathanBrouwer Nov 22, 2026
5bb9615
Rollup merge of #165782 - mejrs:unsafe_attrs, r=JonathanBrouwer
JonathanBrouwer Nov 22, 2026
69e3f50
Rollup merge of #165833 - saethlin:windows-allocator-provenance, r=Ma…
JonathanBrouwer Nov 22, 2026
ca29f19
Rollup merge of #165834 - mejrs:tempfile, r=Mark-Simulacrum
JonathanBrouwer Nov 22, 2026
b3d20ea
Rollup merge of #165889 - BioTomateDE:outdated-docs, r=Mark-Simulacrum
JonathanBrouwer Nov 22, 2026
5115122
Rollup merge of #165923 - beetrees:generic-simd-array-return, r=worki…
JonathanBrouwer Nov 22, 2026
93e1180
Rollup merge of #166012 - adpthegreat:add_more_adtdef_queries, r=maka…
JonathanBrouwer Nov 22, 2026
75edc74
Rollup merge of #166186 - RalfJung:file-append, r=JohnTitor
JonathanBrouwer Nov 22, 2026
ae2efe3
Rollup merge of #166216 - bjorn3:profiler_builtins_core_dep, r=Mark-S…
JonathanBrouwer Nov 22, 2026
b5c32cc
Rollup merge of #166259 - tgross35:formatoptions-debug, r=hanna-kruppe
JonathanBrouwer Nov 22, 2026
092cfcb
Rollup merge of #166263 - arifd:slice-split-single-element-docs, r=Ma…
JonathanBrouwer Nov 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ dependencies = [
"cargo_metadata 0.23.1",
"directories",
"rustc-build-sysroot",
"rustc_tools_util 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version",
"serde",
"serde_json",
Expand Down Expand Up @@ -667,7 +666,7 @@ dependencies = [
"itertools",
"pulldown-cmark",
"regex",
"rustc_tools_util 0.4.2",
"rustc_tools_util",
"serde",
"serde_json",
"tempfile",
Expand Down Expand Up @@ -4907,12 +4906,6 @@ dependencies = [
name = "rustc_tools_util"
version = "0.4.2"

[[package]]
name = "rustc_tools_util"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3b75158011a63889ba12084cf1224baad7bcad50f6ee7c842f772b74aa148ed"

[[package]]
name = "rustc_trait_selection"
version = "0.0.0"
Expand Down
28 changes: 13 additions & 15 deletions compiler/rustc_attr_parsing/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,20 @@ impl<'sess> AttributeParser<'sess> {
let inner_span = lower_span(n.item.span);

let accepter = ATTRIBUTE_PARSERS.accepters.get(parts.as_slice());

self.check_attribute_safety(
&attr_path,
inner_span,
n.item.unsafety,
if let Some(accept) = accepter {
accept.safety
} else {
AttributeSafety::Normal
},
&mut emit_lint,
);

if let Some(accept) = accepter {
self.check_attribute_safety(
&attr_path,
inner_span,
n.item.unsafety,
accept.safety,
&mut emit_lint,
);
self.check_attribute_stability(&attr_path, attr_span, accept.stability);
if let [part] = parts.as_slice() {
debug_assert!(BUILTIN_ATTRIBUTE_SET.contains(part));
Expand Down Expand Up @@ -491,14 +497,6 @@ impl<'sess> AttributeParser<'sess> {
span: attr_span,
};

self.check_attribute_safety(
&attr_path,
inner_span,
n.item.unsafety,
AttributeSafety::Normal,
&mut emit_lint,
);

if !matches!(self.should_emit, ShouldEmit::Nothing)
&& Target::from_ast_target(&ast_target) == Target::Crate
{
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_builtin_macros/src/alloc_error_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub(crate) fn expand(
return vec![orig_item];
};

// Generate a bunch of new items using the AllocFnFactory
let span = ecx.with_def_site_ctxt(item.span);

// Generate item statements for the allocator methods.
Expand All @@ -42,7 +41,7 @@ pub(crate) fn expand(
// Generate anonymous constant serving as container for the allocator methods.
let const_item = ecx.item_const_underscore(span, ecx.block(span, stmts));
let const_item = if is_stmt {
Annotatable::Stmt(Box::new(ecx.stmt_item(span, const_item)))
Annotatable::Stmt(ecx.stmt_item(span, const_item))
} else {
Annotatable::Item(const_item)
};
Expand Down
17 changes: 5 additions & 12 deletions compiler/rustc_builtin_macros/src/autodiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ mod llvm_enzyme {
use rustc_ast::tokenstream::*;
use rustc_ast::visit::AssocCtxt::*;
use rustc_ast::{
self as ast, FnRetTy, FnSig, GenericArg, GenericParamKind, Generics, ItemKind,
MetaItemInner, PatKind, TyKind, Visibility,
self as ast, FnRetTy, FnSig, GenericParamKind, Generics, ItemKind, MetaItemInner, PatKind,
TyKind, Visibility,
};
use rustc_attr_ir::RustcAutodiff;
use rustc_expand::base::{Annotatable, ExtCtxt};
Expand All @@ -24,6 +24,7 @@ mod llvm_enzyme {
use tracing::{debug, trace};

use crate::diagnostics;
use crate::util::generic_param_to_arg;

pub(crate) fn outer_normal_attr(
kind: &Box<rustc_ast::NormalAttr>,
Expand Down Expand Up @@ -449,7 +450,7 @@ mod llvm_enzyme {
Annotatable::Stmt(_) => {
let mut d_fn = ecx.item(span, d_attrs, ItemKind::Fn(d_fn));
d_fn.vis = vis;
Annotatable::Stmt(Box::new(ecx.stmt_item(span, d_fn)))
Annotatable::Stmt(ecx.stmt_item(span, d_fn))
}
_ => {
unreachable!("item kind checked previously")
Expand Down Expand Up @@ -577,16 +578,8 @@ mod llvm_enzyme {
.params
.iter()
.filter_map(|p| match &p.kind {
GenericParamKind::Type { .. } => {
let path = ast::Path::from_ident(p.ident);
let ty = ecx.ty_path(path);
Some(GenericArg::Type(ty))
}
GenericParamKind::Const { .. } => {
let anon_const = ecx.const_ident(span, p.ident);
Some(GenericArg::Const(anon_const))
}
GenericParamKind::Lifetime => None,
_ => Some(generic_param_to_arg(ecx, p, span)),
})
.collect::<Vec<_>>();

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/cfg_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl CfgEval<'_> {
Annotatable::Stmt(_) => {
let stmt =
parser.parse_stmt_without_recovery(false, ForceCollect::Yes, false)?;
self.flat_map_stmt(stmt).pop().map(|stmt| Annotatable::Stmt(Box::new(stmt)))
self.flat_map_stmt(stmt).pop().map(Annotatable::Stmt)
}
Annotatable::Expr(_) => {
let mut expr = parser.parse_expr_force_collect()?;
Expand Down
6 changes: 1 addition & 5 deletions compiler/rustc_builtin_macros/src/cfg_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ fn tts_to_mac_result<'cx, 'sess>(
tts: TokenStream,
span: Span,
) -> Box<dyn MacResult + 'cx> {
match ExpandResult::from_tts(ecx, tts, site_span, span, Ident::with_dummy_span(sym::cfg_select))
{
ExpandResult::Ready(x) => x,
_ => unreachable!("from_tts always returns Ready"),
}
ExpandResult::from_tts(ecx, tts, site_span, span, Ident::with_dummy_span(sym::cfg_select))
}

macro_rules! forward_to_parser_any_macro {
Expand Down
35 changes: 19 additions & 16 deletions compiler/rustc_builtin_macros/src/deriving/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(crate) fn expand_derive_clone(
// enough. Whether Clone is implemented for fields is irrelevant so we
// don't assert it.)
let bounds;
let body: MethodBodyFunc<'_>;
let body;
let is_simple;
match &item.kind {
ItemKind::Struct(_, Generics { params, .. }, _)
Expand All @@ -42,16 +42,22 @@ pub(crate) fn expand_derive_clone(
.any(|param| matches!(param.kind, ast::GenericParamKind::Type { .. }))
{
is_simple = true;
body = Box::new(|c, s, sub| clone_simple_body(c, s, sub, false));
body = MethodBody::Directly(clone_simple_body(cx, span, item, false));
} else {
is_simple = false;
body = Box::new(|c, s, sub| clone_body(c, s, sub, item.kind.ident().unwrap()));
body = MethodBody::SubstructureFunc {
body_func: Box::new(|c, s, sub| {
clone_body(c, s, sub, item.kind.ident().unwrap())
}),
strategy: FieldlessVariantsStrategy::Default,
has_other_selflike_arg: false,
};
}
}
ItemKind::Union(..) => {
bounds = smallvec![path_std!(cx, span, marker::Copy)];
is_simple = true;
body = Box::new(|c, s, sub| clone_simple_body(c, s, sub, true));
body = MethodBody::Directly(clone_simple_body(cx, span, item, true));
}
_ => cx.dcx().span_bug(span, "`derive(Clone)` on wrong item kind"),
}
Expand Down Expand Up @@ -86,28 +92,25 @@ pub(crate) fn expand_derive_clone(
methods: smallvec![MethodDef {
name: sym::clone,
generics: cx.empty_generics(span),
explicit_self: true,
nonself_args: SmallVec::new(),
has_other_selflike_arg: false,
args: thin_vec![cx.param_self_ref(span)],
ret_ty: cx.ty_self(span),
attributes: thin_vec![
cx.generated_attr(span, ast::GeneratedAttr::Inline),
cx.generated_attr(span, ast::GeneratedAttr::RustcTrivialFieldReads)
],
fieldless_variants_strategy: FieldlessVariantsStrategy::Default,
body,
}],
is_const,
..
};

trait_def.expand_ext(cx, item, push, is_simple)
trait_def.expand(cx, item, push);
}

fn clone_simple_body(
cx: &ExtCtxt<'_>,
trait_span: Span,
substr: Substructure<'_>,
item: &ast::Item,
is_union: bool,
) -> BlockOrExpr {
let mut stmts = ThinVec::new();
Expand Down Expand Up @@ -148,16 +151,16 @@ fn clone_simple_body(
&[sym::clone, sym::AssertParamIsCopy],
);
} else {
match substr {
StaticStruct(vdata, ..) => {
match &item.kind {
ast::ItemKind::Struct(.., vdata) => {
process_variant(vdata);
}
StaticEnum(enum_def, ..) => {
ast::ItemKind::Enum(.., enum_def) => {
for variant in &enum_def.variants {
process_variant(&variant.data);
}
}
_ => cx.dcx().span_bug(trait_span, "unexpected substructure in simple `derive(Clone)`"),
_ => unreachable!(),
}
}
BlockOrExpr::new_mixed(stmts, Some(cx.expr_deref(trait_span, cx.expr_self(trait_span))))
Expand All @@ -169,7 +172,7 @@ fn clone_body(
substr: Substructure<'_>,
type_ident: Ident,
) -> BlockOrExpr {
let subcall = |field: FieldInfo| {
let subcall = |field: FieldInfo<'_>| {
let args = thin_vec![field.self_expr];
cx.expr_call_global(
field.span,
Expand Down Expand Up @@ -201,7 +204,7 @@ fn clone_body(
VariantData::Struct { .. } => {
let fields = all_fields
.into_iter()
.map(|field| cx.field_imm(field.span, field.name.unwrap(), subcall(field)))
.map(|field| cx.field_imm(field.span, field.def.ident.unwrap(), subcall(field)))
.collect::<ThinVec<_>>();

cx.expr_struct(trait_span, ctor_path, fields)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use thin_vec::{ThinVec, thin_vec};
use crate::deriving::generic::*;
use crate::deriving::path_std;
use crate::diagnostics;
use crate::util::generic_param_to_arg;

pub(crate) fn expand_derive_coerce_pointee(
cx: &ExtCtxt<'_>,
Expand Down
Loading
Loading