Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #42961

Closed
wants to merge 18 commits into from
Closed

Rollup of 8 pull requests #42961

wants to merge 18 commits into from

Conversation

Yorwba and others added 18 commits June 22, 2017 22:01
I reworded it slightly to make it more clear that the function only take
two arguments - the output and the Arguments struct that can be
generated from the format_args! macro.

r? @steveklabnik
This rewords and removes the `Arguments` section from the docs for
fmt::format.

r? @steveklabnik
This had an accidental `u8 as *mut T` where it was intended to have just a
normal pointer-to-pointer cast.

Closes rust-lang#42827
Try to make clear that this isn't an API guarantee for now, as we likely
want to refine these errors in the future, e.g. `ENOSPC` "No space left
on device".

CC rust-lang#40322
…paths, r=arielb1

Note different versions of same crate when absolute paths of different types match.

The current check to address rust-lang#22750 only works when the paths of the mismatched types relative to the current crate are equal, but this does not always work if one of the types is only included through an indirect dependency. If reexports are involved, the indirectly included path can e.g. [contain private modules](rust-lang#22750 (comment)).

This PR takes care of these cases by also comparing the *absolute* path, which is equal if the type hasn't moved in the module hierarchy between versions. A more coarse check would be to compare only the crate names instead of full paths, but that might lead to too many false positives.

Additionally, I believe it would be helpful to show where the differing crates came from, i.e. the information in `rustc::middle::cstore::CrateSource`, but I'm not sure yet how to nicely display all of that, so I'm leaving it to a future PR.
Update docs for fmt::write.

rust-lang#29355

I reworded it slightly to make it more clear that the function only take
two arguments - the output and the Arguments struct that can be
generated from the format_args! macro.

r? @steveklabnik
Update docs for std::fmt::format rust-lang#29355.

This rewords and removes the `Arguments` section from the docs for
fmt::format.

r? @steveklabnik
std: Fix implementation of `Alloc::alloc_one`

This had an accidental `u8 as *mut T` where it was intended to have just a
normal pointer-to-pointer cast.

Closes rust-lang#42827
…r=GuillaumeGomez

Document possible `io::ErrorKind`s of `fs::open`

Try to make clear that this isn't an API guarantee for now, as we likely
want to refine these errors in the future, e.g. `ENOSPC` "No space left
on device".

CC rust-lang#40322
compile-error.md: Fix link reference

Was a copy-paste mistake, I guess
Document that `/` works as separator on Windows

Hi Whenever I see code like `Path::new("./src/bin/main.rs")` or `path.ends_with("foo/bar")`, I wonder if it will work on Windows as I expect. Unfortunately, reading the current docs does not help to answer this question, because all examples are Unix-specific.

However, I believe that using `/` is fine, because both Windows itself [and Rust stdlib](https://github.com/rust-lang/rust/blob/47faf1d51952ecd9d4c8a7325332fba34fbe00bd/src/libstd/sys/windows/path.rs#L26) do treat it as a file separator, and because it is [actually used](https://github.com/rust-lang/cargo/blob/abf01e1eddb3145c83f71b469ea7bee37141e5e1/tests/git.rs#L579) in Cargo. So looks like we can just document it?

r? @steveklabnik

cc @retep998 I don't actually program for windows that much, so I might be totally wrong, and perhaps we should advise to always use (allocating) `.join` method to construct paths of more than one component?
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@frewsxcv
Copy link
Member Author

@bors p=10 r+

@bors
Copy link
Contributor

bors commented Jun 29, 2017

📌 Commit aa63ec0 has been approved by frewsxcv

@bors
Copy link
Contributor

bors commented Jun 29, 2017

⌛ Testing commit aa63ec0 with merge fecf6e012b71b5dbca8dd547339c849b383498a8...

@bors
Copy link
Contributor

bors commented Jun 29, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Jun 29, 2017

macOS failed, legit (#42826).

[01:22:58] failures:
[01:22:58] 
[01:22:58] ---- [run-make] run-make/type-mismatch-same-crate-name stdout ----
[01:22:58] 	
[01:22:58] error: make failed
[01:22:58] status: exit code: 2
[01:22:58] command: "make"
[01:22:58] stdout:
[01:22:58] ------------------------------------------
[01:22:58] # compile two different versions of crateA
[01:22:58] DYLD_LIBRARY_PATH="/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin:/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/lib:" '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/bin/rustc' --out-dir /Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin -L /Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin  --crate-type=rlib crateA.rs -C metadata=-1 -C extra-filename=-1
[01:22:58] DYLD_LIBRARY_PATH="/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin:/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/lib:" '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/bin/rustc' --out-dir /Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin -L /Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin  --crate-type=rlib crateA.rs -C metadata=-2 -C extra-filename=-2
[01:22:58] # make crateB depend on version 1 of crateA
[01:22:58] DYLD_LIBRARY_PATH="/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin:/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/lib:" '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/bin/rustc' --out-dir /Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin -L /Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin  --crate-type=rlib crateB.rs --extern crateA=/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin/libcrateA-1.rlib
[01:22:58] # make crateC depend on version 2 of crateA
[01:22:58] DYLD_LIBRARY_PATH="/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin:/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/lib:" '/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/bin/rustc' --out-dir /Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin -L /Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin  crateC.rs --extern crateA=/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make/type-mismatch-same-crate-name.stage2-x86_64-apple-darwin/libcrateA-2.rlib 2>&1 | \
[01:22:58] 		grep -z \
[01:22:58] 	"mismatched types.*\
[01:22:58] 	crateB::try_foo(foo2);.*\
[01:22:58] 	expected struct \`crateA::foo::Foo\`, found struct \`crateA::Foo\`.*\
[01:22:58] 	different versions of crate \`crateA\`.*\
[01:22:58] 	mismatched types.*\
[01:22:58] 	crateB::try_bar(bar2);.*\
[01:22:58] 	expected trait \`crateA::bar::Bar\`, found trait \`crateA::Bar\`.*\
[01:22:58] 	different versions of crate \`crateA\`"
[01:22:58] 
[01:22:58] ------------------------------------------
[01:22:58] stderr:
[01:22:58] ------------------------------------------
[01:22:58] warning: unused variable: `x`
[01:22:58]   --> crateB.rs:13:16
[01:22:58]    |
[01:22:58] 13 | pub fn try_foo(x: crateA::Foo){}
[01:22:58]    |                ^
[01:22:58]    |
[01:22:58]    = note: #[warn(unused_variables)] on by default
[01:22:58] 
[01:22:58] warning: unused variable: `x`
[01:22:58]   --> crateB.rs:14:16
[01:22:58]    |
[01:22:58] 14 | pub fn try_bar(x: Box<crateA::Bar>){}
[01:22:58]    |                ^
[01:22:58]    |
[01:22:58]    = note: #[warn(unused_variables)] on by default
[01:22:58] 
[01:22:58] grep: invalid option -- z
[01:22:58] usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[01:22:58] 	[-e pattern] [-f file] [--binary-files=value] [--color=when]
[01:22:58] 	[--context[=num]] [--directories=action] [--label] [--line-buffered]
[01:22:58] 	[--null] [pattern] [file ...]
[01:22:58] make[1]: *** [all] Error 2
[01:22:58] 
[01:22:58] ------------------------------------------
[01:22:58] 
[01:22:58] thread '[run-make] run-make/type-mismatch-same-crate-name' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:2479
[01:22:58] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:22:58] 
[01:22:58] 
[01:22:58] failures:
[01:22:58]     [run-make] run-make/type-mismatch-same-crate-name
[01:22:58] 
[01:22:58] test result: FAILED. 152 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
[01:22:58] 
[01:22:58] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:325
[01:22:58] 
[01:22:58] 
[01:22:58] command did not execute successfully: "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage0-tools/x86_64-apple-darwin/release/compiletest" "--compile-lib-path" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/lib" "--run-lib-path" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib" "--rustc-path" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/bin/rustc" "--rustdoc-path" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/stage2/bin/rustdoc" "--src-base" "/Users/travis/build/rust-lang/rust/src/test/run-make" "--build-base" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/test/run-make" "--stage-id" "stage2-x86_64-apple-darwin" "--mode" "run-make" "--target" "x86_64-apple-darwin" "--host" "x86_64-apple-darwin" "--llvm-filecheck" "/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/llvm/build/bin/FileCheck" "--nodejs" "/Users/travis/.nvm/versions/node/v6.9.1/bin/node" "--host-rustcflags" "-Crpath -O" "--target-rustcflags" "-Crpath -O -Lnative=/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/native/rust-test-helpers" "--docck-python" "/usr/local/bin/python2.7" "--lldb-python" "/usr/bin/python" "--lldb-version" "lldb-360.1.70" "--lldb-python-dir" "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python" "--llvm-version" "4.0.1\n" "--cc" "cc" "--cxx" "c++" "--cflags" "-ffunction-sections -fdata-sections -fPIC -m64 -stdlib=libc++" "--llvm-components" "aarch64 aarch64asmparser aarch64asmprinter aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils all all-targets analysis arm armasmparser armasmprinter armcodegen armdesc armdisassembler arminfo asmparser asmprinter bitreader bitwriter codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb demangle engine executionengine globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jsbackend jsbackendcodegen jsbackenddesc jsbackendinfo libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes pnacltransforms powerpc powerpcasmparser powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target transformutils vectorize x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils" "--llvm-cxxflags" "-I/Users/travis/build/rust-lang/rust/build/x86_64-apple-darwin/llvm/include -ffunction-sections -fdata-sections -fPIC -m64 -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=date-time -std=c++11 -O3   -fno-exceptions -fno-rtti -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:22:58] expected success, got: exit code: 101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup
Projects
None yet
Development

Successfully merging this pull request may close these issues.