Skip to content

Commit 32f6056

Browse files
committed
Auto merge of #44098 - frewsxcv:rollup, r=frewsxcv
Rollup of 7 pull requests - Successful merges: #43776, #43966, #43979, #44072, #44086, #44090, #44091 - Failed merges:
2 parents 669d477 + 502a11d commit 32f6056

File tree

26 files changed

+264
-88
lines changed

26 files changed

+264
-88
lines changed

src/etc/htmldocck.py

+20-13
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
3030
In order to avoid one-off dependencies for this task, this script uses
3131
a reasonably working HTML parser and the existing XPath implementation
32-
from Python 2's standard library. Hopefully we won't render
32+
from Python's standard library. Hopefully we won't render
3333
non-well-formed HTML.
3434
3535
# Commands
@@ -110,11 +110,17 @@
110110
import re
111111
import shlex
112112
from collections import namedtuple
113-
from HTMLParser import HTMLParser
113+
try:
114+
from html.parser import HTMLParser
115+
except ImportError:
116+
from HTMLParser import HTMLParser
114117
from xml.etree import cElementTree as ET
115118

116119
# ⇤/⇥ are not in HTML 4 but are in HTML 5
117-
from htmlentitydefs import entitydefs
120+
try:
121+
from html.entities import entitydefs
122+
except ImportError:
123+
from htmlentitydefs import entitydefs
118124
entitydefs['larrb'] = u'\u21e4'
119125
entitydefs['rarrb'] = u'\u21e5'
120126
entitydefs['nbsp'] = ' '
@@ -123,6 +129,11 @@
123129
VOID_ELEMENTS = set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen',
124130
'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'])
125131

132+
# Python 2 -> 3 compatibility
133+
try:
134+
unichr
135+
except NameError:
136+
unichr = chr
126137

127138
class CustomHTMLParser(HTMLParser):
128139
"""simplified HTML parser.
@@ -184,12 +195,8 @@ def concat_multi_lines(f):
184195

185196
# strip the common prefix from the current line if needed
186197
if lastline is not None:
187-
maxprefix = 0
188-
for i in xrange(min(len(line), len(lastline))):
189-
if line[i] != lastline[i]:
190-
break
191-
maxprefix += 1
192-
line = line[maxprefix:].lstrip()
198+
common_prefix = os.path.commonprefix([line, lastline])
199+
line = line[len(common_prefix):].lstrip()
193200

194201
firstlineno = firstlineno or lineno
195202
if line.endswith('\\'):
@@ -213,7 +220,7 @@ def concat_multi_lines(f):
213220

214221

215222
def get_commands(template):
216-
with open(template, 'rUb') as f:
223+
with open(template, 'rU') as f:
217224
for lineno, line in concat_multi_lines(f):
218225
m = LINE_PATTERN.search(line)
219226
if not m:
@@ -372,7 +379,7 @@ def check_command(c, cache):
372379
cache.get_file(c.args[0])
373380
ret = True
374381
except FailedCheck as err:
375-
cerr = err.message
382+
cerr = str(err)
376383
ret = False
377384
elif len(c.args) == 2: # @has/matches <path> <pat> = string test
378385
cerr = "`PATTERN` did not match"
@@ -413,9 +420,9 @@ def check_command(c, cache):
413420

414421
except FailedCheck as err:
415422
message = '@{}{} check failed'.format('!' if c.negated else '', c.cmd)
416-
print_err(c.lineno, c.context, err.message, message)
423+
print_err(c.lineno, c.context, str(err), message)
417424
except InvalidCheck as err:
418-
print_err(c.lineno, c.context, err.message)
425+
print_err(c.lineno, c.context, str(err))
419426

420427
def check(target, commands):
421428
cache = CachedFiles(target)

src/liballoc/allocator.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl Layout {
110110

111111
/// Creates a layout, bypassing all checks.
112112
///
113-
/// # Unsafety
113+
/// # Safety
114114
///
115115
/// This function is unsafe as it does not verify that `align` is
116116
/// a power-of-two that is also less than or equal to 2^31, nor
@@ -485,7 +485,7 @@ pub unsafe trait Alloc {
485485
/// behavior, e.g. to ensure initialization to particular sets of
486486
/// bit patterns.)
487487
///
488-
/// # Unsafety
488+
/// # Safety
489489
///
490490
/// This function is unsafe because undefined behavior can result
491491
/// if the caller does not ensure that `layout` has non-zero size.
@@ -513,7 +513,7 @@ pub unsafe trait Alloc {
513513

514514
/// Deallocate the memory referenced by `ptr`.
515515
///
516-
/// # Unsafety
516+
/// # Safety
517517
///
518518
/// This function is unsafe because undefined behavior can result
519519
/// if the caller does not ensure all of the following:
@@ -617,7 +617,7 @@ pub unsafe trait Alloc {
617617
/// behavior is well-defined (though underspecified) when this
618618
/// constraint is violated; further discussion below.
619619
///
620-
/// # Unsafety
620+
/// # Safety
621621
///
622622
/// This function is unsafe because undefined behavior can result
623623
/// if the caller does not ensure all of the following:
@@ -688,7 +688,7 @@ pub unsafe trait Alloc {
688688
/// Behaves like `alloc`, but also ensures that the contents
689689
/// are set to zero before being returned.
690690
///
691-
/// # Unsafety
691+
/// # Safety
692692
///
693693
/// This function is unsafe for the same reasons that `alloc` is.
694694
///
@@ -714,7 +714,7 @@ pub unsafe trait Alloc {
714714
/// the returned block. For some `layout` inputs, like arrays, this
715715
/// may include extra storage usable for additional data.
716716
///
717-
/// # Unsafety
717+
/// # Safety
718718
///
719719
/// This function is unsafe for the same reasons that `alloc` is.
720720
///
@@ -736,7 +736,7 @@ pub unsafe trait Alloc {
736736
/// the returned block. For some `layout` inputs, like arrays, this
737737
/// may include extra storage usable for additional data.
738738
///
739-
/// # Unsafety
739+
/// # Safety
740740
///
741741
/// This function is unsafe for the same reasons that `realloc` is.
742742
///
@@ -770,7 +770,7 @@ pub unsafe trait Alloc {
770770
/// memory block referenced by `ptr` has not been transferred, and
771771
/// the contents of the memory block are unaltered.
772772
///
773-
/// # Unsafety
773+
/// # Safety
774774
///
775775
/// This function is unsafe because undefined behavior can result
776776
/// if the caller does not ensure all of the following:
@@ -827,7 +827,7 @@ pub unsafe trait Alloc {
827827
/// the memory block has not been transferred, and the contents of
828828
/// the memory block are unaltered.
829829
///
830-
/// # Unsafety
830+
/// # Safety
831831
///
832832
/// This function is unsafe because undefined behavior can result
833833
/// if the caller does not ensure all of the following:
@@ -920,7 +920,7 @@ pub unsafe trait Alloc {
920920
///
921921
/// Captures a common usage pattern for allocators.
922922
///
923-
/// # Unsafety
923+
/// # Safety
924924
///
925925
/// This function is unsafe because undefined behavior can result
926926
/// if the caller does not ensure both:
@@ -993,7 +993,7 @@ pub unsafe trait Alloc {
993993
/// The returned block is suitable for passing to the
994994
/// `alloc`/`realloc` methods of this allocator.
995995
///
996-
/// # Unsafety
996+
/// # Safety
997997
///
998998
/// This function is unsafe because undefined behavior can result
999999
/// if the caller does not ensure all of the following:
@@ -1037,7 +1037,7 @@ pub unsafe trait Alloc {
10371037
///
10381038
/// Captures a common usage pattern for allocators.
10391039
///
1040-
/// # Unsafety
1040+
/// # Safety
10411041
///
10421042
/// This function is unsafe because undefined behavior can result
10431043
/// if the caller does not ensure both:

src/liballoc/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ impl<I: FusedIterator + ?Sized> FusedIterator for Box<I> {}
633633
/// that `FnBox` may be deprecated in the future if `Box<FnOnce()>`
634634
/// closures become directly usable.)
635635
///
636-
/// ### Example
636+
/// # Examples
637637
///
638638
/// Here is a snippet of code which creates a hashmap full of boxed
639639
/// once closures and then removes them one by one, calling each

src/liballoc/slice.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ mod hack {
171171
impl<T> [T] {
172172
/// Returns the number of elements in the slice.
173173
///
174-
/// # Example
174+
/// # Examples
175175
///
176176
/// ```
177177
/// let a = [1, 2, 3];
@@ -185,7 +185,7 @@ impl<T> [T] {
185185

186186
/// Returns `true` if the slice has a length of 0.
187187
///
188-
/// # Example
188+
/// # Examples
189189
///
190190
/// ```
191191
/// let a = [1, 2, 3];
@@ -523,7 +523,7 @@ impl<T> [T] {
523523

524524
/// Reverses the order of elements in the slice, in place.
525525
///
526-
/// # Example
526+
/// # Examples
527527
///
528528
/// ```
529529
/// let mut v = [1, 2, 3];
@@ -580,7 +580,7 @@ impl<T> [T] {
580580
///
581581
/// Panics if `size` is 0.
582582
///
583-
/// # Example
583+
/// # Examples
584584
///
585585
/// ```
586586
/// let slice = ['r', 'u', 's', 't'];
@@ -613,7 +613,7 @@ impl<T> [T] {
613613
///
614614
/// Panics if `size` is 0.
615615
///
616-
/// # Example
616+
/// # Examples
617617
///
618618
/// ```
619619
/// let slice = ['l', 'o', 'r', 'e', 'm'];
@@ -1040,7 +1040,7 @@ impl<T> [T] {
10401040
/// `Err` is returned, containing the index where a matching
10411041
/// element could be inserted while maintaining sorted order.
10421042
///
1043-
/// # Example
1043+
/// # Examples
10441044
///
10451045
/// Looks up a series of four elements. The first is found, with a
10461046
/// uniquely determined position; the second and third are not
@@ -1074,7 +1074,7 @@ impl<T> [T] {
10741074
/// `Err` is returned, containing the index where a matching
10751075
/// element could be inserted while maintaining sorted order.
10761076
///
1077-
/// # Example
1077+
/// # Examples
10781078
///
10791079
/// Looks up a series of four elements. The first is found, with a
10801080
/// uniquely determined position; the second and third are not
@@ -1419,7 +1419,7 @@ impl<T> [T] {
14191419
///
14201420
/// This function will panic if the two slices have different lengths.
14211421
///
1422-
/// # Example
1422+
/// # Examples
14231423
///
14241424
/// ```
14251425
/// let mut dst = [0, 0, 0];
@@ -1445,7 +1445,7 @@ impl<T> [T] {
14451445
///
14461446
/// This function will panic if the two slices have different lengths.
14471447
///
1448-
/// # Example
1448+
/// # Examples
14491449
///
14501450
/// ```
14511451
/// let mut dst = [0, 0, 0];

src/liballoc/str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,7 @@ impl str {
17141714
///
17151715
/// [`Err`]: str/trait.FromStr.html#associatedtype.Err
17161716
///
1717-
/// # Example
1717+
/// # Examples
17181718
///
17191719
/// Basic usage
17201720
///

src/liballoc/string.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ use boxed::Box;
8282
///
8383
/// # Examples
8484
///
85-
/// You can create a `String` from a literal string with `String::from`:
85+
/// You can create a `String` from a literal string with [`String::from`]:
8686
///
8787
/// ```
8888
/// let hello = String::from("Hello, world!");
@@ -98,6 +98,7 @@ use boxed::Box;
9898
/// hello.push_str("orld!");
9999
/// ```
100100
///
101+
/// [`String::from`]: #method.from
101102
/// [`char`]: ../../std/primitive.char.html
102103
/// [`push`]: #method.push
103104
/// [`push_str`]: #method.push_str

src/libcore/cell.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ impl<'b, T: ?Sized> Ref<'b, T> {
998998
/// A method would interfere with methods of the same name on the contents
999999
/// of a `RefCell` used through `Deref`.
10001000
///
1001-
/// # Example
1001+
/// # Examples
10021002
///
10031003
/// ```
10041004
/// use std::cell::{RefCell, Ref};
@@ -1040,7 +1040,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
10401040
/// `RefMut::map(...)`. A method would interfere with methods of the same
10411041
/// name on the contents of a `RefCell` used through `Deref`.
10421042
///
1043-
/// # Example
1043+
/// # Examples
10441044
///
10451045
/// ```
10461046
/// use std::cell::{RefCell, RefMut};

src/libcore/fmt/builders.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'a, 'b: 'a> fmt::Write for PadAdapter<'a, 'b> {
5858
/// [`Formatter::debug_struct`](struct.Formatter.html#method.debug_struct)
5959
/// method.
6060
///
61-
/// # Example
61+
/// # Examples
6262
///
6363
/// ```
6464
/// use std::fmt;
@@ -153,7 +153,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
153153
/// [`Formatter::debug_tuple`](struct.Formatter.html#method.debug_tuple)
154154
/// method.
155155
///
156-
/// # Example
156+
/// # Examples
157157
///
158158
/// ```
159159
/// use std::fmt;
@@ -290,7 +290,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
290290
/// [`Formatter::debug_set`](struct.Formatter.html#method.debug_set)
291291
/// method.
292292
///
293-
/// # Example
293+
/// # Examples
294294
///
295295
/// ```
296296
/// use std::fmt;
@@ -361,7 +361,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
361361
/// [`Formatter::debug_list`](struct.Formatter.html#method.debug_list)
362362
/// method.
363363
///
364-
/// # Example
364+
/// # Examples
365365
///
366366
/// ```
367367
/// use std::fmt;
@@ -432,7 +432,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
432432
/// [`Formatter::debug_map`](struct.Formatter.html#method.debug_map)
433433
/// method.
434434
///
435-
/// # Example
435+
/// # Examples
436436
///
437437
/// ```
438438
/// use std::fmt;

src/libcore/mem.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ impl<T> ManuallyDrop<T> {
901901

902902
/// Manually drops the contained value.
903903
///
904-
/// # Unsafety
904+
/// # Safety
905905
///
906906
/// This function runs the destructor of the contained value and thus the wrapped value
907907
/// now represents uninitialized data. It is up to the user of this method to ensure the

src/librustc_back/target/haiku_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ pub fn opts() -> TargetOptions {
2020
target_family: Some("unix".to_string()),
2121
relro_level: RelroLevel::Full,
2222
linker_is_gnu: true,
23-
no_integrated_as: true,
2423
.. Default::default()
2524
}
2625
}

0 commit comments

Comments
 (0)