Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit bcf94de

Browse files
committedJun 23, 2024
Auto merge of #126878 - matthiaskrgr:rollup-oufemqp, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #126230 (tidy: skip submodules if not present for non-CI environments) - #126612 (Update outdated README in build-manifest.) - #126616 (less bootstrap warnings) - #126663 (remove `GIT_DIR` handling in pre-push hook) - #126830 (make unsized_fn_params an internal feature) - #126833 (don't ICE when encountering an extern type field during validation) - #126837 (delegation: Do not crash on qpaths without a trait) - #126851 (Rework pattern and expression nonterminal kinds.) - #126862 (Add needs-symlink directive to compiletest) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 33422e7 + e4f102d commit bcf94de

Some content is hidden

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

43 files changed

+343
-211
lines changed
 

‎compiler/rustc_expand/src/errors.rs

+7
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,13 @@ pub(crate) struct GlobDelegationOutsideImpls {
449449
pub span: Span,
450450
}
451451

452+
#[derive(Diagnostic)]
453+
#[diag(expand_glob_delegation_traitless_qpath)]
454+
pub(crate) struct GlobDelegationTraitlessQpath {
455+
#[primary_span]
456+
pub span: Span,
457+
}
458+
452459
// This used to be the `proc_macro_back_compat` lint (#83125). It was later
453460
// turned into a hard error.
454461
#[derive(Diagnostic)]

‎compiler/rustc_expand/src/expand.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use crate::base::*;
22
use crate::config::StripUnconfigured;
33
use crate::errors::{
4-
EmptyDelegationMac, GlobDelegationOutsideImpls, IncompleteParse, RecursionLimitReached,
5-
RemoveExprNotSupported, RemoveNodeNotSupported, UnsupportedKeyValue, WrongFragmentKind,
4+
EmptyDelegationMac, GlobDelegationOutsideImpls, GlobDelegationTraitlessQpath, IncompleteParse,
5+
RecursionLimitReached, RemoveExprNotSupported, RemoveNodeNotSupported, UnsupportedKeyValue,
6+
WrongFragmentKind,
67
};
78
use crate::mbe::diagnostics::annotate_err_with_kind;
89
use crate::module::{mod_dir_path, parse_external_mod, DirOwnership, ParsedExternalMod};
@@ -1989,6 +1990,8 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
19891990
}
19901991
None if let Some((deleg, item)) = node.delegation() => {
19911992
let Some(suffixes) = &deleg.suffixes else {
1993+
let traitless_qself =
1994+
matches!(&deleg.qself, Some(qself) if qself.position == 0);
19921995
let item = match node.to_annotatable() {
19931996
Annotatable::ImplItem(item) => item,
19941997
ann @ (Annotatable::Item(_)
@@ -2000,6 +2003,11 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
20002003
}
20012004
_ => unreachable!(),
20022005
};
2006+
if traitless_qself {
2007+
let span = item.span;
2008+
self.cx.dcx().emit_err(GlobDelegationTraitlessQpath { span });
2009+
return Default::default();
2010+
}
20032011
return self.collect_glob_delegation(item, Node::KIND).make_ast::<Node>();
20042012
};
20052013

There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.