Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
fc9bc779
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fc9bc779
编写于
5月 06, 2015
作者:
S
Steve Klabnik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix explanation of Cargo's behavior
https://github.com/rust-lang/rust/pull/25080/files#r29634986
上级
6afa6695
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
8 deletion
+13
-8
src/doc/trpl/guessing-game.md
src/doc/trpl/guessing-game.md
+13
-8
未找到文件。
src/doc/trpl/guessing-game.md
浏览文件 @
fc9bc779
...
...
@@ -410,11 +410,11 @@ $ cargo build
Compiling guessing_game v0.1.0
(
file:///home/you/projects/guessing_game
)
```
So, we told Cargo we wanted any version of
`rand`
, and so it fetched the
latest version at the time this was written,
`v0.3.8`
. But what happens
w
hen next week, version
`v0.4.0`
comes out, which changes something with
`rand`
, and it includes a breaking change? After all, a
`v0.y.z`
version
in SemVer can change every release.
So, we told Cargo we wanted any version of
`rand`
, and so it fetched the
latest
version at the time this was written,
`v0.3.8`
. But what happens when next
w
eek, version
`v0.3.9`
comes out, with an important bugfix? While getting
bugfixes is important, what if
`0.3.9`
contains a regression that breaks our
code?
The answer to this problem is the
`Cargo.lock`
file you’ll now find in your
project directory. When you build your project for the first time, Cargo
...
...
@@ -422,12 +422,17 @@ figures out all of the versions that fit your criteria, and then writes them
to the
`Cargo.lock`
file. When you build your project in the future, Cargo
will see that the
`Cargo.lock`
file exists, and then use that specific version
rather than do all the work of figuring out versions again. This lets you
have a repeatable build automatically.
have a repeatable build automatically. In other words, we’ll stay at
`0.3.8`
until we explicitly upgrade, and so will anyone who we share our code with,
thanks to the lock file.
What about when we _do_ want to use
`v0.
4.0
`
? Cargo has another command,
What about when we _do_ want to use
`v0.
3.9
`
? Cargo has another command,
`update`
, which says ‘ignore the lock, figure out all the latest versions that
fit what we’ve specified. If that works, write those versions out to the lock
file’.
file’. But, by default, Cargo will only look for versions larger than
`0.3.0`
and smaller than
`0.4.0`
. If we want to move to
`0.4.x`
, we’d have to update
the
`Cargo.toml`
directly. When we do, the next time we
`cargo build`
, Cargo
will update the index and re-evaluate our
`rand`
requirements.
There’s a lot more to say about
[
Cargo
][
doccargo
]
and
[
its
ecosystem
][
doccratesio
]
, but for now, that’s all we need to know. Cargo makes
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录