Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 294ef5b

Browse files
committedOct 14, 2015
Auto merge of #29039 - Manishearth:rollup, r=Manishearth
- Successful merges: #28991, #29004, #29006, #29013, #29016, #29024, #29027, #29028, #29029, #29032, #29035 - Failed merges:
2 parents 2939666 + 66b58d1 commit 294ef5b

File tree

13 files changed

+515
-272
lines changed

13 files changed

+515
-272
lines changed
 

‎src/doc/reference.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,11 +1435,11 @@ struct Foo;
14351435

14361436
trait Shape { fn area(&self) -> f64; }
14371437
trait Circle : Shape { fn radius(&self) -> f64; }
1438-
# impl Shape for Foo {
1439-
# fn area(&self) -> f64 {
1440-
# 0.0
1441-
# }
1442-
# }
1438+
impl Shape for Foo {
1439+
fn area(&self) -> f64 {
1440+
0.0
1441+
}
1442+
}
14431443
impl Circle for Foo {
14441444
fn radius(&self) -> f64 {
14451445
println!("calling area: {}", self.area());

‎src/doc/trpl/lifetimes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ associated with it, but the compiler lets you elide (i.e. omit, see
7474
["Lifetime Elision"][lifetime-elision] below) them in common cases.
7575
Before we get to that, though, let’s break the explicit example down:
7676

77-
[lifetime-elision]: #user-content-lifetime-elision
77+
[lifetime-elision]: #lifetime-elision
7878

7979
```rust,ignore
8080
fn bar<'a>(...)

‎src/libcore/iter.rs

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3032,7 +3032,52 @@ impl<A: Clone> DoubleEndedIterator for Repeat<A> {
30323032
fn next_back(&mut self) -> Option<A> { Some(self.element.clone()) }
30333033
}
30343034

3035-
/// Creates a new iterator that endlessly repeats the element `elt`.
3035+
/// Creates a new iterator that endlessly repeats a single element.
3036+
///
3037+
/// The `repeat()` function repeats a single value over and over and over and
3038+
/// over and over and 🔁.
3039+
///
3040+
/// Infinite iterators like `repeat()` are often used with adapters like
3041+
/// [`take()`], in order to make them finite.
3042+
///
3043+
/// [`take()`]: trait.Iterator.html#method.take
3044+
///
3045+
/// # Examples
3046+
///
3047+
/// Basic usage:
3048+
///
3049+
/// ```
3050+
/// use std::iter;
3051+
///
3052+
/// // the number four 4ever:
3053+
/// let mut fours = iter::repeat(4);
3054+
///
3055+
/// assert_eq!(Some(4), fours.next());
3056+
/// assert_eq!(Some(4), fours.next());
3057+
/// assert_eq!(Some(4), fours.next());
3058+
/// assert_eq!(Some(4), fours.next());
3059+
/// assert_eq!(Some(4), fours.next());
3060+
///
3061+
/// // yup, still four
3062+
/// assert_eq!(Some(4), fours.next());
3063+
/// ```
3064+
///
3065+
/// Going finite with [`take()`]:
3066+
///
3067+
/// ```
3068+
/// use std::iter;
3069+
///
3070+
/// // that last example was too many fours. Let's only have four fours.
3071+
/// let mut four_fours = iter::repeat(4).take(4);
3072+
///
3073+
/// assert_eq!(Some(4), four_fours.next());
3074+
/// assert_eq!(Some(4), four_fours.next());
3075+
/// assert_eq!(Some(4), four_fours.next());
3076+
/// assert_eq!(Some(4), four_fours.next());
3077+
///
3078+
/// // ... and now we're done
3079+
/// assert_eq!(None, four_fours.next());
3080+
/// ```
30363081
#[inline]
30373082
#[stable(feature = "rust1", since = "1.0.0")]
30383083
pub fn repeat<T: Clone>(elt: T) -> Repeat<T> {
@@ -3089,6 +3134,19 @@ impl<T> Default for Empty<T> {
30893134
}
30903135

30913136
/// Creates an iterator that yields nothing.
3137+
///
3138+
/// # Exampes
3139+
///
3140+
/// Basic usage:
3141+
///
3142+
/// ```
3143+
/// use std::iter;
3144+
///
3145+
/// // this could have been an iterator over i32, but alas, it's just not.
3146+
/// let mut nope = iter::empty::<i32>();
3147+
///
3148+
/// assert_eq!(None, nope.next());
3149+
/// ```
30923150
#[stable(feature = "iter_empty", since = "1.2.0")]
30933151
pub fn empty<T>() -> Empty<T> {
30943152
Empty(marker::PhantomData)
@@ -3129,6 +3187,56 @@ impl<T> ExactSizeIterator for Once<T> {
31293187
}
31303188

31313189
/// Creates an iterator that yields an element exactly once.
3190+
///
3191+
/// This is commonly used to adapt a single value into a [`chain()`] of other
3192+
/// kinds of iteration. Maybe you have an iterator that covers almost
3193+
/// everything, but you need an extra special case. Maybe you have a function
3194+
/// which works on iterators, but you only need to process one value.
3195+
///
3196+
/// [`chain()`]: trait.Iterator.html#method.chain
3197+
///
3198+
/// # Examples
3199+
///
3200+
/// Basic usage:
3201+
///
3202+
/// ```
3203+
/// use std::iter;
3204+
///
3205+
/// // one is the loneliest number
3206+
/// let mut one = iter::once(1);
3207+
///
3208+
/// assert_eq!(Some(1), one.next());
3209+
///
3210+
/// // just one, that's all we get
3211+
/// assert_eq!(None, one.next());
3212+
/// ```
3213+
///
3214+
/// Chaining together with another iterator. Let's say that we want to iterate
3215+
/// over each file of the `.foo` directory, but also a configuration file,
3216+
/// `.foorc`:
3217+
///
3218+
/// ```no_run
3219+
/// use std::iter;
3220+
/// use std::fs;
3221+
/// use std::path::PathBuf;
3222+
///
3223+
/// let dirs = fs::read_dir(".foo").unwrap();
3224+
///
3225+
/// // we need to convert from an iterator of DirEntry-s to an iterator of
3226+
/// // PathBufs, so we use map
3227+
/// let dirs = dirs.map(|file| file.unwrap().path());
3228+
///
3229+
/// // now, our iterator just for our config file
3230+
/// let config = iter::once(PathBuf::from(".foorc"));
3231+
///
3232+
/// // chain the two iterators together into one big iterator
3233+
/// let files = dirs.chain(config);
3234+
///
3235+
/// // this will give us all of the files in .foo as well as .foorc
3236+
/// for f in files {
3237+
/// println!("{:?}", f);
3238+
/// }
3239+
/// ```
31323240
#[stable(feature = "iter_once", since = "1.2.0")]
31333241
pub fn once<T>(value: T) -> Once<T> {
31343242
Once { inner: Some(value).into_iter() }

‎src/libfmt_macros/lib.rs

Lines changed: 220 additions & 160 deletions
Large diffs are not rendered by default.

‎src/liblog/directive.rs

Lines changed: 45 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ pub struct LogDirective {
1717
pub level: u32,
1818
}
1919

20-
pub const LOG_LEVEL_NAMES: [&'static str; 4] = ["ERROR", "WARN", "INFO",
21-
"DEBUG"];
20+
pub const LOG_LEVEL_NAMES: [&'static str; 4] = ["ERROR", "WARN", "INFO", "DEBUG"];
2221

2322
/// Parse an individual log level that is either a number or a symbolic log level
2423
fn parse_log_level(level: &str) -> Option<u32> {
25-
level.parse::<u32>().ok().or_else(|| {
26-
let pos = LOG_LEVEL_NAMES.iter().position(|&name| name.eq_ignore_ascii_case(level));
27-
pos.map(|p| p as u32 + 1)
28-
}).map(|p| cmp::min(p, ::MAX_LOG_LEVEL))
24+
level.parse::<u32>()
25+
.ok()
26+
.or_else(|| {
27+
let pos = LOG_LEVEL_NAMES.iter().position(|&name| name.eq_ignore_ascii_case(level));
28+
pos.map(|p| p as u32 + 1)
29+
})
30+
.map(|p| cmp::min(p, ::MAX_LOG_LEVEL))
2931
}
3032

3133
/// Parse a logging specification string (e.g: "crate1,crate2::mod3,crate3::x=1/foo")
@@ -40,44 +42,48 @@ pub fn parse_logging_spec(spec: &str) -> (Vec<LogDirective>, Option<String>) {
4042
let mods = parts.next();
4143
let filter = parts.next();
4244
if parts.next().is_some() {
43-
println!("warning: invalid logging spec '{}', \
44-
ignoring it (too many '/'s)", spec);
45+
println!("warning: invalid logging spec '{}', ignoring it (too many '/'s)",
46+
spec);
4547
return (dirs, None);
4648
}
47-
mods.map(|m| { for s in m.split(',') {
48-
if s.is_empty() { continue }
49-
let mut parts = s.split('=');
50-
let (log_level, name) = match (parts.next(), parts.next().map(|s| s.trim()), parts.next()) {
51-
(Some(part0), None, None) => {
52-
// if the single argument is a log-level string or number,
53-
// treat that as a global fallback
54-
match parse_log_level(part0) {
55-
Some(num) => (num, None),
56-
None => (::MAX_LOG_LEVEL, Some(part0)),
57-
}
49+
mods.map(|m| {
50+
for s in m.split(',') {
51+
if s.is_empty() {
52+
continue
5853
}
59-
(Some(part0), Some(""), None) => (::MAX_LOG_LEVEL, Some(part0)),
60-
(Some(part0), Some(part1), None) => {
61-
match parse_log_level(part1) {
62-
Some(num) => (num, Some(part0)),
63-
_ => {
64-
println!("warning: invalid logging spec '{}', \
65-
ignoring it", part1);
66-
continue
54+
let mut parts = s.split('=');
55+
let (log_level, name) = match (parts.next(),
56+
parts.next().map(|s| s.trim()),
57+
parts.next()) {
58+
(Some(part0), None, None) => {
59+
// if the single argument is a log-level string or number,
60+
// treat that as a global fallback
61+
match parse_log_level(part0) {
62+
Some(num) => (num, None),
63+
None => (::MAX_LOG_LEVEL, Some(part0)),
6764
}
6865
}
69-
},
70-
_ => {
71-
println!("warning: invalid logging spec '{}', \
72-
ignoring it", s);
73-
continue
74-
}
75-
};
76-
dirs.push(LogDirective {
77-
name: name.map(str::to_owned),
78-
level: log_level,
79-
});
80-
}});
66+
(Some(part0), Some(""), None) => (::MAX_LOG_LEVEL, Some(part0)),
67+
(Some(part0), Some(part1), None) => {
68+
match parse_log_level(part1) {
69+
Some(num) => (num, Some(part0)),
70+
_ => {
71+
println!("warning: invalid logging spec '{}', ignoring it", part1);
72+
continue
73+
}
74+
}
75+
}
76+
_ => {
77+
println!("warning: invalid logging spec '{}', ignoring it", s);
78+
continue
79+
}
80+
};
81+
dirs.push(LogDirective {
82+
name: name.map(str::to_owned),
83+
level: log_level,
84+
});
85+
}
86+
});
8187

8288
(dirs, filter.map(str::to_owned))
8389
}

‎src/liblog/lib.rs

Lines changed: 69 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ pub trait Logger {
235235
fn log(&mut self, record: &LogRecord);
236236
}
237237

238-
struct DefaultLogger { handle: Stderr }
238+
struct DefaultLogger {
239+
handle: Stderr,
240+
}
239241

240242
/// Wraps the log level with fmt implementations.
241243
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
@@ -246,7 +248,7 @@ impl fmt::Display for LogLevel {
246248
let LogLevel(level) = *self;
247249
match LOG_LEVEL_NAMES.get(level as usize - 1) {
248250
Some(ref name) => fmt::Display::fmt(name, fmt),
249-
None => fmt::Display::fmt(&level, fmt)
251+
None => fmt::Display::fmt(&level, fmt),
250252
}
251253
}
252254
}
@@ -301,11 +303,10 @@ pub fn log(level: u32, loc: &'static LogLocation, args: fmt::Arguments) {
301303
// Completely remove the local logger from TLS in case anyone attempts to
302304
// frob the slot while we're doing the logging. This will destroy any logger
303305
// set during logging.
304-
let mut logger: Box<Logger + Send> = LOCAL_LOGGER.with(|s| {
305-
s.borrow_mut().take()
306-
}).unwrap_or_else(|| {
307-
box DefaultLogger { handle: io::stderr() }
308-
});
306+
let mut logger: Box<Logger + Send> = LOCAL_LOGGER.with(|s| s.borrow_mut().take())
307+
.unwrap_or_else(|| {
308+
box DefaultLogger { handle: io::stderr() }
309+
});
309310
logger.log(&LogRecord {
310311
level: LogLevel(level),
311312
args: args,
@@ -320,22 +321,21 @@ pub fn log(level: u32, loc: &'static LogLocation, args: fmt::Arguments) {
320321
/// safely
321322
#[doc(hidden)]
322323
#[inline(always)]
323-
pub fn log_level() -> u32 { unsafe { LOG_LEVEL } }
324+
pub fn log_level() -> u32 {
325+
unsafe { LOG_LEVEL }
326+
}
324327

325328
/// Replaces the thread-local logger with the specified logger, returning the old
326329
/// logger.
327330
pub fn set_logger(logger: Box<Logger + Send>) -> Option<Box<Logger + Send>> {
328331
let mut l = Some(logger);
329-
LOCAL_LOGGER.with(|slot| {
330-
mem::replace(&mut *slot.borrow_mut(), l.take())
331-
})
332+
LOCAL_LOGGER.with(|slot| mem::replace(&mut *slot.borrow_mut(), l.take()))
332333
}
333334

334335
/// A LogRecord is created by the logging macros, and passed as the only
335336
/// argument to Loggers.
336337
#[derive(Debug)]
337338
pub struct LogRecord<'a> {
338-
339339
/// The module path of where the LogRecord originated.
340340
pub module_path: &'a str,
341341

@@ -373,7 +373,9 @@ pub fn mod_enabled(level: u32, module: &str) -> bool {
373373
// again to whether they should really be here or not. Hence, despite this
374374
// check being expanded manually in the logging macro, this function checks
375375
// the log level again.
376-
if level > unsafe { LOG_LEVEL } { return false }
376+
if level > unsafe { LOG_LEVEL } {
377+
return false
378+
}
377379

378380
// This assertion should never get tripped unless we're in an at_exit
379381
// handler after logging has been torn down and a logging attempt was made.
@@ -385,14 +387,11 @@ pub fn mod_enabled(level: u32, module: &str) -> bool {
385387
}
386388
}
387389

388-
fn enabled(level: u32,
389-
module: &str,
390-
iter: slice::Iter<directive::LogDirective>)
391-
-> bool {
390+
fn enabled(level: u32, module: &str, iter: slice::Iter<directive::LogDirective>) -> bool {
392391
// Search for the longest match, the vector is assumed to be pre-sorted.
393392
for directive in iter.rev() {
394393
match directive.name {
395-
Some(ref name) if !module.starts_with(&name[..]) => {},
394+
Some(ref name) if !module.starts_with(&name[..]) => {}
396395
Some(..) | None => {
397396
return level <= directive.level
398397
}
@@ -445,16 +444,14 @@ mod tests {
445444

446445
#[test]
447446
fn match_full_path() {
448-
let dirs = [
449-
LogDirective {
450-
name: Some("crate2".to_string()),
451-
level: 3
452-
},
453-
LogDirective {
454-
name: Some("crate1::mod1".to_string()),
455-
level: 2
456-
}
457-
];
447+
let dirs = [LogDirective {
448+
name: Some("crate2".to_string()),
449+
level: 3,
450+
},
451+
LogDirective {
452+
name: Some("crate1::mod1".to_string()),
453+
level: 2,
454+
}];
458455
assert!(enabled(2, "crate1::mod1", dirs.iter()));
459456
assert!(!enabled(3, "crate1::mod1", dirs.iter()));
460457
assert!(enabled(3, "crate2", dirs.iter()));
@@ -463,49 +460,72 @@ mod tests {
463460

464461
#[test]
465462
fn no_match() {
466-
let dirs = [
467-
LogDirective { name: Some("crate2".to_string()), level: 3 },
468-
LogDirective { name: Some("crate1::mod1".to_string()), level: 2 }
469-
];
463+
let dirs = [LogDirective {
464+
name: Some("crate2".to_string()),
465+
level: 3,
466+
},
467+
LogDirective {
468+
name: Some("crate1::mod1".to_string()),
469+
level: 2,
470+
}];
470471
assert!(!enabled(2, "crate3", dirs.iter()));
471472
}
472473

473474
#[test]
474475
fn match_beginning() {
475-
let dirs = [
476-
LogDirective { name: Some("crate2".to_string()), level: 3 },
477-
LogDirective { name: Some("crate1::mod1".to_string()), level: 2 }
478-
];
476+
let dirs = [LogDirective {
477+
name: Some("crate2".to_string()),
478+
level: 3,
479+
},
480+
LogDirective {
481+
name: Some("crate1::mod1".to_string()),
482+
level: 2,
483+
}];
479484
assert!(enabled(3, "crate2::mod1", dirs.iter()));
480485
}
481486

482487
#[test]
483488
fn match_beginning_longest_match() {
484-
let dirs = [
485-
LogDirective { name: Some("crate2".to_string()), level: 3 },
486-
LogDirective { name: Some("crate2::mod".to_string()), level: 4 },
487-
LogDirective { name: Some("crate1::mod1".to_string()), level: 2 }
488-
];
489+
let dirs = [LogDirective {
490+
name: Some("crate2".to_string()),
491+
level: 3,
492+
},
493+
LogDirective {
494+
name: Some("crate2::mod".to_string()),
495+
level: 4,
496+
},
497+
LogDirective {
498+
name: Some("crate1::mod1".to_string()),
499+
level: 2,
500+
}];
489501
assert!(enabled(4, "crate2::mod1", dirs.iter()));
490502
assert!(!enabled(4, "crate2", dirs.iter()));
491503
}
492504

493505
#[test]
494506
fn match_default() {
495-
let dirs = [
496-
LogDirective { name: None, level: 3 },
497-
LogDirective { name: Some("crate1::mod1".to_string()), level: 2 }
498-
];
507+
let dirs = [LogDirective {
508+
name: None,
509+
level: 3,
510+
},
511+
LogDirective {
512+
name: Some("crate1::mod1".to_string()),
513+
level: 2,
514+
}];
499515
assert!(enabled(2, "crate1::mod1", dirs.iter()));
500516
assert!(enabled(3, "crate2::mod2", dirs.iter()));
501517
}
502518

503519
#[test]
504520
fn zero_level() {
505-
let dirs = [
506-
LogDirective { name: None, level: 3 },
507-
LogDirective { name: Some("crate1::mod1".to_string()), level: 0 }
508-
];
521+
let dirs = [LogDirective {
522+
name: None,
523+
level: 3,
524+
},
525+
LogDirective {
526+
name: Some("crate1::mod1".to_string()),
527+
level: 0,
528+
}];
509529
assert!(!enabled(1, "crate1::mod1", dirs.iter()));
510530
assert!(enabled(3, "crate2::mod2", dirs.iter()));
511531
}

‎src/librustc/front/map/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,10 @@ impl<'ast> Map<'ast> {
528528
NodeTraitItem(ti) => PathName(ti.name),
529529
NodeVariant(v) => PathName(v.node.name),
530530
NodeLifetime(lt) => PathName(lt.name),
531+
NodeTyParam(tp) => PathName(tp.name),
532+
NodeLocal(&Pat { node: PatIdent(_,l,_), .. }) => {
533+
PathName(l.node.name)
534+
},
531535
_ => panic!("no path elem for {:?}", node)
532536
}
533537
}
@@ -988,4 +992,3 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
988992
}
989993
}
990994
}
991-

‎src/librustc_bitflags/lib.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
//! A typesafe bitmask flag generator.
2424
25-
#[cfg(test)] #[macro_use] extern crate std;
25+
#[cfg(test)]
26+
#[macro_use]
27+
extern crate std;
2628

2729
/// The `bitflags!` macro generates a `struct` that holds a set of C-style
2830
/// bitmask flags. It is useful for creating typesafe wrappers for C APIs.
@@ -321,7 +323,7 @@ mod tests {
321323
}
322324

323325
#[test]
324-
fn test_bits(){
326+
fn test_bits() {
325327
assert_eq!(Flags::empty().bits(), 0b00000000);
326328
assert_eq!(Flags::FlagA.bits(), 0b00000001);
327329
assert_eq!(Flags::FlagABC.bits(), 0b00000111);
@@ -354,7 +356,7 @@ mod tests {
354356
}
355357

356358
#[test]
357-
fn test_is_empty(){
359+
fn test_is_empty() {
358360
assert!(Flags::empty().is_empty());
359361
assert!(!Flags::FlagA.is_empty());
360362
assert!(!Flags::FlagABC.is_empty());
@@ -413,7 +415,7 @@ mod tests {
413415
}
414416

415417
#[test]
416-
fn test_insert(){
418+
fn test_insert() {
417419
let mut e1 = Flags::FlagA;
418420
let e2 = Flags::FlagA | Flags::FlagB;
419421
e1.insert(e2);
@@ -425,7 +427,7 @@ mod tests {
425427
}
426428

427429
#[test]
428-
fn test_remove(){
430+
fn test_remove() {
429431
let mut e1 = Flags::FlagA | Flags::FlagB;
430432
let e2 = Flags::FlagA | Flags::FlagC;
431433
e1.remove(e2);
@@ -484,12 +486,12 @@ mod tests {
484486

485487
#[test]
486488
fn test_hash() {
487-
let mut x = Flags::empty();
488-
let mut y = Flags::empty();
489-
assert!(hash(&x) == hash(&y));
490-
x = Flags::all();
491-
y = Flags::FlagABC;
492-
assert!(hash(&x) == hash(&y));
489+
let mut x = Flags::empty();
490+
let mut y = Flags::empty();
491+
assert!(hash(&x) == hash(&y));
492+
x = Flags::all();
493+
y = Flags::FlagABC;
494+
assert!(hash(&x) == hash(&y));
493495
}
494496

495497
fn hash<T: Hash>(t: &T) -> u64 {

‎src/librustc_typeck/check/regionck.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
592592
};
593593

594594
substs_wf_in_scope(rcx, origin, &callee.substs, expr.span, expr_region);
595+
type_must_outlive(rcx, infer::ExprTypeIsNotInScope(callee.ty, expr.span),
596+
callee.ty, expr_region);
595597
}
596598

597599
// Check any autoderefs or autorefs that appear.
@@ -664,6 +666,8 @@ fn visit_expr(rcx: &mut Rcx, expr: &hir::Expr) {
664666
}
665667
}
666668

669+
debug!("regionck::visit_expr(e={:?}, repeating_scope={}) - visiting subexprs",
670+
expr, rcx.repeating_scope);
667671
match expr.node {
668672
hir::ExprPath(..) => {
669673
rcx.fcx.opt_node_ty_substs(expr.id, |item_substs| {

‎src/libstd/io/error.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ use option::Option::{self, Some, None};
1717
use result;
1818
use sys;
1919

20-
/// A specialized [`Result`][result] type for I/O operations.
21-
///
22-
/// [result]: ../result/enum.Result.html
20+
/// A specialized [`Result`](../result/enum.Result.html) type for I/O
21+
/// operations.
2322
///
2423
/// This type is broadly used across `std::io` for any operation which may
2524
/// produce an error.

‎src/rustllvm/PassWrapper.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,7 @@ LLVMRustSetDataLayoutFromTargetMachine(LLVMModuleRef Module,
335335
LLVMTargetMachineRef TMR) {
336336
TargetMachine *Target = unwrap(TMR);
337337
#if LLVM_VERSION_MINOR >= 7
338-
if (const DataLayout *DL = Target->getDataLayout())
339-
unwrap(Module)->setDataLayout(*DL);
338+
unwrap(Module)->setDataLayout(Target->createDataLayout());
340339
#elif LLVM_VERSION_MINOR >= 6
341340
if (const DataLayout *DL = Target->getSubtargetImpl()->getDataLayout())
342341
unwrap(Module)->setDataLayout(DL);

‎src/test/run-pass/issue-22814.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
trait Test {}
12+
13+
macro_rules! test {
14+
( $($name:ident)+) => (
15+
impl<$($name: Test),*> Test for ($($name,)*) {
16+
}
17+
)
18+
}
19+
20+
test!(A B C);
21+
22+
fn main() {}

‎src/test/run-pass/issue-28999.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct Xyz<'a, V> {
12+
pub v: (V, &'a u32),
13+
}
14+
15+
pub fn eq<'a, 's, 't, V>(this: &'s Xyz<'a, V>, other: &'t Xyz<'a, V>) -> bool
16+
where V: PartialEq {
17+
this.v == other.v
18+
}
19+
20+
fn main() {}

0 commit comments

Comments
 (0)
Please sign in to comment.