Skip to content

Commit 053666f

Browse files
committed
Auto merge of #61672 - Centril:rollup-jxo89ir, r=Centril
Rollup of 6 pull requests Successful merges: - #61646 (Remove useless allocations in macro_rules follow logic.) - #61658 (remove useless ident() functions in const tests) - #61660 (Minimize use of `#![feature(custom_attribute)]`) - #61666 (Add test for trait ICE) - #61669 ( syntax: Remove `Deref` impl from `Token`) - #61670 (Update RLS) Failed merges: r? @ghost
2 parents 991c719 + e0c825c commit 053666f

File tree

97 files changed

+927
-1051
lines changed

Some content is hidden

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

97 files changed

+927
-1051
lines changed

Cargo.lock

+11-11
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
12771277

12781278
[[package]]
12791279
name = "jsonrpc-core"
1280-
version = "10.0.1"
1280+
version = "12.0.0"
12811281
source = "registry+https://github.com/rust-lang/crates.io-index"
12821282
dependencies = [
12831283
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1407,7 +1407,7 @@ dependencies = [
14071407

14081408
[[package]]
14091409
name = "lsp-types"
1410-
version = "0.57.0"
1410+
version = "0.57.2"
14111411
source = "registry+https://github.com/rust-lang/crates.io-index"
14121412
dependencies = [
14131413
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2266,7 +2266,7 @@ name = "rls"
22662266
version = "1.36.0"
22672267
dependencies = [
22682268
"cargo 0.38.0",
2269-
"cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
2269+
"cargo_metadata 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
22702270
"clippy_lints 0.0.212",
22712271
"crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
22722272
"difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2276,11 +2276,11 @@ dependencies = [
22762276
"heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
22772277
"home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
22782278
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
2279-
"jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
2279+
"jsonrpc-core 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
22802280
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
22812281
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
22822282
"lsp-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
2283-
"lsp-types 0.57.0 (registry+https://github.com/rust-lang/crates.io-index)",
2283+
"lsp-types 0.57.2 (registry+https://github.com/rust-lang/crates.io-index)",
22842284
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
22852285
"ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
22862286
"racer 2.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2295,7 +2295,7 @@ dependencies = [
22952295
"rls-vfs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
22962296
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
22972297
"rustc-workspace-hack 1.0.0",
2298-
"rustc_tools_util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
2298+
"rustc_tools_util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
22992299
"rustfmt-nightly 1.2.2",
23002300
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
23012301
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3030,12 +3030,12 @@ dependencies = [
30303030

30313031
[[package]]
30323032
name = "rustc_tools_util"
3033-
version = "0.1.1"
3034-
source = "registry+https://github.com/rust-lang/crates.io-index"
3033+
version = "0.2.0"
30353034

30363035
[[package]]
30373036
name = "rustc_tools_util"
30383037
version = "0.2.0"
3038+
source = "registry+https://github.com/rust-lang/crates.io-index"
30393039

30403040
[[package]]
30413041
name = "rustc_traits"
@@ -4229,7 +4229,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
42294229
"checksum jemalloc-sys 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7bef0d4ce37578dfd80b466e3d8324bd9de788e249f1accebb0c472ea4b52bdc"
42304230
"checksum jobserver 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b3d51e24009d966c8285d524dbaf6d60926636b2a89caee9ce0bd612494ddc16"
42314231
"checksum json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad0485404155f45cce53a40d4b2d6ac356418300daed05273d9e26f91c390be"
4232-
"checksum jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a5152c3fda235dfd68341b3edf4121bc4428642c93acbd6de88c26bf95fc5d7"
4232+
"checksum jsonrpc-core 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "288dca7f9713710a29e485076b9340156cb701edb46a881f5d0c31aa4f5b9143"
42334233
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
42344234
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
42354235
"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
@@ -4243,7 +4243,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
42434243
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
42444244
"checksum log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19af41f0565d7c19b2058153ad0b42d4d5ce89ec4dbf06ed6741114a8b63e7cd"
42454245
"checksum lsp-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "169d737ad89cf8ddd82d1804d9122f54568c49377665157277cc90d747b1d31a"
4246-
"checksum lsp-types 0.57.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d220de1fbbb12b60df17898272579c22329375fc4baa960402fbd17cf0cdd165"
4246+
"checksum lsp-types 0.57.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b62b77309737b1e262b3bbf37ff8faa740562c633b14702afe9be85dbcb6f88a"
42474247
"checksum lzma-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d1eaa027402541975218bb0eec67d6b0412f6233af96e0d096d31dbdfd22e614"
42484248
"checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
42494249
"checksum macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2c4deaccc2ead6a28c16c0ba82f07d52b6475397415ce40876e559b0b0ea510"
@@ -4350,7 +4350,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
43504350
"checksum rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "526e7b6d2707a5b9bec3927d424ad70fa3cfc68e0ac1b75e46cdbbc95adc5108"
43514351
"checksum rustc-rayon-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "79d38ca7cbc22fa59f09d8534ea4b27f67b0facf0cbe274433aceea227a02543"
43524352
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
4353-
"checksum rustc_tools_util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c5a95edfa0c893236ae4778bb7c4752760e4c0d245e19b5eff33c5aa5eb9dc"
4353+
"checksum rustc_tools_util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b725dadae9fabc488df69a287f5a99c5eaf5d10853842a8a3dfac52476f544ee"
43544354
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
43554355
"checksum rustfix 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "af7c21531a91512a4a51b490be6ba1c8eff34fdda0dc5bf87dc28d86748aac56"
43564356
"checksum rusty-fork 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9591f190d2852720b679c21f66ad929f9f1d7bb09d1193c26167586029d8489c"

src/doc/rustc/src/lints/listing/warn-by-default.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -728,19 +728,17 @@ This lint detects attributes that were not used by the compiler. Some
728728
example code that triggers this lint:
729729

730730
```rust
731-
#![feature(custom_attribute)]
732-
733-
#![mutable_doc]
731+
#![macro_export]
734732
```
735733

736734
This will produce:
737735

738736
```text
739737
warning: unused attribute
740-
--> src/main.rs:4:1
738+
--> src/main.rs:1:1
741739
|
742-
4 | #![mutable_doc]
743-
| ^^^^^^^^^^^^^^^
740+
1 | #![macro_export]
741+
| ^^^^^^^^^^^^^^^^
744742
|
745743
```
746744

src/liballoc/alloc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ extern "Rust" {
1515
// them from the `#[global_allocator]` attribute if there is one, or uses the
1616
// default implementations in libstd (`__rdl_alloc` etc in `src/libstd/alloc.rs`)
1717
// otherwise.
18-
#[allocator]
18+
#[cfg_attr(bootstrap, allocator)]
19+
#[cfg_attr(not(bootstrap), rustc_allocator)]
1920
#[rustc_allocator_nounwind]
2021
fn __rust_alloc(size: usize, align: usize) -> *mut u8;
2122
#[rustc_allocator_nounwind]

src/liballoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
#![feature(coerce_unsized)]
8080
#![feature(dispatch_from_dyn)]
8181
#![feature(core_intrinsics)]
82-
#![feature(custom_attribute)]
82+
#![cfg_attr(bootstrap, feature(custom_attribute))]
8383
#![feature(dropck_eyepatch)]
8484
#![feature(exact_size_is_empty)]
8585
#![feature(fmt_internals)]

src/libcore/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
#![feature(concat_idents)]
7676
#![feature(const_fn)]
7777
#![feature(const_fn_union)]
78-
#![feature(custom_attribute)]
7978
#![feature(doc_cfg)]
8079
#![feature(doc_spotlight)]
8180
#![feature(extern_types)]

src/librustc/hir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,7 @@ bitflags! {
25742574
/// `#[cold]`: a hint to LLVM that this function, when called, is never on
25752575
/// the hot path.
25762576
const COLD = 1 << 0;
2577-
/// `#[allocator]`: a hint to LLVM that the pointer returned from this
2577+
/// `#[rustc_allocator]`: a hint to LLVM that the pointer returned from this
25782578
/// function is never null.
25792579
const ALLOCATOR = 1 << 1;
25802580
/// `#[unwind]`: an indicator that this function may unwind despite what

src/librustc_codegen_llvm/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#![feature(box_syntax)]
1111
#![feature(const_cstr_unchecked)]
1212
#![feature(crate_visibility_modifier)]
13-
#![feature(custom_attribute)]
1413
#![feature(extern_types)]
1514
#![feature(in_band_lifetimes)]
1615
#![allow(unused_attributes)]

src/librustc_codegen_ssa/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![feature(box_patterns)]
44
#![feature(box_syntax)]
55
#![feature(core_intrinsics)]
6-
#![feature(custom_attribute)]
76
#![feature(libc)]
87
#![feature(rustc_diagnostic_macros)]
98
#![feature(stmt_expr_attributes)]

src/librustc_codegen_utils/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#![feature(box_patterns)]
99
#![feature(box_syntax)]
1010
#![feature(core_intrinsics)]
11-
#![feature(custom_attribute)]
1211
#![feature(never_type)]
1312
#![feature(nll)]
1413
#![allow(unused_attributes)]

src/librustc_errors/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
22

3-
#![feature(custom_attribute)]
43
#![allow(unused_attributes)]
54
#![cfg_attr(unix, feature(libc))]
65
#![feature(nll)]

src/librustc_save_analysis/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
2-
#![feature(custom_attribute)]
32
#![feature(nll)]
43
#![deny(rust_2018_idioms)]
54
#![deny(internal)]

src/librustc_typeck/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2445,7 +2445,7 @@ fn codegen_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> Codegen
24452445
for attr in attrs.iter() {
24462446
if attr.check_name(sym::cold) {
24472447
codegen_fn_attrs.flags |= CodegenFnAttrFlags::COLD;
2448-
} else if attr.check_name(sym::allocator) {
2448+
} else if attr.check_name(sym::rustc_allocator) {
24492449
codegen_fn_attrs.flags |= CodegenFnAttrFlags::ALLOCATOR;
24502450
} else if attr.check_name(sym::unwind) {
24512451
codegen_fn_attrs.flags |= CodegenFnAttrFlags::UNWIND;

src/librustdoc/html/highlight.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl<'a> Classifier<'a> {
257257
token::Question => Class::QuestionMark,
258258

259259
token::Dollar => {
260-
if self.lexer.peek().kind.is_ident() {
260+
if self.lexer.peek().is_ident() {
261261
self.in_macro_nonterminal = true;
262262
Class::MacroNonTerminal
263263
} else {

src/libsyntax/attr/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::source_map::{BytePos, Spanned, dummy_spanned};
2020
use crate::parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration};
2121
use crate::parse::parser::Parser;
2222
use crate::parse::{self, ParseSess, PResult};
23-
use crate::parse::token::{self, Token, TokenKind};
23+
use crate::parse::token::{self, Token};
2424
use crate::ptr::P;
2525
use crate::symbol::{sym, Symbol};
2626
use crate::ThinVec;
@@ -467,8 +467,7 @@ impl MetaItem {
467467
segment.ident.span.ctxt());
468468
idents.push(TokenTree::token(token::ModSep, mod_sep_span).into());
469469
}
470-
idents.push(TokenTree::token(TokenKind::from_ast_ident(segment.ident),
471-
segment.ident.span).into());
470+
idents.push(TokenTree::Token(Token::from_ast_ident(segment.ident)).into());
472471
last_pos = segment.ident.span.hi();
473472
}
474473
self.node.tokens(self.span).append_to_tree_and_joint_vec(&mut idents);

src/libsyntax/ext/tt/macro_parser.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ use crate::ast::{Ident, Name};
7878
use crate::ext::tt::quoted::{self, TokenTree};
7979
use crate::parse::{Directory, ParseSess};
8080
use crate::parse::parser::{Parser, PathStyle};
81-
use crate::parse::token::{self, DocComment, Nonterminal, Token, TokenKind};
81+
use crate::parse::token::{self, DocComment, Nonterminal, Token};
8282
use crate::print::pprust;
8383
use crate::symbol::{kw, sym, Symbol};
8484
use crate::tokenstream::{DelimSpan, TokenStream};
@@ -199,7 +199,7 @@ struct MatcherPos<'root, 'tt: 'root> {
199199
seq_op: Option<quoted::KleeneOp>,
200200

201201
/// The separator if we are in a repetition.
202-
sep: Option<TokenKind>,
202+
sep: Option<Token>,
203203

204204
/// The "parent" matcher position if we are in a repetition. That is, the matcher position just
205205
/// before we enter the sequence.
@@ -417,24 +417,24 @@ fn nameize<I: Iterator<Item = NamedMatch>>(
417417

418418
/// Generates an appropriate parsing failure message. For EOF, this is "unexpected end...". For
419419
/// other tokens, this is "unexpected token...".
420-
pub fn parse_failure_msg(tok: TokenKind) -> String {
421-
match tok {
420+
pub fn parse_failure_msg(tok: &Token) -> String {
421+
match tok.kind {
422422
token::Eof => "unexpected end of macro invocation".to_string(),
423423
_ => format!(
424424
"no rules expected the token `{}`",
425-
pprust::token_to_string(&tok)
425+
pprust::token_to_string(tok)
426426
),
427427
}
428428
}
429429

430430
/// Performs a token equality check, ignoring syntax context (that is, an unhygienic comparison)
431-
fn token_name_eq(t1: &TokenKind, t2: &TokenKind) -> bool {
432-
if let (Some((name1, is_raw1)), Some((name2, is_raw2))) = (t1.ident_name(), t2.ident_name()) {
433-
name1 == name2 && is_raw1 == is_raw2
434-
} else if let (Some(name1), Some(name2)) = (t1.lifetime_name(), t2.lifetime_name()) {
435-
name1 == name2
431+
fn token_name_eq(t1: &Token, t2: &Token) -> bool {
432+
if let (Some((ident1, is_raw1)), Some((ident2, is_raw2))) = (t1.ident(), t2.ident()) {
433+
ident1.name == ident2.name && is_raw1 == is_raw2
434+
} else if let (Some(ident1), Some(ident2)) = (t1.lifetime(), t2.lifetime()) {
435+
ident1.name == ident2.name
436436
} else {
437-
*t1 == *t2
437+
t1.kind == t2.kind
438438
}
439439
}
440440

@@ -712,7 +712,7 @@ pub fn parse(
712712

713713
// If we reached the EOF, check that there is EXACTLY ONE possible matcher. Otherwise,
714714
// either the parse is ambiguous (which should never happen) or there is a syntax error.
715-
if token_name_eq(&parser.token, &token::Eof) {
715+
if parser.token == token::Eof {
716716
if eof_items.len() == 1 {
717717
let matches = eof_items[0]
718718
.matches
@@ -804,8 +804,8 @@ pub fn parse(
804804

805805
/// The token is an identifier, but not `_`.
806806
/// We prohibit passing `_` to macros expecting `ident` for now.
807-
fn get_macro_name(token: &TokenKind) -> Option<(Name, bool)> {
808-
match *token {
807+
fn get_macro_name(token: &Token) -> Option<(Name, bool)> {
808+
match token.kind {
809809
token::Ident(name, is_raw) if name != kw::Underscore => Some((name, is_raw)),
810810
_ => None,
811811
}

0 commit comments

Comments
 (0)