Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 28, 2025. It is now read-only.
/rustPublic archive
forked fromrust-lang/rust

Commitcaa187f

Browse files
committed
Auto merge ofrust-lang#125744 - fmease:rollup-ky7d098, r=fmease
Rollup of 7 pull requestsSuccessful merges: -rust-lang#125653 (Migrate `run-make/const-prop-lint` to `rmake.rs`) -rust-lang#125662 (Rewrite `fpic`, `simple-dylib` and `issue-37893` `run-make` tests in `rmake.rs` or ui test format) -rust-lang#125699 (Streamline `x fmt` and improve its output) -rust-lang#125701 ([ACP 362] genericize `ptr::from_raw_parts`) -rust-lang#125723 (Migrate `run-make/crate-data-smoke` to `rmake.rs`) -rust-lang#125733 (Add lang items for `AsyncFn*`, `Future`, `AsyncFnKindHelper`'s associated types) -rust-lang#125734 (ast: Revert a breaking attribute visiting order change)r? `@ghost``@rustbot` modify labels: rollup
2 parents23ea77b +fdfffc0 commitcaa187f

File tree

56 files changed

+519
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+519
-297
lines changed

‎compiler/rustc_ast/src/visit.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,10 +852,10 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(
852852
ctxt:AssocCtxt,
853853
) ->V::Result{
854854
let&Item{id: _,span: _, ident,ref vis,ref attrs,ref kind,tokens: _} = item;
855-
walk_list!(visitor, visit_attribute, attrs);
856855
try_visit!(visitor.visit_vis(vis));
857856
try_visit!(visitor.visit_ident(ident));
858857
try_visit!(kind.walk(item, ctxt, visitor));
858+
walk_list!(visitor, visit_attribute, attrs);
859859
V::Result::output()
860860
}
861861

‎compiler/rustc_hir/src/lang_items.rs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,18 @@ language_item_table! {
228228
AsyncFn, sym::async_fn, async_fn_trait,Target::Trait,GenericRequirement::Exact(1);
229229
AsyncFnMut, sym::async_fn_mut, async_fn_mut_trait,Target::Trait,GenericRequirement::Exact(1);
230230
AsyncFnOnce, sym::async_fn_once, async_fn_once_trait,Target::Trait,GenericRequirement::Exact(1);
231-
AsyncFnKindHelper, sym::async_fn_kind_helper,async_fn_kind_helper,Target::Trait,GenericRequirement::Exact(1);
231+
AsyncFnOnceOutput, sym::async_fn_once_output, async_fn_once_output,Target::AssocTy,GenericRequirement::Exact(1);
232+
CallOnceFuture, sym::call_once_future, call_once_future,Target::AssocTy,GenericRequirement::Exact(1);
233+
CallRefFuture, sym::call_ref_future, call_ref_future,Target::AssocTy,GenericRequirement::Exact(2);
234+
AsyncFnKindHelper, sym::async_fn_kind_helper, async_fn_kind_helper,Target::Trait,GenericRequirement::Exact(1);
235+
AsyncFnKindUpvars, sym::async_fn_kind_upvars, async_fn_kind_upvars,Target::AssocTy,GenericRequirement::Exact(5);
232236

233237
FnOnceOutput, sym::fn_once_output, fn_once_output,Target::AssocTy,GenericRequirement::None;
234238

235239
Iterator, sym::iterator, iterator_trait,Target::Trait,GenericRequirement::Exact(0);
236240
FusedIterator, sym::fused_iterator, fused_iterator_trait,Target::Trait,GenericRequirement::Exact(0);
237241
Future, sym::future_trait, future_trait,Target::Trait,GenericRequirement::Exact(0);
242+
FutureOutput, sym::future_output, future_output,Target::AssocTy,GenericRequirement::Exact(0);
238243
AsyncIterator, sym::async_iterator, async_iterator_trait,Target::Trait,GenericRequirement::Exact(0);
239244

240245
CoroutineState, sym::coroutine_state, coroutine_state,Target::Enum,GenericRequirement::None;

‎compiler/rustc_hir_analysis/src/collect.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ pub fn suggest_impl_trait<'tcx>(
14781478
),
14791479
(
14801480
infcx.tcx.lang_items().future_trait(),
1481-
infcx.tcx.get_diagnostic_item(sym::FutureOutput),
1481+
infcx.tcx.lang_items().future_output(),
14821482
format_as_assoc,
14831483
),
14841484
(

‎compiler/rustc_span/src/symbol.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ symbols! {
210210
FsPermissions,
211211
FusedIterator,
212212
Future,
213-
FutureOutput,
214213
GlobalAlloc,
215214
Hash,
216215
HashMap,
@@ -439,8 +438,10 @@ symbols! {
439438
async_fn,
440439
async_fn_in_trait,
441440
async_fn_kind_helper,
441+
async_fn_kind_upvars,
442442
async_fn_mut,
443443
async_fn_once,
444+
async_fn_once_output,
444445
async_fn_track_caller,
445446
async_fn_traits,
446447
async_for_loop,
@@ -498,6 +499,8 @@ symbols! {
498499
call,
499500
call_mut,
500501
call_once,
502+
call_once_future,
503+
call_ref_future,
501504
caller_location,
502505
capture_disjoint_fields,
503506
catch_unwind,
@@ -911,6 +914,7 @@ symbols! {
911914
fundamental,
912915
fused_iterator,
913916
future,
917+
future_output,
914918
future_trait,
915919
gdb_script_file,
916920
ge,

‎compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs‎

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_macros::{TypeFoldable, TypeVisitable};
99
use rustc_middle::bug;
1010
use rustc_middle::traits::solve::Goal;
1111
use rustc_middle::ty::{self,Ty,TyCtxt,TypeFoldable,TypeFolder,TypeSuperFoldable,Upcast};
12-
use rustc_span::sym;
1312

1413
usecrate::solve::EvalCtxt;
1514

@@ -454,12 +453,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<'tc
454453
.rebind(ty::TraitRef::new(tcx, future_trait_def_id,[sig.output()]))
455454
.upcast(tcx),
456455
];
457-
let future_output_def_id = tcx
458-
.associated_items(future_trait_def_id)
459-
.filter_by_name_unhygienic(sym::Output)
460-
.next()
461-
.unwrap()
462-
.def_id;
456+
let future_output_def_id = tcx.require_lang_item(LangItem::FutureOutput,None);
463457
let future_output_ty =Ty::new_projection(tcx, future_output_def_id,[sig.output()]);
464458
Ok((
465459
bound_sig.rebind(AsyncCallableRelevantTypes{
@@ -510,12 +504,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<'tc
510504
);
511505
}
512506

513-
let future_output_def_id = tcx
514-
.associated_items(future_trait_def_id)
515-
.filter_by_name_unhygienic(sym::Output)
516-
.next()
517-
.unwrap()
518-
.def_id;
507+
let future_output_def_id = tcx.require_lang_item(LangItem::FutureOutput,None);
519508
let future_output_ty =Ty::new_projection(tcx, future_output_def_id,[sig.output()]);
520509
Ok((
521510
bound_sig.rebind(AsyncCallableRelevantTypes{
@@ -592,13 +581,7 @@ fn coroutine_closure_to_ambiguous_coroutine<'tcx>(
592581
args: ty::CoroutineClosureArgs<'tcx>,
593582
sig: ty::CoroutineClosureSignature<'tcx>,
594583
) ->Ty<'tcx>{
595-
let async_fn_kind_trait_def_id = tcx.require_lang_item(LangItem::AsyncFnKindHelper,None);
596-
let upvars_projection_def_id = tcx
597-
.associated_items(async_fn_kind_trait_def_id)
598-
.filter_by_name_unhygienic(sym::Upvars)
599-
.next()
600-
.unwrap()
601-
.def_id;
584+
let upvars_projection_def_id = tcx.require_lang_item(LangItem::AsyncFnKindUpvars,None);
602585
let tupled_upvars_ty =Ty::new_projection(
603586
tcx,
604587
upvars_projection_def_id,

‎compiler/rustc_trait_selection/src/solve/normalizes_to/mod.rs‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -407,16 +407,20 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
407407
output_coroutine_ty,
408408
coroutine_return_ty,
409409
}|{
410-
let(projection_term, term) =match tcx.item_name(goal.predicate.def_id()){
411-
sym::CallOnceFuture =>(
410+
let lang_items = tcx.lang_items();
411+
let(projection_term, term) =ifSome(goal.predicate.def_id())
412+
== lang_items.call_once_future()
413+
{
414+
(
412415
ty::AliasTerm::new(
413416
tcx,
414417
goal.predicate.def_id(),
415418
[goal.predicate.self_ty(), tupled_inputs_ty],
416419
),
417420
output_coroutine_ty.into(),
418-
),
419-
sym::CallRefFuture =>(
421+
)
422+
}elseifSome(goal.predicate.def_id()) == lang_items.call_ref_future(){
423+
(
420424
ty::AliasTerm::new(
421425
tcx,
422426
goal.predicate.def_id(),
@@ -427,8 +431,9 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
427431
],
428432
),
429433
output_coroutine_ty.into(),
430-
),
431-
sym::Output =>(
434+
)
435+
}elseifSome(goal.predicate.def_id()) == lang_items.async_fn_once_output(){
436+
(
432437
ty::AliasTerm::new(
433438
tcx,
434439
goal.predicate.def_id(),
@@ -438,8 +443,9 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> {
438443
],
439444
),
440445
coroutine_return_ty.into(),
441-
),
442-
name =>bug!("no such associated type: {name}"),
446+
)
447+
}else{
448+
bug!("no such associated type in `AsyncFn*`: {:?}", goal.predicate.def_id())
443449
};
444450
ty::ProjectionPredicate{ projection_term, term}
445451
},

‎compiler/rustc_trait_selection/src/traits/project.rs‎

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,14 +1680,8 @@ fn confirm_closure_candidate<'cx, 'tcx>(
16801680
args.coroutine_captures_by_ref_ty(),
16811681
)
16821682
}else{
1683-
let async_fn_kind_trait_def_id =
1684-
tcx.require_lang_item(LangItem::AsyncFnKindHelper,None);
1685-
let upvars_projection_def_id = tcx
1686-
.associated_items(async_fn_kind_trait_def_id)
1687-
.filter_by_name_unhygienic(sym::Upvars)
1688-
.next()
1689-
.unwrap()
1690-
.def_id;
1683+
let upvars_projection_def_id =
1684+
tcx.require_lang_item(LangItem::AsyncFnKindUpvars,None);
16911685
let tupled_upvars_ty =Ty::new_projection(
16921686
tcx,
16931687
upvars_projection_def_id,
@@ -1816,14 +1810,8 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
18161810
args.coroutine_captures_by_ref_ty(),
18171811
)
18181812
}else{
1819-
let async_fn_kind_trait_def_id =
1820-
tcx.require_lang_item(LangItem::AsyncFnKindHelper,None);
1821-
let upvars_projection_def_id = tcx
1822-
.associated_items(async_fn_kind_trait_def_id)
1823-
.filter_by_name_unhygienic(sym::Upvars)
1824-
.next()
1825-
.unwrap()
1826-
.def_id;
1813+
let upvars_projection_def_id =
1814+
tcx.require_lang_item(LangItem::AsyncFnKindUpvars,None);
18271815
// When we don't know the closure kind (and therefore also the closure's upvars,
18281816
// which are computed at the same time), we must delay the computation of the
18291817
// generator's upvars. We do this using the `AsyncFnKindHelper`, which as a trait
@@ -1880,13 +1868,7 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
18801868
let term =match item_name{
18811869
sym::CallOnceFuture | sym::CallRefFuture => sig.output(),
18821870
sym::Output =>{
1883-
let future_trait_def_id = tcx.require_lang_item(LangItem::Future,None);
1884-
let future_output_def_id = tcx
1885-
.associated_items(future_trait_def_id)
1886-
.filter_by_name_unhygienic(sym::Output)
1887-
.next()
1888-
.unwrap()
1889-
.def_id;
1871+
let future_output_def_id = tcx.require_lang_item(LangItem::FutureOutput,None);
18901872
Ty::new_projection(tcx, future_output_def_id,[sig.output()])
18911873
}
18921874
name =>bug!("no such associated type: {name}"),
@@ -1919,13 +1901,7 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
19191901
let term =match item_name{
19201902
sym::CallOnceFuture | sym::CallRefFuture => sig.output(),
19211903
sym::Output =>{
1922-
let future_trait_def_id = tcx.require_lang_item(LangItem::Future,None);
1923-
let future_output_def_id = tcx
1924-
.associated_items(future_trait_def_id)
1925-
.filter_by_name_unhygienic(sym::Output)
1926-
.next()
1927-
.unwrap()
1928-
.def_id;
1904+
let future_output_def_id = tcx.require_lang_item(LangItem::FutureOutput,None);
19291905
Ty::new_projection(tcx, future_output_def_id,[sig.output()])
19301906
}
19311907
name =>bug!("no such associated type: {name}"),

‎library/core/src/future/future.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::task::{Context, Poll};
3535
pubtraitFuture{
3636
/// The type of value produced on completion.
3737
#[stable(feature ="futures_api", since ="1.36.0")]
38-
#[rustc_diagnostic_item="FutureOutput"]
38+
#[cfg_attr(not(bootstrap), lang="future_output")]
3939
typeOutput;
4040

4141
/// Attempt to resolve the future to a final value, registering

‎library/core/src/ops/async_function.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub trait AsyncFn<Args: Tuple>: AsyncFnMut<Args> {
2626
pubtraitAsyncFnMut<Args:Tuple>:AsyncFnOnce<Args>{
2727
/// Future returned by [`AsyncFnMut::async_call_mut`] and [`AsyncFn::async_call`].
2828
#[unstable(feature ="async_fn_traits", issue ="none")]
29+
#[cfg_attr(not(bootstrap), lang ="call_ref_future")]
2930
typeCallRefFuture<'a>:Future<Output =Self::Output>
3031
where
3132
Self:'a;
@@ -46,10 +47,12 @@ pub trait AsyncFnMut<Args: Tuple>: AsyncFnOnce<Args> {
4647
pubtraitAsyncFnOnce<Args:Tuple>{
4748
/// Future returned by [`AsyncFnOnce::async_call_once`].
4849
#[unstable(feature ="async_fn_traits", issue ="none")]
50+
#[cfg_attr(not(bootstrap), lang ="call_once_future")]
4951
typeCallOnceFuture:Future<Output =Self::Output>;
5052

5153
/// Output type of the called closure's future.
5254
#[unstable(feature ="async_fn_traits", issue ="none")]
55+
#[cfg_attr(not(bootstrap), lang ="async_fn_once_output")]
5356
typeOutput;
5457

5558
/// Call the [`AsyncFnOnce`], returning a future which may move out of the called closure.
@@ -143,6 +146,7 @@ mod internal_implementation_detail {
143146
// `for<'env> fn() -> (&'env T, ...)`. This allows us to represent the binder
144147
// of the closure's self-capture, and these upvar types will be instantiated with
145148
// the `'closure_env` region provided to the associated type.
149+
#[cfg_attr(not(bootstrap), lang ="async_fn_kind_upvars")]
146150
typeUpvars<'closure_env,Inputs,Upvars,BorrowedUpvarsAsFnPtr>;
147151
}
148152
}

‎library/core/src/ptr/metadata.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ pub const fn metadata<T: ?Sized>(ptr: *const T) -> <T as Pointee>::Metadata {
120120
#[rustc_const_unstable(feature ="ptr_metadata", issue ="81513")]
121121
#[inline]
122122
pubconstfnfrom_raw_parts<T: ?Sized>(
123-
data_pointer:*const(),
123+
data_pointer:*constimplThin,
124124
metadata: <TasPointee>::Metadata,
125125
) ->*constT{
126126
aggregate_raw_ptr(data_pointer, metadata)
@@ -134,7 +134,7 @@ pub const fn from_raw_parts<T: ?Sized>(
134134
#[rustc_const_unstable(feature ="ptr_metadata", issue ="81513")]
135135
#[inline]
136136
pubconstfnfrom_raw_parts_mut<T: ?Sized>(
137-
data_pointer:*mut(),
137+
data_pointer:*mutimplThin,
138138
metadata: <TasPointee>::Metadata,
139139
) ->*mutT{
140140
aggregate_raw_ptr(data_pointer, metadata)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp