Skip to content

Commit bb61a29

Browse files
committed
Auto merge of #143951 - jhpratt:rollup-vqxstga, r=jhpratt
Rollup of 16 pull requests Successful merges: - #142301 (tests: Fix duplicated-path-in-error fail with musl) - #142936 (rustdoc-json: Structured attributes) - #143355 (wrapping shift: remove first bitmask and table) - #143630 (Drop `./x suggest`) - #143738 (Move several float tests to floats/mod.rs) - #143752 (Don't panic if WASI_SDK_PATH not set when detecting compiler) - #143820 (Fixed a core crate compilation failure when enabling the `optimize_for_size` feature on some targets) - #143837 (Adjust `run_make_support::symbols` helpers) - #143878 (Port `#[pointee]` to the new attribute parsing infrastructure) - #143907 (core: make `str::split_at_unchecked()` inline) - #143910 (Add experimental `backtrace-trace-only` std feature) - #143927 (Preserve constness in trait objects up to hir ty lowering) - #143935 (rustc_type_ir/walk: move docstring to `TypeWalker` itself) - #143938 (Update books) - #143941 (update `cfg_select!` documentation) - #143948 (Update mdbook to 0.4.52) Failed merges: - #143926 (Remove deprecated fields in bootstrap) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 7f2065a + bd93aa9 commit bb61a29

File tree

108 files changed

+1053
-1986
lines changed

Some content is hidden

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

108 files changed

+1053
-1986
lines changed

Cargo.lock

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5069,14 +5069,6 @@ dependencies = [
50695069
"syn 1.0.109",
50705070
]
50715071

5072-
[[package]]
5073-
name = "suggest-tests"
5074-
version = "0.1.0"
5075-
dependencies = [
5076-
"build_helper",
5077-
"glob",
5078-
]
5079-
50805072
[[package]]
50815073
name = "syn"
50825074
version = "1.0.109"

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ members = [
3939
"src/tools/rustdoc-gui-test",
4040
"src/tools/rustdoc-themes",
4141
"src/tools/rustfmt",
42-
"src/tools/suggest-tests",
4342
"src/tools/test-float-parse",
4443
"src/tools/tidy",
4544
"src/tools/tier-check",

compiler/rustc_attr_data_structures/src/attributes.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ pub enum AttributeKind {
349349
/// Represents `#[path]`
350350
Path(Symbol, Span),
351351

352+
/// Represents `#[pointee]`
353+
Pointee(Span),
354+
352355
/// Represents `#[rustc_pub_transparent]` (used by the `repr_transparent_external_private_fields` lint).
353356
PubTransparent(Span),
354357

compiler/rustc_attr_data_structures/src/encode_cross_crate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ impl AttributeKind {
5757
ParenSugar(..) => No,
5858
PassByValue(..) => Yes,
5959
Path(..) => No,
60+
Pointee(..) => No,
6061
PubTransparent(..) => Yes,
6162
Repr { .. } => No,
6263
RustcLayoutScalarValidRangeEnd(..) => Yes,

compiler/rustc_attr_parsing/src/attributes/traits.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,10 @@ impl<S: Stage> NoArgsAttributeParser<S> for FundamentalParser {
145145
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
146146
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::Fundamental;
147147
}
148+
149+
pub(crate) struct PointeeParser;
150+
impl<S: Stage> NoArgsAttributeParser<S> for PointeeParser {
151+
const PATH: &[Symbol] = &[sym::pointee];
152+
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
153+
const CREATE: fn(Span) -> AttributeKind = AttributeKind::Pointee;
154+
}

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ use crate::attributes::test_attrs::IgnoreParser;
4848
use crate::attributes::traits::{
4949
AllowIncoherentImplParser, CoherenceIsCoreParser, CoinductiveParser, ConstTraitParser,
5050
DenyExplicitImplParser, DoNotImplementViaObjectParser, FundamentalParser, MarkerParser,
51-
ParenSugarParser, SkipDuringMethodDispatchParser, SpecializationTraitParser, TypeConstParser,
52-
UnsafeSpecializationMarkerParser,
51+
ParenSugarParser, PointeeParser, SkipDuringMethodDispatchParser, SpecializationTraitParser,
52+
TypeConstParser, UnsafeSpecializationMarkerParser,
5353
};
5454
use crate::attributes::transparency::TransparencyParser;
5555
use crate::attributes::{AttributeParser as _, Combine, Single, WithoutArgs};
@@ -178,6 +178,7 @@ attribute_parsers!(
178178
Single<WithoutArgs<OmitGdbPrettyPrinterSectionParser>>,
179179
Single<WithoutArgs<ParenSugarParser>>,
180180
Single<WithoutArgs<PassByValueParser>>,
181+
Single<WithoutArgs<PointeeParser>>,
181182
Single<WithoutArgs<PubTransparentParser>>,
182183
Single<WithoutArgs<SpecializationTraitParser>>,
183184
Single<WithoutArgs<StdInternalSymbolParser>>,

compiler/rustc_builtin_macros/messages.ftl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ builtin_macros_cfg_accessible_literal_path = `cfg_accessible` path cannot be a l
8181
builtin_macros_cfg_accessible_multiple_paths = multiple `cfg_accessible` paths are specified
8282
builtin_macros_cfg_accessible_unspecified_path = `cfg_accessible` path is not specified
8383
84-
builtin_macros_cfg_select_no_matches = none of the rules in this `cfg_select` evaluated to true
84+
builtin_macros_cfg_select_no_matches = none of the predicates in this `cfg_select` evaluated to true
8585
86-
builtin_macros_cfg_select_unreachable = unreachable rule
86+
builtin_macros_cfg_select_unreachable = unreachable predicate
8787
.label = always matches
88-
.label2 = this rules is never reached
88+
.label2 = this predicate is never reached
8989
9090
builtin_macros_coerce_pointee_requires_maybe_sized = `derive(CoercePointee)` requires `{$name}` to be marked `?Sized`
9191

compiler/rustc_builtin_macros/src/cfg_select.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use rustc_ast::tokenstream::TokenStream;
22
use rustc_attr_parsing as attr;
33
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult};
4-
use rustc_parse::parser::cfg_select::{CfgSelectBranches, CfgSelectRule, parse_cfg_select};
4+
use rustc_parse::parser::cfg_select::{CfgSelectBranches, CfgSelectPredicate, parse_cfg_select};
55
use rustc_span::{Ident, Span, sym};
66

77
use crate::errors::{CfgSelectNoMatches, CfgSelectUnreachable};
88

9-
/// Selects the first arm whose rule evaluates to true.
9+
/// Selects the first arm whose predicate evaluates to true.
1010
fn select_arm(ecx: &ExtCtxt<'_>, branches: CfgSelectBranches) -> Option<(TokenStream, Span)> {
1111
for (cfg, tt, arm_span) in branches.reachable {
1212
if attr::cfg_matches(
@@ -30,11 +30,11 @@ pub(super) fn expand_cfg_select<'cx>(
3030
ExpandResult::Ready(match parse_cfg_select(&mut ecx.new_parser_from_tts(tts)) {
3131
Ok(branches) => {
3232
if let Some((underscore, _, _)) = branches.wildcard {
33-
// Warn for every unreachable rule. We store the fully parsed branch for rustfmt.
34-
for (rule, _, _) in &branches.unreachable {
35-
let span = match rule {
36-
CfgSelectRule::Wildcard(underscore) => underscore.span,
37-
CfgSelectRule::Cfg(cfg) => cfg.span(),
33+
// Warn for every unreachable predicate. We store the fully parsed branch for rustfmt.
34+
for (predicate, _, _) in &branches.unreachable {
35+
let span = match predicate {
36+
CfgSelectPredicate::Wildcard(underscore) => underscore.span,
37+
CfgSelectPredicate::Cfg(cfg) => cfg.span(),
3838
};
3939
let err = CfgSelectUnreachable { span, wildcard_span: underscore.span };
4040
ecx.dcx().emit_warn(err);
@@ -50,7 +50,7 @@ pub(super) fn expand_cfg_select<'cx>(
5050
Ident::with_dummy_span(sym::cfg_select),
5151
);
5252
} else {
53-
// Emit a compiler error when none of the rules matched.
53+
// Emit a compiler error when none of the predicates matched.
5454
let guar = ecx.dcx().emit_err(CfgSelectNoMatches { span: sp });
5555
DummyResult::any(sp, guar)
5656
}

compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
4949
} = self.lower_poly_trait_ref(
5050
&trait_bound.trait_ref,
5151
trait_bound.span,
52-
hir::BoundConstness::Never,
52+
trait_bound.modifiers.constness,
5353
hir::BoundPolarity::Positive,
5454
dummy_self,
5555
&mut user_written_bounds,

compiler/rustc_parse/src/parser/cfg_select.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_span::Span;
77
use crate::exp;
88
use crate::parser::Parser;
99

10-
pub enum CfgSelectRule {
10+
pub enum CfgSelectPredicate {
1111
Cfg(MetaItemInner),
1212
Wildcard(Token),
1313
}
@@ -20,7 +20,7 @@ pub struct CfgSelectBranches {
2020
pub wildcard: Option<(Token, TokenStream, Span)>,
2121
/// All branches after the first wildcard, including further wildcards.
2222
/// These branches are kept for formatting.
23-
pub unreachable: Vec<(CfgSelectRule, TokenStream, Span)>,
23+
pub unreachable: Vec<(CfgSelectPredicate, TokenStream, Span)>,
2424
}
2525

2626
/// Parses a `TokenTree` that must be of the form `{ /* ... */ }`, and returns a `TokenStream` where
@@ -52,7 +52,7 @@ pub fn parse_cfg_select<'a>(p: &mut Parser<'a>) -> PResult<'a, CfgSelectBranches
5252
match branches.wildcard {
5353
None => branches.wildcard = Some((underscore, tts, span)),
5454
Some(_) => {
55-
branches.unreachable.push((CfgSelectRule::Wildcard(underscore), tts, span))
55+
branches.unreachable.push((CfgSelectPredicate::Wildcard(underscore), tts, span))
5656
}
5757
}
5858
} else {
@@ -64,7 +64,9 @@ pub fn parse_cfg_select<'a>(p: &mut Parser<'a>) -> PResult<'a, CfgSelectBranches
6464

6565
match branches.wildcard {
6666
None => branches.reachable.push((meta_item, tts, span)),
67-
Some(_) => branches.unreachable.push((CfgSelectRule::Cfg(meta_item), tts, span)),
67+
Some(_) => {
68+
branches.unreachable.push((CfgSelectPredicate::Cfg(meta_item), tts, span))
69+
}
6870
}
6971
}
7072
}

0 commit comments

Comments
 (0)