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 9 pull requests #119862

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5b153b5
annotate-snippets: update to 0.10
klensy Dec 30, 2023
46cf55a
tidy: add\remove deps
klensy Dec 30, 2023
b86e251
Delegation implementation: step 1
Bryanskiy Nov 26, 2023
784b50c
chore: remove unnecessary blank line
Rustin170506 Jan 11, 2024
8f98b54
coverage: Extract helper function `term_for_bcb`
Zalathar Jan 3, 2024
c593218
coverage: Store extracted spans as a flat list of mappings
Zalathar Jan 3, 2024
124fff0
coverage: Add enums to accommodate other kinds of coverage mappings
Zalathar Dec 28, 2023
f0a3684
Inline and remove `DiagCtxtInner::bump_{lint_err,err}_count`.
nnethercote Jan 10, 2024
2aac288
Use the right level with `-Ztreat-err-as-bug`.
nnethercote Jan 10, 2024
a0f5431
Move code around.
nnethercote Jan 10, 2024
552bed8
Remove `DiagnosticBuilder::into_diagnostic` from `-Ztreat-err-as-bug`…
nnethercote Jan 10, 2024
f5c0cd0
Inline and remove three functions.
nnethercote Jan 11, 2024
d5aafb8
Use `struct_fatal` in `new_parser_from_file`.
nnethercote Jan 11, 2024
2668270
Stop using `DiagnosticBuilder::buffer` in `WritebackCx`.
nnethercote Jan 10, 2024
29c601a
Stop using `DiagnosticBuilder::buffer` in `Checker`.
nnethercote Jan 10, 2024
fbe68bc
Stop using `DiagnosticBuilder::buffer` in `BorrowckErrors`.
nnethercote Jan 11, 2024
d02150f
Fix lifetimes in `StringReader`.
nnethercote Jan 11, 2024
6656413
Stop using `DiagnosticBuilder::buffer` in the parser.
nnethercote Jan 11, 2024
4fd1db1
Remove `DiagnosticBuilder::buffer`.
nnethercote Jan 11, 2024
252ac15
Bubble up error type
oli-obk Jan 10, 2024
af7f8f9
Silence follow up errors if astconv already errored
oli-obk Jan 10, 2024
55cab53
Taint more aggressively in astconv
oli-obk Jan 10, 2024
4580f4a
rustfmt.toml: don't ignore just any `tests` path, only root one
klensy Jan 11, 2024
aa696c5
apply fmt
klensy Jan 11, 2024
6b6f2a5
rint: further doc tweaks
RalfJung Jan 11, 2024
90cc8ba
fix: update broken stderr
Rustin170506 Jan 11, 2024
db86056
give const-err4 a more descriptive name
RalfJung Jan 11, 2024
4284afa
Rollup merge of #118947 - Bryanskiy:delegStep1, r=petrochenkov,lcnr
matthiaskrgr Jan 11, 2024
762f101
Rollup merge of #119448 - klensy:annotate-snippets-0.10, r=davidtwco
matthiaskrgr Jan 11, 2024
63b5065
Rollup merge of #119813 - oli-obk:even_more_follow_up_errors2, r=este…
matthiaskrgr Jan 11, 2024
3b07e0c
Rollup merge of #119836 - hi-rustin:rustin-patch-docs-blank-line, r=C…
matthiaskrgr Jan 11, 2024
86c79bd
Rollup merge of #119841 - nnethercote:rm-DiagnosticBuilder-buffer, r=…
matthiaskrgr Jan 11, 2024
c0fd496
Rollup merge of #119842 - Zalathar:kind, r=oli-obk
matthiaskrgr Jan 11, 2024
3c0877a
Rollup merge of #119845 - RalfJung:rint, r=nagisa
matthiaskrgr Jan 11, 2024
e8acbea
Rollup merge of #119852 - RalfJung:const-err4, r=compiler-errors
matthiaskrgr Jan 11, 2024
a855391
Rollup merge of #119853 - klensy:rustfmt-ignore, r=cuviper
matthiaskrgr Jan 11, 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
22 changes: 16 additions & 6 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ dependencies = [
"yansi-term",
]

[[package]]
name = "annotate-snippets"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a433302f833baa830c0092100c481c7ea768c5981a3c36f549517a502f246dd"
dependencies = [
"anstyle",
"unicode-width",
]

[[package]]
name = "ansi_term"
version = "0.12.1"
Expand Down Expand Up @@ -3771,7 +3781,7 @@ dependencies = [
name = "rustc_errors"
version = "0.0.0"
dependencies = [
"annotate-snippets",
"annotate-snippets 0.10.1",
"derive_setters",
"rustc_ast",
"rustc_ast_pretty",
Expand Down Expand Up @@ -3831,7 +3841,7 @@ dependencies = [
name = "rustc_fluent_macro"
version = "0.0.0"
dependencies = [
"annotate-snippets",
"annotate-snippets 0.10.1",
"fluent-bundle",
"fluent-syntax",
"proc-macro2",
Expand Down Expand Up @@ -4738,7 +4748,7 @@ dependencies = [
name = "rustfmt-nightly"
version = "1.7.0"
dependencies = [
"annotate-snippets",
"annotate-snippets 0.9.1",
"anyhow",
"bytecount",
"cargo_metadata 0.15.4",
Expand Down Expand Up @@ -5728,7 +5738,7 @@ version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aaf4bf7c184b8dfc7a4d3b90df789b1eb992ee42811cd115f32a7a1eb781058d"
dependencies = [
"annotate-snippets",
"annotate-snippets 0.9.1",
"anyhow",
"bstr",
"cargo-platform",
Expand Down Expand Up @@ -5859,9 +5869,9 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"

[[package]]
name = "unicode-width"
version = "0.1.10"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
dependencies = [
"compiler_builtins",
"rustc-std-workspace-core",
Expand Down
25 changes: 23 additions & 2 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2873,6 +2873,7 @@ impl Item {
| ItemKind::ForeignMod(_)
| ItemKind::GlobalAsm(_)
| ItemKind::MacCall(_)
| ItemKind::Delegation(_)
| ItemKind::MacroDef(_) => None,
ItemKind::Static(_) => None,
ItemKind::Const(i) => Some(&i.generics),
Expand Down Expand Up @@ -3019,6 +3020,15 @@ pub struct Fn {
pub body: Option<P<Block>>,
}

#[derive(Clone, Encodable, Decodable, Debug)]
pub struct Delegation {
/// Path resolution id.
pub id: NodeId,
pub qself: Option<P<QSelf>>,
pub path: Path,
pub body: Option<P<Block>>,
}

#[derive(Clone, Encodable, Decodable, Debug)]
pub struct StaticItem {
pub ty: P<Ty>,
Expand Down Expand Up @@ -3104,14 +3114,20 @@ pub enum ItemKind {

/// A macro definition.
MacroDef(MacroDef),

/// A delegation item (`reuse`).
///
/// E.g. `reuse <Type as Trait>::name { target_expr_template }`.
Delegation(Box<Delegation>),
}

impl ItemKind {
pub fn article(&self) -> &'static str {
use ItemKind::*;
match self {
Use(..) | Static(..) | Const(..) | Fn(..) | Mod(..) | GlobalAsm(..) | TyAlias(..)
| Struct(..) | Union(..) | Trait(..) | TraitAlias(..) | MacroDef(..) => "a",
| Struct(..) | Union(..) | Trait(..) | TraitAlias(..) | MacroDef(..)
| Delegation(..) => "a",
ExternCrate(..) | ForeignMod(..) | MacCall(..) | Enum(..) | Impl { .. } => "an",
}
}
Expand All @@ -3135,6 +3151,7 @@ impl ItemKind {
ItemKind::MacCall(..) => "item macro invocation",
ItemKind::MacroDef(..) => "macro definition",
ItemKind::Impl { .. } => "implementation",
ItemKind::Delegation(..) => "delegated function",
}
}

Expand Down Expand Up @@ -3176,6 +3193,8 @@ pub enum AssocItemKind {
Type(Box<TyAlias>),
/// A macro expanding to associated items.
MacCall(P<MacCall>),
/// An associated delegation item.
Delegation(Box<Delegation>),
}

impl AssocItemKind {
Expand All @@ -3184,7 +3203,7 @@ impl AssocItemKind {
Self::Const(box ConstItem { defaultness, .. })
| Self::Fn(box Fn { defaultness, .. })
| Self::Type(box TyAlias { defaultness, .. }) => defaultness,
Self::MacCall(..) => Defaultness::Final,
Self::MacCall(..) | Self::Delegation(..) => Defaultness::Final,
}
}
}
Expand All @@ -3196,6 +3215,7 @@ impl From<AssocItemKind> for ItemKind {
AssocItemKind::Fn(fn_kind) => ItemKind::Fn(fn_kind),
AssocItemKind::Type(ty_alias_kind) => ItemKind::TyAlias(ty_alias_kind),
AssocItemKind::MacCall(a) => ItemKind::MacCall(a),
AssocItemKind::Delegation(delegation) => ItemKind::Delegation(delegation),
}
}
}
Expand All @@ -3209,6 +3229,7 @@ impl TryFrom<ItemKind> for AssocItemKind {
ItemKind::Fn(fn_kind) => AssocItemKind::Fn(fn_kind),
ItemKind::TyAlias(ty_kind) => AssocItemKind::Type(ty_kind),
ItemKind::MacCall(a) => AssocItemKind::MacCall(a),
ItemKind::Delegation(d) => AssocItemKind::Delegation(d),
_ => return Err(item_kind),
})
}
Expand Down
16 changes: 16 additions & 0 deletions compiler/rustc_ast/src/mut_visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,14 @@ pub fn noop_visit_item_kind<T: MutVisitor>(kind: &mut ItemKind, vis: &mut T) {
}
ItemKind::MacCall(m) => vis.visit_mac_call(m),
ItemKind::MacroDef(def) => vis.visit_macro_def(def),
ItemKind::Delegation(box Delegation { id, qself, path, body }) => {
vis.visit_id(id);
vis.visit_qself(qself);
vis.visit_path(path);
if let Some(body) = body {
vis.visit_block(body);
}
}
}
}

Expand Down Expand Up @@ -1155,6 +1163,14 @@ pub fn noop_flat_map_assoc_item<T: MutVisitor>(
visit_opt(ty, |ty| visitor.visit_ty(ty));
}
AssocItemKind::MacCall(mac) => visitor.visit_mac_call(mac),
AssocItemKind::Delegation(box Delegation { id, qself, path, body }) => {
visitor.visit_id(id);
visitor.visit_qself(qself);
visitor.visit_path(path);
if let Some(body) = body {
visitor.visit_block(body);
}
}
}
visitor.visit_span(span);
visit_lazy_tts(tokens, visitor);
Expand Down
18 changes: 18 additions & 0 deletions compiler/rustc_ast/src/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,15 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
}
ItemKind::MacCall(mac) => visitor.visit_mac_call(mac),
ItemKind::MacroDef(ts) => visitor.visit_mac_def(ts, item.id),
ItemKind::Delegation(box Delegation { id: _, qself, path, body }) => {
if let Some(qself) = qself {
visitor.visit_ty(&qself.ty);
}
walk_path(visitor, path);
if let Some(body) = body {
visitor.visit_block(body);
}
}
}
walk_list!(visitor, visit_attribute, &item.attrs);
}
Expand Down Expand Up @@ -704,6 +713,15 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a AssocItem,
AssocItemKind::MacCall(mac) => {
visitor.visit_mac_call(mac);
}
AssocItemKind::Delegation(box Delegation { id: _, qself, path, body }) => {
if let Some(qself) = qself {
visitor.visit_ty(&qself.ty);
}
walk_path(visitor, path);
if let Some(body) = body {
visitor.visit_block(body);
}
}
}
}

Expand Down
Loading
Loading