Skip to content

Commit 61b6bf5

Browse files
committed
Auto merge of #49106 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests - Successful merges: #48943, #48960, #48983, #49055, #49057, #49077, #49082, #49083 - Failed merges:
2 parents c3fd5d0 + ef9581e commit 61b6bf5

File tree

22 files changed

+923
-48
lines changed

22 files changed

+923
-48
lines changed

config.toml.example

+4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@
118118
# Indicate whether submodules are managed and updated automatically.
119119
#submodules = true
120120

121+
# Update submodules only when the checked out commit in the submodules differs
122+
# from what is committed in the main rustc repo.
123+
#fast-submodules = true
124+
121125
# The path to (or name of) the GDB executable to use. This is only used for
122126
# executing the debuginfo test suite.
123127
#gdb = "gdb"

src/bootstrap/bootstrap.py

+55-20
Original file line numberDiff line numberDiff line change
@@ -597,10 +597,8 @@ def build_bootstrap(self):
597597
self.cargo()))
598598
args = [self.cargo(), "build", "--manifest-path",
599599
os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")]
600-
if self.verbose:
600+
for _ in range(1, self.verbose):
601601
args.append("--verbose")
602-
if self.verbose > 1:
603-
args.append("--verbose")
604602
if self.use_locked_deps:
605603
args.append("--locked")
606604
if self.use_vendored_sources:
@@ -614,20 +612,55 @@ def build_triple(self):
614612
return config
615613
return default_build_triple()
616614

615+
def check_submodule(self, module, slow_submodules):
616+
if not slow_submodules:
617+
checked_out = subprocess.Popen(["git", "rev-parse", "HEAD"],
618+
cwd=os.path.join(self.rust_root, module),
619+
stdout=subprocess.PIPE)
620+
return checked_out
621+
else:
622+
return None
623+
624+
def update_submodule(self, module, checked_out, recorded_submodules):
625+
module_path = os.path.join(self.rust_root, module)
626+
627+
if checked_out != None:
628+
default_encoding = sys.getdefaultencoding()
629+
checked_out = checked_out.communicate()[0].decode(default_encoding).strip()
630+
if recorded_submodules[module] == checked_out:
631+
return
632+
633+
print("Updating submodule", module)
634+
635+
run(["git", "submodule", "-q", "sync", module],
636+
cwd=self.rust_root, verbose=self.verbose)
637+
run(["git", "submodule", "update",
638+
"--init", "--recursive", module],
639+
cwd=self.rust_root, verbose=self.verbose)
640+
run(["git", "reset", "-q", "--hard"],
641+
cwd=module_path, verbose=self.verbose)
642+
run(["git", "clean", "-qdfx"],
643+
cwd=module_path, verbose=self.verbose)
644+
617645
def update_submodules(self):
618646
"""Update submodules"""
619647
if (not os.path.exists(os.path.join(self.rust_root, ".git"))) or \
620648
self.get_toml('submodules') == "false":
621649
return
622-
print('Updating submodules')
650+
slow_submodules = self.get_toml('fast-submodule') == "false"
651+
start_time = time()
652+
if slow_submodules:
653+
print('Unconditionally updating all submodules')
654+
else:
655+
print('Updating only changed submodules')
623656
default_encoding = sys.getdefaultencoding()
624-
run(["git", "submodule", "-q", "sync"], cwd=self.rust_root, verbose=self.verbose)
625657
submodules = [s.split(' ', 1)[1] for s in subprocess.check_output(
626658
["git", "config", "--file",
627659
os.path.join(self.rust_root, ".gitmodules"),
628660
"--get-regexp", "path"]
629661
).decode(default_encoding).splitlines()]
630662
filtered_submodules = []
663+
submodules_names = []
631664
for module in submodules:
632665
if module.endswith("llvm"):
633666
if self.get_toml('llvm-config'):
@@ -645,16 +678,19 @@ def update_submodules(self):
645678
config = self.get_toml('lld')
646679
if config is None or config == 'false':
647680
continue
648-
filtered_submodules.append(module)
649-
run(["git", "submodule", "update",
650-
"--init", "--recursive"] + filtered_submodules,
651-
cwd=self.rust_root, verbose=self.verbose)
652-
run(["git", "submodule", "-q", "foreach", "git",
653-
"reset", "-q", "--hard"],
654-
cwd=self.rust_root, verbose=self.verbose)
655-
run(["git", "submodule", "-q", "foreach", "git",
656-
"clean", "-qdfx"],
657-
cwd=self.rust_root, verbose=self.verbose)
681+
check = self.check_submodule(module, slow_submodules)
682+
filtered_submodules.append((module, check))
683+
submodules_names.append(module)
684+
recorded = subprocess.Popen(["git", "ls-tree", "HEAD"] + submodules_names,
685+
cwd=self.rust_root, stdout=subprocess.PIPE)
686+
recorded = recorded.communicate()[0].decode(default_encoding).strip().splitlines()
687+
recorded_submodules = {}
688+
for data in recorded:
689+
data = data.split()
690+
recorded_submodules[data[3]] = data[2]
691+
for module in filtered_submodules:
692+
self.update_submodule(module[0], module[1], recorded_submodules)
693+
print("Submodules updated in %.2f seconds" % (time() - start_time))
658694

659695
def set_dev_environment(self):
660696
"""Set download URL for development environment"""
@@ -675,7 +711,7 @@ def bootstrap(help_triggered):
675711
parser.add_argument('--config')
676712
parser.add_argument('--build')
677713
parser.add_argument('--clean', action='store_true')
678-
parser.add_argument('-v', '--verbose', action='store_true')
714+
parser.add_argument('-v', '--verbose', action='count', default=0)
679715

680716
args = [a for a in sys.argv if a != '-h' and a != '--help']
681717
args, _ = parser.parse_known_args(args)
@@ -691,10 +727,9 @@ def bootstrap(help_triggered):
691727
except (OSError, IOError):
692728
pass
693729

694-
if '\nverbose = 2' in build.config_toml:
695-
build.verbose = 2
696-
elif '\nverbose = 1' in build.config_toml:
697-
build.verbose = 1
730+
match = re.search(r'\nverbose = (\d+)', build.config_toml)
731+
if match is not None:
732+
build.verbose = max(build.verbose, int(match.group(1)))
698733

699734
build.use_vendored_sources = '\nvendor = true' in build.config_toml
700735

src/bootstrap/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ impl<'a> Builder<'a> {
763763
cargo.env("WINAPI_NO_BUNDLED_LIBRARIES", "1");
764764
}
765765

766-
if self.is_very_verbose() {
766+
for _ in 1..self.verbosity {
767767
cargo.arg("-v");
768768
}
769769

src/bootstrap/dist.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,22 @@ fn make_win_dist(
203203
"libbcrypt.a",
204204
"libcomctl32.a",
205205
"libcomdlg32.a",
206+
"libcredui.a",
206207
"libcrypt32.a",
208+
"libdbghelp.a",
207209
"libgdi32.a",
208210
"libimagehlp.a",
209211
"libiphlpapi.a",
210212
"libkernel32.a",
213+
"libmsimg32.a",
211214
"libmsvcrt.a",
212215
"libodbc32.a",
213216
"libole32.a",
214217
"liboleaut32.a",
215218
"libopengl32.a",
216219
"libpsapi.a",
217220
"librpcrt4.a",
221+
"libsecur32.a",
218222
"libsetupapi.a",
219223
"libshell32.a",
220224
"libuser32.a",
@@ -225,8 +229,6 @@ fn make_win_dist(
225229
"libwinspool.a",
226230
"libws2_32.a",
227231
"libwsock32.a",
228-
"libdbghelp.a",
229-
"libmsimg32.a",
230232
];
231233

232234
//Find mingw artifacts we want to bundle

src/bootstrap/flags.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use cache::{Interned, INTERNER};
2929

3030
/// Deserialized version of all flags for this compile.
3131
pub struct Flags {
32-
pub verbose: usize, // verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose
32+
pub verbose: usize, // number of -v args; each extra -v after the first is passed to Cargo
3333
pub on_fail: Option<String>,
3434
pub stage: Option<u32>,
3535
pub keep_stage: Option<u32>,

src/bootstrap/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,6 @@ impl Build {
606606
self.verbosity > 0
607607
}
608608

609-
pub fn is_very_verbose(&self) -> bool {
610-
self.verbosity > 1
611-
}
612-
613609
/// Prints a message if this build is configured in verbose mode.
614610
fn verbose(&self, msg: &str) {
615611
if self.is_verbose() {

src/liballoc/heap.rs

-8
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,6 @@ unsafe impl Alloc for Heap {
228228
}
229229
}
230230

231-
/// An arbitrary non-null address to represent zero-size allocations.
232-
///
233-
/// This preserves the non-null invariant for types like `Box<T>`. The address
234-
/// may overlap with non-zero-size memory allocations.
235-
#[rustc_deprecated(since = "1.19.0", reason = "Use Unique/NonNull::empty() instead")]
236-
#[unstable(feature = "heap_api", issue = "27700")]
237-
pub const EMPTY: *mut () = 1 as *mut ();
238-
239231
/// The allocator for unique pointers.
240232
// This function must not unwind. If it does, MIR trans will fail.
241233
#[cfg(not(test))]

src/librustc/middle/resolve_lifetime.rs

+21-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use hir::map::Map;
1919
use hir::def::Def;
2020
use hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
2121
use hir::ItemLocalId;
22+
use hir::LifetimeName;
2223
use ty::{self, TyCtxt};
2324

2425
use std::cell::Cell;
@@ -569,10 +570,26 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
569570
for bound in bounds {
570571
self.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None);
571572
}
572-
if lifetime.is_elided() {
573-
self.resolve_object_lifetime_default(lifetime)
574-
} else {
575-
self.visit_lifetime(lifetime);
573+
match lifetime.name {
574+
LifetimeName::Implicit => {
575+
// If the user does not write *anything*, we
576+
// use the object lifetime defaulting
577+
// rules. So e.g. `Box<dyn Debug>` becomes
578+
// `Box<dyn Debug + 'static>`.
579+
self.resolve_object_lifetime_default(lifetime)
580+
}
581+
LifetimeName::Underscore => {
582+
// If the user writes `'_`, we use the *ordinary* elision
583+
// rules. So the `'_` in e.g. `Box<dyn Debug + '_>` will be
584+
// resolved the same as the `'_` in `&'_ Foo`.
585+
//
586+
// cc #48468
587+
self.resolve_elided_lifetimes(slice::from_ref(lifetime), false)
588+
}
589+
LifetimeName::Static | LifetimeName::Name(_) => {
590+
// If the user wrote an explicit name, use that.
591+
self.visit_lifetime(lifetime);
592+
}
576593
}
577594
}
578595
hir::TyRptr(ref lifetime_ref, ref mt) => {

src/librustc/mir/interpret/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct EvalError<'tcx> {
2020

2121
impl<'tcx> From<EvalErrorKind<'tcx>> for EvalError<'tcx> {
2222
fn from(kind: EvalErrorKind<'tcx>) -> Self {
23-
let backtrace = match env::var("RUST_BACKTRACE") {
23+
let backtrace = match env::var("MIRI_BACKTRACE") {
2424
Ok(ref val) if !val.is_empty() => Some(Backtrace::new_unresolved()),
2525
_ => None
2626
};

src/librustc_driver/driver.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -877,10 +877,6 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
877877
Ok(())
878878
})?;
879879

880-
if resolver.found_unresolved_macro {
881-
sess.parse_sess.span_diagnostic.abort_if_errors();
882-
}
883-
884880
// Needs to go *after* expansion to be able to check the results of macro expansion.
885881
time(sess, "complete gated feature checking", || {
886882
sess.track_errors(|| {
@@ -892,6 +888,12 @@ pub fn phase_2_configure_and_expand_inner<'a, F>(sess: &'a Session,
892888
})
893889
})?;
894890

891+
// Unresolved macros might be due to mistyped `#[macro_use]`,
892+
// so abort after checking for unknown attributes. (#49074)
893+
if resolver.found_unresolved_macro {
894+
sess.parse_sess.span_diagnostic.abort_if_errors();
895+
}
896+
895897
// Lower ast -> hir.
896898
// First, we need to collect the dep_graph.
897899
let dep_graph = match future_dep_graph {

src/librustc_llvm/ffi.rs

+42
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ extern "C" {
621621
pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
622622
pub fn LLVMRustConstInt128Get(ConstantVal: ValueRef, SExt: bool,
623623
high: *mut u64, low: *mut u64) -> bool;
624+
pub fn LLVMConstRealGetDouble (ConstantVal: ValueRef, losesInfo: *mut Bool) -> f64;
624625

625626

626627
// Operations on composite constants
@@ -1201,6 +1202,46 @@ extern "C" {
12011202
Name: *const c_char)
12021203
-> ValueRef;
12031204

1205+
pub fn LLVMRustBuildVectorReduceFAdd(B: BuilderRef,
1206+
Acc: ValueRef,
1207+
Src: ValueRef)
1208+
-> ValueRef;
1209+
pub fn LLVMRustBuildVectorReduceFMul(B: BuilderRef,
1210+
Acc: ValueRef,
1211+
Src: ValueRef)
1212+
-> ValueRef;
1213+
pub fn LLVMRustBuildVectorReduceAdd(B: BuilderRef,
1214+
Src: ValueRef)
1215+
-> ValueRef;
1216+
pub fn LLVMRustBuildVectorReduceMul(B: BuilderRef,
1217+
Src: ValueRef)
1218+
-> ValueRef;
1219+
pub fn LLVMRustBuildVectorReduceAnd(B: BuilderRef,
1220+
Src: ValueRef)
1221+
-> ValueRef;
1222+
pub fn LLVMRustBuildVectorReduceOr(B: BuilderRef,
1223+
Src: ValueRef)
1224+
-> ValueRef;
1225+
pub fn LLVMRustBuildVectorReduceXor(B: BuilderRef,
1226+
Src: ValueRef)
1227+
-> ValueRef;
1228+
pub fn LLVMRustBuildVectorReduceMin(B: BuilderRef,
1229+
Src: ValueRef,
1230+
IsSigned: bool)
1231+
-> ValueRef;
1232+
pub fn LLVMRustBuildVectorReduceMax(B: BuilderRef,
1233+
Src: ValueRef,
1234+
IsSigned: bool)
1235+
-> ValueRef;
1236+
pub fn LLVMRustBuildVectorReduceFMin(B: BuilderRef,
1237+
Src: ValueRef,
1238+
IsNaN: bool)
1239+
-> ValueRef;
1240+
pub fn LLVMRustBuildVectorReduceFMax(B: BuilderRef,
1241+
Src: ValueRef,
1242+
IsNaN: bool)
1243+
-> ValueRef;
1244+
12041245
pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
12051246
pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
12061247
pub fn LLVMBuildPtrDiff(B: BuilderRef,
@@ -1567,6 +1608,7 @@ extern "C" {
15671608
pub fn LLVMRustWriteValueToString(value_ref: ValueRef, s: RustStringRef);
15681609

15691610
pub fn LLVMIsAConstantInt(value_ref: ValueRef) -> ValueRef;
1611+
pub fn LLVMIsAConstantFP(value_ref: ValueRef) -> ValueRef;
15701612

15711613
pub fn LLVMRustPassKind(Pass: PassRef) -> PassKind;
15721614
pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> PassRef;

0 commit comments

Comments
 (0)