about summary refs log tree commit diff
path: root/src/librustc/session/search_paths.rs
AgeCommit message (Collapse)AuthorLines
2019-12-03Move Session to librustc_sessionMark Rousskov-72/+0
2019-10-21Remove many unnecessary trait derivations.Nicholas Nethercote-2/+1
2019-04-22Remove double trailing newlinesvarkor-1/+0
2019-03-13Use derive macro for HashStableJohn Kåre Alsaker-1/+2
2019-02-05move librustc to 2018Mark Mansi-2/+2
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-12Avoid regenerating the `Vec<PathBuf>` in `FileSearch::search()`.Nicholas Nethercote-1/+13
`FileSearch::search()` traverses one or more directories. For each directory it generates a `Vec<PathBuf>` containing one element per file in that directory. In some benchmarks this occurs enough that the allocations done for the `PathBuf`s are significant, and in practice a small number of directories are being traversed over and over again. For example, when compiling the `tokio-webpush-simple` benchmark, two directories are traversed 58 times each. Each of these directories have more than 100 files. This commit changes things so that all the `Vec<PathBuf>`s that will be needed by a `Session` are precomputed when that `Session` is created; they are stored in `SearchPath`. `FileSearch` gets a reference to the necessary `SearchPath`s. This reduces instruction counts on several benchmarks by 1--5%. The commit also removes the barely-used `visited_dirs` hash in `for_each_lib_searchPath`. It only detects if `tlib_path` is the same as one of the previously seen paths, which is unlikely.
2018-12-12Introduce `SearchPath` and replace `SearchPaths` with `Vec<SearchPath>`.Nicholas Nethercote-36/+20
It's more idiomatic, makes the code shorter, and will help with the next commit.
2018-12-04Utilize `?` instead of `return None`.Corey Farwell-6/+5
2018-10-15rustc/session: improve allocationsljedrz-1/+1
2018-09-29don't elide lifetimes in paths in librustc/Zack M. Davis-1/+1
This seemed like a good way to kick the tires on the elided-lifetimes-in-paths lint (#52069)—seems to work! This was also pretty tedious—it sure would be nice if `cargo fix` worked on this codebase (#53896)!
2018-03-20Implement some trivial size_hints for various iteratorsPhlosioneer-0/+7
This also implements ExactSizeIterator where applicable. Addresses most of the Iterator traits mentioned in #23708.
2016-08-11Add the notion of a dependency tracking status to commandline arguments.Michael Woerister-1/+1
Commandline arguments influence whether incremental compilation can use its compilation cache and thus their changes relative to previous compilation sessions need to be taking into account. This commit makes sure that one has to specify for every commandline argument whether it influences incremental compilation or not.
2016-01-15Add an --output option for specifying an error emitterNick Cameron-4/+3
2015-12-17move error handling from libsyntax/diagnostics.rs to libsyntax/errors/*Nick Cameron-2/+2
Also split out emitters into their own module.
2015-08-25Respect `--color` when printing early errorsBarosl Lee-2/+3
Currently, `early_error` and `early_warn` in `librustc::session` always use `ColorConfig::Auto`. Modify them to follow the color configuration set by the `--color` option. As colored output is also printed during the early stage, parsing the `--color` option should be done as early as possible. However, there are still some cases when the output needs to be colored before knowing the exact color settings. In these cases, it will be defaulted to `ColorConfig::Auto`, which is the same as before. Fixes #27879.
2015-03-23Add generic conversion traitsAaron Turon-1/+1
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-13Reject `-L ""`, `-L native=`, and other empty search paths.Ryan Prichard-0/+4
It wasn't clear to me that early_error was correct here, but it seems to work. This code is reachable from `rustdoc`, which is problematic, because early_error panics. rustc handles the panics gracefully (without ICEing or crashing), but rustdoc does not. It's not the first such rustdoc problem, though: $ rustdoc hello.rs --extern std=bad-std error: extern location for std does not exist: bad-std hello.rs:1:1: 1:1 error: can't find crate for `std` hello.rs:1 ^ error: aborting due to 2 previous errors thread '<unnamed>' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:151 thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "rustc failed"', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/result.rs:744 thread '<main>' panicked at 'child thread None panicked', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/thread.rs:661
2015-03-04std: Deprecate std::old_io::fsAlex Crichton-3/+4
This commit deprecates the majority of std::old_io::fs in favor of std::fs and its new functionality. Some functions remain non-deprecated but are now behind a feature gate called `old_fs`. These functions will be deprecated once suitable replacements have been implemented. The compiler has been migrated to new `std::fs` and `std::path` APIs where appropriate as part of this change.
2015-02-04rustc: Recognize `-L framework=foo`Alex Crichton-0/+3
On OSX the linker has a separate framework lookup path which is specified via the `-F` flag. This adds a new kind of `-L` path recognized by the compiler for frameworks to be passed through to the linker. Closes #20259
2015-01-29s/Show/Debug/gJorge Aparicio-2/+2
2015-01-21Fallout from stabilization.Aaron Turon-4/+4
2015-01-16rustc: Fix a leak in dependency= pathsAlex Crichton-3/+6
With the addition of separate search paths to the compiler, it was intended that applications such as Cargo could require a `--extern` flag per `extern crate` directive in the source. The system can currently be subverted, however, due to the `existing_match()` logic in the crate loader. When loading crates we first attempt to match an `extern crate` directive against all previously loaded crates to avoid reading metadata twice. This "hit the cache if possible" step was erroneously leaking crates across the search path boundaries, however. For example: extern crate b; extern crate a; If `b` depends on `a`, then it will load crate `a` when the `extern crate b` directive is being processed. When the compiler reaches `extern crate a` it will use the previously loaded version no matter what. If the compiler was not invoked with `-L crate=path/to/a`, it will still succeed. This behavior is allowing `extern crate` declarations in Cargo without a corresponding declaration in the manifest of a dependency, which is considered a bug. This commit fixes this problem by keeping track of the origin search path for a crate. Crates loaded from the dependency search path are not candidates for crates which are loaded from the crate search path. As a result of this fix, this is a likely a breaking change for a number of Cargo packages. If the compiler starts informing that a crate can no longer be found, it likely means that the dependency was forgotten in your Cargo.toml. [breaking-change]
2015-01-13Some random thingsNick Cameron-2/+2
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-2/+2
2015-01-03rustc: fix falloutJorge Aparicio-1/+3
2014-12-31rustc: Re-jigger -L and -l for MSYS compatibilityAlex Crichton-9/+8
As discovered in #20376, the MSYS shell will silently rewrite arguemnts that look like unix paths into their windows path counterparts for compatibility, but the recently added `:kind` syntax added to the `-L` flag does not allow for this form of rewriting. This means that the syntax can be difficult to use at an MSYS prompt, as well as causing tests to fail when run manuall right now. This commit takes the other option presented in the original issue to prefix the path with `kind=` instead of suffixing it with `:kind`. For consistence, the `-l` flag is also now migrating to `kind=name`. This is a breaking change due to the *removal* of behavior with `-L`. All code using `:kind` should now pass `kind=` for `-L` arguments. This is not currently, but will become, a breaking change for `-l` flags. The old `name:kind` syntax is still accepted, but all code should update to `kind=name`. [breaking-change] Closes #20376
2014-12-23rustc: Add knowledge of separate lookup pathsAlex Crichton-0/+69
This commit adds support for the compiler to distinguish between different forms of lookup paths in the compiler itself. Issue #19767 has some background on this topic, as well as some sample bugs which can occur if these lookup paths are not separated. This commits extends the existing command line flag `-L` with the same trailing syntax as the `-l` flag. Each argument to `-L` can now have a trailing `:all`, `:native`, `:crate`, or `:dependency`. This suffix indicates what form of lookup path the compiler should add the argument to. The `dependency` lookup path is used when looking up crate dependencies, the `crate` lookup path is used when looking for immediate dependencies (`extern crate` statements), and the `native` lookup path is used for probing for native libraries to insert into rlibs. Paths with `all` are used for all of these purposes (the default). The default compiler lookup path (the rustlib libdir) is by default added to all of these paths. Additionally, the `RUST_PATH` lookup path is added to all of these paths. Closes #19767