Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e836a2f
implement continue_ok and break_ok for ControlFlow
jogru0 Apr 24, 2025
b981b84
moved simple test to coretests, introduced more fleshed out doctests …
jogru0 Apr 26, 2025
6dbac3f
add nvptx_target_feature
jedbrown Feb 27, 2025
35a485d
target-feature: enable rust target features implied by target-cpu
jedbrown May 22, 2025
4653b7a
Stabilize const `TypeId::of`
oli-obk Jul 18, 2025
288a565
Upgrade semicolon_in_expressions_from_macros from warn to deny
joshtriplett Jul 23, 2025
ef608f1
Introduce `target_spec_enum` macro to avoid duplication
Noratrieb Jul 26, 2025
987a49b
bootstrap: extract `cc` query into a new function
mati865 Jul 29, 2025
9cfe5f6
bootstrap: split runtime DLL part out of `make_win_dist`
mati865 Jul 29, 2025
ec40ee4
Add documentation for unstable_feature_bound
tiif Jul 30, 2025
712c28e
Remove space
tiif Jul 30, 2025
b3f369d
Address some rustc inconsistency issues
zeroomega Jul 17, 2025
1dfa421
Add --print target-spec-json-schema
Noratrieb Jul 26, 2025
1eb9b13
Change visibility of Args new function
chotchki Aug 2, 2025
74e85a2
removed gate
Kivooeo Aug 3, 2025
23e6be2
Port #[macro_export] to the new attribute parsing infrastructure
Periodic1911 Jul 12, 2025
f6ce4ac
Anonymize binders in tail call sig
compiler-errors Aug 2, 2025
c7ea022
Enforce tail call type is related to body return type in borrowck
compiler-errors Aug 4, 2025
904e2af
Port `#[coroutine]` to the new attribute system
scrabsha Aug 1, 2025
b4f404b
Fix wrong font being used for tooltips `i` icons
GuillaumeGomez Aug 4, 2025
2260749
Add GUI regression test for tooltips `i` icons
GuillaumeGomez Aug 4, 2025
91e606b
Tweak auto trait errors
estebank Feb 28, 2025
a573fd9
Don't actually pass BB to check_call_dest
compiler-errors Aug 4, 2025
d2e3ea9
windows-gnullvm: include `libunwind.dll` in dist
mati865 Jul 29, 2025
81081f4
compiletest: add hint for when a ui test produces no errors
lolbinarycat Aug 4, 2025
7196d8c
Rehome tests/ui/issues/ tests [3/?]
Oneirical Jul 13, 2025
868bdde
Preserve the .debug_gdb_scripts section
sebastianpoeplau Aug 1, 2025
33cb419
Mark all deprecation lints in name resolution as deny-by-default and …
petrochenkov Jul 14, 2025
3e764d0
Add regression tests for seemingly fixed issues
ShoyuVanilla Aug 4, 2025
b4d923c
Embed GDB pretty printers in rlibs and dylibs
sebastianpoeplau Aug 1, 2025
5e15bae
Rollup merge of #137831 - estebank:auto-trait-err, r=compiler-errors
Zalathar Aug 6, 2025
04a83eb
Rollup merge of #138689 - jedbrown:jed/nvptx-target-feature, r=ZuseZ4
Zalathar Aug 6, 2025
1960acf
Rollup merge of #140267 - jogru0:control_flow, r=dtolnay
Zalathar Aug 6, 2025
419f09c
Rollup merge of #143679 - sebastianpoeplau:preserve-debug-gdb-scripts…
Zalathar Aug 6, 2025
90d5b23
Rollup merge of #143857 - Periodic1911:macro-export, r=jdonszelmann
Zalathar Aug 6, 2025
1a8b5bd
Rollup merge of #143929 - petrochenkov:depresolve, r=lcnr
Zalathar Aug 6, 2025
4c5b436
Rollup merge of #144133 - oli-obk:stabilize-const-type-id, r=lcnr
Zalathar Aug 6, 2025
2fc30c8
Rollup merge of #144369 - joshtriplett:mbe-expr-semi-deny-by-default,…
Zalathar Aug 6, 2025
ddc9954
Rollup merge of #144473 - zeroomega:rustc_inconsistency, r=Mark-Simul…
Zalathar Aug 6, 2025
9cf60d5
Rollup merge of #144498 - Noratrieb:rustc-json-schema, r=jieyouxu
Zalathar Aug 6, 2025
216c285
Rollup merge of #144552 - Oneirical:uncountable-integer-3, r=jieyouxu
Zalathar Aug 6, 2025
8ca7b19
Rollup merge of #144659 - mati865:gnullvm-vendor-libunwind, r=Kobzol
Zalathar Aug 6, 2025
df402fe
Rollup merge of #144676 - tiif:dev_guide_unstable_bound, r=BoxyUwU
Zalathar Aug 6, 2025
d95f02b
Rollup merge of #144794 - scrabsha:push-noqrrttovmwy, r=jdonszelmann
Zalathar Aug 6, 2025
80800d3
Rollup merge of #144835 - compiler-errors:tail-call-sig-binder, r=Waf…
Zalathar Aug 6, 2025
79459e2
Rollup merge of #144836 - chotchki:patch-1, r=tgross35
Zalathar Aug 6, 2025
4b58fad
Rollup merge of #144861 - Kivooeo:payload-as-str-stabilization, r=Chr…
Zalathar Aug 6, 2025
98a44f3
Rollup merge of #144910 - ShoyuVanilla:add-regression-tests, r=fee1-dead
Zalathar Aug 6, 2025
ed10104
Rollup merge of #144913 - GuillaumeGomez:fix-wrong-i-icon, r=fmease
Zalathar Aug 6, 2025
097664f
Rollup merge of #144917 - compiler-errors:tail-call-linked-lifetimes,…
Zalathar Aug 6, 2025
c89b0b4
Rollup merge of #144924 - lolbinarycat:compiletest-pass-directives-hi…
Zalathar Aug 6, 2025
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
18 changes: 6 additions & 12 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
}

let expr_hir_id = self.lower_node_id(e.id);
self.lower_attrs(expr_hir_id, &e.attrs, e.span);
let attrs = self.lower_attrs(expr_hir_id, &e.attrs, e.span);

let kind = match &e.kind {
ExprKind::Array(exprs) => hir::ExprKind::Array(self.lower_exprs(exprs)),
Expand Down Expand Up @@ -232,10 +232,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
*fn_arg_span,
),
None => self.lower_expr_closure(
attrs,
binder,
*capture_clause,
e.id,
expr_hir_id,
*constness,
*movability,
fn_decl,
Expand Down Expand Up @@ -1052,10 +1052,10 @@ impl<'hir> LoweringContext<'_, 'hir> {

fn lower_expr_closure(
&mut self,
attrs: &[rustc_hir::Attribute],
binder: &ClosureBinder,
capture_clause: CaptureBy,
closure_id: NodeId,
closure_hir_id: hir::HirId,
constness: Const,
movability: Movability,
decl: &FnDecl,
Expand All @@ -1067,15 +1067,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
let (binder_clause, generic_params) = self.lower_closure_binder(binder);

let (body_id, closure_kind) = self.with_new_scopes(fn_decl_span, move |this| {
let mut coroutine_kind = if this
.attrs
.get(&closure_hir_id.local_id)
.is_some_and(|attrs| attrs.iter().any(|attr| attr.has_name(sym::coroutine)))
{
Some(hir::CoroutineKind::Coroutine(Movability::Movable))
} else {
None
};

let mut coroutine_kind = find_attr!(attrs, AttributeKind::Coroutine(_) => hir::CoroutineKind::Coroutine(Movability::Movable));

// FIXME(contracts): Support contracts on closures?
let body_id = this.lower_fn_body(decl, None, |this| {
this.coroutine_kind = coroutine_kind;
Expand Down
15 changes: 15 additions & 0 deletions compiler/rustc_attr_parsing/src/attributes/body.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! Attributes that can be found in function body.
use rustc_hir::attrs::AttributeKind;
use rustc_span::{Symbol, sym};

use super::{NoArgsAttributeParser, OnDuplicate};
use crate::context::Stage;

pub(crate) struct CoroutineParser;

impl<S: Stage> NoArgsAttributeParser<S> for CoroutineParser {
const PATH: &[Symbol] = &[sym::coroutine];
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
const CREATE: fn(rustc_span::Span) -> AttributeKind = |span| AttributeKind::Coroutine(span);
}
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use crate::parser::ArgParser;
use crate::session_diagnostics::UnusedMultiple;

pub(crate) mod allow_unstable;
pub(crate) mod body;
pub(crate) mod cfg;
pub(crate) mod cfg_old;
pub(crate) mod codegen_attrs;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, Symbol, sym};
use crate::attributes::allow_unstable::{
AllowConstFnUnstableParser, AllowInternalUnstableParser, UnstableFeatureBoundParser,
};
use crate::attributes::body::CoroutineParser;
use crate::attributes::codegen_attrs::{
ColdParser, CoverageParser, ExportNameParser, NakedParser, NoMangleParser, OptimizeParser,
TargetFeatureParser, TrackCallerParser, UsedParser,
Expand Down Expand Up @@ -185,6 +186,7 @@ attribute_parsers!(
Single<WithoutArgs<ConstContinueParser>>,
Single<WithoutArgs<ConstStabilityIndirectParser>>,
Single<WithoutArgs<ConstTraitParser>>,
Single<WithoutArgs<CoroutineParser>>,
Single<WithoutArgs<DenyExplicitImplParser>>,
Single<WithoutArgs<DoNotImplementViaObjectParser>>,
Single<WithoutArgs<ExportStableParser>>,
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_hir/src/attrs/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ pub enum AttributeKind {
/// Represents `#[const_trait]`.
ConstTrait(Span),

/// Represents `#[coroutine]`.
Coroutine(Span),

/// Represents `#[coverage(..)]`.
Coverage(Span, CoverageAttrKind),

Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/attrs/encode_cross_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ impl AttributeKind {
ConstStability { .. } => Yes,
ConstStabilityIndirect => No,
ConstTrait(..) => No,
Coroutine(..) => No,
Coverage(..) => No,
DenyExplicitImpl(..) => No,
Deprecation { .. } => Yes,
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
&Attribute::Parsed(AttributeKind::Coverage(attr_span, _)) => {
self.check_coverage(attr_span, span, target)
}
&Attribute::Parsed(AttributeKind::Coroutine(attr_span)) => {
self.check_coroutine(attr_span, target)
}
Attribute::Unparsed(attr_item) => {
style = Some(attr_item.style);
match attr.path().as_slice() {
Expand Down Expand Up @@ -391,9 +394,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
[sym::autodiff_forward, ..] | [sym::autodiff_reverse, ..] => {
self.check_autodiff(hir_id, attr, span, target)
}
[sym::coroutine, ..] => {
self.check_coroutine(attr, target);
}
[sym::linkage, ..] => self.check_linkage(attr, span, target),
[
// ok
Expand Down Expand Up @@ -2634,11 +2634,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
}
}

fn check_coroutine(&self, attr: &Attribute, target: Target) {
fn check_coroutine(&self, attr_span: Span, target: Target) {
match target {
Target::Closure => return,
_ => {
self.dcx().emit_err(errors::CoroutineOnNonClosure { span: attr.span() });
self.dcx().emit_err(errors::CoroutineOnNonClosure { span: attr_span });
}
}
}
Expand Down
15 changes: 9 additions & 6 deletions tests/ui/attributes/malformed-attrs.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ error: malformed `patchable_function_entry` attribute input
LL | #[patchable_function_entry]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`

error: malformed `coroutine` attribute input
--> $DIR/malformed-attrs.rs:108:5
|
LL | #[coroutine = 63] || {}
| ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[coroutine]`

error: malformed `must_not_suspend` attribute input
--> $DIR/malformed-attrs.rs:129:1
|
Expand Down Expand Up @@ -421,6 +415,15 @@ LL | #[proc_macro = 18]
| | didn't expect any arguments here
| help: must be of the form: `#[proc_macro]`

error[E0565]: malformed `coroutine` attribute input
--> $DIR/malformed-attrs.rs:108:5
|
LL | #[coroutine = 63] || {}
| ^^^^^^^^^^^^----^
| | |
| | didn't expect any arguments here
| help: must be of the form: `#[coroutine]`

error[E0565]: malformed `proc_macro_attribute` attribute input
--> $DIR/malformed-attrs.rs:113:1
|
Expand Down