Skip to content

Commit 8789360

Browse files
committed
Auto merge of #40785 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests - Successful merges: #40501, #40524, #40636, #40739, #40756 - Failed merges:
2 parents e703b33 + b8fbc64 commit 8789360

File tree

28 files changed

+269
-164
lines changed

28 files changed

+269
-164
lines changed

src/bootstrap/bootstrap.py

+5-12
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,8 @@ class RustBuild(object):
160160
def download_stage0(self):
161161
cache_dst = os.path.join(self.build_dir, "cache")
162162
rustc_cache = os.path.join(cache_dst, self.stage0_rustc_date())
163-
cargo_cache = os.path.join(cache_dst, self.stage0_cargo_rev())
164163
if not os.path.exists(rustc_cache):
165164
os.makedirs(rustc_cache)
166-
if not os.path.exists(cargo_cache):
167-
os.makedirs(cargo_cache)
168165

169166
if self.rustc().startswith(self.bin_root()) and \
170167
(not os.path.exists(self.rustc()) or self.rustc_out_of_date()):
@@ -195,15 +192,15 @@ def download_stage0(self):
195192
if self.cargo().startswith(self.bin_root()) and \
196193
(not os.path.exists(self.cargo()) or self.cargo_out_of_date()):
197194
self.print_what_it_means_to_bootstrap()
198-
filename = "cargo-nightly-{}.tar.gz".format(self.build)
199-
url = "https://s3.amazonaws.com/rust-lang-ci/cargo-builds/" + self.stage0_cargo_rev()
200-
tarball = os.path.join(cargo_cache, filename)
195+
filename = "cargo-{}-{}.tar.gz".format(channel, self.build)
196+
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
197+
tarball = os.path.join(rustc_cache, filename)
201198
if not os.path.exists(tarball):
202199
get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
203200
unpack(tarball, self.bin_root(), match="cargo", verbose=self.verbose)
204201
self.fix_executable(self.bin_root() + "/bin/cargo")
205202
with open(self.cargo_stamp(), 'w') as f:
206-
f.write(self.stage0_cargo_rev())
203+
f.write(self.stage0_rustc_date())
207204

208205
def fix_executable(self, fname):
209206
# If we're on NixOS we need to change the path to the dynamic loader
@@ -258,9 +255,6 @@ def fix_executable(self, fname):
258255
print("warning: failed to call patchelf: %s" % e)
259256
return
260257

261-
def stage0_cargo_rev(self):
262-
return self._cargo_rev
263-
264258
def stage0_rustc_date(self):
265259
return self._rustc_date
266260

@@ -283,7 +277,7 @@ def cargo_out_of_date(self):
283277
if not os.path.exists(self.cargo_stamp()) or self.clean:
284278
return True
285279
with open(self.cargo_stamp(), 'r') as f:
286-
return self.stage0_cargo_rev() != f.read()
280+
return self.stage0_rustc_date() != f.read()
287281

288282
def bin_root(self):
289283
return os.path.join(self.build_dir, self.build, "stage0")
@@ -578,7 +572,6 @@ def bootstrap():
578572

579573
data = stage0_data(rb.rust_root)
580574
rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
581-
rb._cargo_rev = data['cargo']
582575

583576
# Fetch/build the bootstrap
584577
rb.build = rb.build_triple()

src/bootstrap/channel.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use build_helper::output;
2323
use Build;
2424

2525
// The version number
26-
pub const CFG_RELEASE_NUM: &'static str = "1.17.0";
26+
pub const CFG_RELEASE_NUM: &'static str = "1.18.0";
2727

2828
// An optional number to put after the label, e.g. '.2' -> '-beta.2'
2929
// Be sure to make this starts with a dot to conform to semver pre-release

src/libcollections/slice.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ impl<T> [T] {
11621162
///
11631163
/// # Current implementation
11641164
///
1165-
/// The current algorithm is based on Orson Peters' [pdqsort][pattern-defeating quicksort],
1165+
/// The current algorithm is based on Orson Peters' [pattern-defeating quicksort][pdqsort],
11661166
/// which is a quicksort variant designed to be very fast on certain kinds of patterns,
11671167
/// sometimes achieving linear time. It is randomized but deterministic, and falls back to
11681168
/// heapsort on degenerate inputs.
@@ -1199,7 +1199,7 @@ impl<T> [T] {
11991199
///
12001200
/// # Current implementation
12011201
///
1202-
/// The current algorithm is based on Orson Peters' [pdqsort][pattern-defeating quicksort],
1202+
/// The current algorithm is based on Orson Peters' [pattern-defeating quicksort][pdqsort],
12031203
/// which is a quicksort variant designed to be very fast on certain kinds of patterns,
12041204
/// sometimes achieving linear time. It is randomized but deterministic, and falls back to
12051205
/// heapsort on degenerate inputs.
@@ -1239,7 +1239,7 @@ impl<T> [T] {
12391239
///
12401240
/// # Current implementation
12411241
///
1242-
/// The current algorithm is based on Orson Peters' [pdqsort][pattern-defeating quicksort],
1242+
/// The current algorithm is based on Orson Peters' [pattern-defeating quicksort][pdqsort],
12431243
/// which is a quicksort variant designed to be very fast on certain kinds of patterns,
12441244
/// sometimes achieving linear time. It is randomized but deterministic, and falls back to
12451245
/// heapsort on degenerate inputs.

src/librustc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#![feature(conservative_impl_trait)]
3030
#![feature(const_fn)]
3131
#![feature(core_intrinsics)]
32-
#![cfg_attr(stage0,feature(field_init_shorthand))]
3332
#![feature(i128_type)]
3433
#![feature(libc)]
3534
#![feature(loop_break_value)]

src/librustc_asan/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![cfg_attr(not(stage0), feature(sanitizer_runtime))]
12-
#![cfg_attr(not(stage0), sanitizer_runtime)]
11+
#![sanitizer_runtime]
12+
#![feature(sanitizer_runtime)]
1313
#![feature(alloc_system)]
1414
#![feature(staged_api)]
1515
#![no_std]

src/librustc_data_structures/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#![feature(shared)]
2929
#![feature(collections_range)]
30-
#![cfg_attr(stage0,feature(field_init_shorthand))]
3130
#![feature(nonzero)]
3231
#![feature(rustc_private)]
3332
#![feature(staged_api)]

src/librustc_incremental/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![feature(rand)]
2525
#![feature(core_intrinsics)]
2626
#![feature(conservative_impl_trait)]
27-
#![cfg_attr(stage0,feature(field_init_shorthand))]
2827
#![cfg_attr(stage0, feature(pub_restricted))]
2928

3029
extern crate graphviz;

src/librustc_lsan/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![cfg_attr(not(stage0), feature(sanitizer_runtime))]
12-
#![cfg_attr(not(stage0), sanitizer_runtime)]
11+
#![sanitizer_runtime]
12+
#![feature(sanitizer_runtime)]
1313
#![feature(alloc_system)]
1414
#![feature(staged_api)]
1515
#![no_std]

src/librustc_metadata/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#![feature(box_patterns)]
2121
#![feature(conservative_impl_trait)]
2222
#![feature(core_intrinsics)]
23-
#![cfg_attr(stage0, feature(field_init_shorthand))]
2423
#![feature(i128_type)]
2524
#![feature(proc_macro_internals)]
2625
#![feature(quote)]

src/librustc_mir/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
2323
#![feature(associated_consts)]
2424
#![feature(box_patterns)]
2525
#![feature(box_syntax)]
26-
#![cfg_attr(stage0, feature(field_init_shorthand))]
2726
#![feature(i128_type)]
2827
#![feature(rustc_diagnostic_macros)]
2928
#![feature(rustc_private)]
@@ -61,4 +60,4 @@ pub fn provide(providers: &mut Providers) {
6160
mir_map::provide(providers);
6261
shim::provide(providers);
6362
transform::qualify_consts::provide(providers);
64-
}
63+
}

src/librustc_msan/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![cfg_attr(not(stage0), feature(sanitizer_runtime))]
12-
#![cfg_attr(not(stage0), sanitizer_runtime)]
11+
#![sanitizer_runtime]
12+
#![feature(sanitizer_runtime)]
1313
#![feature(alloc_system)]
1414
#![feature(staged_api)]
1515
#![no_std]

src/librustc_resolve/build_reduced_graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl<'a> Resolver<'a> {
539539
binding: &'a NameBinding<'a>,
540540
span: Span,
541541
allow_shadowing: bool) {
542-
if self.builtin_macros.insert(name, binding).is_some() && !allow_shadowing {
542+
if self.global_macros.insert(name, binding).is_some() && !allow_shadowing {
543543
let msg = format!("`{}` is already in scope", name);
544544
let note =
545545
"macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560)";

src/librustc_resolve/lib.rs

+24-20
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ use std::mem::replace;
7575
use std::rc::Rc;
7676

7777
use resolve_imports::{ImportDirective, ImportDirectiveSubclass, NameResolution, ImportResolver};
78-
use macros::{InvocationData, LegacyBinding, LegacyScope};
78+
use macros::{InvocationData, LegacyBinding, LegacyScope, MacroBinding};
7979

8080
// NB: This module needs to be declared first so diagnostics are
8181
// registered before they are used.
@@ -1174,7 +1174,7 @@ pub struct Resolver<'a> {
11741174

11751175
crate_loader: &'a mut CrateLoader,
11761176
macro_names: FxHashSet<Name>,
1177-
builtin_macros: FxHashMap<Name, &'a NameBinding<'a>>,
1177+
global_macros: FxHashMap<Name, &'a NameBinding<'a>>,
11781178
lexical_macro_resolutions: Vec<(Name, &'a Cell<LegacyScope<'a>>)>,
11791179
macro_map: FxHashMap<DefId, Rc<SyntaxExtension>>,
11801180
macro_defs: FxHashMap<Mark, DefId>,
@@ -1372,7 +1372,7 @@ impl<'a> Resolver<'a> {
13721372

13731373
crate_loader: crate_loader,
13741374
macro_names: FxHashSet(),
1375-
builtin_macros: FxHashMap(),
1375+
global_macros: FxHashMap(),
13761376
lexical_macro_resolutions: Vec::new(),
13771377
macro_map: FxHashMap(),
13781378
macro_exports: Vec::new(),
@@ -2429,9 +2429,9 @@ impl<'a> Resolver<'a> {
24292429
};
24302430
}
24312431
}
2432-
let is_builtin = self.builtin_macros.get(&path[0].name).cloned()
2432+
let is_global = self.global_macros.get(&path[0].name).cloned()
24332433
.map(|binding| binding.get_macro(self).kind() == MacroKind::Bang).unwrap_or(false);
2434-
if primary_ns != MacroNS && (is_builtin || self.macro_names.contains(&path[0].name)) {
2434+
if primary_ns != MacroNS && (is_global || self.macro_names.contains(&path[0].name)) {
24352435
// Return some dummy definition, it's enough for error reporting.
24362436
return Some(
24372437
PathResolution::new(Def::Macro(DefId::local(CRATE_DEF_INDEX), MacroKind::Bang))
@@ -2566,6 +2566,7 @@ impl<'a> Resolver<'a> {
25662566
self.resolve_ident_in_module(module, ident, ns, false, record_used)
25672567
} else if opt_ns == Some(MacroNS) {
25682568
self.resolve_lexical_macro_path_segment(ident, ns, record_used)
2569+
.map(MacroBinding::binding)
25692570
} else {
25702571
match self.resolve_ident_in_lexical_scope(ident, ns, record_used) {
25712572
Some(LexicalScopeBinding::Item(binding)) => Ok(binding),
@@ -3223,7 +3224,7 @@ impl<'a> Resolver<'a> {
32233224
};
32243225
let msg1 = format!("`{}` could refer to the name {} here", name, participle(b1));
32253226
let msg2 = format!("`{}` could also refer to the name {} here", name, participle(b2));
3226-
let note = if !lexical && b1.is_glob_import() {
3227+
let note = if b1.expansion == Mark::root() || !lexical && b1.is_glob_import() {
32273228
format!("consider adding an explicit import of `{}` to disambiguate", name)
32283229
} else if let Def::Macro(..) = b1.def() {
32293230
format!("macro-expanded {} do not shadow",
@@ -3243,11 +3244,15 @@ impl<'a> Resolver<'a> {
32433244
let msg = format!("`{}` is ambiguous", name);
32443245
self.session.add_lint(lint::builtin::LEGACY_IMPORTS, id, span, msg);
32453246
} else {
3246-
self.session.struct_span_err(span, &format!("`{}` is ambiguous", name))
3247-
.span_note(b1.span, &msg1)
3248-
.span_note(b2.span, &msg2)
3249-
.note(&note)
3250-
.emit();
3247+
let mut err =
3248+
self.session.struct_span_err(span, &format!("`{}` is ambiguous", name));
3249+
err.span_note(b1.span, &msg1);
3250+
match b2.def() {
3251+
Def::Macro(..) if b2.span == DUMMY_SP =>
3252+
err.note(&format!("`{}` is also a builtin macro", name)),
3253+
_ => err.span_note(b2.span, &msg2),
3254+
};
3255+
err.note(&note).emit();
32513256
}
32523257
}
32533258

@@ -3361,22 +3366,21 @@ impl<'a> Resolver<'a> {
33613366
if self.proc_macro_enabled { return; }
33623367

33633368
for attr in attrs {
3364-
let name = unwrap_or!(attr.name(), continue);
3365-
let maybe_binding = self.builtin_macros.get(&name).cloned().or_else(|| {
3366-
let ident = Ident::with_empty_ctxt(name);
3367-
self.resolve_lexical_macro_path_segment(ident, MacroNS, None).ok()
3368-
});
3369-
3370-
if let Some(binding) = maybe_binding {
3371-
if let SyntaxExtension::AttrProcMacro(..) = *binding.get_macro(self) {
3369+
if attr.path.segments.len() > 1 {
3370+
continue
3371+
}
3372+
let ident = attr.path.segments[0].identifier;
3373+
let result = self.resolve_lexical_macro_path_segment(ident, MacroNS, None);
3374+
if let Ok(binding) = result {
3375+
if let SyntaxExtension::AttrProcMacro(..) = *binding.binding().get_macro(self) {
33723376
attr::mark_known(attr);
33733377

33743378
let msg = "attribute procedural macros are experimental";
33753379
let feature = "proc_macro";
33763380

33773381
feature_err(&self.session.parse_sess, feature,
33783382
attr.span, GateIssue::Language, msg)
3379-
.span_note(binding.span, "procedural macro imported here")
3383+
.span_note(binding.span(), "procedural macro imported here")
33803384
.emit();
33813385
}
33823386
}

0 commit comments

Comments
 (0)