summary refs log tree commit diff
path: root/src/librustc_driver/driver.rs
AgeCommit message (Collapse)AuthorLines
2015-07-10Change some instances of .connect() to .join()Wesley Wiser-1/+1
2015-07-08trans: Link rlibs to dylibs with --whole-archiveAlex Crichton-2/+2
This commit starts passing the `--whole-archive` flag (`-force_load` on OSX) to the linker when linking rlibs into dylibs. The primary purpose of this commit is to ensure that the linker doesn't strip out objects from an archive when creating a dynamic library. Information on how this can go wrong can be found in issues #14344 and #25185. The unfortunate part about passing this flag to the linker is that we have to preprocess the rlib to remove the metadata and compressed bytecode found within. This means that creating a dylib will now take longer to link as we've got to copy around the input rlibs to a temporary location, modify them, and then invoke the linker. This isn't done for executables, however, so the "hello world" compile time is not affected. This fix was instigated because of the previous commit where rlibs may not contain multiple object files instead of one due to codegen units being greater than one. That change prevented the main distribution from being compiled with more than one codegen-unit and this commit fixes that. Closes #14344 Closes #25185
2015-07-05Feature-gate #[prelude_import].Eduard Burtescu-1/+1
2015-06-27Address nitsJared Roesch-1/+1
2015-06-26rustc: switch most remaining middle::ty functions to methods.Eduard Burtescu-10/+10
2015-06-20Auto merge of #26417 - brson:feature-err, r=steveklabnikbors-2/+4
It now says '#[feature] may not be used on the stable release channel'. I had to convert this error from a lint to a normal compiler error. I left the lint previously-used for this in place since removing it is a breaking change. It will just go unused until the end of time. Fixes #24125
2015-06-20Auto merge of #26382 - alexcrichton:less-racy-path, r=brsonbors-7/+0
Environment variables are global state so this can lead to surprising results if the driver is called in a multithreaded environment (e.g. doctests). There shouldn't be any memory corruption that's possible, but a lot of the bots have been failing because they can't find `cc` or `gcc` in the path during doctests, and I highly suspect that it is due to the compiler modifying `PATH` in a multithreaded fashion. This commit moves the logic for appending to `PATH` to only affect the child process instead of also affecting the parent, at least for the linking stage. When loading dynamic libraries the compiler still modifies `PATH` on Windows, but this may be more difficult to fix than spawning off a new process.
2015-06-18Make a better error message for using #[feature] on stable rustBrian Anderson-2/+4
It now says '#[feature] may not be used on the stable release channel'. I had to convert this error from a lint to a normal compiler error. I left the lint previously-used for this in place since removing it is a breaking change. It will just go unused until the end of time. Fixes #24125
2015-06-19rustc: enforce stack discipline on ty::ctxt.Eduard Burtescu-114/+135
2015-06-19rustc_resolve: don't require redundant arguments to resolve_crate.Eduard Burtescu-5/+1
2015-06-19rustc: remove ownership of tcx from trans' context.Eduard Burtescu-22/+21
2015-06-17rustc_driver: Frob the global PATH lessAlex Crichton-7/+0
Environment variables are global state so this can lead to surprising results if the driver is called in a multithreaded environment (e.g. doctests). There shouldn't be any memory corruption that's possible, but a lot of the bots have been failing because they can't find `cc` or `gcc` in the path during doctests, and I highly suspect that it is due to the compiler modifying `PATH` in a multithreaded fashion. This commit moves the logic for appending to `PATH` to only affect the child process instead of also affecting the parent, at least for the linking stage. When loading dynamic libraries the compiler still modifies `PATH` on Windows, but this may be more difficult to fix than spawning off a new process.
2015-06-11Auto merge of #26199 - swgillespie:issue-26092, r=alexcrichtonbors-2/+2
`driver::build_output_filenames` calls `file_stem` on a PathBuf obtained from the output file compiler flag. It's possible to pass the empty string to this compiler flag. When file_stem is called on an empty Path, it returns None, which is unwrapped and the compiler panics. This change modifies the `unwrap` to an `unwrap_or` so that the empty string is passed through the compilation pipeline until it reaches `trans::back::write_output_file`, which will emit an appropriate error. Instead of panicking, the error that is emitted now is: ``` $ rustc -o "" thing.rs error: could not write output to : No such file or directory ``` The `:` is a little strange, but it /is/ reporting the filename (the empty string) correctly, I suppose. Both gcc and clang hand the output file to ld, which emits a similar error message when faced with the empty string as an output file: ``` $ clang -o "" thing.c ld: can't open output file for writing: , errno=2 for architecture x86_64 ``` This PR also adds a test for this, in `run-make`. This fixes issue #26092.
2015-06-11Conver reborrows to .iter() calls where appropriateJoshua Landau-1/+1
2015-06-10fix #26092 by returning an empty OS string when the output file path has no ↵swgillespie-2/+2
file_stem
2015-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-3/+3
2015-06-10syntax: move ast_map to librustc.Eduard Burtescu-1/+1
2015-05-26Make caching in stability work. This improves stability check performanceAriel Ben-Yehuda-1/+1
by 90%.
2015-05-24Auto merge of #25168 - Manishearth:register_attr, r=eddybbors-3/+5
This lets plugin authors opt attributes out of the `custom_attribute` and `unused_attribute` checks. cc @thepowersgang
2015-05-14Move configuration 1 phase before crate metadata collectionKevin Ballard-11/+11
Stripping unconfigured items prior to collecting crate metadata means we can say things like `#![cfg_attr(foo, crate_type="lib")]`. Fixes #25347.
2015-05-10Rollup merge of #25252 - inrustwetrust:crate-type-attribute, r=alexcrichtonManish Goregaokar-5/+2
Fixes the problem in #16974 with unhelpful error messages when accidentally using the wrong syntax for the `crate_type="lib"` attribute. The attribute syntax error now shows up instead of "main function not found".
2015-05-10Upgraded warning for invalid crate_type attribute syntax to an errorinrustwetrust-5/+2
If the user intended to set the crate_type to "lib" but accidentally used incorrect syntax such as `#![crate_type(lib)]`, the compilation would fail with "main function not found". This made it hard to locate the source of the problem, since the failure would cause the warning about the incorrect attribute not to be shown.
2015-05-07Add support for registering attributes with rustc in pluginsManish Goregaokar-3/+5
This lets plugin authors opt attributes out of the `custom_attribute` and `unused_attribute` checks.
2015-05-05rustc: Fix more verbatim paths leaking to gccAlex Crichton-1/+2
Turns out that a verbatim path was leaking through to gcc via the PATH environment variable (pointing to the bundled gcc provided by the main distribution) which was wreaking havoc when gcc itself was run. The fix here is to just stop passing verbatim paths down by adding more liberal uses of `fix_windows_verbatim_for_gcc`. Closes #25072
2015-04-18Return nonzero exit code if there are errors at a stop pointFlorian Hahn-5/+10
2015-04-17Rollup merge of #24430 - laumann:trace-macros-flag, r=pnkfelixManish Goregaokar-0/+1
This is the second attempt at turning the trace_macros macro into a compiler flag. See #22619
2015-04-16Auto merge of #24437 - fhahn:issue-24434, r=alexcrichtonbors-2/+3
closes #24434 This PR changes executes `syntax::config::strip_unconfigured_items` before `syntax::feature_gate::check_crate_macros(sess.codemap()`. As far as I know, `strip_unconfigured_items` should be independent of `check_crate_macros`.
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-2/+2
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-14Strip configuration before checking feature gates of macrosFlorian Hahn-2/+3
closes #24434
2015-04-14Fix: sess.opt should have been sess.optsThomas Jespersen-1/+1
2015-04-14Add "trace-macros" as a compiler flagThomas Jespersen-0/+1
Fixes #22619
2015-04-08Allow plugins to register LLVM passesKeegan McAllister-1/+3
2015-03-28Rollup merge of #23803 - richo:unused-braces, r=ManishearthManish Goregaokar-1/+1
Pretty much what it says on the tin.
2015-03-28cleanup: Remove unused braces in use statementsRicho Healey-1/+1
2015-03-25rustc: Remove support for int/uintAlex Crichton-4/+2
This commit removes all parsing, resolve, and compiler support for the old and long-deprecated int/uint types.
2015-03-23Add generic conversion traitsAaron Turon-3/+3
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-08normalize the current directory as Path{""}Richo Healey-1/+1
2015-03-08rustc: Fix an ICE when -o bare-pathRicho Healey-1/+4
rustc will ICE if you specify an outfile path that is bare without a directory. As a workaround, before this -o ./foo will work
2015-03-06Rollup merge of #23090 - alexcrichton:dep-info, r=pnkfelixManish Goregaokar-1/+3
Closes #23089
2015-03-05rustc: Don't emit dep-info for imported filesAlex Crichton-1/+3
Closes #23089
2015-03-06Run feature-gating on the final AST passed to the compiler.Huon Wilson-4/+21
This ensures we catch everything; previously, an unknown attribute inserted by #[cfg_attr(...)] in a macro expansion would not be detected.
2015-03-04std: Deprecate std::old_io::fsAlex Crichton-25/+26
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-25Rollup merge of #22727 - alexcrichton:prep-env, r=aturonManish Goregaokar-2/+3
This commit moves `std::env` away from the `std::old_io` error type as well as the `std::old_path` module. Methods returning an error now return `io::Error` and methods consuming or returning paths use `std::path` instead of `std::old_path`. This commit does not yet mark these APIs as `#[stable]`. This commit also migrates `std::old_io::TempDir` to `std::fs::TempDir` with essentially the exact same API. This type was added to interoperate with the new path API and has its own `tempdir` feature. Finally, this commit reverts the deprecation of `std::os` APIs returning the old path API types. This deprecation can come back once the entire `std::old_path` module is deprecated. [breaking-change]
2015-02-24std: Move std::env to the new I/O APIsAlex Crichton-2/+3
This commit moves `std::env` away from the `std::old_io` error type as well as the `std::old_path` module. Methods returning an error now return `io::Error` and methods consuming or returning paths use `std::path` instead of `std::old_path`. This commit does not yet mark these APIs as `#[stable]`. This commit also migrates `std::old_io::TempDir` to `std::fs::TempDir` with essentially the exact same API. This type was added to interoperate with the new path API and has its own `tempdir` feature. Finally, this commit reverts the deprecation of `std::os` APIs returning the old path API types. This deprecation can come back once the entire `std::old_path` module is deprecated. [breaking-change]
2015-02-24rustc: combine partial_def_map and last_private_map into def_map.Eduard Burtescu-4/+0
2015-02-24rustc_resolve: don't handle impl items as if they were modules.Eduard Burtescu-3/+3
2015-02-24rustc: use partially resolved definitions to replace the `T::A` hack.Eduard Burtescu-0/+2
2015-02-22Rollup merge of #22592 - nikomatsakis:deprecate-bracket-bracket, r=aturonManish Goregaokar-9/+9
r? @aturon
2015-02-21In the rustc driver, we pass the expanded, not the pre-expansion, AST to the ↵Nick Cameron-2/+5
post-analysis callback. We can also pass this to post-write-deps callback.
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-9/+9
where possible.