Skip to content

Commit 5a71fb3

Browse files
authored
Auto merge of #36684 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests - Successful merges: #36018, #36498, #36500, #36559, #36566, #36578, #36664 - Failed merges:
2 parents ee959a8 + f342ece commit 5a71fb3

File tree

25 files changed

+112
-75
lines changed

25 files changed

+112
-75
lines changed

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"
676676
valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
677677
valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples"
678678
valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
679-
valopt_nosave docdir "${CFG_PREFIX}/share/doc/rust" "install man pages in PATH"
679+
valopt_nosave docdir "${CFG_PREFIX}/share/doc/rust" "install documentation in PATH"
680680

681681
# On Windows this determines root of the subtree for target libraries.
682682
# Host runtime libs always go to 'bin'.

src/bootstrap/bootstrap.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ def stage0_data(rust_root):
131131
def format_build_time(duration):
132132
return str(datetime.timedelta(seconds=int(duration)))
133133

134-
class RustBuild:
134+
135+
class RustBuild(object):
135136
def download_stage0(self):
136137
cache_dst = os.path.join(self.build_dir, "cache")
137138
rustc_cache = os.path.join(cache_dst, self.stage0_rustc_date())
@@ -142,7 +143,7 @@ def download_stage0(self):
142143
os.makedirs(cargo_cache)
143144

144145
if self.rustc().startswith(self.bin_root()) and \
145-
(not os.path.exists(self.rustc()) or self.rustc_out_of_date()):
146+
(not os.path.exists(self.rustc()) or self.rustc_out_of_date()):
146147
if os.path.exists(self.bin_root()):
147148
shutil.rmtree(self.bin_root())
148149
channel = self.stage0_rustc_channel()
@@ -165,7 +166,7 @@ def download_stage0(self):
165166
f.write(self.stage0_rustc_date())
166167

167168
if self.cargo().startswith(self.bin_root()) and \
168-
(not os.path.exists(self.cargo()) or self.cargo_out_of_date()):
169+
(not os.path.exists(self.cargo()) or self.cargo_out_of_date()):
169170
channel = self.stage0_cargo_channel()
170171
filename = "cargo-{}-{}.tar.gz".format(channel, self.build)
171172
url = "https://static.rust-lang.org/cargo-dist/" + self.stage0_cargo_date()
@@ -238,8 +239,8 @@ def rustc(self):
238239

239240
def get_string(self, line):
240241
start = line.find('"')
241-
end = start + 1 + line[start+1:].find('"')
242-
return line[start+1:end]
242+
end = start + 1 + line[start + 1:].find('"')
243+
return line[start + 1:end]
243244

244245
def exe_suffix(self):
245246
if sys.platform == 'win32':

src/doc/rust.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ em {
159159

160160
footer {
161161
border-top: 1px solid #ddd;
162-
font-size: 14.3px;
162+
font-size: 14px;
163163
font-style: italic;
164164
padding-top: 5px;
165165
margin-top: 3em;

src/etc/debugger_pretty_printers_common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def extract_length_and_ptr_from_slice(slice_val):
328328
UNQUALIFIED_TYPE_MARKERS = frozenset(["(", "[", "&", "*"])
329329

330330
def extract_type_name(qualified_type_name):
331-
'''Extracts the type name from a fully qualified path'''
331+
"""Extracts the type name from a fully qualified path"""
332332
if qualified_type_name[0] in UNQUALIFIED_TYPE_MARKERS:
333333
return qualified_type_name
334334

src/etc/gdb_rust_pretty_printing.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def rust_pretty_printer_lookup_function(gdb_val):
170170
#=------------------------------------------------------------------------------
171171
# Pretty Printer Classes
172172
#=------------------------------------------------------------------------------
173-
class RustStructPrinter:
173+
class RustStructPrinter(object):
174174
def __init__(self, val, omit_first_field, omit_type_name, is_tuple_like):
175175
self.__val = val
176176
self.__omit_first_field = omit_first_field
@@ -205,11 +205,12 @@ def display_hint(self):
205205
return ""
206206

207207

208-
class RustSlicePrinter:
208+
class RustSlicePrinter(object):
209209
def __init__(self, val):
210210
self.__val = val
211211

212-
def display_hint(self):
212+
@staticmethod
213+
def display_hint():
213214
return "array"
214215

215216
def to_string(self):
@@ -226,7 +227,7 @@ def children(self):
226227
yield (str(index), (raw_ptr + index).dereference())
227228

228229

229-
class RustStringSlicePrinter:
230+
class RustStringSlicePrinter(object):
230231
def __init__(self, val):
231232
self.__val = val
232233

@@ -236,11 +237,12 @@ def to_string(self):
236237
return '"%s"' % raw_ptr.string(encoding="utf-8", length=length)
237238

238239

239-
class RustStdVecPrinter:
240+
class RustStdVecPrinter(object):
240241
def __init__(self, val):
241242
self.__val = val
242243

243-
def display_hint(self):
244+
@staticmethod
245+
def display_hint():
244246
return "array"
245247

246248
def to_string(self):
@@ -255,7 +257,7 @@ def children(self):
255257
yield (str(index), (gdb_ptr + index).dereference())
256258

257259

258-
class RustStdStringPrinter:
260+
class RustStdStringPrinter(object):
259261
def __init__(self, val):
260262
self.__val = val
261263

@@ -266,7 +268,7 @@ def to_string(self):
266268
length=length)
267269

268270

269-
class RustCStyleVariantPrinter:
271+
class RustCStyleVariantPrinter(object):
270272
def __init__(self, val):
271273
assert val.type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_ENUM
272274
self.__val = val
@@ -275,7 +277,7 @@ def to_string(self):
275277
return str(self.__val.get_wrapped_value())
276278

277279

278-
class IdentityPrinter:
280+
class IdentityPrinter(object):
279281
def __init__(self, string):
280282
self.string = string
281283

src/etc/lldb_batchmode.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737

3838

3939
def print_debug(s):
40-
"Print something if DEBUG_OUTPUT is True"
40+
"""Print something if DEBUG_OUTPUT is True"""
4141
global DEBUG_OUTPUT
4242
if DEBUG_OUTPUT:
4343
print("DEBUG: " + str(s))
4444

4545

4646
def normalize_whitespace(s):
47-
"Replace newlines, tabs, multiple spaces, etc with exactly one space"
47+
"""Replace newlines, tabs, multiple spaces, etc with exactly one space"""
4848
return re.sub("\s+", " ", s)
4949

5050

@@ -71,7 +71,7 @@ def breakpoint_callback(frame, bp_loc, dict):
7171

7272

7373
def execute_command(command_interpreter, command):
74-
"Executes a single CLI command"
74+
"""Executes a single CLI command"""
7575
global new_breakpoints
7676
global registered_breakpoints
7777

src/etc/lldb_rust_formatters.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ def print_val(lldb_val, internal_dict):
171171
#=--------------------------------------------------------------------------------------------------
172172

173173
def print_struct_val(val, internal_dict, omit_first_field, omit_type_name, is_tuple_like):
174-
'''
174+
"""
175175
Prints a struct, tuple, or tuple struct value with Rust syntax.
176176
Ignores any fields before field_start_index.
177-
'''
177+
"""
178178
assert val.type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_STRUCT
179179

180180
if omit_type_name:
@@ -221,7 +221,7 @@ def render_child(child_index):
221221
"body": body}
222222

223223
def print_pointer_val(val, internal_dict):
224-
'''Prints a pointer value with Rust syntax'''
224+
"""Prints a pointer value with Rust syntax"""
225225
assert val.type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_PTR
226226
sigil = "&"
227227
type_name = val.type.get_unqualified_type_name()
@@ -275,8 +275,8 @@ def print_std_string_val(val, internal_dict):
275275
#=--------------------------------------------------------------------------------------------------
276276

277277
def print_array_of_values(array_name, data_ptr_val, length, internal_dict):
278-
'''Prints a contigous memory range, interpreting it as values of the
279-
pointee-type of data_ptr_val.'''
278+
"""Prints a contigous memory range, interpreting it as values of the
279+
pointee-type of data_ptr_val."""
280280

281281
data_ptr_type = data_ptr_val.type
282282
assert data_ptr_type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_PTR

src/etc/platform-intrinsics/generator.py

+20-11
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,19 @@ class Void(Type):
119119
def __init__(self):
120120
Type.__init__(self, 0)
121121

122-
def compiler_ctor(self):
122+
@staticmethod
123+
def compiler_ctor():
123124
return '::VOID'
124125

125126
def compiler_ctor_ref(self):
126127
return '&' + self.compiler_ctor()
127128

128-
def rust_name(self):
129+
@staticmethod
130+
def rust_name():
129131
return '()'
130132

131-
def type_info(self, platform_info):
133+
@staticmethod
134+
def type_info(platform_info):
132135
return None
133136

134137
def __eq__(self, other):
@@ -282,7 +285,7 @@ def __eq__(self, other):
282285

283286
class Pointer(Type):
284287
def __init__(self, elem, llvm_elem, const):
285-
self._elem = elem;
288+
self._elem = elem
286289
self._llvm_elem = llvm_elem
287290
self._const = const
288291
Type.__init__(self, BITWIDTH_POINTER)
@@ -503,7 +506,7 @@ def monomorphise(self):
503506
# must be a power of two
504507
assert width & (width - 1) == 0
505508
def recur(processed, untouched):
506-
if untouched == []:
509+
if not untouched:
507510
ret = processed[0]
508511
args = processed[1:]
509512
yield MonomorphicIntrinsic(self._platform, self.intrinsic, width,
@@ -756,22 +759,26 @@ class ExternBlock(object):
756759
def __init__(self):
757760
pass
758761

759-
def open(self, platform):
762+
@staticmethod
763+
def open(platform):
760764
return 'extern "platform-intrinsic" {'
761765

762-
def render(self, mono):
766+
@staticmethod
767+
def render(mono):
763768
return ' fn {}{}{};'.format(mono.platform_prefix(),
764769
mono.intrinsic_name(),
765770
mono.intrinsic_signature())
766771

767-
def close(self):
772+
@staticmethod
773+
def close():
768774
return '}'
769775

770776
class CompilerDefs(object):
771777
def __init__(self):
772778
pass
773779

774-
def open(self, platform):
780+
@staticmethod
781+
def open(platform):
775782
return '''\
776783
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
777784
// file at the top-level directory of this distribution and at
@@ -798,7 +805,8 @@ def open(self, platform):
798805
if !name.starts_with("{0}") {{ return None }}
799806
Some(match &name["{0}".len()..] {{'''.format(platform.platform_prefix())
800807

801-
def render(self, mono):
808+
@staticmethod
809+
def render(mono):
802810
return '''\
803811
"{}" => Intrinsic {{
804812
inputs: {{ static INPUTS: [&'static Type; {}] = [{}]; &INPUTS }},
@@ -810,7 +818,8 @@ def render(self, mono):
810818
mono.compiler_ret(),
811819
mono.llvm_name())
812820

813-
def close(self):
821+
@staticmethod
822+
def close():
814823
return '''\
815824
_ => return None,
816825
})

src/etc/test-float-parse/runtests.py

-2
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,13 @@ def run(test):
177177

178178

179179
def interact(proc, queue):
180-
line = ""
181180
n = 0
182181
while proc.poll() is None:
183182
line = proc.stdout.readline()
184183
if not line:
185184
continue
186185
assert line.endswith('\n'), "incomplete line: " + repr(line)
187186
queue.put(line)
188-
line = ""
189187
n += 1
190188
if n % UPDATE_EVERY_N == 0:
191189
msg("got", str(n // 1000) + "k", "records")

src/etc/unicode.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,28 @@ def load_unicode_data(f):
8282
canon_decomp = {}
8383
compat_decomp = {}
8484

85-
udict = {};
86-
range_start = -1;
85+
udict = {}
86+
range_start = -1
8787
for line in fileinput.input(f):
88-
data = line.split(';');
88+
data = line.split(';')
8989
if len(data) != 15:
9090
continue
91-
cp = int(data[0], 16);
91+
cp = int(data[0], 16)
9292
if is_surrogate(cp):
9393
continue
9494
if range_start >= 0:
9595
for i in xrange(range_start, cp):
96-
udict[i] = data;
97-
range_start = -1;
96+
udict[i] = data
97+
range_start = -1
9898
if data[1].endswith(", First>"):
99-
range_start = cp;
100-
continue;
101-
udict[cp] = data;
99+
range_start = cp
100+
continue
101+
udict[cp] = data
102102

103103
for code in udict:
104-
[code_org, name, gencat, combine, bidi,
104+
(code_org, name, gencat, combine, bidi,
105105
decomp, deci, digit, num, mirror,
106-
old, iso, upcase, lowcase, titlecase ] = udict[code];
106+
old, iso, upcase, lowcase, titlecase) = udict[code]
107107

108108
# generate char to char direct common and simple conversions
109109
# uppercase to lowercase
@@ -382,7 +382,7 @@ def emit_bool_trie(f, name, t_data, is_pub=True):
382382
global bytes_old, bytes_new
383383
bytes_old += 8 * len(t_data)
384384
CHUNK = 64
385-
rawdata = [False] * 0x110000;
385+
rawdata = [False] * 0x110000
386386
for (lo, hi) in t_data:
387387
for cp in range(lo, hi + 1):
388388
rawdata[cp] = True

src/libcollections/vec_deque.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -726,18 +726,18 @@ impl<T> VecDeque<T> {
726726
/// ```
727727
/// use std::collections::VecDeque;
728728
///
729-
/// let mut vector: VecDeque<u32> = VecDeque::new();
729+
/// let mut vector = VecDeque::new();
730730
///
731731
/// vector.push_back(0);
732732
/// vector.push_back(1);
733733
/// vector.push_back(2);
734734
///
735-
/// assert_eq!(vector.as_slices(), (&[0u32, 1, 2] as &[u32], &[] as &[u32]));
735+
/// assert_eq!(vector.as_slices(), (&[0, 1, 2][..], &[][..]));
736736
///
737737
/// vector.push_front(10);
738738
/// vector.push_front(9);
739739
///
740-
/// assert_eq!(vector.as_slices(), (&[9u32, 10] as &[u32], &[0u32, 1, 2] as &[u32]));
740+
/// assert_eq!(vector.as_slices(), (&[9, 10][..], &[0, 1, 2][..]));
741741
/// ```
742742
#[inline]
743743
#[stable(feature = "deque_extras_15", since = "1.5.0")]
@@ -764,7 +764,7 @@ impl<T> VecDeque<T> {
764764
/// ```
765765
/// use std::collections::VecDeque;
766766
///
767-
/// let mut vector: VecDeque<u32> = VecDeque::new();
767+
/// let mut vector = VecDeque::new();
768768
///
769769
/// vector.push_back(0);
770770
/// vector.push_back(1);
@@ -774,7 +774,7 @@ impl<T> VecDeque<T> {
774774
///
775775
/// vector.as_mut_slices().0[0] = 42;
776776
/// vector.as_mut_slices().1[0] = 24;
777-
/// assert_eq!(vector.as_slices(), (&[42u32, 10] as &[u32], &[24u32, 1] as &[u32]));
777+
/// assert_eq!(vector.as_slices(), (&[42, 10][..], &[24, 1][..]));
778778
/// ```
779779
#[inline]
780780
#[stable(feature = "deque_extras_15", since = "1.5.0")]

0 commit comments

Comments
 (0)