Skip to content

Commit e4297ba

Browse files
committed
Auto merge of #80156 - RalfJung:rollup-m3poz8z, r=RalfJung
Rollup of 6 pull requests Successful merges: - #80121 (Change the message for `if_let_guard` feature gate) - #80130 (docs: Edit rustc_span::symbol::Symbol method) - #80135 (Don't allow `const` to begin a nonterminal) - #80145 (Fix typo in rustc_typeck docs) - #80146 (Edit formatting in Rust Prelude docs) - #80147 (Add missing punctuation to std::alloc docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 6340607 + 441a33e commit e4297ba

File tree

9 files changed

+42
-21
lines changed

9 files changed

+42
-21
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
620620
}
621621
};
622622
}
623-
gate_all!(if_let_guard, "`if let` guard is not implemented");
623+
gate_all!(if_let_guard, "`if let` guards are experimental");
624624
gate_all!(let_chains, "`let` expressions in this position are experimental");
625625
gate_all!(async_closure, "async closures are unstable");
626626
gate_all!(generators, "yield syntax is experimental");

compiler/rustc_parse/src/parser/nonterminal.rs

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ impl<'a> Parser<'a> {
2727
token.can_begin_expr()
2828
// This exception is here for backwards compatibility.
2929
&& !token.is_keyword(kw::Let)
30+
// This exception is here for backwards compatibility.
31+
&& !token.is_keyword(kw::Const)
3032
}
3133
NonterminalKind::Ty => token.can_begin_type(),
3234
NonterminalKind::Ident => get_macro_ident(token).is_some(),

compiler/rustc_span/src/symbol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,7 @@ impl Symbol {
16321632
self == kw::True || self == kw::False
16331633
}
16341634

1635-
/// This symbol can be a raw identifier.
1635+
/// Returns `true` if this symbol can be a raw identifier.
16361636
pub fn can_be_raw(self) -> bool {
16371637
self != kw::Invalid && self != kw::Underscore && !self.is_path_segment_keyword()
16381638
}

compiler/rustc_typeck/src/check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ fn adt_destructor(tcx: TyCtxt<'_>, def_id: DefId) -> Option<ty::Destructor> {
270270

271271
/// If this `DefId` is a "primary tables entry", returns
272272
/// `Some((body_id, header, decl))` with information about
273-
/// it's body-id, fn-header and fn-decl (if any). Otherwise,
273+
/// its body-id, fn-header and fn-decl (if any). Otherwise,
274274
/// returns `None`.
275275
///
276276
/// If this function returns `Some`, then `typeck_results(def_id)` will

library/std/src/alloc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Memory allocation APIs
1+
//! Memory allocation APIs.
22
//!
33
//! In a given program, the standard library has one “global” memory allocator
44
//! that is used for example by `Box<T>` and `Vec<T>`.

library/std/src/prelude/mod.rs

+12-13
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,37 @@
2626
//! # Prelude contents
2727
//!
2828
//! The current version of the prelude (version 1) lives in
29-
//! [`std::prelude::v1`], and re-exports the following.
29+
//! [`std::prelude::v1`], and re-exports the following:
3030
//!
31-
//! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`], [`Unpin`]}. The
32-
//! marker traits indicate fundamental properties of types.
33-
//! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}. Various
31+
//! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`], [`Unpin`]},
32+
//! marker traits that indicate fundamental properties of types.
33+
//! * [`std::ops`]::{[`Drop`], [`Fn`], [`FnMut`], [`FnOnce`]}, various
3434
//! operations for both destructors and overloading `()`.
3535
//! * [`std::mem`]::[`drop`][`mem::drop`], a convenience function for explicitly
3636
//! dropping a value.
3737
//! * [`std::boxed`]::[`Box`], a way to allocate values on the heap.
38-
//! * [`std::borrow`]::[`ToOwned`], The conversion trait that defines
38+
//! * [`std::borrow`]::[`ToOwned`], the conversion trait that defines
3939
//! [`to_owned`], the generic method for creating an owned type from a
4040
//! borrowed type.
4141
//! * [`std::clone`]::[`Clone`], the ubiquitous trait that defines
4242
//! [`clone`][`Clone::clone`], the method for producing a copy of a value.
43-
//! * [`std::cmp`]::{[`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`] }. The
43+
//! * [`std::cmp`]::{[`PartialEq`], [`PartialOrd`], [`Eq`], [`Ord`] }, the
4444
//! comparison traits, which implement the comparison operators and are often
4545
//! seen in trait bounds.
46-
//! * [`std::convert`]::{[`AsRef`], [`AsMut`], [`Into`], [`From`]}. Generic
46+
//! * [`std::convert`]::{[`AsRef`], [`AsMut`], [`Into`], [`From`]}, generic
4747
//! conversions, used by savvy API authors to create overloaded methods.
4848
//! * [`std::default`]::[`Default`], types that have default values.
49-
//! * [`std::iter`]::{[`Iterator`], [`Extend`], [`IntoIterator`],
50-
//! [`DoubleEndedIterator`], [`ExactSizeIterator`]}. Iterators of various
49+
//! * [`std::iter`]::{[`Iterator`], [`Extend`], [`IntoIterator`]
50+
//! [`DoubleEndedIterator`], [`ExactSizeIterator`]}, iterators of various
5151
//! kinds.
52-
//! * [`std::option`]::[`Option`]::{[`self`][`Option`], [`Some`], [`None`]}. A
52+
//! * [`std::option`]::[`Option`]::{[`self`][`Option`], [`Some`], [`None`]}, a
5353
//! type which expresses the presence or absence of a value. This type is so
5454
//! commonly used, its variants are also exported.
55-
//! * [`std::result`]::[`Result`]::{[`self`][`Result`], [`Ok`], [`Err`]}. A type
55+
//! * [`std::result`]::[`Result`]::{[`self`][`Result`], [`Ok`], [`Err`]}, a type
5656
//! for functions that may succeed or fail. Like [`Option`], its variants are
5757
//! exported as well.
5858
//! * [`std::string`]::{[`String`], [`ToString`]}, heap allocated strings.
59-
//! * [`std::vec`]::[`Vec`], a growable, heap-allocated
60-
//! vector.
59+
//! * [`std::vec`]::[`Vec`], a growable, heap-allocated vector.
6160
//!
6261
//! [`mem::drop`]: crate::mem::drop
6362
//! [`std::borrow`]: crate::borrow
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// check-pass
2+
3+
macro_rules! exp {
4+
(const $n:expr) => {
5+
$n
6+
};
7+
}
8+
9+
macro_rules! stmt {
10+
(exp $e:expr) => {
11+
$e
12+
};
13+
(exp $($t:tt)+) => {
14+
exp!($($t)+)
15+
};
16+
}
17+
18+
fn main() {
19+
stmt!(exp const 1);
20+
}

src/test/ui/rfc-2294-if-let-guard/feature-gate.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::ops::Range;
55
fn _if_let_guard() {
66
match () {
77
() if let 0 = 1 => {}
8-
//~^ ERROR `if let` guard is not implemented
8+
//~^ ERROR `if let` guards are experimental
99

1010
() if (let 0 = 1) => {}
1111
//~^ ERROR `let` expressions in this position are experimental
@@ -74,7 +74,7 @@ fn _macros() {
7474
match () {
7575
#[cfg(FALSE)]
7676
() if let 0 = 1 => {}
77-
//~^ ERROR `if let` guard is not implemented
77+
//~^ ERROR `if let` guards are experimental
7878
_ => {}
7979
}
8080
use_expr!(let 0 = 1);

src/test/ui/rfc-2294-if-let-guard/feature-gate.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | macro_rules! use_expr {
77
LL | use_expr!(let 0 = 1);
88
| ^^^ no rules expected this token in macro call
99

10-
error[E0658]: `if let` guard is not implemented
10+
error[E0658]: `if let` guards are experimental
1111
--> $DIR/feature-gate.rs:7:12
1212
|
1313
LL | () if let 0 = 1 => {}
@@ -16,7 +16,7 @@ LL | () if let 0 = 1 => {}
1616
= note: see issue #51114 <https://github.com/rust-lang/rust/issues/51114> for more information
1717
= help: add `#![feature(if_let_guard)]` to the crate attributes to enable
1818

19-
error[E0658]: `if let` guard is not implemented
19+
error[E0658]: `if let` guards are experimental
2020
--> $DIR/feature-gate.rs:76:12
2121
|
2222
LL | () if let 0 = 1 => {}

0 commit comments

Comments
 (0)