Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 10 pull requests #133770

Merged
merged 28 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
41c3b5c
show forbidden_lint_groups in future-compat reports
RalfJung Nov 27, 2024
20630c5
add "profiler" option coverage for ci-rustc
onur-ozkan Dec 1, 2024
a17294d
fix ICE when promoted has layout size overflow
RalfJung Dec 1, 2024
85e4765
Add specific test for check-cfg "and X more" diagnostic
Urgau Nov 29, 2024
1c4657d
compiletest: un-escape new-line in normalize replacement string
Urgau Dec 1, 2024
d37ed10
Fix crash with `-Zdump-mir-dataflow`
nnethercote Nov 28, 2024
9f2f690
Add test for `-Zdump-mir-dataflow`.
nnethercote Dec 1, 2024
cecef13
Simplify `ResultsHandle`.
nnethercote Dec 1, 2024
99e726b
add "optimized-compiler-builtins" option coverage for ci-rustc
onur-ozkan Dec 2, 2024
778321d
Change `AttrArgs::Eq` into a struct variant
oli-obk Dec 2, 2024
c0b5322
Add a helper method for extracting spans from AttrArgsEq
oli-obk Dec 2, 2024
da182b6
Deduplicate some matches that always panic in one arm
oli-obk Dec 2, 2024
43bed16
Reduce conflicts for check-cfg `target_feature` cfg values
Urgau Dec 1, 2024
72297d4
Fix `f16::midpoint` const feature gate
Urgau Dec 2, 2024
eadea77
Use c"lit" for CStrings without unwrap
kornelski Nov 30, 2024
c5fedc2
Stabilize `const_maybe_uninit_write`
tgross35 Oct 14, 2024
277e049
Move `Const::{from_anon_const,try_from_lit}` to hir_ty_lowering
camelid Nov 29, 2024
dcf332b
Fix broken intra-doc link
camelid Nov 29, 2024
e56e685
Rollup merge of #131713 - tgross35:stabilize-const_maybe_uninit_write…
GuillaumeGomez Dec 2, 2024
f79e09c
Rollup merge of #133535 - RalfJung:forbidden_lint_groups-future-compa…
GuillaumeGomez Dec 2, 2024
6f0d15a
Rollup merge of #133610 - camelid:move-from_anon_const, r=BoxyUwU
GuillaumeGomez Dec 2, 2024
65b0dad
Rollup merge of #133701 - kornelski:c-str, r=workingjubilee
GuillaumeGomez Dec 2, 2024
b1a643e
Rollup merge of #133704 - RalfJung:promoted-size-overflow-ice, r=comp…
GuillaumeGomez Dec 2, 2024
7d67af9
Rollup merge of #133705 - onur-ozkan:profiler-check, r=jieyouxu
GuillaumeGomez Dec 2, 2024
8a26a8b
Rollup merge of #133710 - Urgau:target_feature-merge-conflitcs, r=jie…
GuillaumeGomez Dec 2, 2024
3586e4a
Rollup merge of #133732 - nnethercote:fix-Z-dump-mir-dataflow, r=comp…
GuillaumeGomez Dec 2, 2024
6f9f17f
Rollup merge of #133746 - oli-obk:push-xwyrylxmrtvq, r=jieyouxu
GuillaumeGomez Dec 2, 2024
73f225a
Rollup merge of #133763 - Urgau:f16-midpoint-const-feat, r=Amanieu
GuillaumeGomez Dec 2, 2024
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
Prev Previous commit
Next Next commit
Add a helper method for extracting spans from AttrArgsEq
  • Loading branch information
oli-obk committed Dec 2, 2024
commit c0b532277b431822abb2b18aacf4adc6300e11ba
14 changes: 10 additions & 4 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1750,15 +1750,21 @@ pub enum AttrArgsEq {
Hir(MetaItemLit),
}

impl AttrArgsEq {
pub fn span(&self) -> Span {
match self {
AttrArgsEq::Ast(p) => p.span,
AttrArgsEq::Hir(lit) => lit.span,
}
}
}

impl AttrArgs {
pub fn span(&self) -> Option<Span> {
match self {
AttrArgs::Empty => None,
AttrArgs::Delimited(args) => Some(args.dspan.entire()),
AttrArgs::Eq { eq_span, value: AttrArgsEq::Ast(expr) } => Some(eq_span.to(expr.span)),
AttrArgs::Eq { value: AttrArgsEq::Hir(lit), .. } => {
unreachable!("in literal form when getting span: {:?}", lit);
}
AttrArgs::Eq { eq_span, value } => Some(eq_span.to(value.span())),
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_resolve/src/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ pub fn attrs_to_doc_fragments<'a>(

fn span_for_value(attr: &ast::Attribute) -> Span {
if let ast::AttrKind::Normal(normal) = &attr.kind
&& let ast::AttrArgs::Eq { value: ast::AttrArgsEq::Hir(meta), .. } = &normal.item.args
&& let ast::AttrArgs::Eq { value, .. } = &normal.item.args
{
meta.span.with_ctxt(attr.span.ctxt())
value.span().with_ctxt(attr.span.ctxt())
} else {
attr.span
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::iter;
use std::path::PathBuf;

use rustc_ast::{AttrArgs, AttrArgsEq, AttrKind, Attribute, MetaItemInner};
use rustc_ast::{AttrArgs, AttrKind, Attribute, MetaItemInner};
use rustc_data_structures::fx::FxHashMap;
use rustc_errors::codes::*;
use rustc_errors::{ErrorGuaranteed, struct_span_code_err};
Expand Down Expand Up @@ -639,8 +639,7 @@ impl<'tcx> OnUnimplementedDirective {
let report_span = match &item.args {
AttrArgs::Empty => item.path.span,
AttrArgs::Delimited(args) => args.dspan.entire(),
AttrArgs::Eq { eq_span, value: AttrArgsEq::Ast(expr) } => eq_span.to(expr.span),
AttrArgs::Eq { eq_span, value: AttrArgsEq::Hir(expr) } => eq_span.to(expr.span),
AttrArgs::Eq { eq_span, value } => eq_span.to(value.span()),
};

if let Some(item_def_id) = item_def_id.as_local() {
Expand Down