Skip to content

Commit fbf2445

Browse files
committed
---
yaml --- r: 216367 b: refs/heads/stable c: 3434469 h: refs/heads/master i: 216365: b417522 216363: 5a1ee96 216359: 393b393 216351: 9ad4b06 v: v3
1 parent 62b5b61 commit fbf2445

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2691
-1002
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 7bfb5ed826c3fa6544865095f3f9158d95efb3a3
32+
refs/heads/stable: 3434469b518bda1d140e7859239ad1c800060af8
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375

branches/stable/src/libcore/intrinsics.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,17 @@ extern "rust-intrinsic" {
255255
/// Returns `true` if a type is managed (will be allocated on the local heap)
256256
pub fn owns_managed<T>() -> bool;
257257

258-
/// Calculates the offset from a pointer. The offset *must* be in-bounds of
259-
/// the object, or one-byte-past-the-end. An arithmetic overflow is also
260-
/// undefined behaviour.
258+
/// Calculates the offset from a pointer.
261259
///
262260
/// This is implemented as an intrinsic to avoid converting to and from an
263261
/// integer, since the conversion would throw away aliasing information.
262+
///
263+
/// # Safety
264+
///
265+
/// Both the starting and resulting pointer must be either in bounds or one
266+
/// byte past the end of an allocated object. If either pointer is out of
267+
/// bounds or arithmetic overflow occurs then any further use of the
268+
/// returned value will result in undefined behavior.
264269
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
265270

266271
/// Copies `count * size_of<T>` bytes from `src` to `dst`. The source

branches/stable/src/libcore/ptr.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,10 @@ impl<T: ?Sized> *const T {
284284
///
285285
/// # Safety
286286
///
287-
/// The offset must be in-bounds of the object, or one-byte-past-the-end.
288-
/// Otherwise `offset` invokes Undefined Behaviour, regardless of whether
289-
/// the pointer is used.
287+
/// Both the starting and resulting pointer must be either in bounds or one
288+
/// byte past the end of an allocated object. If either pointer is out of
289+
/// bounds or arithmetic overflow occurs then
290+
/// any further use of the returned value will result in undefined behavior.
290291
#[stable(feature = "rust1", since = "1.0.0")]
291292
#[inline]
292293
pub unsafe fn offset(self, count: isize) -> *const T where T: Sized {

branches/stable/src/librustc/diagnostics.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,25 @@ match x {
168168
```
169169
"##,
170170

171+
E0013: r##"
172+
Static and const variables can refer to other const variables. But a const
173+
variable cannot refer to a static variable. For example, `Y` cannot refer to `X`
174+
here:
175+
176+
```
177+
static X: i32 = 42;
178+
const Y: i32 = X;
179+
```
180+
181+
To fix this, the value can be extracted as a const and then used:
182+
183+
```
184+
const A: i32 = 42;
185+
static X: i32 = A;
186+
const Y: i32 = A;
187+
```
188+
"##,
189+
171190
E0015: r##"
172191
The only function calls allowed in static or constant expressions are enum
173192
variant constructors or struct constructors (for unit or tuple structs). This
@@ -462,7 +481,6 @@ register_diagnostics! {
462481
E0010,
463482
E0011,
464483
E0012,
465-
E0013,
466484
E0014,
467485
E0016,
468486
E0017,

branches/stable/src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#![feature(path_ext)]
4040
#![feature(str_char)]
4141
#![feature(into_cow)]
42+
#![feature(fs_canonicalize)]
4243
#![feature(slice_patterns)]
4344
#![cfg_attr(test, feature(test))]
4445

@@ -138,7 +139,6 @@ pub mod plugin;
138139
pub mod lint;
139140

140141
pub mod util {
141-
pub use rustc_back::fs;
142142
pub use rustc_back::sha2;
143143

144144
pub mod common;

branches/stable/src/librustc/metadata/creader.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ use metadata::decoder;
2121
use metadata::loader;
2222
use metadata::loader::CratePaths;
2323

24-
use std::path::{Path, PathBuf};
24+
use std::path::PathBuf;
2525
use std::rc::Rc;
26+
use std::fs;
27+
2628
use syntax::ast;
2729
use syntax::abi;
2830
use syntax::attr;
@@ -32,7 +34,6 @@ use syntax::parse;
3234
use syntax::parse::token::InternedString;
3335
use syntax::parse::token;
3436
use syntax::visit;
35-
use util::fs;
3637
use log;
3738

3839
pub struct CrateReader<'a> {
@@ -322,7 +323,7 @@ impl<'a> CrateReader<'a> {
322323
let source = self.sess.cstore.get_used_crate_source(cnum).unwrap();
323324
if let Some(locs) = self.sess.opts.externs.get(name) {
324325
let found = locs.iter().any(|l| {
325-
let l = fs::realpath(&Path::new(&l[..])).ok();
326+
let l = fs::canonicalize(l).ok();
326327
source.dylib.as_ref().map(|p| &p.0) == l.as_ref() ||
327328
source.rlib.as_ref().map(|p| &p.0) == l.as_ref()
328329
});
@@ -664,7 +665,7 @@ fn import_codemap(local_codemap: &codemap::CodeMap,
664665
.into_inner()
665666
.map_in_place(|mbc|
666667
codemap::MultiByteChar {
667-
pos: mbc.pos + start_pos,
668+
pos: mbc.pos - start_pos,
668669
bytes: mbc.bytes
669670
});
670671

branches/stable/src/librustc/metadata/filesearch.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use std::fs;
1818
use std::io::prelude::*;
1919
use std::path::{Path, PathBuf};
2020

21-
use util::fs as myfs;
2221
use session::search_paths::{SearchPaths, PathKind};
2322

2423
#[derive(Copy, Clone)]
@@ -191,7 +190,7 @@ pub fn get_or_default_sysroot() -> PathBuf {
191190
// Follow symlinks. If the resolved path is relative, make it absolute.
192191
fn canonicalize(path: Option<PathBuf>) -> Option<PathBuf> {
193192
path.and_then(|path| {
194-
match myfs::realpath(&path) {
193+
match fs::canonicalize(&path) {
195194
Ok(canon) => Some(canon),
196195
Err(e) => panic!("failed to get realpath: {}", e),
197196
}

branches/stable/src/librustc/metadata/loader.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,12 @@ use metadata::encoder;
225225
use metadata::filesearch::{FileSearch, FileMatches, FileDoesntMatch};
226226
use syntax::codemap::Span;
227227
use syntax::diagnostic::SpanHandler;
228-
use util::fs;
229228
use util::common;
230229
use rustc_back::target::Target;
231230

232231
use std::cmp;
233232
use std::collections::HashMap;
233+
use std::fs;
234234
use std::io::prelude::*;
235235
use std::io;
236236
use std::path::{Path, PathBuf};
@@ -430,9 +430,9 @@ impl<'a> Context<'a> {
430430
.or_insert_with(|| (HashMap::new(), HashMap::new()));
431431
let (ref mut rlibs, ref mut dylibs) = *slot;
432432
if rlib {
433-
rlibs.insert(fs::realpath(path).unwrap(), kind);
433+
rlibs.insert(fs::canonicalize(path).unwrap(), kind);
434434
} else {
435-
dylibs.insert(fs::realpath(path).unwrap(), kind);
435+
dylibs.insert(fs::canonicalize(path).unwrap(), kind);
436436
}
437437

438438
FileMatches
@@ -660,10 +660,10 @@ impl<'a> Context<'a> {
660660
// there's at most one rlib and at most one dylib.
661661
for loc in locs {
662662
if loc.file_name().unwrap().to_str().unwrap().ends_with(".rlib") {
663-
rlibs.insert(fs::realpath(&loc).unwrap(),
663+
rlibs.insert(fs::canonicalize(&loc).unwrap(),
664664
PathKind::ExternFlag);
665665
} else {
666-
dylibs.insert(fs::realpath(&loc).unwrap(),
666+
dylibs.insert(fs::canonicalize(&loc).unwrap(),
667667
PathKind::ExternFlag);
668668
}
669669
}

branches/stable/src/librustc_back/fs.rs

Lines changed: 0 additions & 91 deletions
This file was deleted.

branches/stable/src/librustc_back/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#![feature(path_ext)]
4242
#![feature(step_by)]
4343
#![feature(libc)]
44+
#![feature(fs_canonicalize)]
4445
#![cfg_attr(test, feature(test, rand))]
4546

4647
extern crate syntax;
@@ -53,7 +54,6 @@ pub mod abi;
5354
pub mod archive;
5455
pub mod tempdir;
5556
pub mod arm;
56-
pub mod fs;
5757
pub mod mips;
5858
pub mod mipsel;
5959
pub mod rpath;

branches/stable/src/librustc_back/rpath.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
use std::collections::HashSet;
1212
use std::env;
13-
use std::io;
1413
use std::path::{Path, PathBuf};
14+
use std::fs;
1515
use syntax::ast;
1616

1717
pub struct RPathConfig<'a> {
@@ -20,7 +20,6 @@ pub struct RPathConfig<'a> {
2020
pub is_like_osx: bool,
2121
pub has_rpath: bool,
2222
pub get_install_prefix_lib_path: &'a mut FnMut() -> PathBuf,
23-
pub realpath: &'a mut FnMut(&Path) -> io::Result<PathBuf>,
2423
}
2524

2625
pub fn get_rpath_flags(config: &mut RPathConfig) -> Vec<String> {
@@ -95,11 +94,11 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig, lib: &Path) -> String
9594
};
9695

9796
let cwd = env::current_dir().unwrap();
98-
let mut lib = (config.realpath)(&cwd.join(lib)).unwrap();
97+
let mut lib = fs::canonicalize(&cwd.join(lib)).unwrap_or(cwd.join(lib));
9998
lib.pop();
10099
let mut output = cwd.join(&config.out_filename);
101100
output.pop();
102-
let output = (config.realpath)(&output).unwrap();
101+
let output = fs::canonicalize(&output).unwrap_or(output);
103102
let relative = path_relative_from(&lib, &output)
104103
.expect(&format!("couldn't create relative path from {:?} to {:?}", output, lib));
105104
// FIXME (#9639): This needs to handle non-utf8 paths
@@ -231,7 +230,6 @@ mod tests {
231230
is_like_osx: true,
232231
out_filename: PathBuf::from("bin/rustc"),
233232
get_install_prefix_lib_path: &mut || panic!(),
234-
realpath: &mut |p| Ok(p.to_path_buf()),
235233
};
236234
let res = get_rpath_relative_to_output(config,
237235
Path::new("lib/libstd.so"));
@@ -243,7 +241,6 @@ mod tests {
243241
get_install_prefix_lib_path: &mut || panic!(),
244242
has_rpath: true,
245243
is_like_osx: false,
246-
realpath: &mut |p| Ok(p.to_path_buf()),
247244
};
248245
let res = get_rpath_relative_to_output(config,
249246
Path::new("lib/libstd.so"));

0 commit comments

Comments
 (0)